/* Casa Shopping — design tokens ported 1:1 from The Nest (homelab-dashboard src/app/globals.css). */
[data-theme="night"] {
  --surface-deep: #141414; --surface: #181818; --surface-raised: #262626;
  --ink-off: #3a3a3a; --ink-dim: #8a8a8a; --ink-faint: #8f8f8f; --ink-muted: #9a9a9a; --ink-soft: #a8a8a8;
  --ink: #bdbdbd; --ink-raised: #c8c8c8; --ink-heading: #d2d2d2; --ink-bright: #d6d6d6; --ink-strong: #dcdcdc;
  --accent: #88c0d0; --crit: #e34671; --crit-ink: #fc6b83; --warn: #f1b467; --warn-ink: #f1b467;
  --icon: #888888; --icon-dim: #7a7a7a;
  --tint: 228, 228, 228; --deep: 20, 20, 20; --blue: 136, 192, 208; --shade: 0, 0, 0; --sk: 1; --hl: 228, 228, 228;
  --card: rgba(255, 255, 255, 0.025);
  color-scheme: dark;
}
[data-theme="day"] {
  --surface-deep: #f2f1ed; --surface: #f7f7f4; --surface-raised: #f2f1ed;
  --ink-off: #cdcdc9; --ink-dim: #74736e; --ink-faint: #6e6d68; --ink-muted: #66655f; --ink-soft: #57564f;
  --ink: #3d3c35; --ink-raised: #33322b; --ink-heading: #26251e; --ink-bright: #26251e; --ink-strong: #26251e;
  --accent: #34785c; --crit: #cf2d56; --crit-ink: #b8264b; --warn: #9a6a24; --warn-ink: #8f6220;
  --icon: #7a7974; --icon-dim: #84847e;
  --tint: 38, 37, 30; --deep: 247, 247, 244; --blue: 52, 120, 92; --shade: 0, 0, 0; --sk: 0.12; --hl: 255, 255, 255;
  --card: #f2f1ed;
  color-scheme: light;
}
:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --panel: inset 0 1px 1px rgba(var(--hl), .12), inset 0 24px 48px rgba(var(--hl), .02), inset 0 0 0 1px rgba(var(--tint), .07);
  --lifted: var(--panel), 0 24px 32px rgba(var(--shade), calc(.6 * var(--sk)));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--surface); color: var(--ink); font: 15px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[data-theme="day"] ::selection { background: #8bc4f8; }
input::placeholder, textarea::placeholder { color: var(--ink-dim); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* shell */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: rgba(var(--deep), .92); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 -1px 0 rgba(var(--tint), .06); min-height: 60px; }
.wordmark { display: flex; align-items: baseline; gap: 5px; font: 600 20px var(--display); letter-spacing: -.01em; color: var(--ink-heading); }
.wordmark span { font-weight: 400; color: var(--ink-muted); }
.top-r { display: flex; align-items: center; gap: 8px; }
.clock { font: 11px var(--mono); color: var(--ink-soft); white-space: nowrap; }
.clock span { margin-left: 5px; color: var(--ink-faint); }
.dtabs { display: none; }
.round { display: inline-flex; align-items: center; justify-content: center; height: 36px; min-width: 36px; padding: 0 10px; border-radius: 999px;
  background: rgba(var(--tint), .06); box-shadow: inset 0 0 0 1px rgba(var(--tint), .12); font: 600 11px var(--mono); letter-spacing: .06em; color: var(--ink); }

/* LiveBadge */
.live { display: inline-flex; align-items: center; gap: 5px; border-radius: 5px; padding: 2px 7px; font: 10px var(--mono);
  letter-spacing: .06em; white-space: nowrap; background: rgba(var(--tint), .07); color: var(--ink-muted); }
.live i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-soft); }
.live.warn { background: rgba(241, 180, 103, .14); color: var(--warn-ink); }
.live.warn i { background: var(--warn); }

/* ThemeSwitch (same SVG as The Nest) */
.tswitch { display: block; line-height: 0; border-radius: 999px; box-shadow: 0 1px 3px rgba(var(--shade), calc(.2 * var(--sk))); }
.tswitch svg { width: 46px; height: 20px; display: block; }
.tswitch .mv { transition: transform .45s cubic-bezier(.6, .05, .25, 1), opacity .35s ease; }
[data-theme="night"] .tswitch .stars { opacity: 1; } [data-theme="day"] .tswitch .stars { opacity: 0; }
[data-theme="night"] .tswitch .daysky { opacity: 0; }
[data-theme="night"] .tswitch .clouds { transform: translateY(18px); }
[data-theme="night"] .tswitch .sun { transform: translateX(68px); opacity: 0; }
[data-theme="day"] .tswitch .moon { transform: translateX(-68px); opacity: 0; }

/* content */
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 10px 150px; }
.title { display: flex; align-items: baseline; gap: 8px; margin: 2px 4px 8px; }
.title h1 { margin: 0; font: 600 22px var(--display); letter-spacing: -.02em; color: var(--ink-heading); }
.count { font: 11px var(--mono); color: var(--ink-muted); }
.caps { font: 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.panel { border-radius: 16px; background: var(--card); box-shadow: var(--panel); margin-bottom: 14px; overflow: hidden; }
.panel.lifted { box-shadow: var(--lifted); }
.phead { display: flex; align-items: center; gap: 8px; padding: 7px 12px 6px; box-shadow: inset 0 -1px 0 rgba(var(--tint), .06); }
.phead .nm { flex: 1; min-width: 0; font: 600 13px var(--display); color: var(--ink-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 500;
  background: rgba(var(--tint), .06); box-shadow: inset 0 0 0 1px rgba(var(--tint), .12); color: var(--ink); text-decoration: none; white-space: nowrap; }
.pill.acc { background: rgba(var(--blue), .16); box-shadow: inset 0 0 0 1px rgba(var(--blue), .35); color: var(--ink-strong); }
.chip { display: inline-flex; align-items: center; border-radius: 5px; padding: 1px 6px; font: 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.chip.low { background: rgba(241, 180, 103, .14); color: var(--warn-ink); }
.chip.out { background: rgba(227, 70, 113, .13); color: var(--crit-ink); }
.chip.ok { background: rgba(var(--tint), .07); color: var(--ink-muted); }

/* rows */
.row { position: relative; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 2px 12px 2px 4px; background: var(--surface);
  background: transparent; touch-action: pan-y; transition: transform .18s ease, opacity .2s ease; }
.row + .row { box-shadow: inset 0 1px 0 rgba(var(--tint), .07); }
.row .body { flex: 1; min-width: 0; padding: 3px 0; text-align: left; }
.row .nm { display: block; font-size: 14px; line-height: 1.25; color: var(--ink-strong); overflow-wrap: anywhere; }
.row .meta { display: flex; gap: 6px; align-items: center; margin-top: 0; font-size: 11px; color: var(--ink-muted); }
.check { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; }
.check span { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.75px var(--ink-faint); display: grid; place-items: center; transition: background .15s; }
.check span svg { opacity: 0; }
.row.done .check span { background: var(--accent); box-shadow: none; }
.row.done .check span svg { opacity: 1; }
.row.done .nm { text-decoration: line-through; color: var(--ink-dim); }
.row.gone { opacity: 0; transform: translateX(40px); }
.swipebg { position: absolute; inset: 0; display: flex; align-items: center; padding-left: 18px; background: rgba(var(--blue), .18); color: var(--ink-strong);
  font: 600 12px var(--mono); letter-spacing: .08em; }
.rowwrap { position: relative; overflow: hidden; }
.rowwrap + .rowwrap { box-shadow: inset 0 1px 0 rgba(var(--tint), .07); }
.rowwrap .row { background: var(--surface); }
.panel .rowwrap .row { background: color-mix(in srgb, var(--surface) 97%, rgb(var(--tint))); }
[data-theme="day"] .panel .rowwrap .row { background: var(--card); }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; margin-left: 10px; background: var(--ink-soft); box-shadow: 0 0 3px rgba(var(--tint), .35); }
.dot.low { background: var(--warn); box-shadow: 0 0 3px rgba(241, 180, 103, .35); }
.dot.out { background: var(--crit); box-shadow: 0 0 3px rgba(227, 70, 113, .35); }
.seg { flex: none; display: inline-flex; padding: 2px; border-radius: 10px; background: rgba(var(--tint), .06); box-shadow: inset 0 0 0 1px rgba(var(--tint), .1); }
.seg button { min-width: 44px; height: 38px; padding: 0 8px; border-radius: 8px; font-size: 12px; font-weight: 500; color: var(--ink-muted); }
.seg button.on { background: rgba(var(--tint), .14); color: var(--ink-strong); }
.seg button.on.low { background: rgba(241, 180, 103, .2); color: var(--warn-ink); }
.seg button.on.out { background: rgba(227, 70, 113, .18); color: var(--crit-ink); }
.seg.wide { display: flex; } .seg.wide button { flex: 1; }

.search { width: 100%; height: 44px; border: 0; outline: 0; border-radius: 12px; padding: 0 14px; background: rgba(var(--tint), .06);
  box-shadow: inset 0 0 0 1px rgba(var(--tint), .1); font-size: 16px; }
.search:focus { box-shadow: inset 0 0 0 1.5px rgba(var(--blue), .6); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 2px 12px; scrollbar-width: none; }
.chips button { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px; background: rgba(var(--tint), .05);
  box-shadow: inset 0 0 0 1px rgba(var(--tint), .1); color: var(--ink-soft); }
.chips button.on { background: rgba(var(--tint), .14); color: var(--ink-strong); }
.sect { margin: 16px 6px 8px; display: flex; justify-content: space-between; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-muted); }
.empty b { display: block; font: 600 18px var(--display); color: var(--ink-heading); margin-bottom: 4px; }

/* quick add */
.quick { position: fixed; z-index: 15; left: 0; right: 0; bottom: calc(76px + env(safe-area-inset-bottom)); padding: 8px 12px; }
.quick .in { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; padding: 8px; border-radius: 18px; background: rgba(var(--deep), .97);
  box-shadow: var(--lifted); }
.quick input { flex: 1; min-width: 0; height: 44px; border: 0; outline: 0; background: transparent; padding: 0 8px; font-size: 16px; }
.storebtn { flex: none; max-width: 30%; height: 44px; padding: 0 12px; border-radius: 12px; background: rgba(var(--tint), .07);
  box-shadow: inset 0 0 0 1px rgba(var(--tint), .12); font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storebtn.set { color: var(--ink-strong); background: rgba(var(--blue), .14); box-shadow: inset 0 0 0 1px rgba(var(--blue), .35); }
.addbtn { flex: none; width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: var(--surface-deep); display: grid; place-items: center; }
.addbtn:disabled { opacity: .4; }
.sugg { max-width: 760px; margin: 0 auto 6px; border-radius: 14px; overflow: hidden; background: rgba(var(--deep), .98); box-shadow: var(--lifted); }
.sugg button { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: center; min-height: 46px; padding: 0 14px; text-align: left; }
.sugg button + button { box-shadow: inset 0 1px 0 rgba(var(--tint), .07); }
.sugg small { color: var(--ink-muted); font-size: 12px; }

/* tab bar (iOS style, as The Nest phone shell) */
.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px max(22px, env(safe-area-inset-bottom));
  background: rgba(var(--deep), .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: inset 0 1px 0 rgba(var(--tint), .1); }
.tabbar button { position: relative; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-faint); }
.tabbar button .ic { width: 44px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 999px; }
.tabbar button.on { color: var(--ink-strong); }
.tabbar button.on .ic { background: rgba(var(--tint), .1); }
.tabbar button small { font-size: 10px; font-weight: 500; }
.badge { position: absolute; top: 2px; left: calc(50% + 8px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #cf2d56;
  color: #fff; font: 10px/16px var(--mono); text-align: center; }

/* sheets */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .2s; }
.scrim.on { opacity: 1; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 88dvh; display: flex; flex-direction: column; border-radius: 20px 20px 0 0;
  background: var(--surface-raised); box-shadow: var(--lifted); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  padding-bottom: env(safe-area-inset-bottom); }
[data-theme="day"] .sheet { background: var(--surface); }
.sheet.on { transform: none; }
.grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(var(--tint), .2); margin: 8px auto 2px; }
.shead { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 10px; }
.shead h2 { margin: 0; font: 600 18px var(--display); color: var(--ink-heading); }
.sbody { overflow-y: auto; padding: 0 16px 18px; -webkit-overflow-scrolling: touch; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; margin: 0 2px 5px; }
.field input, .field textarea, .field select { width: 100%; min-height: 46px; border: 0; outline: 0; border-radius: 12px; padding: 11px 14px;
  background: rgba(var(--tint), .06); box-shadow: inset 0 0 0 1px rgba(var(--tint), .1); font-size: 16px; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field textarea:focus { box-shadow: inset 0 0 0 1.5px rgba(var(--blue), .6); }
.field .storebtn { max-width: none; width: 100%; text-align: left; height: 46px; }
.btns { display: flex; gap: 10px; margin-top: 16px; }
.btn { flex: 1; height: 48px; border-radius: 12px; font-weight: 600; background: rgba(var(--tint), .08); box-shadow: inset 0 0 0 1px rgba(var(--tint), .12); }
.btn.pri { background: var(--accent); color: var(--surface-deep); box-shadow: none; }
.btn.danger { color: var(--crit-ink); flex: 0 0 auto; padding: 0 18px; }
.list { border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: inset 0 0 0 1px rgba(var(--tint), .07); }
.opt { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 50px; padding: 0 14px; text-align: left; }
.opt + .opt { box-shadow: inset 0 1px 0 rgba(var(--tint), .07); }
.opt .nm { flex: 1; }
.opt small { color: var(--ink-muted); font: 11px var(--mono); }
.opt.on { color: var(--ink-strong); background: rgba(var(--blue), .12); }
.opt.new { color: var(--accent); font-weight: 600; }
.opt input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--accent); }

/* recipes / history / more */
.rbody { padding: 10px 14px 14px; }
.rbody ul { margin: 6px 0 10px; padding-left: 18px; }
.rbody li { margin: 3px 0; }
.rsteps { white-space: pre-line; color: var(--ink-soft); font-size: 14px; }
details summary { cursor: pointer; padding: 6px 0; list-style: none; }
details summary::-webkit-details-marker { display: none; }
.hrow { display: flex; gap: 8px; align-items: center; min-height: 36px; padding: 4px 12px; font-size: 13px; }
.hrow + .hrow { box-shadow: inset 0 1px 0 rgba(var(--tint), .07); }
.hrow .chip { min-width: 68px; justify-content: center; }
.hrow .nm { flex: 1; min-width: 0; color: var(--ink-strong); }
.hrow .t { font: 11px var(--mono); color: var(--ink-muted); white-space: nowrap; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; min-height: 56px; }
.mrow + .mrow { box-shadow: inset 0 1px 0 rgba(var(--tint), .07); }
a.tel { color: var(--accent); font: 13px var(--mono); }

.toast { position: fixed; z-index: 60; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0;
  pointer-events: none; display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px); padding: 10px 10px 10px 16px; border-radius: 14px;
  background: var(--ink-strong); color: var(--surface); font-size: 14px; transition: .2s; box-shadow: 0 10px 30px rgba(0, 0, 0, calc(.5 * var(--sk) + .1)); }
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { padding: 6px 12px; border-radius: 8px; background: rgba(127, 127, 127, .25); font-weight: 600; }
.toast.err { background: var(--crit); color: #fff; }

/* desktop */
@media (min-width: 900px) {
  .tabbar { display: none; }
  .dtabs { display: flex; gap: 2px; margin-left: 24px; }
  .dtabs button { position: relative; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--ink-faint); }
  .dtabs button.on { background: rgba(var(--tint), .1); color: var(--ink-strong); }
  .dtabs .badge { position: static; display: inline-block; margin-left: 6px; }
  .top-l { display: flex; align-items: center; }
  .top { padding-left: 28px; padding-right: 28px; }
  .tswitch svg { width: 52px; height: 22px; }
  main { padding-top: 22px; padding-bottom: 60px; }
  .quick { position: sticky; top: 60px; bottom: auto; padding: 0 0 14px; max-width: 760px; margin: 0 auto; width: 100%; }
  .quick .in { box-shadow: var(--panel); background: var(--card); }
  .toast { bottom: 32px; }
  .sheet { left: 50%; right: auto; bottom: 50%; width: 520px; border-radius: 20px; transform: translate(-50%, 60%); opacity: 0; transition: .22s; }
  .sheet.on { transform: translate(-50%, 50%); opacity: 1; }
  .grab { display: none; }
  .row:hover, .opt:hover { background-color: rgba(var(--tint), .04); }
}
.panel { margin-bottom: 8px; }

@media (max-width: 420px) { .quick .storebtn { padding: 0 9px; font-size: 12px; } }
