/* DukaPOS — forest green, M-Pesa leaf, maize accent. The cart is a paper till receipt. */
:root {
  --bg: #eef2ef; --card: #ffffff; --paper: #fffef8; --ink: #15241e; --muted: #5f7068; --line: #dbe3de; --line-2: #c9d4cd;
  --forest: #0e3b2e; --forest-2: #164a3b; --forest-ink: #dcebe4; --forest-muted: #8fb1a3;
  --brand: #1f8a4c; --brand-2: #17733f; --brand-ink: #ffffff; --brand-soft: #e3f3e9;
  --maize: #f2b33d; --maize-soft: #fdf1d6; --mpesa: #3aa335;
  --ok: #17733f; --ok-soft: #e3f3e9; --warn: #9a5b00; --warn-soft: #fdf1d6; --bad: #b3261e; --bad-soft: #fbe7e5;
  --cat-0: #1f8a4c; --cat-1: #d67a1f; --cat-2: #2c6bb3; --cat-3: #b13a7d; --cat-4: #6d58c7; --cat-5: #0d8a8a; --cat-6: #6b7c74;
  --logo-ink: var(--forest);
  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow: 0 1px 0 rgba(14,59,46,.04), 0 6px 20px -8px rgba(14,59,46,.12);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1511; --card: #12201a; --paper: #16251f; --ink: #e6efea; --muted: #93a79d; --line: #223630; --line-2: #2d443b;
    --forest: #081d16; --forest-2: #0f2e24; --brand: #34b36a; --brand-2: #2a9c5a; --brand-ink: #04170d; --brand-soft: #143325;
    --maize-soft: #33280f; --ok: #5ccf8b; --ok-soft: #133024; --warn: #f2b33d; --warn-soft: #33280f; --bad: #f28b82; --bad-soft: #3a1714;
    --cat-0: #3fbf74; --cat-1: #f0a04b; --cat-2: #5b9be6; --cat-3: #e070ad; --cat-4: #9c88f0; --cat-5: #3cc2c2; --cat-6: #8a9c94;
    --shadow: none; color-scheme: dark;
  }
  .chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .stat.hero { border-color: var(--line); }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 0; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; letter-spacing: -.01em; font-weight: 700; }
h1 { font-size: 1.5rem; letter-spacing: -.02em; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
code { background: var(--brand-soft); color: var(--brand-2); padding: 1px 6px; border-radius: 5px; font-size: .85em; }
:focus-visible { outline: 3px solid var(--maize); outline-offset: 2px; border-radius: 6px; }
.ic { width: 19px; height: 19px; flex-shrink: 0; }

/* Forms */
input, select, textarea { font: inherit; color: inherit; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; width: 100%; min-height: 44px; transition: border-color .15s; }
input:hover, select:hover { border-color: var(--line-2); }
input:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
input[type=file] { padding: 8px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .87rem; font-weight: 600; color: var(--ink); }
label small { font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.inline { flex-direction: row; align-items: center; gap: 8px; } label.inline input { width: auto; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1.5px solid var(--line-2); background: var(--card); color: var(--ink);
  border-radius: var(--r-sm); padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; min-height: 44px; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { border-color: var(--brand); } .btn:active { transform: translateY(1px); } .btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.mpesa { background: var(--mpesa); color: #fff; border-color: var(--mpesa); }
.btn.danger { color: var(--bad); } .btn.danger:hover { border-color: var(--bad); background: var(--bad-soft); }
.btn.ghost { background: transparent; border-color: transparent; } .btn.ghost:hover { background: var(--brand-soft); border-color: transparent; }
.btn.sm { padding: 5px 11px; min-height: 34px; font-size: .85rem; }
.btn.big { min-height: 58px; font-size: 1.12rem; border-radius: var(--r); }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; font-size: .8rem; padding: 0; font-weight: 600; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-sm); color: var(--forest-muted); }
.icon-btn:hover { background: var(--forest-2); color: #fff; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 244px; background: var(--forest); color: var(--forest-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px 16px; }
.brand b { font-size: 1.12rem; letter-spacing: -.01em; }
.brand small { display: block; color: var(--forest-muted); font-size: .78rem; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo { width: 38px; height: 38px; border-radius: 11px; background: var(--maize); color: #fff; display: grid; place-items: center; flex-shrink: 0; --logo-ink: var(--maize); }
.logo svg { width: 26px; height: 26px; }
.side .logo { background: var(--maize); } .side .logo svg { color: var(--forest); } .side .logo { --logo-ink: var(--maize); }
.side nav { display: flex; flex-direction: column; padding: 8px 12px; gap: 2px; flex: 1; overflow-y: auto; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--forest-ink); font-weight: 500; position: relative; }
.side nav a .ic { color: var(--forest-muted); }
.side nav a:hover { background: var(--forest-2); text-decoration: none; }
.side nav a.on { background: var(--forest-2); color: #fff; font-weight: 700; }
.side nav a.on .ic { color: var(--maize); }
.side nav a.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--maize); }
.me { border-top: 1px solid var(--forest-2); padding: 14px 14px 16px 18px; display: flex; align-items: center; gap: 10px; }
.me b { display: block; font-size: .92rem; line-height: 1.2; } .me small { display: block; color: var(--forest-muted); font-size: .78rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--forest-2); color: var(--maize); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.scrim { display: none; }
.main { flex: 1; min-width: 0; padding: 22px 28px 48px; }
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; min-height: 40px; }
.top h1 { margin: 0; flex: 1; }
.menu { display: none; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-sm); font-size: 1.15rem; width: 42px; height: 42px; color: var(--ink); cursor: pointer; }

/* Surfaces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; } .card.narrow { max-width: 540px; }
.card > details > summary, details.card > summary { cursor: pointer; }
details.card > summary { list-style: none; } details.card > summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--brand-soft); color: var(--brand); margin-right: 8px; font-weight: 700; }
details.card[open] > summary::before { content: "−"; }
details.card > summary b { font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-top: 14px; } .span2 { grid-column: span 2; }
.row { display: flex; align-items: center; }
.row > input:not([type=checkbox]), .row > select { width: auto; flex: 1 1 170px; }
.card h3:not(:first-child) { margin-top: 22px; } .gap { gap: 10px; } .wrap { flex-wrap: wrap; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar input:not([type=checkbox]) { width: auto; min-width: 220px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; } .cols2 > .card { margin-bottom: 0; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .right { text-align: right; } .pad { padding: 18px 20px; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); } .b td { font-weight: 700; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 40px 16px; color: var(--muted); grid-column: 1 / -1; }
.empty b { color: var(--ink); font-size: 1rem; }

.alert { padding: 12px 16px; border-radius: var(--r); margin-bottom: 16px; background: var(--ok-soft); color: var(--ok); border-left: 4px solid currentColor; font-weight: 500; }
.alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert ul { margin: 6px 0 0; padding-left: 20px; font-weight: 400; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--bg); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
a.pill:hover { text-decoration: none; }

/* Tables */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl th { text-align: left; font-size: .82rem; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--brand-soft) 45%, transparent); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .n, .n { text-align: right; font-variant-numeric: tabular-nums; }
.tbl.kv td:first-child { color: var(--muted); }
.card:not(.flush) .tbl td, .card:not(.flush) .tbl th { padding-left: 0; } .card:not(.flush) .tbl th { background: none; }
.card:not(.flush) .tbl tbody tr:hover td { background: none; }
tr.dim td { opacity: .5; } tr.strike td:nth-child(n+2):nth-child(-n+6) { text-decoration: line-through; }
.actions { text-align: right; white-space: nowrap; }
.actions > * { display: inline-flex; vertical-align: middle; margin: 0 0 0 4px; } .actions form { margin: 0 0 0 4px; }
details.pop { display: inline-block; }
details.pop { position: relative; } details.pop > summary { list-style: none; } details.pop > summary::-webkit-details-marker { display: none; }
details.pop > form { position: absolute; right: 0; top: 110%; z-index: 20; width: 270px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: 0 16px 40px -10px rgba(14,59,46,.3); }

/* Dashboard */
.stats { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.stats.small { grid-template-columns: repeat(3, 1fr); margin: 14px 0; gap: 10px; }
.stats.small > div { background: var(--bg); padding: 12px; border-radius: var(--r); }
.stats.small span { display: block; font-size: .8rem; color: var(--muted); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat span { color: var(--muted); font-size: .85rem; font-weight: 500; }
.stat b, .stat-num { display: block; font-size: 1.55rem; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; }
.stat small { font-size: .82rem; margin-top: auto; }
.stat.hero { background: var(--forest); border-color: var(--forest); color: #fff; position: relative; overflow: hidden; }
.stat.hero span { color: var(--forest-muted); }
.stat.hero b { font-size: 2.1rem; color: #fff; }
.stat.hero small.ok-t { color: var(--maize); } .stat.hero small.bad-t { color: #ffb4ab; } .stat.hero small { color: var(--forest-ink); }
.stat.hero > * { position: relative; z-index: 1; }
.stat.hero::after { content: ""; position: absolute; right: -46px; bottom: -58px; width: 120px; height: 120px; border-radius: 50%; border: 16px solid var(--forest-2); z-index: 0; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 6px; }
.bar i { display: block; width: 100%; max-width: 26px; background: var(--brand); border-radius: 6px 6px 3px 3px; opacity: .85; transition: opacity .15s; }
.bar:last-child i { background: var(--maize); opacity: 1; }
.bar:hover i { opacity: 1; }
.bar span { font-size: .72rem; color: var(--muted); }
.meter { display: grid; grid-template-columns: 110px 1fr 80px; align-items: center; gap: 12px; margin: 12px 0; font-size: .92rem; }
.meter div { background: var(--bg); height: 10px; border-radius: 99px; overflow: hidden; } .meter i { display: block; height: 100%; border-radius: 99px; }
.meter b { text-align: right; font-variant-numeric: tabular-nums; }
.m-cash { background: var(--cat-2); } .m-mpesa { background: var(--mpesa); } .m-credit { background: var(--maize); } .m-card { background: var(--cat-4); }
.setup { background: var(--maize-soft); border-color: transparent; }
.setup ol { margin: 0; padding-left: 20px; } .setup li { margin: 8px 0; } .setup li.done { text-decoration: line-through; opacity: .55; }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 7px 15px; font: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--forest); color: #fff; border-color: var(--forest); }
.chip.static { cursor: default; display: inline-block; margin: 3px 0; }

/* POS */
.main-pos { height: 100vh; display: flex; flex-direction: column; padding-bottom: 18px; }
.main-pos > .alert { animation: fadeout .4s ease 3s forwards; }
@keyframes fadeout { to { opacity: 0; height: 0; padding: 0; margin: 0; overflow: hidden; border: 0; } }
.pos { display: grid; grid-template-columns: 1fr 400px; gap: 20px; flex: 1; min-height: 0; }
.pos > * { min-width: 0; }
.pos-left { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.pos-search { position: relative; }
.pos-search::before { content: ""; position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); opacity: .5;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat; }
.pos-search input { font-size: 1.05rem; min-height: 54px; padding-left: 46px; border-radius: var(--r); background: var(--card); }
#cats { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; overflow-y: auto; align-content: start; padding: 2px 2px 24px; }
.tile { --c: var(--cat-6); background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r); padding: 12px; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px; min-height: 124px; color: var(--ink); font: inherit; position: relative; overflow: hidden; transition: border-color .12s, transform .06s; }
.tile::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c); opacity: .85; }
.tile:hover { border-color: var(--c); }
.tile:active { transform: scale(.97); }
.tile.out { opacity: .55; } .tile.out .tstock { background: var(--bad-soft); color: var(--bad); }
.tmono { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: .82rem; letter-spacing: .02em;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.tname { font-weight: 600; font-size: .92rem; line-height: 1.25; flex: 1; }
.tfoot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tprice { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; }
.tstock { font-size: .72rem; color: var(--muted); background: var(--bg); padding: 2px 7px; border-radius: 99px; white-space: nowrap; }

/* The receipt */
.receipt { display: flex; flex-direction: column; min-height: 0; background: var(--paper); border: 1px solid var(--line); border-bottom: 0;
  border-radius: var(--r-lg) var(--r-lg) 0 0; padding: 16px 18px 18px; position: relative; margin-bottom: 12px;
  box-shadow: 0 10px 30px -12px rgba(14,59,46,.25); }
.receipt::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -11px; height: 12px;
  background: linear-gradient(-45deg, transparent 8px, var(--paper) 0) 0 0 / 16px 12px repeat-x, linear-gradient(45deg, transparent 8px, var(--paper) 0) 0 0 / 16px 12px repeat-x; }
.cust { display: flex; align-items: center; gap: 6px; padding-bottom: 12px; border-bottom: 1.5px dashed var(--line-2); }
#custName { flex: 1; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cart { flex: 1; overflow-y: auto; padding: 4px 0; }
.cart .empty { padding: 50px 10px; }
.line { display: grid; grid-template-columns: 1fr auto 78px 24px; align-items: center; gap: 8px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.lname { font-weight: 600; font-size: .92rem; line-height: 1.3; } .lname small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; }
.qty { display: flex; align-items: center; background: var(--card); border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 32px; height: 34px; border: 0; background: none; color: var(--ink); font-size: 1.1rem; cursor: pointer; }
.qty button:hover { background: var(--brand-soft); color: var(--brand); }
.qty input { width: 44px; min-height: 34px; border: 0; border-radius: 0; text-align: center; padding: 0 2px; font-weight: 600; box-shadow: none !important; background: none; }
.ltotal { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .93rem; }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .95rem; padding: 4px; border-radius: 6px; } .x:hover { color: var(--bad); background: var(--bad-soft); }
.totals { border-top: 1.5px dashed var(--line-2); padding: 12px 0; display: flex; flex-direction: column; gap: 4px; font-variant-numeric: tabular-nums; }
.totals > div { display: flex; justify-content: space-between; }
.totals .grand { font-size: 1.1rem; margin-top: 8px; padding-top: 10px; border-top: 3px double var(--line-2); align-items: baseline; font-weight: 600; }
.totals .grand b { font-size: 1.75rem; letter-spacing: -.02em; color: var(--ink); }
#payBtn { background: var(--brand); }

/* Dialogs */
.dlg { border: 0; border-radius: 22px; padding: 22px; width: min(500px, calc(100vw - 24px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(8,29,22,.55); }
.dlg[open] { animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dlg::backdrop { background: rgba(8,29,22,.6); backdrop-filter: blur(2px); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; } .dlg-head h2 { margin: 0; font-size: 1.3rem; }
.dlg > label, .dlg .tab > * + * { margin-top: 10px; }
.due { display: grid; grid-template-columns: 1fr 1fr; background: var(--forest); color: var(--forest-muted); border-radius: var(--r); padding: 14px 16px; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.due > div + div { text-align: right; border-left: 1px solid var(--forest-2); }
.due span { display: block; font-size: .8rem; }
.due b { display: block; color: #fff; font-size: 1.3rem; letter-spacing: -.01em; } .due .bad-t { color: var(--maize); } .due .ok-t { color: #8ee6b0; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: var(--r); margin-bottom: 14px; overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: none; padding: 9px 8px; border-radius: 9px; font: inherit; font-size: .84rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(14,59,46,.15); }
.tabs button[data-tab=stk].on, .tabs button[data-tab=code].on { color: var(--mpesa); }
.tab { display: flex; flex-direction: column; gap: 10px; } .tab[hidden] { display: none; }
#cashAmt { font-size: 1.4rem; font-weight: 700; min-height: 56px; }
.change { font-size: 1.05rem; } .change b { font-variant-numeric: tabular-nums; font-size: 1.3rem; } .change.big { font-size: 1.2rem; margin-top: 10px; }
.paylist { margin: 14px 0; display: flex; flex-direction: column; gap: 6px; } .paylist:empty { margin: 8px 0; }
.payrow { display: flex; align-items: center; gap: 8px; background: var(--brand-soft); padding: 10px 12px; border-radius: 10px; font-variant-numeric: tabular-nums; } .payrow span:first-child { flex: 1; font-weight: 500; }
.stk-status { padding: 12px 14px; border-radius: var(--r); background: var(--bg); margin-top: 10px; font-weight: 500; }
.stk-status.ok { background: var(--ok-soft); color: var(--ok); } .stk-status.bad { background: var(--bad-soft); color: var(--bad); }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes sp { to { transform: rotate(360deg); } }
.list { max-height: 320px; overflow-y: auto; margin: 12px 0; display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; gap: 10px; align-items: center; justify-content: space-between; text-align: left; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; padding: 11px 13px; font: inherit; cursor: pointer; }
.item:hover { border-color: var(--brand); }
details summary { cursor: pointer; font-weight: 600; margin: 6px 0; }
.done-box { text-align: center; padding: 12px 0 20px; }
.tick { width: 72px; height: 72px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 2.1rem; display: grid; place-items: center; margin: 0 auto 14px; animation: tickin .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes tickin { from { transform: scale(.4); opacity: 0; } }
.done-box h2 { font-size: 1.4rem; } .done-box .change { background: var(--maize-soft); border-radius: var(--r); padding: 12px; } .done-box .change:empty { display: none; }
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: var(--forest); color: #fff; padding: 11px 20px; border-radius: 999px; z-index: 1000; font-weight: 500; box-shadow: 0 10px 30px -8px rgba(8,29,22,.5); }

/* Billing */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.plan { display: flex; flex-direction: column; } .plan .btn { margin-top: auto; }
.plan.current { border: 2px solid var(--brand); position: relative; }
.plan.current::before { content: "Your plan"; position: absolute; top: -12px; left: 18px; background: var(--brand); color: var(--brand-ink); font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 99px; }
.price { font-size: 2.1rem; font-weight: 800; margin: 2px 0 12px; letter-spacing: -.02em; } .price small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.plan ul { padding: 0; margin: 0 0 18px; list-style: none; } .plan li { padding: 5px 0 5px 26px; position: relative; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 800; }

/* Auth */
body.auth { min-height: 100vh; }
.auth-wrap { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { background: var(--forest); color: var(--forest-ink); padding: 36px 48px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-hero::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px;
  background: repeating-linear-gradient(90deg, var(--maize) 0 40px, var(--brand) 40px 64px, #b3261e 64px 72px, var(--brand) 72px 96px); }
.auth-hero .brand { padding: 0; } .auth-hero .brand b { color: #fff; font-size: 1.25rem; }
.auth-hero .logo svg { color: var(--forest); }
.hero-copy { margin-top: auto; max-width: 30ch; }
.hero-copy h2 { color: #fff; font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.05; letter-spacing: -.03em; font-weight: 800; margin-bottom: 16px; }
.hero-copy p { color: var(--forest-muted); font-size: 1.05rem; max-width: 42ch; margin: 0; }
.hero-receipt { margin: 40px 0 8px; width: 290px; background: #fffef8; color: #15241e; padding: 18px 18px 22px; border-radius: 12px 12px 0 0; position: relative; transform: rotate(-2deg);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); font-variant-numeric: tabular-nums; font-size: .9rem; }
.hero-receipt::after { content: ""; position: absolute; left: 0; right: 0; bottom: -11px; height: 12px;
  background: linear-gradient(-45deg, transparent 8px, #fffef8 0) 0 0 / 16px 12px repeat-x, linear-gradient(45deg, transparent 8px, #fffef8 0) 0 0 / 16px 12px repeat-x; }
.hr-row, .hr-total { display: flex; justify-content: space-between; padding: 5px 0; }
.hr-row { border-bottom: 1px dashed #d6ddd8; }
.hr-total { font-weight: 800; font-size: 1.1rem; padding-top: 10px; }
.hr-pay { margin-top: 10px; background: #e3f3e9; color: #17733f; padding: 7px 10px; border-radius: 8px; font-size: .82rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hr-pay .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mpesa); box-shadow: 0 0 0 3px rgba(58,163,53,.25); }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 88px); max-width: 560px; width: 100%; margin: 0 auto; }
.auth-card h2 { font-size: 1.75rem; letter-spacing: -.02em; margin-bottom: 4px; }
.auth-card h2 + .muted { margin: 0 0 22px; }
.auth-card .btn.block { margin-top: 6px; min-height: 50px; }
.auth-card > .center { margin-top: 20px; }
.mobile-only { display: none !important; }

/* Responsive */
@media (max-width: 1100px) { .pos { grid-template-columns: 1fr 350px; } .stats { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  .side { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .side.open { left: 0; } .side.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(8,29,22,.5); z-index: 40; }
  .menu { display: block; }
  .main { padding: 14px 16px 40px; }
  h1 { font-size: 1.3rem; }
  .cols2, .form-grid, .stats { grid-template-columns: 1fr; } .span2 { grid-column: auto; }
  .stats.small { grid-template-columns: repeat(3, 1fr); }
  .main-pos { height: auto; }
  .pos { grid-template-columns: minmax(0, 1fr); }
  .grid { max-height: 26vh; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); padding-bottom: 8px; }
  .tile { min-height: 104px; }
  .receipt { position: sticky; bottom: 0; max-height: 50vh; border-radius: var(--r-lg) var(--r-lg) 0 0; margin-bottom: 0; padding: 12px 16px 14px; z-index: 5; }
  #custName { order: 5; flex-basis: 100%; }
  .totals .grand b { font-size: 1.45rem; }
  .receipt::after { display: none; }
  .cust { flex-wrap: wrap; }
  .toolbar input:not([type=checkbox]) { min-width: 0; width: 100%; }
  .auth-wrap { grid-template-columns: 1fr; } .auth-hero { display: none; } .mobile-only { display: flex !important; padding: 0 0 20px; }
  .auth-card { padding: 32px 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media print { .side, .top, .noprint, .alert, .scrim { display: none !important; } .main { padding: 0; } .card { border: 0; box-shadow: none; } }

/* ---- Platform admin ---- */
.is-admin .side { background: #10231d; }
.imp-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--maize-soft); color: var(--warn);
  border: 1.5px dashed var(--maize); border-radius: var(--r); padding: 10px 14px; margin-bottom: 16px; font-weight: 500; }
.main-pos > .imp-bar { margin-bottom: 10px; padding: 6px 12px; }
a.chip { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
textarea { font: inherit; color: inherit; background: var(--card); border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; width: 100%; resize: vertical; }
.danger-zone { border-color: var(--bad-soft); } .danger-zone summary b { color: var(--bad); }
.admin-auth .auth-hero { justify-content: space-between; }
