/* ============================================================
   C Stash — inventory  ·  Raycast-inspired design system
   ============================================================ */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 18px;

  /* Raycast brand */
  --accent: #ff6363;
  --accent-hi: #ff8080;
  --accent-press: #e94f4f;

  --ok: #4bd07f;
  --warn: #f5b544;
  --danger: #ff6363;
}

/* ---- Dark (Raycast default) ---- */
:root[data-theme="dark"] {
  --bg: #151515;
  --bg-2: #0e0e0e;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-hi: rgba(255, 255, 255, 0.14);
  --hairline: rgba(255, 255, 255, 0.06);

  --text: #f5f5f5;
  --text-dim: rgba(255, 255, 255, 0.52);
  --text-faint: rgba(255, 255, 255, 0.34);

  --glass-bg: rgba(30, 30, 32, 0.66);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-hi: rgba(255, 255, 255, 0.06);

  --field-bg: rgba(255, 255, 255, 0.05);
  --row-hover: rgba(255, 255, 255, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 50px -18px rgba(0, 0, 0, 0.55);
  --glow: radial-gradient(680px 380px at 50% -8%, rgba(255, 99, 99, 0.13), transparent 68%);
}

/* ---- Light ---- */
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-2: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #f6f6f7;
  --surface-3: #eeeef0;
  --border: rgba(20, 20, 22, 0.10);
  --border-hi: rgba(20, 20, 22, 0.16);
  --hairline: rgba(20, 20, 22, 0.07);

  --text: #17171a;
  --text-dim: rgba(20, 20, 22, 0.58);
  --text-faint: rgba(20, 20, 22, 0.40);

  --glass-bg: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(20, 20, 22, 0.09);
  --glass-hi: rgba(255, 255, 255, 0.9);

  --field-bg: #ffffff;
  --row-hover: rgba(20, 20, 22, 0.035);
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.06), 0 18px 44px -20px rgba(20, 20, 40, 0.22);
  --glow: radial-gradient(680px 380px at 50% -8%, rgba(255, 99, 99, 0.09), transparent 68%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* Always reserve the scrollbar gutter so switching tabs (long ⇄ short page)
   never shifts the layout sideways. */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-3); border-radius: 7px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); background-clip: content-box; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Ambient background (fixed, painted once) ---- */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--glow);
  pointer-events: none;
  transform: translateZ(0);
}
.blob { display: none; }

/* ---- Glass surface (Raycast command-bar feel) ---- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
}

/* ============================================================
   Layout
   ============================================================ */
.app { display: grid; grid-template-columns: 248px 1fr; gap: 20px; max-width: 1340px; margin: 0 auto; padding: 20px; min-height: 100vh; }
.app[hidden] { display: none; }

.sidebar {
  position: sticky; top: 20px; height: calc(100vh - 40px);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 22px;
  transform: translateZ(0);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 15px; font-weight: 800;
  color: #fff; background: linear-gradient(160deg, var(--accent-hi), var(--accent));
  box-shadow: 0 2px 8px -2px rgba(255, 99, 99, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.brand-text strong { display: block; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.brand-text small { color: var(--text-faint); font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dim);
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item span { font-size: 15px; width: 18px; text-align: center; filter: grayscale(0.15); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--surface-3); color: var(--text); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.hint { font-size: 11px; color: var(--text-faint); line-height: 1.55; padding: 0 4px; }

.content { min-width: 0; display: flex; flex-direction: column; gap: 20px; padding-bottom: 40px; }

/* ---- Page header ---- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.page-head p { color: var(--text-dim); font-size: 13px; margin-top: 3px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   Buttons / fields
   ============================================================ */
.btn {
  font: inherit; font-size: 13px; font-weight: 550;
  padding: 8px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-hi); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: background .14s, border-color .14s, opacity .14s;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { opacity: 0.8; }
.btn-primary {
  background: var(--accent); color: #fff; border-color: transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: var(--accent-hi); }
.btn-primary:active { background: var(--accent-press); opacity: 1; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 32%, var(--border)); background: color-mix(in oklab, var(--danger) 10%, transparent); }
.btn-danger:hover { background: color-mix(in oklab, var(--danger) 16%, transparent); }
.btn-icon { padding: 7px 8px; border-radius: 8px; background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-icon:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.14); color: inherit;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
}
.btn-primary .kbd { background: rgba(255, 255, 255, 0.22); }

label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim); font-weight: 550; }
.field input, .field select, .field textarea {
  font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--field-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; outline: none;
  transition: border-color .14s, box-shadow .14s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent);
}
.field textarea { resize: vertical; min-height: 64px; }
.field select option { color: #111; }

/* ============================================================
   Dashboard
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(184px, 1fr)); gap: 14px; }
.stat { padding: 16px 18px; display: flex; flex-direction: column; gap: 5px; border-radius: var(--radius); }
.stat .label { font-size: 11px; color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 24px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 11.5px; color: var(--text-dim); }
.stat.accent .value { color: var(--accent); }

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; }
.grid-2 > * { min-width: 0; }

.card { padding: 18px 20px; border-radius: var(--radius); }
.card h3 { font-size: 14px; font-weight: 620; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; letter-spacing: -0.01em; }
.card h3 .muted { font-weight: 450; color: var(--text-faint); font-size: 12px; }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 156px 1fr auto; align-items: center; gap: 12px; font-size: 12.5px; }
.bar-row .name { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { display: block; height: 8px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--accent), #ff9a5c); min-width: 4px; }
.bar-row .amt { font-variant-numeric: tabular-nums; font-weight: 550; }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 144px; height: 144px; border-radius: 50%; flex-shrink: 0; position: relative; }
.donut::after { content: ""; position: absolute; inset: 25px; border-radius: 50%; background: var(--bg); }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; z-index: 1; }
.donut-center strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.donut-center small { font-size: 10px; color: var(--text-faint); }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; }
.legend div { display: flex; align-items: center; gap: 8px; color: var(--text-dim); }
.legend i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }

.mini-list { display: flex; flex-direction: column; }
.mini-list .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hairline); font-size: 12.5px; }
.mini-list .row:first-child { border-top: 0; }
.mini-list .row .meta { color: var(--text-faint); font-size: 11.5px; }
.badge { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim); }
.badge.soon { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 30%, var(--border)); background: color-mix(in oklab, var(--warn) 10%, transparent); }
.badge.overdue { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 30%, var(--border)); background: color-mix(in oklab, var(--danger) 10%, transparent); }
.badge.ok { color: var(--ok); }

/* ============================================================
   Inventory
   ============================================================ */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input[type="search"], .toolbar select {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--field-bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; outline: none;
}
.toolbar input[type="search"]:focus, .toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent); }
.toolbar input[type="search"] { min-width: 200px; flex: 1; }
.toolbar .spacer { flex: 1; }

.category { padding: 4px 6px 6px; overflow: hidden; border-radius: var(--radius); }
.cat-head { display: flex; align-items: center; gap: 11px; padding: 12px; cursor: pointer; border-radius: 10px; transition: background .14s; }
.cat-head:hover { background: var(--row-hover); }
.cat-head .chev { color: var(--text-faint); transition: transform .18s; font-size: 11px; }
.category.collapsed .chev { transform: rotate(-90deg); }
.category.collapsed .cat-body { display: none; }
.cat-icon { font-size: 18px; }
.cat-title { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.cat-title .count { color: var(--text-faint); font-weight: 450; font-size: 12px; margin-left: 8px; }
.cat-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.cat-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.cat-actions { display: flex; gap: 2px; }
.cat-body { padding: 2px 4px 6px; }

table.items { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.items th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-faint); font-weight: 600; padding: 7px 10px; }
table.items td { padding: 10px; border-top: 1px solid var(--hairline); vertical-align: top; }
table.items tbody tr:hover { background: var(--row-hover); }
table.items .num { text-align: right; font-variant-numeric: tabular-nums; }
table.items .t-name strong { font-weight: 600; }
table.items .t-name .sub { display: block; color: var(--text-faint); font-size: 11px; margin-top: 2px; }
.pill { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-dim); }
.row-actions { display: flex; gap: 1px; justify-content: flex-end; }
.row-actions .btn-icon { font-size: 11px; opacity: .55; }
.row-actions .btn-icon:hover { opacity: 1; }

.empty { text-align: center; padding: 42px 20px; color: var(--text-faint); }
.empty .big { font-size: 30px; margin-bottom: 8px; }

/* ============================================================
   Modal + toast
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; }
.modal-overlay[hidden] { display: none; }
.modal { width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; border-radius: var(--radius-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--hairline); }
.modal-head h2 { font-size: 15px; font-weight: 620; }
.modal-body { padding: 18px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.modal-body .full { grid-column: 1 / -1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--hairline); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--glass-bg); backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border); border-radius: 10px;
  padding: 10px 16px; font-size: 13px; font-weight: 550; z-index: 60; box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }

/* ============================================================
   Landing / sign-in gate
   ============================================================ */
.landing { position: fixed; inset: 0; z-index: 40; overflow-y: auto;
  display: grid; place-items: center; padding: 48px 22px;
  background: var(--bg); }
.landing[hidden] { display: none; }
.landing::before { content: ""; position: absolute; inset: 0; background: var(--glow); pointer-events: none; }

.landing-inner { position: relative; width: 100%; max-width: 460px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }

.landing-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.landing-brand .brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: 16px; }
.landing-brand strong { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }

.landing-title { font-size: clamp(1.5rem, 4.5vw, 1.95rem); font-weight: 650; line-height: 1.18; letter-spacing: -0.025em; text-wrap: balance; }
.landing-sub { color: var(--text-dim); font-size: 14.5px; max-width: 38ch; }

.cmd {
  width: 100%; margin-top: 10px; text-align: left;
  background: var(--glass-bg); backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border: 1px solid var(--glass-border); border-radius: 16px;
  box-shadow: 0 1px 0 var(--glass-hi) inset, 0 30px 80px -24px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.cmd form { display: flex; flex-direction: column; }
.cmd-field { display: flex; align-items: center; gap: 11px; padding: 14px 16px; }
.cmd-field svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-faint); }
.cmd-field input {
  flex: 1; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 14.5px; color: var(--text);
}
.cmd-field input::placeholder { color: var(--text-faint); }
.cmd-sep { height: 1px; background: var(--hairline); }
.cmd-foot { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-top: 1px solid var(--hairline); background: rgba(0, 0, 0, 0.12); }
.cmd-foot .btn-primary { margin-right: auto; }
.cmd-err { color: var(--danger); font-size: 12px; padding: 0 16px 12px; }
.cmd-err[hidden] { display: none; }

.landing-skip { margin-top: 4px; background: transparent; border: 0; color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; padding: 8px 12px; border-radius: 8px; transition: color .14s, background .14s; }
.landing-skip:hover { color: var(--text); background: var(--surface-2); }
.landing-note { color: var(--text-faint); font-size: 11.5px; max-width: 40ch; line-height: 1.5; }

/* ============================================================
   Scan (phone camera → AI → prefilled form)
   ============================================================ */
.fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 45;
  width: 52px; height: 52px; border-radius: 50%; border: 0;
  display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: #fff;
  box-shadow: 0 10px 26px -8px rgba(255, 99, 99, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform .14s, background .14s;
}
.fab:hover { background: var(--accent-hi); transform: translateY(-1px); }
.fab:active { background: var(--accent-press); }
.fab[hidden] { display: none; }
.fab svg { width: 22px; height: 22px; }

.scan-overlay {
  position: fixed; inset: 0; z-index: 70; display: none;
  place-items: center; align-content: center; gap: 18px;
  background: rgba(10, 10, 10, 0.72); backdrop-filter: blur(6px);
  color: var(--text); font-size: 14px; font-weight: 550;
}
body.scanning .scan-overlay { display: grid; }
.scan-pulse {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(160deg, var(--accent-hi), var(--accent));
  animation: scanpulse 1s ease-in-out infinite;
}
@keyframes scanpulse { 0%, 100% { transform: scale(0.82); opacity: .55; } 50% { transform: scale(1); opacity: 1; } }

/* ============================================================
   Electron desktop (frameless window)
   ============================================================ */
.titlebar { display: none; }
.is-electron .titlebar { display: block; position: fixed; top: 0; left: 0; right: 0; height: 34px; z-index: 100; -webkit-app-region: drag; }
.is-electron .app { padding-top: 40px; }
.is-electron .sidebar { top: 40px; height: calc(100vh - 62px); }
.is-electron .landing { padding-top: 60px; }
.is-electron .page-head { -webkit-app-region: drag; }
.is-electron .page-head button,
.is-electron .page-head a,
.is-electron .page-head input,
.is-electron .page-head select { -webkit-app-region: no-drag; }
.is-electron .cmd, .is-electron .landing-skip { -webkit-app-region: no-drag; }
@media (max-width: 900px) { .is-electron .sidebar { top: 0; height: auto; } }

/* ============================================================
   Bottom tab bar + pull-to-refresh (mobile only)
   ============================================================ */
.tabbar { display: none; }
.ptr { display: none; }

@media (max-width: 900px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 46;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in oklab, var(--bg) 82%, transparent);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid var(--border);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 4px 5px; border: 0; background: transparent; cursor: pointer;
    color: var(--text-faint); font: inherit; font-size: 10.5px; font-weight: 550;
    border-radius: 10px; transition: color .14s;
  }
  .tab svg { width: 21px; height: 21px; }
  .tab.is-active { color: var(--accent); }

  .ptr {
    display: flex; position: fixed; left: 0; right: 0; top: 0; z-index: 30;
    justify-content: center; padding-top: calc(env(safe-area-inset-top) + 4px);
    pointer-events: none; opacity: 0; transform: translateY(-6px);
    transition: opacity .15s, transform .15s;
  }
  body.ptr-armed .ptr { opacity: 1; transform: translateY(4px); }
  body.ptr-loading .ptr { opacity: 1; transform: translateY(4px); }
  .ptr-spin {
    width: 22px; height: 22px; border-radius: 50%;
    border: 2px solid var(--surface-3); border-top-color: var(--accent);
  }
  body.ptr-loading .ptr-spin { animation: ptrspin .7s linear infinite; }
  @keyframes ptrspin { to { transform: rotate(360deg); } }
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  html { overflow-y: auto; }             /* the tab bar covers the gutter; no scroll shift on phones */
  body { overscroll-behavior-y: contain; }

  .app { grid-template-columns: 1fr; padding: 10px; gap: 12px; }
  .app { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }  /* clear the tab bar */

  /* sidebar becomes a slim top bar: brand + theme only, nav moves to the tab bar */
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; gap: 10px;
    padding: calc(env(safe-area-inset-top) + 8px) 12px 8px;
    border-radius: 0; border: 0; border-bottom: 1px solid var(--border);
    background: color-mix(in oklab, var(--bg) 82%, transparent);
    backdrop-filter: blur(20px) saturate(180%);
  }
  .sidebar .nav { display: none; }
  .sidebar-foot {
    display: flex; flex-direction: row; margin-top: 0; margin-left: auto; gap: 8px; align-items: center;
  }
  .sidebar-foot .hint { display: none; }
  #themeToggle { padding: 7px 10px; }

  .content { gap: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .modal-body { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .bar-row { grid-template-columns: 88px 1fr auto; font-size: 12px; }
  .cat-meta { flex-basis: 100%; margin-left: 28px; justify-content: flex-start; }
  table.items { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions .btn { font-size: 12px; padding: 8px 11px; }

  /* Scan FAB sits just above the tab bar */
  .fab {
    width: 56px; height: 56px;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(74px + env(safe-area-inset-bottom));
  }
  .fab svg { width: 24px; height: 24px; }

  .landing { padding: 32px 20px calc(32px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
