/* Gomok Supermarket — one stylesheet. Colours are tokens; dark mode follows the device. */
:root {
  --bg: #f4f6f4; --card: #ffffff; --ink: #14201a; --muted: #5d6b63; --line: #dde3df; --soft: #eef3ef;
  --accent: #15803d; --accent-ink: #ffffff; --accent-soft: #dcfce7; --top: #14532d; --top-ink: #f0fdf4;
  --warn: #b45309; --warn-soft: #fef3c7; --bad: #b91c1c; --bad-soft: #fee2e2; --ok: #15803d; --info: #1d4ed8;
  --radius: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 4px 14px rgb(0 0 0 / .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1511; --card: #15201a; --ink: #e7efe9; --muted: #9fb0a6; --line: #26352c; --soft: #1b2921;
    --accent: #22c55e; --accent-ink: #052e16; --accent-soft: #14361f; --top: #0a2615; --top-ink: #dcfce7;
    --warn: #f59e0b; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3b1414; --ok: #22c55e; --info: #60a5fa;
    --shadow: 0 1px 2px rgb(0 0 0 / .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1511; --card: #15201a; --ink: #e7efe9; --muted: #9fb0a6; --line: #26352c; --soft: #1b2921;
  --accent: #22c55e; --accent-ink: #052e16; --accent-soft: #14361f; --top: #0a2615; --top-ink: #dcfce7;
  --warn: #f59e0b; --warn-soft: #3a2a0a; --bad: #f87171; --bad-soft: #3b1414; --ok: #22c55e; --info: #60a5fa; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 var(--font); display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); }
a { color: var(--accent); }
h2 { margin: 0; font-size: 1.2rem; } h3 { margin: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .lead { font-size: 1.05rem; } .warn { color: var(--warn); } .bad { color: var(--bad); } .ok { color: var(--ok); }
.r { text-align: right; } .c { text-align: center; } .nowrap { white-space: nowrap; } .mono { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
#top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--top); color: var(--top-ink); min-height: 50px; flex-shrink: 0; }
#top .brand { display: flex; align-items: center; gap: 8px; background: none; border: 0; color: inherit; font-weight: 700; padding: 4px 6px; border-radius: 10px; }
#top .brand img { width: 30px; height: 30px; border-radius: 8px; }
#top h1 { flex: 1; margin: 0; font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top .chip, #top .pill { background: rgb(255 255 255 / .12); border: 0; color: inherit; border-radius: 999px; padding: 7px 12px; font-size: .85rem; white-space: nowrap; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; }
#top .pill.ok { background: rgb(34 197 94 / .25); } #top .pill.off { background: rgb(245 158 11 / .3); } #top .pill.bad { background: rgb(239 68 68 / .4); } #top .pill.demo { background: rgb(255 255 255 / .18); }
@media (max-width: 640px) { #brandName { display: none; } #top .chip, #top .pill { padding: 6px 9px; font-size: .78rem; } }
body[data-page="lock"] #branchChip { pointer-events: none; }

main { flex: 1; overflow: auto; position: relative; }
.page { padding: 16px; max-width: 1400px; margin: 0 auto; }
.boot, .empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.sec { margin: 22px 0 10px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.bar .grow { flex: 1; min-width: 180px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 10px 16px; min-height: 44px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 6px 10px; font-size: .88rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; min-height: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.badge { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--bad); color: #fff; font-style: normal; font-size: .75rem; font-weight: 700; text-align: center; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.tag.ok { background: var(--accent-soft); color: var(--ok); } .tag.warn { background: var(--warn-soft); color: var(--warn); } .tag.bad { background: var(--bad-soft); color: var(--bad); } .tag.info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.tile { position: relative; text-align: left; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c, var(--accent)); border-radius: var(--radius); padding: 14px; min-height: 92px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--c, var(--accent)); }
.tile .ic { font-size: 1.6rem; line-height: 1; }
.tile b { font-size: 1rem; } .tile small { color: var(--muted); font-size: .82rem; }
.tile .badge { position: absolute; top: 10px; right: 10px; }
.tile.sm { min-height: 60px; padding: 10px 12px; }
.tile.on { background: var(--accent-soft); border-color: var(--accent); }
.tiles.home .tile { min-height: 110px; }
.tiles.pick { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); max-height: 60vh; overflow: auto; padding: 2px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.kpi small { color: var(--muted); display: block; } .kpi b { font-size: 1.5rem; display: block; margin: 2px 0; font-variant-numeric: tabular-nums; } .kpi span { color: var(--muted); font-size: .82rem; }
.kpi.warn b { color: var(--warn); } .kpi.bad b { color: var(--bad); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-weight: 600; }
.tab.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--soft); padding: 10px; position: sticky; top: 0; }
.tbl td { padding: 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr[data-id], .tbl tr[data-act] { cursor: pointer; } .tbl tr[data-id]:hover td, .tbl tr[data-act]:hover td { background: var(--soft); }
.tbl .r { text-align: right; }
@media (max-width: 640px) {
  .tbl thead { display: none; } .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-top: 1px solid var(--line); padding: 6px 0; } .tbl td { border: 0; padding: 3px 12px; display: flex; justify-content: space-between; gap: 10px; text-align: right; }
  .tbl td::before { content: attr(data-l); color: var(--muted); font-size: .8rem; text-align: left; }
}

/* ---------- forms ---------- */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 14px; }
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; } .fld.wide { grid-column: 1 / -1; }
.lab { font-size: .85rem; font-weight: 600; color: var(--muted); } .lab i { color: var(--bad); font-style: normal; }
.help { color: var(--muted); font-size: .78rem; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], input[type=tel], input[type=search], input:not([type]), textarea, .pickbtn {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.pickbtn { text-align: left; }
input.search { margin-bottom: 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 12px; min-height: 42px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px 6px 6px; min-height: 42px; width: fit-content; }
.toggle span { width: 40px; height: 24px; border-radius: 999px; background: var(--line); position: relative; transition: .15s; }
.toggle span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; }
.toggle.on span { background: var(--accent); } .toggle.on span::after { left: 19px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgb(0 0 0 / .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .12s; }
.modal .sheet { background: var(--card); color: var(--ink); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
.modal.wide .sheet { width: min(980px, 100%); } .modal.full .sheet { width: min(1300px, 100%); height: calc(100vh - 32px); }
.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal header h2 { flex: 1; font-size: 1.1rem; }
.modal .x { border: 0; background: var(--soft); width: 38px; height: 38px; border-radius: 50%; font-size: 1rem; }
.modal .body { padding: 16px; overflow: auto; flex: 1; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (max-width: 640px) { .modal { padding: 0; align-items: flex-end; } .modal .sheet { border-radius: 18px 18px 0 0; max-height: 94vh; width: 100%; } .modal.full .sheet { height: 94vh; } .modal footer .btn { flex: 1; } }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 80; pointer-events: none; width: min(460px, calc(100% - 32px)); }
.toast { background: #1f2937; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); transition: .3s; text-align: center; }
.toast.bad { background: var(--bad); color: #fff; } .toast.ok { background: var(--ok); color: #fff; } .toast.out { opacity: 0; transform: translateY(8px); }

/* ---------- number pad / PIN / sign-in ---------- */
.np .sheet { width: min(380px, 100%); }
.np-val { font-size: 2rem; font-weight: 700; text-align: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; min-height: 64px; font-variant-numeric: tabular-nums; background: var(--soft); }
.np-val.dots { letter-spacing: .3em; }
.np-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.np-k { min-height: 60px; font-size: 1.4rem; font-weight: 600; border: 1px solid var(--line); background: var(--card); border-radius: 14px; }
.np-k:active { background: var(--accent-soft); }
.lock { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; }
.lock-card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; width: min(380px, 100%); box-shadow: var(--shadow); text-align: center; display: flex; flex-direction: column; gap: 10px; }
.lock-card.wide { width: min(520px, 100%); text-align: left; }
.lock-logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto; }
.shake { animation: shake .35s; } @keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------- till ---------- */
body[data-page="till"] main { overflow: hidden; }
.till { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: 100%; }
.till-left { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--line); }
.scan { display: flex; gap: 8px; padding: 10px; background: var(--card); border-bottom: 1px solid var(--line); align-items: center; }
.scan input { font-size: 1.3rem; min-height: 54px; flex: 1; }
.scan .qtyb { font-weight: 700; min-width: 64px; }
.lines { flex: 1; overflow: auto; background: var(--card); }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 90px 110px 120px; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); align-items: center; cursor: pointer; font-variant-numeric: tabular-nums; }
.line .nm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .line .nm small { color: var(--muted); }
.line .pr { color: var(--ok); font-size: .8rem; display: block; }
.line.sel { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.line.head { cursor: default; font-size: .75rem; text-transform: uppercase; color: var(--muted); background: var(--soft); padding: 6px 12px; position: sticky; top: 0; z-index: 1; }
.line .q, .line .p, .line .t { text-align: right; } .line .t { font-weight: 700; }
.lines .empty { padding: 60px 20px; font-size: 1.1rem; }
.till-info { display: flex; gap: 8px; padding: 8px 10px; background: var(--soft); border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; font-size: .9rem; }
.till-right { display: flex; flex-direction: column; background: var(--bg); min-height: 0; }
.totals { background: var(--top); color: var(--top-ink); padding: 14px 16px; font-variant-numeric: tabular-nums; }
.totals .row { display: flex; justify-content: space-between; font-size: .95rem; opacity: .9; }
.totals .grand { display: flex; justify-content: space-between; align-items: baseline; margin-top: 6px; font-size: 1rem; }
.totals .grand b { font-size: 2.4rem; letter-spacing: -.02em; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; overflow: auto; align-content: start; flex: 1; }
.key { border: 1px solid var(--line); background: var(--card); border-radius: 12px; min-height: 62px; padding: 6px; font-weight: 600; font-size: .9rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center; }
.key small { color: var(--muted); font-weight: 400; font-size: .72rem; }
.key:active { background: var(--accent-soft); }
.key.pay { grid-column: 1 / -1; min-height: 76px; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-size: 1.4rem; }
.key.pay small { color: inherit; opacity: .85; }
.key.warn { color: var(--warn); } .key.bad { color: var(--bad); }
@media (max-width: 900px) {
  body[data-page="till"] main { overflow: auto; }
  .till { grid-template-columns: 1fr; height: auto; min-height: 100%; }
  .till-left { border-right: 0; } .lines { min-height: 40vh; max-height: 50vh; }
  .line { grid-template-columns: minmax(0, 1fr) 60px 90px; } .line .p { display: none; }
  .keys { grid-template-columns: repeat(4, 1fr); } .key.pay { grid-column: 1 / -1; }
}
.paylist { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.payrow { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--soft); border-radius: 10px; font-variant-numeric: tabular-nums; }
.due { display: flex; justify-content: space-between; font-size: 1.1rem; padding: 6px 0; font-variant-numeric: tabular-nums; } .due b { font-size: 1.6rem; }
.methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.methods .tile { min-height: 70px; align-items: center; justify-content: center; text-align: center; border-left-width: 1px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.results .tile { min-height: 70px; }
.results .tile .pr { color: var(--accent); font-weight: 700; }
.status-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.timeline { list-style: none; padding: 0; margin: 0; } .timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--accent); margin-left: 6px; position: relative; } .timeline li::before { content: ''; position: absolute; left: -6px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.hbar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; } .hbar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.notice.info { background: var(--accent-soft); color: var(--ok); }
@media print { #top, .no-print { display: none !important; } main { overflow: visible; } }

/* ---------- side menu on every page ---------- */
#shell { flex: 1; display: flex; min-height: 0; position: relative; }
#shell > main { flex: 1; min-width: 0; }
#side { width: 236px; flex-shrink: 0; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
#side:empty, body[data-page="lock"] #side { display: none; }
#side button { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left; border-radius: 10px; padding: 9px 10px; min-height: 42px; color: var(--ink); }
#side button:hover { background: var(--soft); }
#side .ic { width: 26px; text-align: center; font-size: 1.15rem; flex-shrink: 0; }
#side b { flex: 1; font-weight: 600; } #side .car { color: var(--muted); font-size: .8rem; }
#side .sd-home.on, #side .sd-item.on { background: var(--accent); color: var(--accent-ink); }
#side .sd-head.cur { color: var(--accent); }
#side .sd-items { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 8px 14px; padding-left: 8px; border-left: 2px solid var(--line); }
#side .sd-item { min-height: 36px; padding: 6px 8px; font-size: .92rem; }
#side .sd-item span:not(.ic) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#side .sd-item .ic { width: 22px; font-size: 1rem; }
#side .badge { flex-shrink: 0; }
#side .sd-lock { margin: auto 6px 6px; width: calc(100% - 12px); box-sizing: border-box; padding: 14px 12px; border-radius: 14px; justify-content: center; gap: 10px; font-size: 1.05rem; background: var(--accent); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
#side .sd-lock .ic { font-size: 1.3rem; }
#side .sd-lock:hover { filter: brightness(1.08); }
body.side-mini #side .sd-lock b { display: none; }
body.side-mini #side .sd-lock { margin: auto 0 6px; width: 100%; padding: 12px 4px; }
#side .sd-fold { margin-top: 0; color: var(--muted); font-size: .85rem; justify-content: center; }
body.side-mini #side { width: 62px; padding: 10px 6px; }
body.side-mini #side b, body.side-mini #side .car, body.side-mini #side .sd-items { display: none; }
body.side-mini #side button { justify-content: center; padding: 9px 4px; }
body.side-mini #side .badge { position: absolute; top: 2px; right: 2px; }
.menubtn { display: none; background: rgb(255 255 255 / .12); border: 0; color: inherit; border-radius: 10px; width: 42px; height: 38px; font-size: 1.2rem; }
/* the till keeps its full width: the menu opens over it from the ☰ button */
body[data-page="till"] #side { display: none; }
body[data-page="till"] .menubtn { display: inline-block; }
body.side-open #side { display: flex !important; position: absolute; left: 0; top: 0; bottom: 0; z-index: 40; width: min(280px, 85vw); box-shadow: 0 10px 40px rgb(0 0 0 / .35); }
body.side-open.side-mini #side b, body.side-open.side-mini #side .car { display: inline; }
body.side-open.side-mini #side .sd-items { display: flex; }
body.side-open.side-mini #side button { justify-content: flex-start; padding: 9px 10px; }
@media (max-width: 900px) {
  #side { display: none; }
  .menubtn { display: inline-block; }
}

/* ---------- Home: boxes fill the screen, no scrolling ---------- */
body[data-page="home"] main { overflow: hidden; }
.home2 { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; }
.home-nav { display: none; }
.home-title { margin: 0; font-size: 1.1rem; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.hn { position: relative; display: flex; align-items: center; gap: 8px; border: 0; background: var(--soft); border-radius: 999px; padding: 8px 14px; min-height: 44px; white-space: nowrap; flex-shrink: 0; }
.hn .ic { font-size: 1.2rem; line-height: 1; } .hn.on { background: var(--accent); color: var(--accent-ink); }
.hn .badge { position: absolute; right: 2px; top: 2px; }
.home-main { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; min-height: 0; overflow: hidden; }
.kpis.slim { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; flex-shrink: 0; }
.home-quick { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; margin-top: 8px; }
.home-quick .btn small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.kpis.slim .kpi { padding: 8px 12px; display: grid; grid-template-columns: auto 1fr; align-items: baseline; column-gap: 10px; }
.kpis.slim .kpi small { grid-column: 1 / -1; } .kpis.slim .kpi b { font-size: 1.2rem; margin: 0; } .kpis.slim .kpi span { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* boxes keep a normal size (at most 140px high) and sit at the top; on a small screen they shrink so nothing scrolls */
.home-grid { flex: 1; min-height: 0; display: grid; gap: 12px; align-content: start; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); grid-auto-rows: minmax(0, 140px); }
.home-grid .tile { min-height: 0; justify-content: center; overflow: hidden; padding: 10px 16px; gap: 2px; }
.home-grid .tile .ic { font-size: clamp(1.3rem, 2.6vh, 1.8rem); } .home-grid .tile b { font-size: clamp(.95rem, 2vh, 1.15rem); }
.home-grid .tile small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 900px) {
  body[data-page="home"] main { overflow: auto; }
  .home2 { grid-template-rows: auto 1fr; height: auto; min-height: 100%; }
  .home-nav { display: flex; gap: 6px; padding: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 2; }
  .home-title { display: none; }
  .home-main { overflow: visible; }
  .kpis.slim { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; grid-auto-rows: minmax(96px, auto); flex: none; }
}

/* ---------- premium glossy finish (on unless body.flat — Developer settings → Look & feel) ----------
   Soft depth, light from the top, smooth motion. Colours still come from the tokens, so dark mode and
   the accent colour work the same. */
:root { --gloss-hi: rgb(255 255 255 / .55); --gloss-lift: 0 2px 4px rgb(16 24 20 / .05), 0 10px 28px -6px rgb(16 24 20 / .14); --ease: cubic-bezier(.2, .8, .2, 1); }
:root[data-theme="dark"] { --gloss-hi: rgb(255 255 255 / .06); --gloss-lift: 0 2px 4px rgb(0 0 0 / .35), 0 12px 30px -8px rgb(0 0 0 / .6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --gloss-hi: rgb(255 255 255 / .06); --gloss-lift: 0 2px 4px rgb(0 0 0 / .35), 0 12px 30px -8px rgb(0 0 0 / .6); } }
body:not(.flat) { background: radial-gradient(1200px 600px at 100% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%), var(--bg); background-attachment: fixed; }
body:not(.flat) #top { background: linear-gradient(135deg, color-mix(in srgb, var(--top) 88%, #fff 0%), color-mix(in srgb, var(--top) 70%, var(--accent))); box-shadow: inset 0 -1px 0 rgb(255 255 255 / .08), 0 4px 18px -6px rgb(0 0 0 / .35); position: relative; z-index: 3; }
body:not(.flat) #top .chip, body:not(.flat) #top .pill, body:not(.flat) .menubtn { background: rgb(255 255 255 / .14); box-shadow: inset 0 1px 0 rgb(255 255 255 / .18); backdrop-filter: blur(6px); }
body:not(.flat) .card, body:not(.flat) .kpi, body:not(.flat) .tile, body:not(.flat) .tbl-wrap, body:not(.flat) .lock-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--card) 100%, #fff 0%) 0%, color-mix(in srgb, var(--card) 94%, var(--soft)) 100%);
  box-shadow: inset 0 1px 0 var(--gloss-hi), var(--gloss-lift); border-color: color-mix(in srgb, var(--line) 80%, transparent); }
body:not(.flat) .tile { transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s; }
body:not(.flat) .tile:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 var(--gloss-hi), 0 4px 8px rgb(16 24 20 / .06), 0 18px 36px -10px color-mix(in srgb, var(--c, var(--accent)) 35%, transparent); }
body:not(.flat) .tile:active { transform: translateY(0) scale(.99); }
body:not(.flat) .tile .ic { display: inline-grid; place-items: center; width: 2.1em; height: 2.1em; border-radius: 12px; font-size: 1.25rem;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, var(--accent)) 22%, var(--card)), color-mix(in srgb, var(--c, var(--accent)) 8%, var(--card))); box-shadow: inset 0 1px 0 var(--gloss-hi); }
body:not(.flat) .home-grid .tile .ic { font-size: clamp(1.1rem, 2.2vh, 1.5rem); }
body:not(.flat) .kpi b { letter-spacing: -.01em; }
body:not(.flat) .btn { transition: transform .12s var(--ease), box-shadow .15s, border-color .15s, background .15s; box-shadow: inset 0 1px 0 var(--gloss-hi), 0 1px 2px rgb(0 0 0 / .06); }
body:not(.flat) .btn:active { transform: scale(.98); }
body:not(.flat) .btn.primary, body:not(.flat) .tab.on, body:not(.flat) .seg button.on, body:not(.flat) #side .sd-home.on, body:not(.flat) #side .sd-item.on, body:not(.flat) .hn.on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent) 55%, color-mix(in srgb, var(--accent) 85%, #000));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 6px 16px -6px color-mix(in srgb, var(--accent) 70%, transparent); border-color: transparent; }
body:not(.flat) .btn.danger { background: linear-gradient(180deg, color-mix(in srgb, var(--bad) 80%, #fff), var(--bad)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .3), 0 6px 16px -6px color-mix(in srgb, var(--bad) 70%, transparent); }
body:not(.flat) .key { transition: transform .1s var(--ease), background .15s; box-shadow: inset 0 1px 0 var(--gloss-hi), 0 1px 2px rgb(0 0 0 / .05); }
body:not(.flat) .key:active { transform: scale(.97); }
body:not(.flat) .key.pay { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 75%, #fff), var(--accent) 50%, color-mix(in srgb, var(--accent) 80%, #000)); box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), 0 10px 24px -8px color-mix(in srgb, var(--accent) 75%, transparent); border: 0; }
body:not(.flat) .totals { background: linear-gradient(160deg, color-mix(in srgb, var(--top) 92%, #fff 0%), color-mix(in srgb, var(--top) 75%, var(--accent))); box-shadow: inset 0 1px 0 rgb(255 255 255 / .08); }
body:not(.flat) .modal { background: rgb(10 16 13 / .42); backdrop-filter: blur(6px); }
body:not(.flat) .modal .sheet { border-radius: 22px; box-shadow: 0 30px 80px -10px rgb(0 0 0 / .45), inset 0 1px 0 var(--gloss-hi); animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (max-width: 640px) { body:not(.flat) .modal .sheet { border-radius: 22px 22px 0 0; animation: rise .25s var(--ease); } @keyframes rise { from { transform: translateY(40px); opacity: .4; } } }
body:not(.flat) #side { background: linear-gradient(180deg, var(--card), color-mix(in srgb, var(--card) 92%, var(--soft))); box-shadow: inset -1px 0 0 var(--line); border-right: 0; }
body:not(.flat) #side button { transition: background .15s, color .15s; }
body:not(.flat) input:focus, body:not(.flat) textarea:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
body:not(.flat) .toggle.on span { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, #fff), var(--accent)); }
body:not(.flat) .toast { border-radius: 14px; backdrop-filter: blur(8px); box-shadow: 0 12px 30px -8px rgb(0 0 0 / .4); }
body:not(.flat) .tbl th { background: color-mix(in srgb, var(--soft) 85%, var(--card)); }
body:not(.flat) .line.sel { box-shadow: inset 4px 0 0 var(--accent), inset 0 0 0 999px color-mix(in srgb, var(--accent) 4%, transparent); }
body:not(.flat) main > * { animation: fadein .2s var(--ease); }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { body:not(.flat) * { animation: none !important; transition: none !important; } }
@media print { body { background: #fff !important; } }

/* ---------- error pop-up (SM.ui.errorPop, every error message) ---------- */
#errPop { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: transparent; pointer-events: auto; }
#errPop .ep-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; width: min(420px, 100%); background: var(--card); color: var(--ink); border: 2px solid var(--bad); border-radius: 18px; padding: 16px 18px; box-shadow: 0 24px 60px -10px rgb(127 29 29 / .55); }
#errPop.on .ep-card { animation: errshake .42s cubic-bezier(.36, .07, .19, .97); }
#errPop .ep-ic { font-size: 2rem; width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; background: var(--bad-soft); flex-shrink: 0; }
#errPop .ep-tx { flex: 1; min-width: 0; } #errPop .ep-tx b { color: var(--bad); font-size: 1.05rem; } #errPop .ep-tx p { margin: 2px 0 0; font-size: 1.02rem; overflow-wrap: anywhere; }
#errPop .ep-ok small { opacity: .8; font-weight: 400; margin-left: 4px; }
@keyframes errshake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
#errPop .ep-ok { min-width: 160px; }
@media (max-width: 640px) { #errPop .ep-ok { width: 100%; } }
/* the shop's own logo: on a white rounded tile in the top bar, wide on the sign-in card */
#top .brand img.own { width: auto; max-width: 120px; height: 32px; object-fit: contain; background: #fff; padding: 2px 6px; border-radius: 8px; }
.lock-logo.own { width: auto; max-width: min(260px, 80%); height: auto; max-height: 96px; border-radius: 0; object-fit: contain; }
/* a coloured logo needs a light tile to read on the dark theme */
:root[data-theme="dark"] .lock-logo.own { background: #fff; padding: 8px 14px; border-radius: 14px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lock-logo.own { background: #fff; padding: 8px 14px; border-radius: 14px; } }
/* connection & sync chip in the top bar */
#top .pill.sp { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; text-align: left; line-height: 1.1; max-width: none; }
#top .pill.sp .sp-txt { display: flex; flex-direction: column; } #top .pill.sp b { font-size: .82rem; } #top .pill.sp small { font-size: .7rem; opacity: .9; white-space: nowrap; }
.sp-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: #ef4444; box-shadow: 0 0 0 3px rgb(239 68 68 / .3); }
.sp-dot.on { background: #22c55e; box-shadow: 0 0 0 3px rgb(34 197 94 / .3); animation: sppulse 2.4s infinite; }
.sp-dot.spin { background: #facc15; box-shadow: 0 0 0 3px rgb(250 204 21 / .35); }
@keyframes sppulse { 50% { box-shadow: 0 0 0 6px rgb(34 197 94 / .08); } }
.sd-box { display: flex; flex-direction: column; gap: 8px; } .sd-row { display: flex; justify-content: space-between; gap: 14px; padding: 8px 10px; background: var(--soft); border-radius: 10px; } .sd-row b { text-align: right; }
@media (max-width: 640px) { #top .pill.sp small { display: none; } }

/* ---------- delivery rider phone screen (js/rider.js) — big tiles, the client's own colours (--accent / --top / --accent2) ---------- */
body.rider-mode #menuBtn, body.rider-mode #branchChip, body.rider-mode #side { display: none !important; }
body.rider-mode #pageTitle { visibility: hidden; }
.lock-tag { margin: -4px 0 0; font-weight: 700; color: var(--accent); }
.rd { max-width: 640px; margin: 0 auto; padding: 12px 12px 28px; display: flex; flex-direction: column; gap: 12px; }
.rd-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; color: var(--top-ink);
  background: linear-gradient(135deg, var(--top), color-mix(in srgb, var(--accent) 70%, var(--top))); box-shadow: inset 0 -4px 0 var(--accent2, transparent), var(--shadow); }
.rd-hi { flex: 1; min-width: 0; display: flex; flex-direction: column; } .rd-hi b { font-size: 1.25rem; } .rd-hi small { opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-count { flex: none; width: 62px; height: 62px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: rgb(255 255 255 / .16); border: 2px solid rgb(255 255 255 / .35); line-height: 1; }
.rd-count b { font-size: 1.5rem; } .rd-count small { font-size: .68rem; opacity: .9; }
.rd-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rd-tabs button { min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.rd-tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.rd-tabs .badge.warn { background: var(--accent2, var(--warn)); color: var(--accent2-ink, #fff); }
.rd-list { display: flex; flex-direction: column; gap: 10px; }
.rd-card { text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 14px 16px; border-radius: 16px; border: 1px solid var(--line); border-left: 6px solid var(--c, var(--accent)); background: var(--card); box-shadow: var(--shadow); width: 100%; }
.rd-card.s-ready { --c: #d97706; } .rd-card.s-out { --c: #0891b2; }
.rd-card:active { transform: scale(.99); }
.rd-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rd-card-name { font-size: 1.25rem; font-weight: 800; line-height: 1.2; }
.rd-card-line { color: var(--muted); font-size: .95rem; }
.rd-card-money { margin-top: 4px; }
.rd-pay { display: inline-block; padding: 6px 10px; border-radius: 10px; font-weight: 600; font-size: .95rem; }
.rd-pay.ok { background: var(--accent-soft); color: var(--ok); }
.rd-pay.due { background: var(--warn-soft); color: var(--warn); } .rd-pay.due b { font-size: 1.1rem; }
.rd-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 34px 16px; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 18px; }
.rd-empty span { font-size: 2.6rem; } .rd-empty b { color: var(--ink); font-size: 1.1rem; }
.rd-modal .sheet { width: min(560px, 100%); }
.rd-pop { display: flex; flex-direction: column; gap: 10px; }
.rd-pop-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rd-name { font-size: 1.5rem; margin: 0; }
.rd-addr { margin: 0; font-size: 1.05rem; }
.rd-note { margin: 0; }
.rd-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rd-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; border-radius: 16px; text-decoration: none; color: var(--ink); background: var(--soft); border: 1px solid var(--line); font-size: .95rem; }
.rd-link span { font-size: 1.6rem; line-height: 1; } .rd-link.wa { background: color-mix(in srgb, #25d366 18%, var(--card)); border-color: color-mix(in srgb, #25d366 45%, var(--line)); }
.rd-money { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: var(--soft); }
.rd-items summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.rd-items ul, .rd-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rd-items li, .rd-rows li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; background: var(--soft); border-radius: 10px; }
.rd-rows li span { display: flex; flex-direction: column; min-width: 0; } .rd-rows li small { color: var(--muted); } .rd-rows li > b { text-align: right; white-space: nowrap; }
.rd-acts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.rd-big { min-height: 60px; font-size: 1.1rem; border-radius: 16px; }
.rd-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .rd-two .btn { min-height: 52px; }
.rd-digits { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 6px 0 12px; }
.rd-digits span { height: 66px; border-radius: 14px; border: 2px solid var(--line); background: var(--soft); display: grid; place-items: center; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.rd-digits span.on { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.rd-code .sheet, .rd-paym .sheet { width: min(420px, 100%); }
.rd-shot { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 150px; border: 2px dashed var(--accent); border-radius: 16px; background: var(--accent-soft); cursor: pointer; text-align: center; padding: 10px; }
.rd-shot span { display: flex; flex-direction: column; align-items: center; font-size: 2.2rem; } .rd-shot b { font-size: 1.05rem; } .rd-shot small { color: var(--muted); font-size: .85rem; }
.rd-shot img { max-width: 100%; max-height: 220px; border-radius: 12px; }
.rd-chips .chip.on, .rd-reasons .tile.on { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
.rd-reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .rd-reasons .tile { min-height: 56px; justify-content: center; border-left-width: 1px; }
.rd-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rd-kpi { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); min-width: 0; }
.rd-kpi small { color: var(--muted); } .rd-kpi b { font-size: 1.4rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rd-kpi.big { grid-column: 1 / -1; } .rd-kpi.big b { font-size: 2rem; } .rd-kpi.warn { border-color: var(--warn); background: var(--warn-soft); } .rd-kpi.warn b { color: var(--warn); } .rd-kpi.ok b { color: var(--ok); }
@media (max-width: 380px) { .rd-reasons { grid-template-columns: 1fr; } .rd-link { min-height: 68px; } }
.rd-cant { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); background: var(--card); }

/* the Lock button in the top bar: on every screen, for everyone signed in (also the POS and the rider screen, which hide the side menu) */
#lockChip { font-weight: 700; background: rgba(255,255,255,.18); }
@media (max-width: 640px) { #lockChip span { display: none; } }
