/* Hamper and Gift Box Inventory — one phone-width column; sticky brand bar, bottom tab bar, sheets slide up from the bottom. */
:root {
  --bg: #F6F3F5;
  --surface: #FFFFFF;
  --sunk: #EEE8EC;
  --ink: #1F161C;
  --muted: #6C5F68;
  --line: #E3DADF;
  --accent: #A3155F;
  --accent-ink: #FFFFFF;
  --accent-soft: #F6E1EC;
  --gold: #A87412;
  --ok: #1B6E45;   --ok-soft: #DFF1E6;
  --warn: #8F5400; --warn-soft: #FAEBD3;
  --bad: #B3261E;  --bad-soft: #FBE3E0;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 14px;
  --shadow: 0 1px 2px rgb(40 10 30 / .06), 0 4px 16px rgb(40 10 30 / .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141014; --surface: #1D181C; --sunk: #262025; --ink: #F3EDF1; --muted: #A99DA6; --line: #352C33;
    --accent: #E35BA3; --accent-ink: #1A0710; --accent-soft: #3A1A2B; --gold: #E0AE4E;
    --ok: #63C994; --ok-soft: #173326; --warn: #F0B45A; --warn-soft: #3A2A12; --bad: #FF8A80; --bad-soft: #3D1A18;
    --shadow: 0 1px 2px rgb(0 0 0 / .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141014; --surface: #1D181C; --sunk: #262025; --ink: #F3EDF1; --muted: #A99DA6; --line: #352C33;
  --accent: #E35BA3; --accent-ink: #1A0710; --accent-soft: #3A1A2B; --gold: #E0AE4E;
  --ok: #63C994; --ok-soft: #173326; --warn: #F0B45A; --warn-soft: #3A2A12; --bad: #FF8A80; --bad-soft: #3D1A18;
  --shadow: 0 1px 2px rgb(0 0 0 / .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--f-body);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px));
}
body.authed::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--surface); z-index: 30; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; line-height: 1.15; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
small, .muted { color: var(--muted); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, td.n, .stat b { font-variant-numeric: tabular-nums; }
.boot { padding: 40vh 16px 0; text-align: center; color: var(--muted); }

.wrap { max-width: 760px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* top bar */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font: 700 1.05rem var(--f-display); position: relative; flex: none; }
.mark::after { content: ""; position: absolute; right: -3px; top: -3px; width: 10px; height: 10px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--gold); border: 2px solid var(--surface); }
.brand strong { display: block; font: 700 1.02rem/1.1 var(--f-display); }
.brand small { font-size: .78rem; }

/* tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabs .row { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); }
.tab { border: 0; background: none; padding: 8px 2px 9px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab .dot { position: absolute; top: 5px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--bad); color: #fff; font-size: .65rem; line-height: 16px; }

main { padding-block: 18px 28px; display: flex; flex-direction: column; gap: 22px; }
section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.eyebrow { font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.lede { color: var(--muted); margin: 4px 0 0; }

/* buttons */
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.danger.armed { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: .85rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { border: 0; background: var(--sunk); width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 1.2rem; line-height: 1; display: grid; place-items: center; flex: none; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* chips */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .c { opacity: .65; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; min-width: 0; }
.stat b { display: block; font: 700 1.55rem/1.1 var(--f-display); }
.stat span { font-size: .78rem; color: var(--muted); display: block; }
.stat.hot b { color: var(--bad); }
.stat.good b { color: var(--ok); }
@media (max-width: 520px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* panels & tables */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--sunk); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
td .sub { display: block; font-size: .8rem; color: var(--muted); }
.neg { color: var(--bad); font-weight: 700; }
.pos { color: var(--ok); font-weight: 700; }
.zero { color: var(--muted); }

.alert { border-radius: var(--r); padding: 12px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert p { margin: 0; font-weight: 600; flex: 1; min-width: 180px; }

.empty { padding: 22px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-family: var(--f-display); font-size: 1.05rem; margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.Booked { background: var(--accent-soft); color: var(--accent); }
.pill.Dispatched { background: var(--warn-soft); color: var(--warn); }
.pill.Delivered { background: var(--ok-soft); color: var(--ok); }
.pill.Cancelled { background: var(--sunk); color: var(--muted); }
.pill.Short, .pill.Overdue { background: var(--bad-soft); color: var(--bad); }
.pill.Low { background: var(--warn-soft); color: var(--warn); }
.pill.OK { background: var(--ok-soft); color: var(--ok); }

/* lists / cards */
.list { display: flex; flex-direction: column; gap: 8px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 2px 0; font-weight: 700; font-size: .85rem; color: var(--muted); }
.day-head.today { color: var(--accent); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; text-align: left; width: 100%; }
.card:hover { border-color: var(--muted); }
.card.overdue { border-left: 4px solid var(--bad); }
.card .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card .ono { font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .03em; }
.card .who { font-weight: 700; font-size: 1rem; }
.card .who small { font-weight: 500; }
.card .what { font-size: .88rem; color: var(--muted); }
.card .row3 { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; flex-wrap: wrap; }
.card .due { color: var(--bad); font-weight: 700; }

.stock-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.stock-card .nm { font-weight: 700; font-size: 1rem; min-width: 0; }
.stock-card .nm small { font-weight: 500; display: block; }
.stock-card .big { font: 700 1.7rem/1 var(--f-display); text-align: right; font-variant-numeric: tabular-nums; }
.stock-card .big small { font: 600 .72rem var(--f-body); color: var(--muted); display: block; text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.stock-card .meta { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.stock-card .meta b { color: var(--ink); font-variant-numeric: tabular-nums; }
.stock-card .acts { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.stock-card.inactive { opacity: .6; }

.menu { display: flex; flex-direction: column; }
.menu button { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 14px; text-align: left; cursor: pointer; font-weight: 600; }
.menu button:last-child { border-bottom: 0; }
.menu button small { display: block; font-weight: 400; }
.menu button::after { content: "›"; font-size: 1.3rem; color: var(--muted); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 180px; }

/* forms */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 600; min-width: 0; }
label.f > span small { font-weight: 400; }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=password], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 12px; font-size: 16px; min-height: 44px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; }
@media (max-width: 440px) { .grid2 { grid-template-columns: 1fr; } }
.form-err { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); font-weight: 600; font-size: .9rem; }
.hint { font-size: .82rem; color: var(--muted); margin: 0; }
.fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.fieldset > legend, .fs-title { font-weight: 700; font-size: .85rem; padding: 0 4px; }
.line-row { display: grid; grid-template-columns: 1fr 70px 90px 36px; gap: 6px; align-items: end; }
.line-row .desc { grid-column: 1 / -1; }
.bom-row { display: grid; grid-template-columns: 1fr 90px 36px; gap: 6px; align-items: end; }
.total-bar { display: flex; justify-content: space-between; font-weight: 700; padding: 4px 2px; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.kv a { color: var(--accent); font-weight: 600; text-decoration: none; }
@media (max-width: 480px) { th, td { padding: 9px 8px; } th { font-size: .66rem; letter-spacing: .03em; } }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-back { position: absolute; inset: 0; background: rgb(20 5 15 / .45); }
.sheet { position: relative; background: var(--bg); width: 100%; max-width: 640px; max-height: calc(100% - 24px - env(safe-area-inset-top, 0px)); border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 18px; max-height: 88vh; } }
@keyframes up { from { transform: translateY(24px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
.sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.sheet > header h2 { font-size: 1.15rem; }
.sheet-body { padding: 14px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.sheet > .form-err { margin: 0 16px 8px; }
.sheet > footer { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.sheet > footer .btn { flex: 1; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.auth form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }
.auth .brand { margin-bottom: 8px; }
.auth h1 { font-size: 1.9rem; }
.pin { letter-spacing: .6em; font-size: 1.3rem !important; text-align: center; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.foot-note { font-size: .8rem; color: var(--muted); text-align: center; }

/* v2: stock rows, item sheet, import */
.search { width: 100%; }
.link-row { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; cursor: pointer; color: var(--ink); }
tr.tap { cursor: pointer; }
tr.tap:hover td { background: var(--sunk); }
tr.inactive td { opacity: .55; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-row .stat b { font-size: 1.3rem; }
.stat.hot b { color: var(--bad); }
.upload { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; border: 2px dashed var(--line); border-radius: var(--r); cursor: pointer; text-align: center; color: var(--muted); }
.drop b { color: var(--accent); font-size: 1.05rem; }
.drop:hover { border-color: var(--accent); }
#imp-file { font-size: .9rem; max-width: 100%; }
.card.static { cursor: default; }
.card.static:hover { border-color: var(--line); }
.sticky-actions { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom, 0px)); background: var(--bg); padding-block: 10px; justify-content: flex-end; border-top: 1px solid var(--line); z-index: 5; }
.sticky-actions .btn.primary { flex: 1; max-width: 320px; }
.line-row { grid-template-columns: 1fr 64px 84px 36px; }

/* v3: Hampers & Inventory sub-tabs */
.tab { font-size: .68rem; }
.subtabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); margin-inline: -4px; padding-inline: 4px; }
.subtabs::-webkit-scrollbar { display: none; }
.subtab { flex: none; border: 0; background: none; padding: 10px 12px 9px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.subtab:hover { color: var(--ink); }
.subtab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.subtab .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad-soft); color: var(--bad); font-size: .7rem; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.toolbar .check { white-space: nowrap; }
