/* JRC Day Book
 * Layout: a ledger-style desk (wide tables, figures first) for owner/cashier/operator;
 * a single-column, thumb-reachable book for salespersons on phones.
 */
/* Palette from the JRC Agro logo: ink #064c6e, gold #cd9a32, leaf #669a66. Glossy, lit-from-above surfaces (as in the price list app). */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --sunk: #eef2f4;
  --ink: #14222b;
  --muted: #566670;
  --line: #d8e0e3;
  --brand-ink: #064c6e;  /* logo navy: brand, primary actions */
  --gold: #cd9a32;       /* logo gold */
  --leaf: #669a66;       /* logo leaf */
  --field: #064c6e;
  --field-ink: #ffffff;
  --turmeric: #cd9a32;   /* pending / attention */
  --good: #3c7f45;
  --good-bg: #e5f1e3;
  --warn-bg: #fbf0d6;
  --warn-ink: #7a5306;
  --bad: #c2303f;
  --bad-bg: #fbe5e7;
  --receipt: #0b6c9c;
  --receipt-bg: #e2eef5;
  --shadow: 0 1px 2px rgba(10, 40, 60, .08), 0 10px 26px -10px rgba(10, 40, 60, .28);
  --gl-hi: rgba(255, 255, 255, .75);
  --gl-lo: rgba(10, 40, 60, .05);
  --gl-edge: rgba(255, 255, 255, .95);
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Public Sans", "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f161a; --surface: #162027; --sunk: #1b262e; --ink: #e3ecf0; --muted: #93a5ae; --line: #2a3842;
    --brand-ink: #9fd3ee; --gold: #e0b04f; --leaf: #8cc48c;
    --field: #6cb8de; --field-ink: #06202e; --turmeric: #e0b04f; --good: #7fd09a; --good-bg: #173023;
    --warn-bg: #3a2f14; --warn-ink: #f1cf86; --bad: #ff8592; --bad-bg: #3d1e22; --receipt: #5fbbe8; --receipt-bg: #163242;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -10px rgba(0,0,0,.65);
    --gl-hi: rgba(255,255,255,.10); --gl-lo: rgba(0,0,0,.22); --gl-edge: rgba(255,255,255,.14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f161a; --surface: #162027; --sunk: #1b262e; --ink: #e3ecf0; --muted: #93a5ae; --line: #2a3842;
  --brand-ink: #9fd3ee; --gold: #e0b04f; --leaf: #8cc48c;
  --field: #6cb8de; --field-ink: #06202e; --turmeric: #e0b04f; --good: #7fd09a; --good-bg: #173023;
  --warn-bg: #3a2f14; --warn-ink: #f1cf86; --bad: #ff8592; --bad-bg: #3d1e22; --receipt: #5fbbe8; --receipt-bg: #163242;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -10px rgba(0,0,0,.65);
  --gl-hi: rgba(255,255,255,.10); --gl-lo: rgba(0,0,0,.22); --gl-edge: rgba(255,255,255,.14);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(22px, 3vw, 30px); font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
small { font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--f-mono); font-size: 13px; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.strong { font-weight: 700; }
.neg { color: var(--bad) !important; }
.pos { color: var(--good) !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 2px; }

/* controls */
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--field) 55%, transparent); outline-offset: 0; border-color: var(--field); }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.btn {
  font: 600 14px/1 var(--f-body); border-radius: 8px; padding: 10px 14px; cursor: pointer;
  border: 1px solid transparent; background: var(--sunk); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--field); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--field); color: var(--field-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.alt { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--sunk); }
.btn.link { background: none; border: 0; padding: 6px 4px; color: var(--field); text-decoration: underline; text-underline-offset: 3px; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 7px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn[data-armed="1"] { background: var(--bad); color: #fff; border-color: var(--bad); }

.seg { display: inline-flex; background: var(--sunk); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg label { display: block; color: var(--ink); font-weight: 600; }
.seg input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }
.seg span { display: block; padding: 7px 12px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.seg input:checked + span { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.12); color: var(--field); }
.seg input:focus-visible + span { outline: 2px solid var(--field); }
.seg.small span { padding: 5px 10px; font-size: 13px; }

.chip { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 99px; letter-spacing: .02em; white-space: nowrap; }
.chip.pending { background: var(--warn-bg); color: var(--warn-ink); }
.chip.approved { background: var(--good-bg); color: var(--good); }
.chip.rejected { background: var(--bad-bg); color: var(--bad); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 5px; }
.tag.receipt { background: var(--receipt-bg); color: var(--receipt); }
.tag.expense { background: var(--sunk); color: var(--muted); }
.tag.new { background: var(--warn-bg); color: var(--warn-ink); font-size: 11px; }
.pill { display: inline-block; padding: 8px 12px; background: var(--sunk); border-radius: 8px; font-weight: 700; align-self: end; }

.demo-banner { background: var(--warn-bg); color: var(--warn-ink); text-align: center; font-size: 13px; font-weight: 600; padding: 6px 16px; }

/* login */
.login { min-height: 100vh; display: grid; place-content: center; gap: 24px; padding-block: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-brand { text-align: center; display: grid; justify-items: center; gap: 8px; max-width: 380px; }
.login-brand p { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.login-card { padding: 24px; width: min(380px, calc(100vw - 32px)); display: grid; gap: 10px; }
.login-card h2 { font-size: 20px; margin-bottom: 4px; }
.demo-pick { display: grid; gap: 6px; margin-top: 10px; padding-top: 14px; border-top: 1px dashed var(--line); }
.demo-pick .btn { justify-content: space-between; padding: 10px 12px; }
.demo-pick .btn small { color: var(--muted); font-weight: 500; }
.center-card { padding: 60px 16px; text-align: center; }
.form-err { background: var(--bad-bg); color: var(--bad); padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 600; }

.mark { font-family: var(--f-display); font-weight: 800; background: var(--field); color: var(--field-ink); border-radius: 8px; padding: 6px 8px; font-size: 14px; letter-spacing: .04em; border-bottom: 3px solid var(--turmeric); }
.mark.big { font-size: 26px; padding: 12px 16px; border-radius: 14px; border-bottom-width: 5px; }

/* top bar */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.top-in { max-width: 1320px; margin: 0 auto; display: flex; align-items: center; gap: 20px; padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { font-family: var(--f-display); font-size: 17px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs a { padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.tabs a:hover { background: var(--sunk); color: var(--ink); }
.tabs a.on { background: var(--sunk); color: var(--field); }
.who { display: flex; align-items: center; gap: 12px; margin-left: auto; text-align: right; }
.who b { display: block; font-size: 14px; line-height: 1.2; }
.who small { color: var(--muted); }

/* desk layout */
.view-desk { max-width: 1320px; margin: 0 auto; padding-block: 22px 60px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.desk { display: grid; gap: 18px; }
.desk-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.filters, .toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters label, .toolbar label { min-width: 140px; }
.toolbar { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.toolbar label { flex: 1 1 140px; }
.toolbar .grow { flex: 2 1 220px; }

.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.fig { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 2px; min-width: 0; }
.fig span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fig b { font-family: var(--f-display); font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.fig small { color: var(--muted); }
.fig.key { background: var(--field); border-color: var(--field); color: var(--field-ink); }
.fig.key span, .fig.key small { color: color-mix(in srgb, var(--field-ink) 78%, transparent); }
.fig.warn { background: var(--warn-bg); border-color: transparent; }
.fig.warn span, .fig.warn small, .fig.warn b { color: var(--warn-ink); }
.figs.slim .fig b { font-size: 20px; }
.figs + .tbl-wrap { margin-top: 10px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.panel-h { display: grid; gap: 3px; }
.panel-h.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .span-2 { grid-column: 1 / -1; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }

.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--sunk); padding: 9px 10px; white-space: nowrap; }
.tbl th.num { text-align: right; }
.tbl td { padding: 9px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--sunk) 55%, transparent); }
.tbl tfoot td { font-weight: 700; background: var(--sunk); font-variant-numeric: tabular-nums; }
.tbl tfoot td.num { text-align: right; }
.tbl.compact td { padding: 7px 10px; }
.tbl tr.dim td { opacity: .55; }
.tbl tr.cur td { background: color-mix(in srgb, var(--field) 8%, transparent); }
.tbl .act { text-align: right; white-space: nowrap; }
.tbl input.cnt { width: 120px; text-align: right; font-variant-numeric: tabular-nums; padding: 7px 9px; }
.tbl .cell-in { border-color: transparent; background: transparent; padding: 6px 8px; }
.tbl .cell-in:hover { border-color: var(--line); }
.tbl .cell-in.short { max-width: 140px; }
.tbl .code-in { max-width: 120px; padding: 6px 8px; }
.barcell { position: relative; min-width: 180px; }
.barcell .bar { position: absolute; left: 10px; top: 50%; height: 8px; margin-top: -4px; border-radius: 4px; background: color-mix(in srgb, var(--field) 30%, transparent); max-width: calc(100% - 110px); }
.barcell .num { position: relative; display: block; }
.tick { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); font-weight: 500; cursor: pointer; }
.tick input { width: 18px; height: 18px; accent-color: var(--field); }
.grp-h { font-size: 15px; display: flex; gap: 10px; align-items: baseline; margin-top: 6px; }
.grp-h span { font-family: var(--f-body); font-weight: 500; color: var(--muted); font-size: 13px; }
.deps { list-style: none; margin: 0; padding: 0; display: grid; }
.deps li { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.deps li:first-child { border-top: 0; }
.deps b { font-variant-numeric: tabular-nums; display: block; }
.deps small { color: var(--muted); }
.deps .r { text-align: right; font-size: 13px; color: var(--muted); display: grid; justify-items: end; }
.search { max-width: 240px; }
.bulk summary { cursor: pointer; font-weight: 600; color: var(--field); font-size: 14px; }
.bulk[open] { display: grid; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-x { display: inline-flex; align-items: center; gap: 4px; background: var(--sunk); border-radius: 99px; padding: 4px 4px 4px 12px; font-size: 13.5px; font-weight: 600; }
.chip-x button { border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; }
.chip-x button:hover { background: var(--bad-bg); color: var(--bad); }
.inline { display: flex; gap: 6px; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: grid; gap: 4px; }
.empty b { color: var(--ink); font-size: 15px; }
.empty.small { padding: 16px; }
.notice { padding: 12px 14px; border-radius: var(--r); font-size: 14px; }
.notice.ok { background: var(--good-bg); color: var(--good); }

/* salesperson (mobile book) */
.view-sales { max-width: 560px; margin: 0 auto; padding-block: 16px 120px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.top-sales .who > div { display: none; }
.sp { display: grid; gap: 14px; }
.sp-head { display: flex; justify-content: space-between; align-items: end; gap: 10px; }
.sp-head h1 { font-size: 22px; }
.date-pill input { width: auto; padding: 8px 10px; font-weight: 600; }
.sp-sum { background: var(--field); color: var(--field-ink); border-radius: 16px; padding: 18px; display: grid; gap: 14px; }
.hero-fig { display: grid; gap: 2px; }
.hero-fig span { font-size: 13px; font-weight: 600; opacity: .85; }
.hero-fig strong { font-family: var(--f-display); font-size: 38px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.1; }
.hero-fig small { opacity: .75; }
.mini { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; border-top: 1px solid color-mix(in srgb, var(--field-ink) 25%, transparent); padding-top: 12px; }
.mini dt { font-size: 12px; opacity: .8; }
.mini dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 16px; }
.mini .warn dd, .mini .warn dt { color: var(--turmeric); opacity: 1; }
.sp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: sticky; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 3; }
.btn.big { padding: 16px; font-size: 16px; border-radius: 12px; box-shadow: var(--shadow); }
.btn.big .plus { font-size: 22px; line-height: 0; font-weight: 800; }
.list-h { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.list-h span { background: var(--sunk); border-radius: 99px; padding: 1px 8px; font-size: 12px; }
.lines { display: grid; gap: 6px; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; color: inherit; cursor: pointer; }
.line:disabled { cursor: default; }
.line:not(:disabled):hover { border-color: var(--field); }
.line.receipt { border-left: 4px solid var(--receipt); }
.line.expense { border-left: 4px solid var(--turmeric); }
.l-main { min-width: 0; display: grid; }
.l-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-main small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-amt { display: grid; justify-items: end; gap: 4px; flex-shrink: 0; }
.l-amt b { font-size: 16px; }

/* bottom sheet */
.sheet { border: 0; padding: 0; width: min(560px, 100vw); max-width: 100vw; margin: auto; border-radius: 18px; width: min(560px, calc(100vw - 20px)); background: var(--surface); color: var(--ink); box-shadow: 0 -10px 40px rgba(0,0,0,.25); }
.sheet::backdrop { background: rgba(10, 20, 15, .45); }
.sheet form { display: grid; gap: 10px; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet input, .sheet select { padding: 12px; font-size: 16px; }
.sheet #shAmt { font-family: var(--f-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sheet .seg { display: grid; grid-template-columns: repeat(4, 1fr); }
.sheet .seg span { text-align: center; padding: 10px 4px; }
.sheet-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.sheet-foot .btn.primary { flex: 1; padding: 14px; font-size: 16px; }
.hint { font-size: 12.5px; color: var(--muted); min-height: 1em; }
.hint.warn { color: var(--warn-ink); background: var(--warn-bg); padding: 6px 8px; border-radius: 6px; }

#toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(440px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 11px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow); transition: opacity .4s, transform .4s; }
.toast.ok { background: var(--good); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .who small { display: none; }
  .tabs { order: 3; flex-basis: 100%; }
}
@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr; }
  .filters label { min-width: 0; flex: 1 1 140px; }
  .fig b { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.desk > *, .panel > *, #oPos, #cPos, #opSum { min-width: 0; }

/* ================= Brand + gloss ================= */
html {
  background:
    radial-gradient(1100px 520px at 8% -8%, color-mix(in srgb, var(--field) 16%, transparent), transparent 62%),
    radial-gradient(900px 460px at 100% 0, color-mix(in srgb, var(--gold) 15%, transparent), transparent 60%),
    radial-gradient(900px 600px at 50% 115%, color-mix(in srgb, var(--leaf) 14%, transparent), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100%;
}
body { background: transparent; }

/* logo */
.logo { display: block; height: 46px; width: auto; flex: none; filter: drop-shadow(0 2px 3px rgba(6, 40, 60, .22)); }
.brand { gap: 14px; }
.brand .divider { width: 1px; align-self: stretch; margin-block: 6px; background: var(--line); }
.brand b { font-family: var(--f-display); font-size: 20px; font-weight: 700; color: var(--brand-ink); }
.login-logo .logo { height: 92px; }
.login-brand h1 { color: var(--brand-ink); }
@media (max-width: 560px) { .logo { height: 36px; } .brand { gap: 10px; } .brand b { font-size: 17px; } }

/* header: frosted glass with a shiny brand stripe */
.top {
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 0; box-shadow: 0 8px 24px -14px rgba(10, 40, 60, .35);
}
.top::after {
  content: ""; display: block; height: 4px;
  background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,0) 55%, rgba(0,0,0,.12)),
              linear-gradient(90deg, var(--field) 0 55%, var(--gold) 55% 80%, var(--leaf) 80% 100%);
}
body::before { background: color-mix(in srgb, var(--bg) 85%, transparent); }
.tabs a { background-image: linear-gradient(180deg, var(--gl-hi), var(--gl-lo)); box-shadow: inset 0 1px 0 var(--gl-edge); border: 1px solid transparent; }
.tabs a.on {
  color: var(--field-ink); border-color: color-mix(in srgb, var(--field) 70%, black);
  background: var(--field);
  background-image: linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,.06) 50%, rgba(0,0,0,.08) 51%, rgba(0,0,0,.18));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 4px 10px -3px color-mix(in srgb, var(--field) 60%, transparent);
}

/* glass cards */
.card, .panel, .fig, .toolbar, .line, .tbl-wrap {
  background-image: linear-gradient(180deg, var(--gl-hi), transparent 42%);
  box-shadow: inset 0 1px 0 var(--gl-edge), var(--shadow);
}
.panel, .fig, .toolbar, .card { border-color: color-mix(in srgb, var(--line) 80%, transparent); }
.tbl th { background-image: linear-gradient(180deg, var(--gl-hi), var(--gl-lo)); }
.tbl tfoot td { background-image: linear-gradient(180deg, var(--gl-lo), var(--gl-hi)); }

/* buttons */
.btn {
  border-radius: 10px; border-color: var(--line);
  background-image: linear-gradient(180deg, var(--gl-hi), rgba(255,255,255,0) 52%, var(--gl-lo));
  box-shadow: inset 0 1px 0 var(--gl-edge), 0 1px 2px rgba(10, 40, 60, .12);
  transition: filter .15s, box-shadow .15s, transform .05s;
}
.btn:hover:not(:disabled) { box-shadow: inset 0 1px 0 var(--gl-edge), 0 4px 10px -2px rgba(10, 40, 60, .22); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,0,0,.18); }
.btn.primary {
  border-color: color-mix(in srgb, var(--field) 70%, black);
  background-image: linear-gradient(180deg, rgba(255,255,255,.34), rgba(255,255,255,.06) 50%, rgba(0,0,0,.08) 51%, rgba(0,0,0,.18));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 5px 12px -3px color-mix(in srgb, var(--field) 60%, transparent);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.alt { background-color: var(--surface); }
.btn.link, .btn.link:hover, .btn.link:active { background-image: none; box-shadow: none; border-color: transparent; transform: none; }
.btn.ghost { background-color: transparent; }
.btn[data-armed="1"] { background-image: linear-gradient(180deg, rgba(255,255,255,.28), rgba(0,0,0,.14)); }

/* segmented controls */
.seg { box-shadow: inset 0 1px 3px rgba(10, 40, 60, .12); }
.seg input:checked + span {
  background: var(--surface);
  background-image: linear-gradient(180deg, var(--gl-hi), var(--gl-lo));
  box-shadow: inset 0 1px 0 var(--gl-edge), 0 2px 5px rgba(10, 40, 60, .18);
}

/* key figure and the salesperson's cash card: glossy navy with a gold edge */
.fig.key, .sp-sum {
  border: 0;
  background-color: var(--field);
  background-image:
    radial-gradient(130% 160% at 0% 0%, rgba(255,255,255,.26), transparent 52%),
    linear-gradient(180deg, rgba(255,255,255,.16) 0%, rgba(255,255,255,.04) 49%, rgba(0,0,0,.06) 50%, rgba(0,0,0,.22) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 -3px 0 var(--gold), 0 12px 26px -12px color-mix(in srgb, var(--field) 75%, transparent);
}
.hero-fig strong, .fig.key b { text-shadow: 0 1px 2px rgba(0,0,0,.22); }
.fig.warn {
  background-color: var(--warn-bg);
  background-image: linear-gradient(180deg, rgba(255,255,255,.45), transparent 50%);
  box-shadow: inset 0 1px 0 var(--gl-edge), inset 0 -3px 0 var(--gold), var(--shadow);
}

/* chips & tags */
.chip, .tag, .pill { background-image: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0)); box-shadow: inset 0 1px 0 rgba(255,255,255,.5); }
.chip.approved { color: var(--good); }

/* inputs: slightly inset */
input, select, textarea { box-shadow: inset 0 1px 2px rgba(10, 40, 60, .08); }
.tbl .cell-in { box-shadow: none; }

/* entry lines */
.line.receipt { border-left-color: var(--receipt); }
.line.expense { border-left-color: var(--gold); }

/* bottom sheet and toasts */
.sheet { background-image: linear-gradient(180deg, var(--gl-hi), transparent 30%); }
.toast { background-image: linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.1)); }
.demo-banner { background-image: linear-gradient(180deg, rgba(255,255,255,.4), transparent); }

/* bar in the 7-day table */
.barcell .bar { background: linear-gradient(90deg, var(--field), var(--leaf)); opacity: .45; }

/* opening cash rows in Setup */
.ob-rows { display: grid; gap: 10px; }
.ob-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-width: 0; }
.ob-row legend { font-weight: 700; padding: 0 4px; color: var(--ink); }
@media (max-width: 480px) { .ob-row { grid-template-columns: 1fr; } }

/* day authorisation */
.auth-list { display: grid; gap: 8px; }
.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background-image: linear-gradient(180deg, var(--gl-hi), transparent 60%); box-shadow: inset 0 1px 0 var(--gl-edge); }
.auth-row.done { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); background-color: color-mix(in srgb, var(--good-bg) 60%, transparent); }
.auth-act { display: flex; gap: 8px; align-items: center; }
.lockbar { margin-bottom: 10px; }
:root[data-theme="dark"] .toast.ok, :root[data-theme="dark"] .toast.bad { color: #0b1a12; }

/* roles */
.roles-pick { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.roles-pick legend { font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.roles-cell { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.tbl .cell-in[data-pf="name"] { min-width: 200px; }
.tbl select.cell-in[data-pf="location"] { min-width: 140px; }

/* customers setup */
.cust-branch { display: flex; gap: 10px; align-items: end; margin-bottom: 12px; }
.cust-branch label { min-width: 220px; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.btns .search { max-width: 220px; width: auto; }

/* salesperson who works for any branch */
.branch-pick { display: grid; gap: 2px; margin-bottom: 2px; color: var(--muted); }
.branch-pick select { width: auto; padding: 6px 10px; font-weight: 700; color: var(--ink); }

/* customer picker: text box + filtering list (list sits in the flow so the keyboard never hides it) */
.combo { position: relative; }
.combo input { width: 100%; padding-right: 46px; }
.combo-btn { position: absolute; right: 4px; top: 4px; bottom: 4px; width: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.combo-menu { list-style: none; margin: 6px 0 0; padding: 4px; max-height: 190px; overflow-y: auto; border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 10px; background: var(--surface-2, var(--surface)); }
.combo-menu li { display: flex; flex-direction: column; gap: 1px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.combo-menu li:hover, .combo-menu li:active { background: rgba(205,154,50,.18); }
.combo-menu li small { color: var(--muted); font-size: 12px; }
.combo-menu li.more { cursor: default; color: var(--muted); font-size: 12.5px; }
.combo-menu li.more:hover { background: none; }

/* cash count */
.count-panel { margin-top: 14px; }
.denoms { display: grid; gap: 6px; margin: 8px 0; }
.den { display: grid; grid-template-columns: 70px 1fr 90px; align-items: center; gap: 10px; }
.den span { font-weight: 700; font-family: var(--f-display); }
.den input { padding: 10px; font-size: 16px; text-align: right; }
.den output { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
