/* brew. to go app: same palette and type as the fridge screens */
:root {
  --bg: #17120F;
  --surface: #241C17;
  --raised: #2E241E;
  --line: #3D3029;
  --text: #F6EFE6;
  --muted: #BFB3A6;
  --faint: #8C7F73;
  --accent: #FF8A3D;
  --accent-hi: #FFB07A;
  --on-accent: #17120F;
  --warn: #FFD24A;
  --bad: #FF7A66;
  --good: #9BD67E;
  --paper: #F6EFE6;
  --ink: #2A211C;
  --display: 'Bricolage Grotesque', 'Figtree', system-ui, sans-serif;
  --body: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 26px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent-hi); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---- frame ------------------------------------------------------------ */
.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(16px, env(safe-area-inset-top)) 20px 8px;
}
.mark { font: 800 26px/1 var(--display); letter-spacing: -0.02em; text-decoration: none; color: var(--text); }
.mark i { font-style: normal; color: var(--accent); }
.mark span { font-weight: 600; color: var(--muted); }
.who { color: var(--muted); font-size: 15px; }
main { flex: 1; padding: 8px 20px 120px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px max(10px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1; max-width: 120px; text-align: center; padding: 8px 4px 6px; border-radius: var(--r-s);
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
}
.tabs a svg { display: block; margin: 0 auto 3px; width: 22px; height: 22px; }
.tabs a[aria-current="page"] { color: var(--text); background: var(--surface); }

/* ---- type ------------------------------------------------------------- */
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.025em; margin: 0; }
h1 { font-size: 40px; line-height: 0.98; font-weight: 800; }
h2 { font-size: 26px; line-height: 1.05; font-weight: 750; margin: 28px 0 12px; }
h3 { font-size: 19px; line-height: 1.15; font-weight: 700; }
p { margin: 0 0 12px; }
main > h1:first-child, .subnav + h1 { margin-top: 18px; }
.lede { color: var(--muted); font-size: 18px; margin-top: 10px; max-width: 34ch; }
.quiet { color: var(--muted); }
.small { font-size: 14px; }

/* ---- the cup: today's hold, filling as you spend ----------------------- */
.today { display: grid; grid-template-columns: 112px 1fr; gap: 20px; align-items: center; margin: 12px 0 22px; }
.cup { width: 112px; height: 132px; }
.cup .rim { fill: none; stroke: var(--muted); stroke-width: 4; stroke-linejoin: round; }
.cup .coffee { fill: var(--accent); transition: transform 900ms cubic-bezier(.2,.8,.2,1); transform-box: fill-box; transform-origin: bottom; }
.cup .crema { fill: var(--accent-hi); }
.cup .steam { fill: none; stroke: var(--faint); stroke-width: 3; stroke-linecap: round; }
.spent { font: 800 52px/0.95 var(--display); letter-spacing: -0.035em; }
.spent small { display: block; font: 600 16px/1.3 var(--body); letter-spacing: 0; color: var(--muted); margin-top: 6px; }

/* ---- buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 14px 22px; cursor: pointer;
  font-weight: 700; font-size: 17px; text-decoration: none;
  background: var(--raised); color: var(--text);
}
.btn:hover { background: var(--line); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hi); }
.btn.big { width: 100%; padding: 22px; font-size: 21px; font-family: var(--display); font-weight: 800; letter-spacing: -0.01em; }
.btn.big svg { width: 28px; height: 28px; }
.btn.ghost { background: transparent; color: var(--accent); padding-left: 0; padding-right: 0; }
.btn.danger { color: var(--bad); }
.btn[disabled] { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* ---- forms ------------------------------------------------------------ */
label { display: block; font-weight: 600; margin: 16px 0 6px; }
label .quiet { font-weight: 400; }
input[type=text], input[type=email], input[type=number], input[type=date], input:not([type]), select, textarea {
  width: 100%; padding: 14px 16px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--surface);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
.code-input { font: 800 34px/1 var(--display); letter-spacing: 0.3em; text-align: center; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; color: var(--muted); }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--surface); padding: 5px; border-radius: 999px; }
.seg button { border: 0; border-radius: 999px; padding: 11px 6px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.toggle { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.toggle input { width: 48px; height: 28px; accent-color: var(--accent); }
.error { color: var(--bad); font-weight: 600; margin-top: 10px; }
.note { padding: 14px 16px; border-radius: var(--r-m); background: var(--surface); color: var(--muted); }
.note.warn { color: var(--warn); }

/* ---- lists ------------------------------------------------------------ */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.line { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.line b { font-weight: 700; }
.line > .small:last-child { white-space: nowrap; }
.line .end { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.line .end .btn.ghost { padding: 4px 0 0; font-size: 15px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--raised); color: var(--muted); }
.pill.on { color: var(--good); }
.pill.off, .pill.bad { color: var(--bad); }
.pill.warn { color: var(--warn); }

/* ---- the receipt slip -------------------------------------------------- */
.slip {
  background: var(--paper); color: var(--ink); padding: 20px 20px 26px; border-radius: 4px 4px 0 0;
  position: relative; margin: 16px 0 26px;
  -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - 10px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/20px 10px repeat-x;
          mask: linear-gradient(#000 0 0) top/100% calc(100% - 10px) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom/20px 10px repeat-x;
}
.slip h3 { color: var(--ink); }
.slip .when { color: #7A6A5D; font-size: 14px; }
.slip .items { list-style: none; margin: 12px 0; padding: 12px 0; border-top: 2px dashed #CDBFB1; border-bottom: 2px dashed #CDBFB1; }
.slip .items li { display: flex; justify-content: space-between; padding: 3px 0; }
.slip > .items:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.slip .total { display: flex; justify-content: space-between; font: 800 22px/1.2 var(--display); }
.slip .btn.ghost { color: #B4531A; }

/* ---- visit steps (same bar as the fridge) ------------------------------ */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.steps div { font-weight: 600; color: var(--muted); font-size: 15px; }
.steps div::before { content: ''; display: block; height: 6px; border-radius: 999px; background: var(--line); margin-bottom: 8px; }
.steps .done::before, .steps .now::before { background: var(--accent); }
.steps .now { color: var(--text); font-weight: 800; }

/* ---- scanner ------------------------------------------------------------ */
.scanner { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; }
.scanner .frame {
  position: absolute; left: 50%; top: 42%; width: min(68vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 28px; box-shadow: 0 0 0 100vmax rgba(23, 18, 15, 0.62); border: 3px solid var(--accent);
}
.scanner .bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 20px max(22px, env(safe-area-inset-bottom)); text-align: center; background: var(--bg); }
.scanner .bar p { color: var(--muted); }

/* ---- sheets ------------------------------------------------------------- */
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(10, 7, 5, 0.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 88dvh; overflow: auto; background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0; padding: 24px 20px max(24px, env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: rise 260ms cubic-bezier(.2,.8,.2,1); }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
}

/* ---- owner screens ------------------------------------------------------- */
.subnav { display: flex; gap: 5px; overflow-x: auto; margin: 4px -20px 6px; padding: 0 20px 6px; scrollbar-width: none; }
.subnav a { flex: 1 0 auto; text-align: center; padding: 8px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; }
.subnav a[aria-current="page"] { background: var(--text); color: var(--bg); }
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: var(--r-m); overflow: hidden; margin: 12px 0; }
.figures div { background: var(--surface); padding: 14px 16px; }
.figures b { display: block; font: 800 26px/1.1 var(--display); letter-spacing: -0.02em; }
.figures span { color: var(--muted); font-size: 14px; }
.unit { padding: 16px 0; border-bottom: 1px solid var(--line); }
.grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin: 8px 0 18px;
}
.lane {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 4px 7px; min-height: 64px;
  text-align: center; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 3px;
}
.lane .nm { font-size: 11px; line-height: 1.15; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lane .q { font: 800 18px/1 var(--display); }
.lane .fill { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.lane .fill i { display: block; height: 100%; background: var(--good); }
.lane.low .fill i { background: var(--warn); }
.lane.empty { opacity: 0.55; }
.lane.exp { border-color: var(--bad); }
.shelf-label { font-size: 14px; color: var(--faint); margin-top: 6px; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data td, table.data th { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { color: var(--muted); font-weight: 600; }
table.data .r { text-align: right; }
.copy { display: flex; gap: 8px; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s); padding: 10px 12px; margin: 6px 0; font: 14px/1.4 ui-monospace, Menlo, monospace; word-break: break-all; }
.copy button { flex-shrink: 0; }

@media (min-width: 720px) {
  main { padding-bottom: 140px; }
}
