/* OmbraHQ 2.0 — Midnight & gold on pure black (Oct 21 decision): gold is the
   brand and the primary action; green only means "good number"; amber "look at
   this"; red "wrong". Phone first. */
:root {
  color-scheme: dark;
  --bg: #000; --card: #0c0c0d; --card2: #161617; --line: rgba(255,255,255,.11); --line2: rgba(255,255,255,.07);
  --text: #f3eee2; --dim: #9c968a; --muted: #6f6a60;
  --gold: #d8b45a; --gold2: #eccf7d; --gold-soft: rgba(216,180,90,.15);
  --good: #35d07f; --good-soft: rgba(53,208,127,.13);
  --warn: #e8b34b; --warn-soft: rgba(232,179,75,.14);
  --bad: #e07a6a; --bad-soft: rgba(224,122,106,.14);
  --display: 'Manrope', 'Avenir Next', 'Segoe UI', sans-serif;
  --body: 'IBM Plex Sans', 'Avenir', 'Segoe UI', sans-serif;
  --r: 18px; --safe-b: env(safe-area-inset-bottom, 0px);
}
/* Light theme — warm paper, the same gold, every color re-based on the
   variables above. Chosen in More → Appearance; the default follows the
   device. The boot script in index.html resolves the choice into
   data-theme on <html> before first paint; app.js keeps it live. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f1e8; --card: #fffdf7; --card2: #ece7d8; --line: rgba(74,62,25,.18); --line2: rgba(74,62,25,.10);
  --text: #221d12; --dim: #655d4b; --muted: #6f6752;
  --gold: #7a5f16; --gold2: #6b5412; --gold-soft: rgba(122,95,22,.13);
  --good: #157347; --good-soft: rgba(21,115,71,.11);
  --warn: #8a5f0a; --warn-soft: rgba(138,95,10,.12);
  --bad: #b23a2c; --bad-soft: rgba(178,58,44,.11);
}
/* On the deeper light-theme gold, gold buttons take cream text (the dark
   theme's near-black text would drop under contrast on it). */
:root[data-theme="light"] .btn.gold, :root[data-theme="light"] .tabbar .badge { color: #fff8e6; }
:root[data-theme="light"] .tabbar { background: rgba(245,241,232,.93); }
:root[data-theme="light"] table.dtable tbody tr:hover td { background: rgba(74,62,25,.045); }
:root[data-theme="light"] .updatebar { box-shadow: 0 8px 24px rgba(74,62,25,.22); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
/* Every bare field is a dark field with light text — a plain <input> in a
   sheet or card must never render as a white box with washed-out text.
   Element selectors on purpose: class rules (.field input, .lines input…)
   still win where a screen styles its own fields. */
input, select, textarea { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
button { cursor: pointer; }
a { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; font-family: var(--display); }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
/* Skeleton paint (A5): heavy screens draw their frame at once, then fill in. */
.skel { border-radius: 10px; background: var(--line); opacity: .55; animation: pulse 1.4s ease-in-out infinite; }
.skel.h { height: 26px; width: 46%; margin: 4px 0 14px; }
.skel.tile { height: 92px; }
.skel.row { height: 54px; margin-bottom: 8px; }
.skel.w60 { width: 60%; } .skel.w80 { width: 80%; }

/* Shell */
.wrap { max-width: 560px; margin: 0 auto; padding: 14px 16px calc(96px + var(--safe-b)); }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.top .logo { width: 30px; height: 30px; flex: 0 0 auto; }
.locpick { appearance: none; background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239c968a' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 36px 9px 16px; font-weight: 500; max-width: 60vw; }
.top .sp { flex: 1; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); border: 1px solid rgba(216,180,90,.35); font-family: var(--display); font-weight: 800; display: grid; place-items: center; }
/* The header "?": opens the current screen's "How this works" text. */
.helpbtn { width: 34px; height: 34px; border-radius: 50%; background: var(--card); color: var(--gold); border: 1px solid var(--line); font-family: var(--display); font-weight: 800; font-size: 16px; flex: 0 0 auto; display: grid; place-items: center; padding: 0; }
.envtag { font-size: 11px; color: var(--warn); border: 1px solid rgba(232,179,75,.4); border-radius: 999px; padding: 2px 8px; }
.sub { color: var(--dim); font-size: 14px; display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 12px; }
h1 { font-family: var(--display); font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 12px; }
h2 { font-family: var(--display); font-size: 17px; font-weight: 700; margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 12px; }
.card.tight { padding: 0; overflow: hidden; }
.label { color: var(--dim); font-size: 14px; }
.big { font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 6px; }
.delta { font-size: 14px; color: var(--dim); }
.up { color: var(--good); } .down { color: var(--bad); } .flat { color: var(--dim); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tiles.two { grid-template-columns: repeat(2, 1fr); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 13px 12px; min-width: 0; }
.tile .v { font-size: 22px; font-weight: 800; margin: 3px 0 2px; letter-spacing: -.02em; }
.tile .h { font-size: 12.5px; color: var(--dim); }
.ok { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }

.rows > * { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-top: 1px solid var(--line2); }
.rows > *:first-child { border-top: 0; }
.rowbtn { width: 100%; background: none; border: 0; text-align: left; }
.rowbtn:active { background: var(--card2); }
.rows .main { flex: 1; min-width: 0; }
.rows .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .s { color: var(--dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .r { text-align: right; flex: 0 0 auto; }
/* Order rows (A2): the item takes the full width and the quantity box sits on
   its OWN line underneath — nothing is ever cut with an ellipsis. */
.rows .orow { display: block; }
.orow .main { display: block; }
.orow .t, .orow .s { overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.orow .qty { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.orow .qty input { width: 110px; }
.chev { color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.dot.gold { background: var(--gold); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.good { background: var(--good); }
.cardhead { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 10px; }
.cardhead small { color: var(--dim); }
.empty { color: var(--dim); padding: 18px; text-align: center; }
.src { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--dim); white-space: nowrap; }
.pill.gold { color: var(--gold); border-color: rgba(216,180,90,.4); background: var(--gold-soft); }
.pill.warn { color: var(--warn); border-color: rgba(232,179,75,.4); background: var(--warn-soft); }
.pill.bad { color: var(--bad); border-color: rgba(224,122,106,.4); background: var(--bad-soft); }
.pill.good { color: var(--good); border-color: rgba(53,208,127,.35); background: var(--good-soft); }

.btn { border: 1px solid var(--line); background: var(--card2); border-radius: 12px; padding: 10px 16px; font-weight: 600; }
.btn.gold { background: var(--gold); color: #1a1407; border-color: var(--gold); font-family: var(--display); font-weight: 800; }
.btn.ghost { background: none; }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: default; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.seg button { flex: 1; background: none; border: 0; border-radius: 10px; padding: 9px 6px; color: var(--dim); font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--card2); color: var(--text); }
/* Costs tab bar (the seg whose buttons carry data-c): 8 tabs don't fit a phone,
   so the bar scrolls horizontally inside itself; buttons keep their full label. */
.seg:has(> button[data-c]) { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg:has(> button[data-c])::-webkit-scrollbar { display: none; }
.seg:has(> button[data-c]) button { flex: 0 0 auto; white-space: nowrap; }
.headrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.headrow .sp { flex: 1; }
.weekpick { display: flex; align-items: center; gap: 6px; }
.weekpick button { background: var(--card); border: 1px solid var(--line); border-radius: 10px; width: 34px; height: 34px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: right; color: var(--dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 12px 10px 8px; white-space: nowrap; }
table.grid th:first-child, table.grid td:first-child { text-align: left; }
table.grid td { text-align: right; padding: 11px 10px; border-top: 1px solid var(--line2); }
table.grid td:first-child { white-space: normal; }
.card.tight { overflow-x: auto; }
table.grid tr.total td { font-weight: 700; }

.field { display: block; margin-bottom: 12px; }
.field span { display: block; color: var(--dim); font-size: 13px; margin-bottom: 5px; }
.field input, .field select, textarea { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; }
.lines input { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; width: 100%; }
.lines td { padding: 6px 4px; vertical-align: top; }
.lines .issue { color: var(--warn); font-size: 12px; }

.math { background: var(--card2); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--dim); margin-top: 10px; }
.note { border: 1px solid rgba(216,180,90,.3); background: var(--gold-soft); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; font-size: 14px; }
.note.warn { border-color: rgba(232,179,75,.35); background: var(--warn-soft); }
/* "How this works": the short explainer for every main screen — what it
   shows, how the number is worked out, what to do with it. Rendered inside
   the help sheet/panel opened by the header "?" (see HELP in app.js). */
.helpbox { border: 1px solid rgba(216,180,90,.3); background: var(--gold-soft); border-radius: 14px; padding: 11px 14px; margin-bottom: 12px; font-size: 13.5px; line-height: 1.5; }
.helpbox .helphead { font-family: var(--display); font-weight: 800; font-size: 13px; color: var(--gold); margin-bottom: 3px; }
.helpbox b { color: var(--gold2); font-weight: 700; }
.err { color: var(--bad); font-size: 14px; margin: 8px 0; }
.vendnew { color: var(--bad); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px; z-index: 50; max-width: 90vw; }

/* Bottom bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); display: flex; justify-content: center; z-index: 20; }
.tabbar nav { display: flex; width: 100%; max-width: 560px; }
.tabbar button { flex: 1; background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; color: var(--dim); font-size: 11.5px; }
.tabbar button svg { width: 24px; height: 24px; }
.tabbar button.on { color: var(--gold); }
.tabbar .badge { position: absolute; margin-left: 18px; margin-top: -4px; background: var(--gold); color: #1a1407; font-size: 10px; font-weight: 800; border-radius: 999px; padding: 0 5px; }
.tabbar button { position: relative; }

/* Sign in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin form { width: 100%; max-width: 380px; }
.signin .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.signin .brand b { font-family: var(--display); font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.signin .btn { width: 100%; padding: 13px; margin-top: 4px; }
.linkbtn { background: none; border: 0; color: var(--gold); padding: 8px 0; }

/* Sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet > div { background: var(--card); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 18px 16px calc(20px + var(--safe-b)); }
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: -6px auto 12px; }
@media (min-width: 700px) { .big { font-size: 54px; } }
/* Panel overlays (help, intro): a sheet on the phone; on desktop the same
   overlay becomes a centered panel with rounded corners all round. */
@media (min-width: 700px) {
  .sheet.panel { align-items: center; padding: 24px; }
  .sheet.panel > div { border-bottom: 1px solid var(--line); border-radius: 22px; max-width: 520px; max-height: 86vh; }
}

/* Month-end count */
.cnt-month { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0 0 12px; }
.cnt-month b { font-family: var(--display); font-size: 17px; min-width: 150px; text-align: center; }
.cnt-gl { color: var(--dim); font-size: 12.5px; padding: 0 18px 8px; margin-top: -6px; }
.cnt-row { padding: 10px 14px 10px 18px !important; }
.cnt-in { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.cnt-in input { width: 84px; text-align: right; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px; font-family: var(--display); font-weight: 700; font-size: 16px; }
.cnt-in input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.cnt-in small { color: var(--dim); font-size: 12px; width: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cnt-search { width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; margin: 0 0 12px; }
.linkbtn.sm { font-size: 13px; padding: 0; }
.catpick { margin-top: 6px; width: 100%; background: var(--card); border: 1px solid var(--line2); border-radius: 8px; padding: 6px 8px; color: var(--dim); font-size: 13px; }
.learned { color: var(--good); font-size: 11.5px; margin-top: 4px; }
.bar { height: 5px; background: var(--line2); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.orig { margin: 10px 0; }
.orig img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.orig iframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 12px; margin-top: 8px; background: #fff; }
.spark { color: var(--dim); } .spark.warn { color: var(--warn); } .spark.ok { color: var(--good); }

.snapstep { margin: 16px 0 8px; font-weight: 600; }
.snapstep b { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--gold, #d6b25a); color: #111; align-items: center; justify-content: center; font-size: 13px; margin-right: 8px; }
.snapstep .muted { font-weight: 400; font-size: 13px; }
.snappages { display: grid; gap: 8px; margin-bottom: 10px; }
.snappage { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 13px; }
.snappage span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field input[type=date] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; box-sizing: border-box; min-height: 44px; }
/* Live stock */
.rangebar { position: relative; height: 6px; border-radius: 3px; background: var(--card2); margin: 8px 0 2px; }
.rangebar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: var(--gold-soft); border: 1px solid rgba(216,180,90,.45); }
.rangebar b { position: absolute; top: -3px; width: 3px; height: 12px; margin-left: -1.5px; border-radius: 2px; background: var(--gold); }
.cnt-today { padding: 12px 18px; border-top: 1px solid var(--line); }
.cnt-today .t { font-weight: 600; } .cnt-today .s { color: var(--dim); font-size: 13px; margin-top: 2px; }
.cnt-today .cnt-in { display: flex; gap: 8px; margin-top: 10px; }
.cnt-today .cnt-in input { flex: 1; min-width: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: inherit; font-size: 16px; }
.cnt-today .cnt-in select { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; color: inherit; }
.locpick.wide { width: 100%; margin: 6px 0; }
.compline { display: grid; grid-template-columns: 56px 88px 1fr 58px; gap: 6px; margin: 6px 0; }
.compline .locpick { min-width: 0; width: 100%; }
.r.num.bad { color: var(--bad); }
.inp { width: 100%; min-width: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: inherit; font-size: 16px; margin: 6px 0; }
.sheet .label { display: block; margin: 12px 0 2px; }
.compline .inp { margin: 0; padding: 10px 8px; }

/* Snap an invoice: shop chips, page thumbnails, one button */
.snaplbl { margin: 14px 0 8px; font-weight: 600; font-size: 14px; color: var(--dim, #9c968a); }
.snapshops { display: flex; flex-wrap: wrap; gap: 8px; }
.snapshops .chip { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line); background: var(--card2); color: inherit; font: inherit; font-weight: 600; }
.snapshops .chip.on { background: var(--gold, #d6b25a); color: #111; border-color: transparent; }
.snapgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.snapthumb, .snapadd { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--card2); }
.snapthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.snapthumb .pdf { display: flex; height: 100%; align-items: center; justify-content: center; font-weight: 700; }
.snapthumb i { position: absolute; left: 6px; bottom: 6px; font-style: normal; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.65); color: #fff; border-radius: 10px; padding: 1px 7px; }
.snapthumb button { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 20px; line-height: 1; }
.snapadd { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border-style: dashed; color: var(--gold, #d6b25a); font: inherit; font-weight: 600; }
.snapadd svg { width: 28px; height: 28px; }
.linkbtn { background: none; border: 0; color: var(--dim, #9c968a); text-decoration: underline; font: inherit; font-size: 14px; padding: 10px 0; }
.snapgo { width: 100%; min-height: 50px; margin-top: 6px; }
.snapnote { text-align: center; font-size: 13px; margin: 8px 0 0; }

/* New version ready */
.updatebar { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; border-radius: 14px; background: var(--card2); border: 1px solid rgba(216,180,90,.45); box-shadow: 0 8px 24px rgba(0,0,0,.5); font-weight: 600; }
/* Recipe review progress (Costs → Menu → Review recipes). */
.gs-progress { height: 6px; border-radius: 3px; background: var(--line, #e5e0d8); overflow: hidden; }
.gs-progress i { display: block; height: 100%; background: #ff8a1f; border-radius: 3px; }

/* Never stuck: a close button on every sheet, a Back bar on sub-screens */
.sheet [role="dialog"] { position: relative; }
.sheetx { position: absolute; top: 10px; right: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--card2); color: inherit; font-size: 16px; z-index: 2; }
.backbar { display: block; background: none; border: 0; color: var(--gold, #d8b45a); font: inherit; font-weight: 600; font-size: 16px; padding: 4px 0 10px; }
/* redesign: shop chips on Today, folding supplier items on Inventory items */
.shopchips{display:flex;gap:8px;overflow-x:auto;margin:10px 0 4px;padding-bottom:2px}
.shopchip{flex:1 0 auto;min-width:92px;display:flex;flex-direction:column;align-items:flex-start;gap:1px;padding:8px 12px;border:1px solid var(--line);border-radius:12px;background:transparent;color:inherit;font:inherit;cursor:pointer;text-align:left}
.shopchip span{font-size:12px;opacity:.75}.shopchip b{font-size:17px}.shopchip small{font-size:11.5px;opacity:.8}
.subtoggle{display:block;background:none;border:0;color:var(--gold,#d8b45a);font:inherit;font-size:13px;padding:0 18px 10px;cursor:pointer}
.subitems{border-left:2px solid var(--line);margin:0 0 8px 18px}
[hidden]{display:none!important}
.rows > .ingrow{display:block;padding:0}
.ingrow > .rowbtn{display:flex;align-items:center;gap:12px;padding:15px 18px}
.subitems > .rowbtn{display:flex;align-items:center;gap:12px;padding:10px 18px}
.shopchip{flex:1 1 0;min-width:0}

/* ---- Desktop-first shell (v431 job) ---------------------------------------
   ≥1024px: full sidebar + wide content (max 1440px) + right-side panels.
   700–1023px: icon rail. <700px: phone (bottom quick tabs, no sidebar). */
.side { display: none; }
@media (min-width: 700px) {
  .shell { display: grid; grid-template-columns: 76px minmax(0, 1fr); min-height: 100vh; }
  .side { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 16px 10px; background: var(--card); border-right: 1px solid var(--line); z-index: 15; }
  .side .lbl, .side .sidegroup, .side .sidesearch, .side .sidepick, .side .sidefoot { display: none; }
  .sidebrand { display: flex; align-items: center; gap: 8px; }
  .sidebrand .logo { width: 30px; height: 30px; }
  .sidebrand .sp { flex: 1; }
  .sidecollapse { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; width: 30px; height: 30px; color: var(--dim); flex: 0 0 auto; }
  .sidenavwrap { display: flex; flex-direction: column; gap: 2px; }
  .sidenav { display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 10px; padding: 9px 10px; color: var(--dim); font-size: 14px; font-weight: 500; text-align: left; width: 100%; }
  .sidenav svg { width: 21px; height: 21px; flex: 0 0 auto; }
  .sidenav:hover { background: var(--card2); color: var(--text); }
  .sidenav.on { background: var(--gold-soft); color: var(--gold); }
  .main .wrap { max-width: 1440px; padding-bottom: 40px; }
  .main .top .logo { display: none; }
  .tabbar { display: none; }
  .toast { bottom: 24px; }
}
@media (min-width: 1024px) {
  .shell { grid-template-columns: 264px minmax(0, 1fr); }
  .shell.sidemin { grid-template-columns: 76px minmax(0, 1fr); }
  .side { padding: 18px 14px; }
  .side .lbl { display: inline; }
  .side .sidegroup { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 6px 4px; }
  .side .sidegroup:empty { display: none; }
  .side .sidesearch { display: block; width: 100%; padding: 8px 12px; font-size: 13.5px; }
  .side .sidepick { display: block; width: 100%; max-width: none; }
  .side .sidefoot { display: flex; align-items: center; gap: 8px; margin-top: auto; padding: 8px 6px 0; }
  .shell.sidemin .side .lbl, .shell.sidemin .side .sidegroup, .shell.sidemin .side .sidesearch, .shell.sidemin .side .sidepick, .shell.sidemin .side .sidefoot { display: none; }
  .shell.sidemin .sidenav { justify-content: center; }
  /* Details open in a right-side panel on desktop (Esc / ✕ / browser Back close). */
  .sheet { align-items: stretch; justify-content: flex-end; }
  .sheet > div { width: min(620px, 52vw); max-width: none; max-height: none; height: 100%; border-radius: 0; border-top: 0; border-bottom: 0; border-right: 0; animation: panelin .18s ease-out; }
  .sheet.panel { align-items: center; justify-content: center; padding: 24px; }
  .sheet.panel > div { width: 100%; height: auto; max-height: 86vh; border-radius: 22px; border: 1px solid var(--line); animation: none; }
  .sheet .grab { display: none; }
  @keyframes panelin { from { transform: translateX(40px); opacity: .4; } to { transform: none; opacity: 1; } }
}
/* Filter bar + data tables (desktop-first screens) */
.fbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.fbar input[type="search"] { flex: 1 1 200px; }
.fbar .sp { flex: 1; }
.twrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); margin-bottom: 12px; }
table.dtable { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 14px; }
table.dtable th { position: sticky; top: 0; background: var(--card2); text-align: left; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); padding: 10px 12px; white-space: nowrap; z-index: 1; }
table.dtable th.sortable { cursor: pointer; }
table.dtable td { padding: 9px 12px; border-top: 1px solid var(--line2); white-space: nowrap; }
/* ONE CHAIN Phase 5: Usage trends — the item-name column stays fixed
   when the week columns scroll sideways. */
table.dtable.stickyfirst th:first-child, table.dtable.stickyfirst td:first-child { position: sticky; left: 0; background: var(--card); z-index: 2; box-shadow: 1px 0 0 var(--line); max-width: 220px; white-space: normal; }
table.dtable tr.sel td { background: var(--gold-soft); }
table.dtable tbody tr:hover td { background: rgba(255,255,255,.03); }
table.dtable td.num, table.dtable th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.dtable .cellinput { width: 100%; min-width: 90px; padding: 6px 8px; }
.bulkbar { display: none; align-items: center; gap: 8px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin-bottom: 12px; flex-wrap: wrap; }
.bulkbar.show { display: flex; }
.tick { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--card2); font-weight: 800; }
.tick.on { background: var(--gold-soft); color: var(--gold); border-color: rgba(216,180,90,.5); }
.tick.no { color: var(--muted); }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal .dow { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 0 4px; }
.cal .day { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 108px; }
.cal .day.off { opacity: .38; }
.cal .day .dn { font-family: var(--display); font-weight: 800; font-size: 15px; }
.cal .day .dt { font-size: 16px; font-weight: 800; margin: 2px 0 6px; }
.cal .day .si { font-size: 12px; color: var(--dim); display: flex; justify-content: space-between; gap: 6px; padding: 2px 0; border-top: 1px solid var(--line2); }
@media (max-width: 699px) { .cal { grid-template-columns: 1fr; } .cal .day { min-height: 0; } .cal .dow { display: none; } }
.edited-note { font-size: 12px; color: var(--muted); }
/* FU11 Cost per item: list left, recipe right on desktop; the pane hides on
   phones, where the same detail opens as a sheet. */
.ciwrap { display: block; }
.cipane { display: none; }
@media (min-width: 900px) { .ciwrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 10px; align-items: start; } .cipane { display: block; position: sticky; top: 10px; } }
