/* =========================================================================
   Sara Perfume — interface
   Dense, calm, and readable on an office monitor for eight hours a day.
   ========================================================================= */

:root {
  --ink:        #17212e;
  --ink-2:      #47586c;
  --ink-3:      #7d8ea1;
  --line:       #dfe5ec;
  --line-2:     #eef2f6;
  --bg:         #f4f6f9;
  --panel:      #ffffff;
  --brand:      #5e2750;
  --brand-2:    #8a3a74;
  --brand-soft: #f6ecf3;
  --good:       #0f7b52;
  --good-soft:  #e6f5ee;
  --warn:       #9a6207;
  --warn-soft:  #fdf3e0;
  --bad:        #b3261e;
  --bad-soft:   #fdecea;
  --gold:       #8a6d1f;
  --radius:     8px;
  --shadow:     0 1px 2px rgba(23,33,46,.06), 0 4px 14px rgba(23,33,46,.06);
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
.boot { padding: 60px; text-align: center; color: var(--ink-3); }
a { color: var(--brand-2); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

/* ---------------------------------------------------------------- shell -- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: #2a1426; color: #e0cfdc; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side .brand {
  padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,.09);
}
.side .brand b { display: block; color: #fff; font-size: 14px; letter-spacing: .02em; }
.side .brand span { font-size: 11px; color: #c9a35a; text-transform: uppercase; letter-spacing: .09em; }
/* Any shape of logo is fitted into this box rather than stretched. */
.side .brand .brand-logo {
  display: block; max-width: 100%; max-height: 52px; width: auto; height: auto;
  object-fit: contain; margin-bottom: 10px;
}

/* --------------------------------------------------------------- search -- */
.searchwrap { position: relative; padding: 10px 12px 4px; }
.searchbox {
  width: 100%; padding: 7px 10px; border-radius: 6px; font-size: 13px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.13);
  color: #fff;
}
.searchbox::placeholder { color: #7f97ae; }
.searchbox:focus {
  outline: none; background: rgba(255,255,255,.15); border-color: var(--brand-2);
}
.searchdrop {
  position: absolute; left: 8px; right: -260px; top: 46px; z-index: 60;
  max-height: 70vh; overflow-y: auto;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 4px 0;
}
.searchgroup {
  padding: 7px 12px 3px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .09em; color: var(--ink-3);
}
.searchempty { padding: 14px 12px; color: var(--ink-3); font-size: 13px; }
.searchhit {
  display: flex; gap: 10px; align-items: baseline; justify-content: space-between;
  padding: 6px 12px; text-decoration: none; color: var(--ink); font-size: 13px;
}
.searchhit:hover { background: var(--brand-soft); }
.searchhit .hit-main { min-width: 0; }
.searchhit .hit-main b { font-weight: 600; }
.searchhit .hit-detail {
  display: block; font-size: 11.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px;
}
.searchhit .hit-side {
  display: flex; gap: 8px; align-items: baseline; flex: none;
  font-size: 11.5px; color: var(--ink-2); white-space: nowrap;
}
.searchmore {
  display: block; padding: 8px 12px; margin-top: 4px; font-size: 12px;
  border-top: 1px solid var(--line-2); text-decoration: none;
}
.searchlist .searchhit { border-bottom: 1px solid var(--line-2); padding: 8px 4px; }
.searchlist .searchhit .hit-detail { max-width: none; white-space: normal; }

/* The currency badge beside an amount whose document is in a different
   currency from the money being handed over. */
.ccytag {
  display: inline-block; margin-left: 5px; padding: 1px 5px;
  border-radius: 3px; font-size: 10px; font-weight: 600; letter-spacing: .04em;
  background: var(--brand-soft); color: var(--brand);
  vertical-align: 1px;
}

.logopreview {
  display: flex; gap: 14px; align-items: center; margin: 10px 0 14px;
  padding: 14px; border: 1px dashed var(--line); border-radius: var(--radius);
  background: var(--bg); min-height: 76px;
}
.logopreview img {
  max-height: 62px; max-width: 190px; width: auto; height: auto;
  object-fit: contain; flex: none;
}

.nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.nav-group { margin: 8px 0 2px; padding: 0 10px; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .11em; color: #b48a9f; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 5px 10px; border-radius: 6px;
  color: #e8d9e4; text-decoration: none; font-size: 13.5px; margin-bottom: 1px;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a.on { background: var(--brand-2); color: #fff; font-weight: 550; }
.nav a .ic { width: 16px; text-align: center; opacity: .9; font-size: 13px; }
.side .who {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.09); font-size: 12px;
}
.side .who b { color: #fff; display: block; }
.side .who span { color: #7f97ae; }
.side .who button {
  margin-top: 8px; width: 100%; background: rgba(255,255,255,.08); color: #c9d6e3;
  border: 0; padding: 6px; border-radius: 5px; cursor: pointer; font-size: 12px;
}
.side .who button:hover { background: rgba(255,255,255,.16); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; }
.topbar .sub { color: var(--ink-3); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.content { padding: 20px 22px 60px; }

/* --------------------------------------------------------------- panels -- */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.panel > header {
  padding: 12px 16px; border-bottom: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 12px;
}
.panel > header h2 { font-size: 13.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); }
.panel > header .spacer { flex: 1; }
.panel .body { padding: 16px; }
.panel .body.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2,minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 760px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- stat tile -- */
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.tile .label { font-size: 11px; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-3); }
.tile .value { font-size: 23px; font-weight: 640; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .note { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.tile.accent { border-left: 3px solid var(--brand); }
.tile.good .value { color: var(--good); }
.tile.bad .value { color: var(--bad); }

/* ---------------------------------------------------------------- tables -- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-3); padding: 9px 12px;
  border-bottom: 1px solid var(--line); background: #fafbfd; position: sticky; top: 0;
  white-space: nowrap;
}
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tbody tr:hover { background: #fafcfe; }
tbody tr.clickable { cursor: pointer; }
tfoot td { padding: 10px 12px; font-weight: 650; border-top: 2px solid var(--line); background: #fafbfd; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.tablewrap { overflow: auto; max-height: 70vh; }
.neg { color: var(--bad); }
.pos { color: var(--good); }

/* ---------------------------------------------------------------- forms --- */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 4px; letter-spacing: .02em; }
label.f > span .hint { font-weight: 400; color: var(--ink-3); }
input, select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft);
}
input[readonly], input:disabled, select:disabled { background: #f5f7fa; color: var(--ink-2); }
input.num, td input.num { text-align: right; font-variant-numeric: tabular-nums; }
textarea { min-height: 62px; resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0 0 14px; }
legend { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); padding: 0 6px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-weight: 550; cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
button:hover, .btn:hover { background: #f6f8fb; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #c9342b; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-2); }
.btn-ghost:hover { background: var(--brand-soft); }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.row > .fit { flex: 0 0 auto; min-width: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
/* Row buttons stay side by side; a wrapped pair reads as two separate
   controls and doubles the height of every row in the table. */
td .actions { flex-wrap: nowrap; gap: 6px; }
td .actions > button, td .actions > a { white-space: nowrap; }

/* --------------------------------------------------------------- badges --- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px;
  font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.b-good { background: var(--good-soft); color: var(--good); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad  { background: var(--bad-soft);  color: var(--bad); }
.b-info { background: var(--brand-soft); color: var(--brand); }
.b-mute { background: var(--line-2); color: var(--ink-2); }

.note {
  padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px;
  border: 1px solid transparent;
}
.note-info { background: var(--brand-soft); border-color: #cfe2f4; color: #0d3f6d; }
.note-warn { background: var(--warn-soft); border-color: #f2e0bd; color: var(--warn); }
.note-bad  { background: var(--bad-soft);  border-color: #f5cdc9; color: var(--bad); }
.note-good { background: var(--good-soft); border-color: #c6e8d8; color: var(--good); }

/* --------------------------------------------------------- action buttons - */
.quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 10px; }
.quick a {
  display: flex; flex-direction: column; gap: 3px; padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
}
.quick a:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.quick a b { font-size: 13.5px; }
.quick a span { font-size: 11.5px; color: var(--ink-3); }
.quick a .ic { font-size: 17px; }

/* ---------------------------------------------------------------- modal --- */
.mask {
  position: fixed; inset: 0; background: rgba(15,28,44,.42); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 100;
  overflow: auto;
}
.modal {
  background: #fff; border-radius: 10px; width: 100%; max-width: 560px;
  box-shadow: 0 20px 60px rgba(15,28,44,.28);
}
.modal.wide { max-width: 900px; }
.modal > header { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: flex; }
.modal > header h3 { font-size: 15px; flex: 1; }
.modal .body { padding: 20px; }
.modal > footer { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 10px; justify-content: flex-end; }

/* --------------------------------------------------------------- toasts --- */
#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex;
  flex-direction: column; gap: 8px; }
.toast {
  background: #17212e; color: #fff; padding: 11px 16px; border-radius: 7px;
  box-shadow: 0 8px 26px rgba(15,28,44,.28); font-size: 13px; max-width: 400px;
  animation: pop .16s ease-out;
}
.toast.ok  { background: #0f7b52; }
.toast.err { background: #b3261e; }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

/* ----------------------------------------------------------------- login -- */
.login-wrap { display: grid; place-items: center; min-height: 100vh; padding: 20px;
  background: linear-gradient(160deg, #0e2439, #123a5c); }
.login {
  background: #fff; padding: 32px; border-radius: 12px; width: 100%; max-width: 380px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.login h1 { font-size: 19px; margin-bottom: 4px; }
.login p.sub { color: var(--ink-3); font-size: 13px; margin: 0 0 22px; }
.login .hintbox { margin-top: 18px; font-size: 12px; color: var(--ink-3);
  background: var(--line-2); padding: 10px 12px; border-radius: 6px; }

/* ------------------------------------------------------------- allocator -- */
.alloc td { vertical-align: middle; }
.alloc input.amt { width: 120px; }
.alloc tr.picked { background: var(--brand-soft); }
.alloc-summary {
  display: flex; gap: 22px; padding: 12px 16px; background: #fafbfd;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.alloc-summary div span { display: block; font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--ink-3); }
.alloc-summary div b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------- preview / result - */
.calc {
  background: #fafbfd; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.calc .ln { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.calc .ln b { font-variant-numeric: tabular-nums; }
.calc .ln.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px;
  font-weight: 650; font-size: 14.5px; }
.calc .ln.sub { color: var(--ink-3); font-size: 12.5px; }

/* --------------------------------------------------------------- charts --- */
.spark { width: 100%; height: 60px; display: block; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.bars .bar { flex: 1; background: var(--brand-2); border-radius: 3px 3px 0 0; min-height: 2px;
  position: relative; }
.bars .bar.b2 { background: #9ec4e6; }
.barlabels { display: flex; gap: 4px; margin-top: 5px; }
.barlabels span { flex: 1; text-align: center; font-size: 10px; color: var(--ink-3); }

/* ---------------------------------------------------------------- print --- */
/* The letterhead only exists on paper: printing a report from the screen
   should produce the same headed document as printing an invoice. */
.printhead { display: none; }

@media print {
  .side, .topbar, .no-print, button, .btn { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  .content { padding: 0; }
  .panel { border: none; box-shadow: none; }
  body { background: #fff; font-size: 11px; }
  .tablewrap { max-height: none; overflow: visible; }
  .printhead {
    display: flex; gap: 14px; align-items: flex-start;
    border-bottom: 2px solid #10508c; padding-bottom: 10px; margin-bottom: 14px;
  }
  .printhead img { max-height: 62px; max-width: 190px; width: auto; height: auto;
    object-fit: contain; flex: none; }
  .printhead h1 { font-size: 16px; color: #10508c; margin: 0; }
  .printhead .co-lines { font-size: 10.5px; color: #5b6b7c; }
  .printhead .spacer { flex: 1; }
  .printhead .when { font-size: 10.5px; color: #5b6b7c; text-align: right; }
}

/* ---- permission tick list --------------------------------------------- */
/* Two columns on a wide screen, one on a narrow one — twenty-four reports in
   a single column is a scroll nobody enjoys. */
.permgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 18px;
}
.permrow { cursor: pointer; }
.permrow:hover { background: var(--hover, rgba(0, 0, 0, .03)); border-radius: 4px; }

/* ---- bills and receipts ----------------------------------------------- */
/* Thumbnails, because somebody looking for a particular receipt recognises it
   by sight long before they read the file name. */
.attgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.attcard {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--panel, #fff);
}
.attcard img {
  width: 100%; height: 120px; object-fit: cover;
  border-radius: 6px; cursor: pointer; display: block;
  background: var(--hover, #f4f4f5);
}
.attcard .attpdf {
  width: 100%; height: 120px; border-radius: 6px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: var(--hover, #f4f4f5); color: var(--muted, #666);
  font-weight: 700; letter-spacing: .1em;
}
.attcard .attname {
  margin-top: 6px; font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-clip { border-color: var(--accent); color: var(--accent); }


/* ------------------------------------------------------------ shop till -- */
.till { display: grid; grid-template-columns: 1fr 380px; gap: 16px; align-items: start; }
.pos-scan { display: flex; gap: 8px; }
.pos-scan input { font-size: 17px; padding: 10px 12px; }
.pos-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-top: 10px; }
.pos-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 10px; background: var(--panel);
  cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 76px; }
.pos-item:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.pos-item b { font-size: 13px; line-height: 1.25; }
.pos-item .pr { font-weight: 700; color: var(--brand); margin-top: auto; }
.pos-item .st { font-size: 11px; color: var(--ink-3); }
.pos-item.out { opacity: .55; }
.pos-cart { position: sticky; top: 12px; }
.pos-cart table td { padding: 5px 6px; }
.pos-cart .qty { width: 54px; text-align: center; }
.pos-cart .pr { width: 78px; }
.pos-total { font-size: 28px; font-weight: 750; text-align: right; color: var(--brand); margin: 6px 0 2px; }
.pos-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pos-pay button { padding: 12px; font-size: 15px; }
.pos-change { text-align: right; font-size: 15px; margin-top: 6px; }
@media (max-width: 1100px) { .till { grid-template-columns: 1fr; } .pos-cart { position: static; } }
