/* nook — see design.md: warm paper pages, white cards, #222 ink, one claret accent (#8c2a44) for the
   main actions and the mic orb; the system serif for headings, the system sans for everything else;
   soft radii, modest weights, one soft shadow tier. Every size, radius and colour comes from the
   tokens below. */

:root {
  --primary: #8c2a44; /* claret */
  --primary-active: #6e1f35;
  --primary-disabled: #e8c8d0;
  --error: #c13515;
  --ink: #222222;
  /* one warm family for all secondary text (body, muted, the italic accents) */
  --body: #3d3530;
  --muted: #6f6052;
  --muted-soft: #9a8c7f;
  --hairline: #e2d9cf; /* lines and edges in the warm family */
  --hairline-soft: #eee7df;
  --border-strong: #c8bcaf;
  --canvas: #ffffff;
  --surface-soft: #f8f4ef;
  --surface-strong: #f1ebe4;
  /* nook's warm paper (the icon's background): the pages sit on it, cards and overlays stay white */
  --page: #f7f2ec;
  --page-deep: #efe6dc;
  --page-line: #e6dccf;
  --count: #cfc3b6; /* the bottle count on cellar cards */
  --tagline: #9a8a7a; /* label caps under the wordmark */
  --serif: ui-serif, "New York", "Iowan Old Style", Palatino, Georgia, serif;
  --shadow: rgba(0, 0, 0, .02) 0 0 0 1px, rgba(0, 0, 0, .04) 0 2px 6px 0, rgba(0, 0, 0, .1) 0 4px 8px 0;

  /* wine styles: data colors for the thin bottle strip, not UI accents */
  --red: #8e2236;
  --white: #d9c46a;
  --rose: #e6a3b0;
  --sparkling: #e2d49e;
  --sparkling_rose: #efbcc6;
  --sweet: #d9a046;
  --fortified: #6e2a22;
  --orange: #d6873f;

  --r-tile: 3px; /* the little data squares and strips (vintages, styles) */
  --r-xs: 4px; --r-sm: 8px; --r-md: 14px; --r-lg: 20px; --r-xl: 32px; --r-full: 9999px;

  /* the type scale: every font size in the app is one of these */
  --fs-label: 11px;   /* label caps, tab names, tiny badges */
  --fs-caption: 13px; /* captions, hints, secondary details */
  --fs-small: 14px;   /* secondary text */
  --fs-body: 16px;    /* body, inputs (never below 16, or iOS zooms in) */
  --fs-lead: 18px;    /* sub-headings, the bottle count, dish names */
  --fs-title: 22px;   /* page and section titles */
  --fs-hero: 30px;    /* the wine's name, the greeting */
  --fs-display: 38px; /* the wordmark, big numbers */

  /* filled dark elements (toasts, your chat bubbles, badges) and what sits on them */
  --inverse: var(--ink);
  --on-inverse: #ffffff;
  --on-primary: #ffffff;
  --shadow-lift: 0 18px 50px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", Roboto, "Inter", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* app-like touch: no double-tap zoom anywhere */
html, body, button, a, input, textarea, select, label, .wine, .lot, .tonight-item { touch-action: manipulation; }
html, body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); font-size: var(--fs-body); font-weight: 400; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; overscroll-behavior-y: none; overflow-x: clip; }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
a { color: var(--ink); text-decoration: underline; }
b, strong { font-weight: 600; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); line-height: 1.43; }
.qty, .lot-title, .lot-window, .stat b, .big-code, .tonight-why, .wine-sub { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
#app { max-width: 640px; margin: 0 auto; min-height: 100dvh; }
.view { position: relative; padding: calc(var(--safe-top) + 8px) 16px calc(var(--safe-bottom) + 99px); }

/* Behind the iPhone status bar: a solid strip, so content scrolling up disappears cleanly */
/* also a thin white strip on every page: iOS takes the status-bar colour from what is pinned at the top */
.statusbar-bg { position: fixed; top: 0; left: 0; right: 0; height: calc(var(--safe-top) + 8px); background: var(--page); z-index: 16; pointer-events: none; }

/* sticky search, white with a bottom hairline */
.topbar { position: sticky; top: var(--safe-top); z-index: 15; margin: 0 -16px 16px; padding: 12px 16px; background: var(--page); border-bottom: 1px solid var(--hairline-soft); }
.topbar .search-row { margin: 0; }
.topbar .stats { margin: 0; } /* the tiles stay at the top while the list scrolls */
.topbar .search-row + .stats { margin-top: 12px; }
.icon-btn { width: 32px; height: 32px; border-radius: var(--r-full); border: 0; background: var(--surface-strong); display: grid; place-items: center; cursor: pointer; flex: none; color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- dock: one floating cluster at the bottom right, within reach of the right thumb ---------- */
.dock { position: fixed; right: 12px; bottom: calc(var(--safe-bottom) + 12px); z-index: 20; display: flex; align-items: center; gap: 10px; }
.dock-tabs { display: flex; align-items: center; padding: 4px 10px; border-radius: var(--r-full); background: var(--canvas); box-shadow: var(--shadow); }
.tab { position: relative; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: var(--fs-label); font-weight: 500; padding: 6px 7px 7px; cursor: pointer; white-space: nowrap; }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: 1px; height: 2px; border-radius: var(--r-full); background: var(--ink); }
/* the mic is the "search orb": the hottest colour moment on the page */
.tab-voice { width: 60px; height: 60px; flex: none; border-radius: var(--r-full); border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; cursor: pointer; box-shadow: var(--shadow); }
.tab-voice:active { background: var(--primary-active); }
.tab-voice svg { width: 26px; height: 26px; }
.tab-voice.recording { background: var(--ink); }
.dock-fade { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--safe-bottom) + 96px); z-index: 18; pointer-events: none; background: linear-gradient(color-mix(in srgb, var(--page) 0%, transparent), var(--page) 70%); }
.voice-status { position: fixed; top: calc(var(--safe-top) + 6px); left: 50%; transform: translateX(-50%); max-width: calc(100% - 32px); z-index: 25; /* at the top, where the thumb on the button can't hide it */ display: flex; align-items: center; gap: 10px; background: var(--inverse); color: var(--on-inverse); padding: 10px 16px; border-radius: var(--r-full); font-size: var(--fs-small); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: blink 1s infinite; flex: none; }

/* ---------- search + filters ---------- */
.search-row { display: flex; gap: 8px; align-items: center; }
.search { flex: 1; min-width: 0; height: 48px; display: flex; align-items: center; gap: 10px; background: var(--canvas); border-radius: var(--r-full); padding: 0 18px; box-shadow: var(--shadow); }
.search:focus-within { box-shadow: 0 0 0 2px var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 0; outline: none; font-size: var(--fs-body); font-weight: 500; }
.search input::placeholder { color: var(--muted); font-weight: 400; }
.search svg { width: 16px; height: 16px; color: var(--ink); flex: none; }
.filter-btn { position: relative; width: 48px; height: 48px; flex: none; border: 1px solid var(--hairline); border-radius: var(--r-full); background: var(--canvas); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.filter-btn svg { width: 18px; height: 18px; }
.filter-btn.on { border: 2px solid var(--ink); }
.filter-btn .count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-full); background: var(--inverse); color: var(--on-inverse); font-size: var(--fs-label); font-weight: 600; display: grid; place-items: center; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); background: var(--canvas); color: var(--ink); padding: 6px 10px 6px 14px; border-radius: var(--r-full); font-size: var(--fs-small); font-weight: 500; cursor: pointer; }
.pill svg { width: 11px; height: 11px; }
.pill.clear { border-color: transparent; text-decoration: underline; padding-left: 6px; }
.fgroup { margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--hairline-soft); }
.fgroup:last-of-type { border-bottom: 0; }
.fchips { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink); padding: 10px 16px; border-radius: var(--r-full); font-size: var(--fs-small); font-weight: 500; cursor: pointer; }
.fchip span { color: var(--muted); font-size: var(--fs-caption); font-weight: 400; font-variant-numeric: tabular-nums; }
.fchip.active { border: 2px solid var(--ink); padding: 9px 15px; background: var(--surface-soft); }
/* Pinned to the very bottom of the card: it also covers the card's bottom padding, so chips that
   scroll under the buttons don't show up again below them. */
.filter-actions { position: sticky; bottom: calc(-1 * (var(--safe-bottom) + 24px)); margin-bottom: calc(-1 * (var(--safe-bottom) + 24px)); display: grid; grid-template-columns: 1fr 2fr; gap: 10px; padding: 16px 0 calc(var(--safe-bottom) + 16px); background: var(--canvas); border-top: 1px solid var(--hairline-soft); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0 0 16px; }
.stat { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 12px 12px; text-align: left; cursor: pointer; color: var(--ink); }
.stat b { display: block; font-size: var(--fs-hero); font-weight: 700; line-height: 1.2; }
.stat span { display: block; font-size: var(--fs-caption); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- wine cards ---------- */
.list { display: flex; flex-direction: column; gap: 12px; }
.wine { display: flex; gap: 14px; background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 16px; cursor: pointer; text-align: left; width: 100%; color: var(--ink); }
.wine.empty { opacity: .45; }
.bottle { width: 4px; border-radius: var(--r-full); flex: none; align-self: stretch; }
.wine-main { flex: 1; min-width: 0; }
.wine-producer { font-size: var(--fs-body); font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wine-title { font-size: var(--fs-body); color: var(--body); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wine-sub { color: var(--muted); font-size: var(--fs-small); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qty { flex: none; text-align: right; font-family: var(--serif); font-size: var(--fs-lead); font-weight: 500; line-height: 1; color: var(--count); } /* the bottle count: a quiet serif numeral in soft cream-grey */

/* drinking window bar: ink, with a Rausch "now" marker */
.wbar { position: relative; height: 4px; border-radius: var(--r-full); background: var(--hairline-soft); margin-top: 10px; }
.wbar .win { position: absolute; top: 0; bottom: 0; border-radius: var(--r-full); background: var(--border-strong); }
.wbar .pk { position: absolute; top: 0; bottom: 0; border-radius: var(--r-full); background: var(--ink); }
.wbar .now { position: absolute; top: 50%; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--canvas); transform: translate(-50%, -50%); } /* today: a dot, centred on its year */

.empty-state { text-align: center; padding: 64px 24px; color: var(--muted); }
.empty-state .big { margin-bottom: 10px; color: var(--muted-soft); }
.empty-state .big svg { width: 40px; height: 40px; }

/* ---------- sheets (no scrim; the card is set off by a top border) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: transparent; z-index: 30; } /* no dimming: catches taps outside the card only */
.sheet-backdrop.open { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31; max-width: 640px; margin: 0 auto;
  background: var(--canvas); border-top: 1px solid var(--hairline); height: calc(100dvh - var(--safe-top) - 2px); /* full height, 2px below the top */
  display: flex; flex-direction: column; transform: translateY(100%); transition: transform .42s cubic-bezier(.32, .72, 0, 1), box-shadow .2s ease, filter .25s ease; /* iOS sheet curve: quick start, long soft landing */
}
.sheet.open { transform: translateY(0); }
.sheet.closing { transition: transform .28s cubic-bezier(.32, .72, 0, 1), filter .25s ease; }
.sheet.dragging { box-shadow: 0 -6px 24px rgba(0, 0, 0, .14); } /* lifts off the page while dragged down */
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px 10px; gap: 8px; border-bottom: 1px solid var(--hairline-soft); }
.sheet-head h2 { margin: 0; font-size: var(--fs-body); font-weight: 600; flex: 1; text-align: center; }
.sheet-head .link { border: 0; background: none; color: var(--ink); font-size: var(--fs-body); font-weight: 500; text-decoration: underline; padding: 10px 4px; cursor: pointer; min-width: 64px; text-align: left; }
.sheet-head .link.right { text-align: right; font-weight: 600; }
.grabber { width: 36px; height: 5px; border-radius: var(--r-full); background: var(--hairline); margin: 8px auto 0; }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px calc(var(--safe-bottom) + 24px); -webkit-overflow-scrolling: touch; }

/* ---------- forms ---------- */
.group { background: var(--canvas); border: 1px solid var(--border-strong); border-radius: var(--r-sm); margin-bottom: 24px; overflow: hidden; }
.field { display: flex; align-items: center; gap: 12px; padding: 0 14px; min-height: 56px; border-bottom: 1px solid var(--border-strong); }
.field:focus-within { box-shadow: inset 0 0 0 2px var(--ink); }
.field:last-child { border-bottom: 0; }
.field label { width: 88px; flex: none; color: var(--muted); font-size: var(--fs-small); font-weight: 500; }
.field input, .field select, .field textarea { flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 14px 0; font-size: var(--fs-body); color: var(--ink); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-soft); }
.field textarea { resize: vertical; min-height: 80px; }
.group-title { font-size: var(--fs-body); font-weight: 600; color: var(--ink); margin: 0 2px 12px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button, .lot-qty button { width: 32px; height: 32px; padding: 0; border-radius: var(--r-full); border: 1px solid var(--border-strong); background: var(--canvas); cursor: pointer; color: var(--ink); display: grid; place-items: center; }
.stepper button svg, .lot-qty button svg { width: 14px; height: 14px; display: block; }
.stepper input { width: 44px; text-align: center; flex: none; }

.seg { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 24px; }
.seg button { border: 1px solid var(--hairline); background: var(--canvas); border-radius: var(--r-sm); padding: 10px 8px; cursor: pointer; font-size: var(--fs-caption); color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.seg button b { color: var(--ink); font-size: var(--fs-small); font-weight: 500; }
.seg button.active { border: 2px solid var(--ink); padding: 9px 7px; background: var(--surface-soft); }
.seg-sizes { grid-template-columns: repeat(5, 1fr); }
.seg-sizes button { padding: 12px 2px; }
.seg-sizes button.active { padding: 11px 1px; }
.seg-sizes b { font-size: var(--fs-caption) !important; }
#colors .bottle { width: 18px !important; height: 4px !important; }

.btn { border: 1px solid var(--ink); border-radius: var(--r-sm); padding: 13px 23px; min-height: 48px; font-size: var(--fs-body); font-weight: 500; cursor: pointer; background: var(--canvas); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:active { background: var(--primary-active); border-color: var(--primary-active); }
.btn.primary:disabled { background: var(--primary-disabled); border-color: var(--primary-disabled); opacity: 1; }
.btn.ghost { background: var(--canvas); color: var(--ink); border-color: var(--ink); }
.btn.danger { background: transparent; color: var(--error); border-color: transparent; text-decoration: underline; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.btn:not(.primary) .spinner { border-color: color-mix(in srgb, var(--ink) 20%, transparent); border-top-color: var(--ink); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: .35; } 40% { opacity: 1; } }

/* ---------- wine page ---------- */
.detail-hero { padding: 8px 2px 24px; border-bottom: 1px solid var(--hairline-soft); margin-bottom: 24px; }
.detail-hero .eyebrow { font-size: var(--fs-small); color: var(--muted); }
.detail-hero h2 { font-size: var(--fs-hero); font-weight: 700; line-height: 1.2; margin: 4px 0; }
.detail-hero .wine-name { font-size: var(--fs-title); font-weight: 500; color: var(--body); line-height: 1.3; }
.detail-hero .grapes { margin-top: 6px; font-size: var(--fs-small); color: var(--muted); }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 12px; }
.section-head h3 { margin: 0; font-size: var(--fs-title); font-weight: 700; }
.section-head .muted { font-size: var(--fs-small); }

.lots { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); margin-bottom: 24px; overflow: hidden; }
.lot { display: flex; align-items: center; gap: 10px; padding: 16px 14px 16px 16px; border-bottom: 1px solid var(--hairline-soft); }
.lot.empty { opacity: .45; }
.lot-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink); }
.lot-title { font-size: var(--fs-body); font-weight: 600; }
.lot-title span { color: var(--muted); font-weight: 400; }
.lot-window { font-size: var(--fs-small); color: var(--body); margin-top: 2px; }
.lot-window b { font-weight: 600; }
.st-peak { color: var(--ink); }
.st-ok { color: var(--ink); }
.st-warn { color: var(--error); }
.st-bad, .st-young { color: var(--muted); }
.lot .wbar { margin-top: 10px; }
.lot-note { font-size: var(--fs-caption); color: var(--muted); margin-top: 8px; line-height: 1.35; }
.lot-note.warn { color: var(--error); }
.lot-qty { display: flex; align-items: center; gap: 8px; flex: none; }
.lot-qty span { min-width: 20px; text-align: center; font-size: var(--fs-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.lot-add { display: flex; width: 100%; align-items: center; justify-content: center; gap: 6px; padding: 16px; border: 0; background: var(--canvas); color: var(--ink); font-size: var(--fs-body); font-weight: 500; text-decoration: underline; cursor: pointer; }
.lot-add svg { width: 14px; height: 14px; }

/* sommelier: a white "host card" */
.ai-card { background: var(--canvas); color: var(--ink); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 24px; margin-bottom: 12px; }
.ai-card .muted { color: var(--muted); }
.ai-glass { display: flex; gap: 16px; align-items: flex-start; }
.ai-glass > svg { margin-top: -3px; }
.ai-glass svg { width: 30px; height: 30px; flex: none; color: var(--ink); }
.ai-card .v { font-size: var(--fs-body); font-weight: 600; line-height: 1.3; } /* a quiet label, like the other card headings */
.ai-card p { margin: 4px 0 0; font-size: var(--fs-small); color: var(--body); }
.ai-foot { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline-soft); font-size: var(--fs-small); color: var(--body); }

.about { margin-bottom: 24px; padding: 24px 14px; border-top: 1px solid var(--hairline-soft); border-bottom: 1px solid var(--hairline-soft); }
.about h4 { margin: 0 0 6px; font-size: var(--fs-title); font-weight: 600; }
.about p { margin: 0 0 20px; color: var(--body); }
.about p:last-child { margin-bottom: 0; }


/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; gap: 12px; padding-bottom: 160px; }
.msg { max-width: 88%; padding: 12px 16px; border-radius: var(--r-lg); line-height: 1.5; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--inverse); color: var(--on-inverse); border-bottom-right-radius: var(--r-xs); white-space: pre-wrap; }
.msg.assistant { align-self: flex-start; background: var(--surface-soft); border-bottom-left-radius: var(--r-xs); }
.msg.assistant p { margin: 0 0 8px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant ul, .msg.assistant ol { margin: 4px 0 8px; padding-left: 20px; }
.msg.assistant h4 { margin: 10px 0 4px; font-size: var(--fs-body); font-weight: 600; }
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-soft); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
.suggestions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.suggestions button { text-align: left; border: 1px solid var(--hairline); background: var(--canvas); border-radius: var(--r-md); padding: 16px; cursor: pointer; color: var(--ink); font-weight: 500; }

/* voice card in the add form */
.voice-card { width: 100%; display: flex; gap: 14px; align-items: center; text-align: left; border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 16px; margin-bottom: 24px; background: var(--surface-soft); color: var(--ink); cursor: pointer; }
.mic-circle { width: 48px; height: 48px; border-radius: var(--r-full); background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; }
.mic-circle svg { width: 22px; height: 22px; }
.voice-card.recording { border: 2px solid var(--ink); padding: 15px; }
.voice-card.recording .mic-circle { background: var(--ink); }
.voice-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.voice-text b { font-size: var(--fs-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.voice-text span { color: var(--muted); font-size: var(--fs-small); }

/* ---------- login / plain pages ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 24px calc(var(--safe-bottom) + 32px); text-align: center; background: var(--page); }
.login .logo { width: 88px; height: 88px; border-radius: var(--r-lg); margin-bottom: 28px; }
.login h1 { font-family: 'Nook', var(--serif); font-style: italic; font-size: var(--fs-display); font-weight: 600; letter-spacing: -.02em; line-height: 1.3; margin: 0 0 8px; }
.login p { color: var(--body); margin: 0 0 32px; max-width: 300px; font-size: var(--fs-body); }
.login h1 + p { margin-top: 6px; font-size: var(--fs-label); font-weight: 500; text-transform: uppercase; letter-spacing: .2em; color: var(--tagline); max-width: none; }
.google-btn { background: var(--primary); color: var(--on-primary); border: 0; border-radius: var(--r-sm); padding: 14px 24px; min-height: 48px; display: inline-flex; gap: 10px; align-items: center; cursor: pointer; font-size: var(--fs-body); font-weight: 500; }
.google-btn:active { background: var(--primary-active); }
.google-btn svg { width: 22px; height: 22px; background: #fff; border-radius: 50%; padding: 3px; }
.code-box { margin-top: 24px; background: var(--surface-soft); border-radius: var(--r-md); padding: 16px 20px; }
.big-code { font-size: var(--fs-display); font-weight: 700; letter-spacing: 6px; margin: 12px 0 20px; }
body.plain { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; }
.auth-card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 32px 24px; max-width: 380px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.auth-card h1 { font-size: var(--fs-title); font-weight: 600; margin-top: 0; }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 92px); transform: translate(-50%, 20px); background: var(--inverse); color: var(--on-inverse); padding: 12px 18px; border-radius: var(--r-sm); font-size: var(--fs-small); font-weight: 500; z-index: 50; opacity: 0; transition: all .2s; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.menu { position: fixed; right: 12px; bottom: calc(var(--safe-bottom) + 84px); background: var(--canvas); border-radius: var(--r-md); padding: 8px 0; z-index: 40; min-width: 250px; box-shadow: var(--shadow); }
.menu button { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border: 0; background: none; padding: 12px 18px; cursor: pointer; color: var(--ink); font-size: var(--fs-body); }
.menu button svg { width: 18px; height: 18px; flex: none; color: var(--ink); }
.menu button:active { background: var(--surface-soft); }
.menu button:disabled { color: var(--muted-soft); }
.menu button:disabled svg { color: var(--muted-soft); }
.menu-sep { height: 1px; background: var(--hairline-soft); margin: 8px 0; }

/* chat history, backups */
.history { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden; }
.history button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 16px; border: 0; border-bottom: 1px solid var(--hairline-soft); background: none; text-align: left; cursor: pointer; color: var(--ink); }
.history button:last-child { border-bottom: 0; }
.history .h-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .h-date { flex: none; font-size: var(--fs-small); color: var(--muted); }
.history button.current .h-title { font-weight: 600; }

.progress { height: 4px; border-radius: var(--r-full); background: var(--hairline-soft); overflow: hidden; margin: 16px 0 12px; }
.progress-bar { height: 100%; width: 0; background: var(--primary); border-radius: var(--r-full); transition: width .3s ease; }
.progress-label { font-weight: 600; font-size: var(--fs-title); margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.progress-current { min-height: 1.4em; margin: 0 0 16px; }

/* ---------- open tonight ---------- */
.tonight { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-md); margin: 0 0 16px; overflow: hidden; }
.tonight-head { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 16px 6px; }
.tonight-head span { font-size: var(--fs-title); font-weight: 600; }
.tonight-head button { border: 0; background: none; color: var(--ink); font-size: var(--fs-small); font-weight: 500; text-decoration: underline; padding: 4px 0; cursor: pointer; }
.tonight-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px 12px 16px; border: 0; border-top: 1px solid var(--hairline-soft); background: none; text-align: left; cursor: pointer; color: var(--ink); }
.tonight-head + .tonight-item { border-top: 0; }
.tonight-item .bottle { align-self: stretch; }
.tonight-main { flex: 1; min-width: 0; }
.tonight-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tonight-title span { font-weight: 400; color: var(--body); }
.tonight-why { font-size: var(--fs-small); color: var(--muted); }
.tonight-item > svg, .history button > svg { width: 16px; height: 16px; flex: none; color: var(--ink); }

/* wine page: ⋯ menu, pairing row, loading state */
.head-right { min-width: 64px; display: flex; justify-content: flex-end; }
.menu button.danger, .menu button.danger svg { color: var(--error); }
.ai-row2 { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--hairline-soft); }
.ai-loading { display: flex; align-items: center; gap: 12px; color: var(--body); }
.ai-loading .spinner { border-color: color-mix(in srgb, var(--ink) 20%, transparent); border-top-color: var(--ink); }

/* storage picker: Fridge · Shelf · Balcony, then Wine fridge · Cellar */
.seg-locs { grid-template-columns: repeat(6, 1fr); }
.seg-locs button { grid-column: span 2; }
.seg-locs button:nth-child(n+4) { grid-column: span 3; }

/* nothing to show → disabled */
.stat:disabled { opacity: .4; cursor: default; }
.fchip:disabled { opacity: .35; cursor: default; }

/* sheet close as an ✕ */
.head-left { min-width: 64px; display: flex; }

/* tonight page */
.tonight-page .section-head { margin-top: 8px; }
.tonight-page > .section-head:first-child { margin: 4px 0 18px; } /* same spot and size as the Vintages and Wishes titles */
.tonight-page > .section-head:first-child h3 { font-size: var(--fs-title); }
.tonight-serve { font-size: var(--fs-caption); color: var(--muted); margin-top: 2px; }
.season-dish { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-bottom: 1px solid var(--hairline-soft); }
.season-dish svg { width: 30px; height: 30px; flex: none; color: var(--ink); margin-top: -2px; }
.season-dish b { display: block; font-size: var(--fs-body); }
.season-dish p { margin: 2px 0 0; font-size: var(--fs-small); color: var(--body); }
.season .tonight-item { border-top: 0; }
.tonight.season + .tonight.season { margin-top: -4px; }

/* No orphans: headings break into even lines, running text avoids a lone last word. */
h1, h2, h3, .wine-name, .tonight b, .season-dish b, .sheet-title { text-wrap: balance; }
p, .about, .ai-card { text-wrap: pretty; }

/* The cellar list is for tapping, not selecting: no text selection or long-press callout. */
.no-select { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.no-select input, .no-select textarea { -webkit-user-select: text; user-select: text; }

/* Search & filters as the fourth tile: icons when nothing is set, the count (with a dark outline) when something is. */
.filter-stat .tile-icon { display: flex; align-items: center; height: 34px; } /* the line height of the numbers */
.filter-stat b svg { width: 28px; height: 26px; display: block; margin-top: 2px; color: var(--ink); }
.filter-stat.on { border: 2px solid var(--ink); padding: 11px 11px; }

/* Search field at the top of the search & filters card */
.fsearch { margin: 0 0 20px; box-shadow: none; border: 1px solid var(--hairline); }
.fsearch:focus-within { box-shadow: none; border: 2px solid var(--ink); padding: 0 17px; }

/* Wish list */
#wish-form { margin: 0 0 16px; }
#wish-form .search { margin: 0; }
.wish-about { font-size: var(--fs-small); color: var(--muted); line-height: 1.4; margin-top: 4px; text-wrap: pretty; }
.wine.wish.loading { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: var(--fs-body); cursor: default; }
.empty-state.small { padding: 32px 16px; }
.wine.wish.loading .spinner { border-color: color-mix(in srgb, var(--ink) 20%, transparent); border-top-color: var(--ink); }
.wish-mic { flex: none; width: 34px; height: 34px; margin-right: -10px; border: 0; border-radius: var(--r-full); background: var(--primary); color: var(--on-primary); display: grid; place-items: center; cursor: pointer; }
.wish-mic svg { width: 16px; height: 16px; color: var(--on-primary); }
.wish-mic.recording { background: var(--ink); }
.wish-mic .spinner { width: 14px; height: 14px; }
#wish-q:disabled { background: none; opacity: 1; }

/* One-line quick add at the top of the new-wine form (same field as the wish list) */
.quick-add { margin: 0 0 24px; }
.quick-add .search { margin: 0; }
.chip-strip { display: inline-block; width: 14px; height: 5px; border-radius: var(--r-tile); margin-right: 7px; vertical-align: middle; }

/* Cancel a recording: ✕ in the dock's listening pill, and in place of the + in the one-line fields */
.field-lead { display: grid; place-items: center; flex: none; }
.field-cancel { width: 26px; height: 26px; margin: 0 -6px; border: 0; border-radius: var(--r-full); background: var(--surface-soft); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.field-cancel svg { width: 12px !important; height: 12px !important; }

/* Country / region filters: dropdowns side by side */
.fselects { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fselect { position: relative; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 10px 34px 10px 14px; background: var(--canvas); min-width: 0; }
.fselect::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.fselect span { font-size: var(--fs-caption); color: var(--muted); }
.fselect select { appearance: none; -webkit-appearance: none; border: 0; background: none; padding: 0; margin: 0; font: inherit; font-size: var(--fs-body); font-weight: 500; color: var(--ink); width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: none; }
.fselect.on { border: 2px solid var(--ink); padding: 9px 33px 9px 13px; }
.fgroup:has(+ .filter-actions) { border-bottom: 0; margin-bottom: 0; }

/* Follow-up suggestions under the latest answer: one row, scrolls sideways if needed */
.followups { display: flex; gap: 8px; overflow-x: auto; margin: 4px -16px 8px; padding: 2px 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.followups::-webkit-scrollbar { display: none; }
.followups button { flex: none; white-space: nowrap; border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink); border-radius: var(--r-full); padding: 8px 14px; font-size: var(--fs-small); font-weight: 500; cursor: pointer; }
.followups button:active { background: var(--surface-soft); }
/* Mic buttons can be held down: no text selection, callout or scrolling while pressed */
.tab-voice, .wish-mic { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }

/* Easy drinking: a switch row */
.fswitch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.fswitch > span { display: flex; flex-direction: column; gap: 2px; }
.fswitch b { font-size: var(--fs-body); font-weight: 600; }
.fswitch small { font-size: var(--fs-caption); color: var(--muted); }
.fswitch input { position: absolute; opacity: 0; pointer-events: none; }
.fswitch i { flex: none; position: relative; width: 50px; height: 30px; border-radius: var(--r-full); background: var(--hairline); transition: background .2s ease; }
.fswitch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s ease; }
.fswitch input:checked + i { background: var(--inverse); }
.fswitch input:checked + i::after { transform: translateX(20px); }

/* Style grid in filters: same look as the wine form, with counts */
.seg-filter { margin-bottom: 0; }
.seg-filter b em { font-style: normal; font-size: var(--fs-caption); font-weight: 400; color: var(--muted); }
.seg-filter button:disabled { opacity: .35; cursor: default; }
.seg-3 { grid-template-columns: repeat(3, 1fr); } /* always three per row, so storage tiles match the style tiles */
.seg-icon { display: grid; place-items: center start; align-self: flex-start; height: 6px; margin: 2px 0 6px; overflow: visible; }
.seg-icon svg { width: 16px; height: 16px; color: var(--ink); margin-top: -5px; }

/* Swipe a cellar card left: Drink (short), Delete (long) */
.swipe { position: relative; border-radius: var(--r-md); overflow: hidden; }
.swipe .wine { position: relative; z-index: 1; transition: transform .34s cubic-bezier(.2, .8, .2, 1); }
.swipe { transition: height .24s ease, margin .24s ease, opacity .24s ease; }
.swipe.collapse { height: 0 !important; margin-bottom: -12px; opacity: 0; } /* closes the row and the list's gap */
.swipe.appear { animation: card-in .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes card-in { from { opacity: 0; transform: translateY(-6px); } }
.qty.tick, .stat b.tick, .cellar-sum b.tick { animation: tick .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes tick { 0% { transform: scale(1); } 35% { transform: scale(1.18); opacity: .55; } 100% { transform: scale(1); } }
.qty { display: inline-block; }
.stat b.tick { transform-origin: left center; }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding: 0 22px; background: var(--surface-soft); color: var(--muted); font-size: var(--fs-small); font-weight: 600; border-radius: var(--r-md); opacity: 0; transition: background-color .15s ease, color .15s ease; }
.swipe.swiping .swipe-bg { opacity: 1; }
.swipe-bg span { display: flex; align-items: center; gap: 8px; }
.swipe-bg svg { width: 18px; height: 18px; }
.swipe-bg .sw-del { display: none; }
.swipe.sw-armed .swipe-bg { background: var(--inverse); color: var(--on-inverse); }
.swipe.sw-delete .swipe-bg { background: var(--error); color: var(--on-primary); }
.swipe.sw-delete .sw-drink { display: none; }
.swipe.sw-delete .sw-del { display: flex; }

/* Message with buttons: text on top, a row of buttons below (Undo, thumbs up / down, Change) */
.atoast { position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 92px); max-width: 520px; margin: 0 auto; z-index: 50; background: var(--inverse); color: var(--on-inverse); padding: 14px 14px 10px 16px; border-radius: var(--r-md); font-size: var(--fs-body); font-weight: 600; box-shadow: var(--shadow); opacity: 0; transform: translateY(14px); transition: opacity .24s ease, transform .3s cubic-bezier(.2, .8, .2, 1); }
.atoast.show { opacity: 1; transform: none; }
.atoast-text { line-height: 1.35; }
.atoast-text small { display: block; font-size: var(--fs-caption); font-weight: 400; color: color-mix(in srgb, var(--on-inverse) 70%, transparent); margin-top: 2px; }
.atoast-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.atoast-gap { flex: 1; }
.atoast button { flex: none; border: 0; background: color-mix(in srgb, var(--on-inverse) 14%, transparent); color: var(--on-inverse); border-radius: var(--r-full); height: 36px; min-width: 44px; padding: 0 14px; font-size: var(--fs-small); font-weight: 600; cursor: pointer; }
.atoast button.thumb { padding: 0; display: grid; place-items: center; }
.atoast button.thumb svg { width: 18px; height: 18px; }
.atoast button.thumb.on { background: var(--on-inverse); color: var(--inverse); }
.atoast button.undo { background: none; text-decoration: underline; padding: 0 6px; }

/* Offline chip */
#offline-chip { position: fixed; top: calc(var(--safe-top) + 6px); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 6px; background: var(--inverse); color: var(--on-inverse); font-size: var(--fs-caption); font-weight: 600; padding: 5px 11px; border-radius: var(--r-full); box-shadow: var(--shadow); pointer-events: none; }
#offline-chip i { width: 6px; height: 6px; border-radius: 50%; background: #f5b400; }

/* "Buy again" tag on wish-list cards */
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: var(--r-full); background: var(--surface-soft); color: var(--muted); font-size: var(--fs-label); font-weight: 600; vertical-align: 2px; }

/* Vintages: per country, one strip of squares per region in decade blocks */
:root { --v-exceptional: #1f6b45; --v-very_good: #6fb07a; --v-solid: #e6d6ad; --v-avoid: #cf5b4b; --v-none: var(--hairline-soft); }
.page-title { margin: 4px 0 18px; font-size: var(--fs-title); font-weight: 700; }
.v-exceptional { background: var(--v-exceptional); } .v-very_good { background: var(--v-very_good); }
.v-solid { background: var(--v-solid); } .v-avoid { background: var(--v-avoid); } .v-none { background: var(--v-none); }
.vintages { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.vgroup { margin-bottom: 22px; }
.vgroup-head { display: grid; grid-template-columns: 118px 1fr; align-items: end; gap: 10px; margin-bottom: 4px; }
.vgroup-head h3 { margin: 0; font-size: var(--fs-body); font-weight: 600; }
.vaxis, .vstrip { display: grid; gap: 2px; } /* columns set inline: one per year, a gap before each decade */
.vaxis span { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: visible; }
.vrow { display: grid; grid-template-columns: 118px 1fr; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hairline-soft); }
.vname { display: block; cursor: default !important; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-small); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; background: none; padding: 0; color: var(--ink); text-align: left; cursor: pointer; }
.vstrip { touch-action: none; } /* the app decides: tip on a sideways slide, scroll only on a clear up/down move */
.vstrip i { display: block; height: 20px; border-radius: var(--r-tile); transition: transform .12s ease; }
.vstrip i.on { transform: scaleY(1.25); box-shadow: 0 0 0 2px var(--canvas), 0 0 0 3px var(--ink); }
.vstrip-loading { grid-column: 1 / -1; font-size: var(--fs-caption); color: var(--muted-soft); }
#vtip { position: fixed; z-index: 70; max-width: 240px; background: var(--inverse); color: var(--on-inverse); border-radius: var(--r-sm); padding: 8px 11px; font-size: var(--fs-caption); line-height: 1.35; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease; }
#vtip.show { opacity: 1; transform: none; }
#vtip b { display: block; font-weight: 600; }
#vtip span { color: color-mix(in srgb, var(--on-inverse) 75%, transparent); }
.vsection { margin-bottom: 18px; }
.vsection-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-caption); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.vsection-head i { width: 12px; height: 12px; border-radius: var(--r-tile); display: inline-block; }
.vyear { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--hairline-soft); font-size: var(--fs-body); }
.vyear b { font-variant-numeric: tabular-nums; }
.vyear span { color: var(--body); line-height: 1.4; }
.vyear em { font-style: normal; font-size: var(--fs-label); font-weight: 600; color: var(--ink); background: var(--surface-soft); border-radius: var(--r-full); padding: 2px 8px; white-space: nowrap; }

/* Offline: everything that needs the internet is greyed out and can't be tapped */
body.offline .tab-voice, body.offline .wish-mic, body.offline .needs-net { opacity: .35; filter: grayscale(1); pointer-events: none; }
body.offline .tab-voice { opacity: 1; filter: none; background: var(--border-strong); box-shadow: none; } /* solid grey, nothing shows through */
body.offline .net-tap { pointer-events: none; } /* still readable, just not tappable */

/* Vintages: country name opens the country page (1980 onwards, a row per decade) */
.vcountry { display: inline-flex; align-items: center; gap: 2px; border: 0; background: none; padding: 0; font: inherit; font-size: var(--fs-body); font-weight: 600; color: var(--ink); cursor: pointer; text-align: left; }
.vcountry svg { width: 15px; height: 15px; color: var(--muted); }
.vcregion { padding: 14px 0 16px; border-top: 1px solid var(--hairline-soft); }
.vcregion:first-child { border-top: 0; padding-top: 0; }
.vcregion h4 { margin: 0 0 10px; font-size: var(--fs-body); font-weight: 600; }
.vdecade { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 10px; margin-bottom: 6px; }
.vdecade > span:first-child { font-size: var(--fs-caption); color: var(--muted); font-variant-numeric: tabular-nums; }
.vstrip10 { grid-template-columns: repeat(10, 1fr); gap: 4px; }
.vstrip10 i { height: 24px; }
.vstrip10 em { display: block; }

/* Settings → Storage spots */
.spots .spot-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--surface-soft); flex: none; }
.spots .spot-icon svg { width: 18px !important; height: 18px !important; }
.spots .h-title small { display: block; font-size: var(--fs-caption); color: var(--muted); margin-top: 1px; }

/* Tonight: food pairing of the day, compact; switch between the season and fast food */
.pair-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; margin: -4px 0 12px; border-radius: var(--r-full); background: var(--page-deep); }
/* one white thumb that glides between the two sides */
.pair-switch::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: var(--r-full); background: var(--canvas); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); transform: translateX(calc(var(--p, 0) * 100%)); transition: transform var(--thumb-t, 0s); } /* follows the finger */
.pair-switch button { position: relative; border: 0; background: none; padding: 7px 11px; border-radius: var(--r-full); font-size: var(--fs-caption); font-weight: 500; color: var(--muted); cursor: pointer; white-space: nowrap; transition: color .25s ease; }
.pair-switch.fast button[data-mode="fastfood"], .pair-switch:not(.fast) button[data-mode="season"] { color: var(--ink); font-weight: 600; }
.pairing .pair + .pair { border-top: 1px solid var(--hairline); }
.pair-dish { display: flex; align-items: center; padding: 14px 16px 2px 16px; } /* the dish starts with the colour bar below; its wine is indented */
.pair-dish svg { width: 18px; height: 18px; flex: none; color: var(--ink); }
.pair-dish b { font-size: var(--fs-body); font-weight: 600; }
.pair-why { margin: 2px 16px 8px 16px; font-size: var(--fs-caption); line-height: 1.4; color: var(--muted); }
.pairing .tonight-item { border-top: 0; padding-top: 8px; }
.pair-none { margin: 4px 16px 14px 32px; }
.pair-wish { display: flex; align-items: center; gap: 8px; width: 100%; margin: 0; padding: 0 16px 12px 32px; border: 0; background: none; text-align: left; font-size: var(--fs-caption); color: var(--muted); cursor: pointer; }
.pair-wish svg { width: 14px; height: 14px; flex: none; color: var(--primary); margin-left: -21px; margin-right: -1px; }
.pair-wish b { font-weight: 600; color: var(--ink); white-space: nowrap; } /* .tonight b balances (and so wraps) otherwise */
.pair-wish span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tonight-page .match-head { margin-top: 28px; }
.pair-viewport { overflow: hidden; touch-action: pan-y; margin: 0 -16px; padding: 0 16px; } /* the dishes run out to the screen edge */
.pair-track { display: flex; gap: 16px; align-items: flex-start; will-change: transform; }
.pair-track > .pairing { flex: 0 0 100%; min-width: 0; }

/* ---------- sommelier card (opens over any page, from the round button) ---------- */
/* Over a wine, a wish, the wish list or a country page the round button stays, the tabs don't. */
body.mic-over .dock { z-index: 35; }
body.mic-over .voice-status { z-index: 36; }
body.mic-over .dock-tabs { opacity: 0; pointer-events: none; }
.dock-tabs { transition: opacity .2s ease; }
.sheet[data-mic] .sheet-body { padding-bottom: calc(var(--safe-bottom) + 91px); }
.somm-ctx:empty { display: none; }
.somm-ctx { margin-bottom: 14px; }
.ctx-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; border: 1px solid var(--hairline); border-radius: var(--r-full); padding: 5px 4px 5px 11px; font-size: var(--fs-caption); font-weight: 600; color: var(--ink); background: var(--surface-soft); }
.ctx-chip > svg { width: 15px; height: 15px; flex: none; }
.ctx-chip span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-chip button { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: var(--r-full); cursor: pointer; padding: 0; }
.ctx-chip button svg { width: 14px; height: 14px; }
.somm-composer textarea { flex: 1; resize: none; border: 0; box-shadow: var(--shadow); background: var(--canvas); border-radius: var(--r-lg); padding: 12px 18px; outline: none; max-height: 140px; font-size: var(--fs-body); color: var(--ink); font-family: inherit; }
.somm-composer textarea:focus { box-shadow: 0 0 0 2px var(--ink); }
.somm-composer button { width: 48px; height: 48px; border-radius: var(--r-full); border: 0; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; cursor: pointer; flex: none; }
.somm-composer button.recording { background: var(--ink); }
.somm-composer button svg { width: 20px; height: 20px; }
.somm-mic { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
.history .h-title small { display: block; font-size: var(--fs-caption); color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; }

/* The sommelier floats as a bubble over the page, with room around it. It rises and fades in, no slide. */
.bubble-backdrop { position: fixed; inset: 0; z-index: 37; background: transparent; } /* catches taps outside the bubble */
/* Behind the bubble the page itself is blurred and dimmed (not a layer on top), so it is soft
   everywhere it shows, also through iOS's see-through bar above the keyboard. */
#app > .view, #app > .dock, #app > .dock-fade, #app > .statusbar-bg { transition: filter .25s ease; }
/* (cards keep their own slide transition below, plus the blur fade) */
body.bubble-open #app > .view, body.bubble-open #app > .dock, body.bubble-open #app > .dock-fade,
body.bubble-open #app > .statusbar-bg, body.bubble-open > .sheet { filter: blur(5.6px); }
.bubble-backdrop.open { opacity: 1; }
.bubble {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--safe-bottom) + 12px); z-index: 38; max-width: 560px; margin: 0 auto;
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 40px); display: flex; flex-direction: column;
  background: var(--canvas); border-radius: var(--r-xl); box-shadow: var(--shadow-lift); overflow: hidden;
  opacity: 0; transform: translateY(14px) scale(.98); transform-origin: 50% 100%;
  transition: opacity .2s ease, transform .26s cubic-bezier(.2, .8, .2, 1);
}
.bubble.open { opacity: 1; transform: none; }
.bubble.closing { transition: opacity .16s ease, transform .2s ease; }
.bubble-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; touch-action: none; }
.bubble-head h2 { flex: 1; margin: 0; text-align: center; font-size: var(--fs-body); font-weight: 600; }
.bubble-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 16px 8px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.bubble .chat { padding: 0 0 4px; }
.bubble .suggestions { margin-top: 0; }
.bubble .suggestions button { padding: 13px 14px; }
.bubble .followups { margin: 4px -16px 0; }
.somm-composer { display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px 12px; background: var(--canvas); }
.somm-composer textarea { box-shadow: none; background: var(--surface-soft); }
/* Wine and wish pages: small name in the header once the big one has scrolled away */
.sheet-head h2 .mini-title { display: block; min-width: 0; opacity: 0; transform: translateY(4px); transition: opacity .18s ease, transform .18s ease; line-height: 1.2; }
.sheet-head h2.shown .mini-title { opacity: 1; transform: none; }
.mini-title b, .mini-title span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-title b { font-size: var(--fs-small); font-weight: 600; }
.mini-title span { font-size: var(--fs-caption); font-weight: 400; color: var(--muted); }
.sheet-head h2:has(.mini-title) { min-width: 0; }

/* Cellar header: title, the numbers as one line of shortcuts, and a search field with the filter inside */
.cellar-sum { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; margin: -12px 0 14px; color: var(--muted); font-size: var(--fs-body); }
.cellar-sum button { border: 0; background: none; padding: 2px 0; font: inherit; color: var(--ink); cursor: pointer; text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 4px; }
.cellar-sum button b { font-weight: 600; font-variant-numeric: tabular-nums; }
.cellar-sum button.hot { color: var(--primary); text-decoration-color: var(--primary-disabled); }
.cellar-search { position: sticky; top: var(--safe-top); z-index: 15; display: flex; align-items: center; margin: 0 -16px 16px; padding: 11px 16px 8px; background: var(--page); }
.search-pill { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 60px 0 18px; border: 0; border-radius: var(--r-full); background: var(--canvas); box-shadow: var(--shadow); color: var(--muted); font: inherit; font-size: var(--fs-body); text-align: left; cursor: pointer; }
.search-pill svg { width: 18px; height: 18px; flex: none; color: var(--ink); }
.search-pill span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-pill span.q { color: var(--ink); font-weight: 500; }
.filter-dot { position: relative; margin: 0 5px 0 -45px; width: 40px; height: 40px; flex: none; border-radius: var(--r-full); border: 1px solid var(--hairline); background: var(--canvas); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.filter-dot svg { width: 18px; height: 18px; }
.filter-dot.on { border: 2px solid var(--ink); }
.filter-dot i { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--inverse); color: var(--on-inverse); font-style: normal; font-size: var(--fs-label); font-weight: 700; display: grid; place-items: center; }
/* Cards fade out under the sticky search, like they do above the dock */
.cellar-search::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 68px; z-index: -1; pointer-events: none; background: linear-gradient(var(--page), color-mix(in srgb, var(--page) 0%, transparent)); opacity: 0; transition: opacity .2s ease; } /* the mirror of the fade above the dock, behind the field's shadow */
.cellar-search.stuck::after { opacity: 1; } /* only once the list scrolls under it */
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title-row .page-title { margin-right: auto; }
.title-btn { width: 38px; height: 38px; margin: -14px 0 0; }
.title-btn svg { width: 20px; height: 20px; }



/* the one-time swipe hint: the first card slides aside and back, showing its action underneath */
.swipe.hint .swipe-bg { opacity: 1; transition: opacity .2s ease; }
.swipe.hint .wine { animation: swipe-hint 1.3s cubic-bezier(.45, 0, .2, 1); }
@keyframes swipe-hint { 0% { transform: none; } 35%, 55% { transform: translateX(-84px); } 100% { transform: none; } }

/* a bottle's vintage: the year's square from the Vintages charts, in front of it */
.lot-vq { display: inline-block; width: 7px; height: 15px; border-radius: var(--r-tile); margin-right: 8px; vertical-align: -2px; } /* the same little bar as on the Vintages page */
/* Not tonight: swiping a pick on Tonight */
.ready-list > .swipe { border-radius: 0; }
.swipe .tonight-item { position: relative; z-index: 1; background: var(--canvas); transition: transform .34s cubic-bezier(.2, .8, .2, 1); }
.ready-list .swipe.sw-delete .swipe-bg { background: var(--ink); }
.ready-list .swipe.sw-delete .sw-drink { display: flex; }
.ready-list .swipe.sw-delete .sw-del { display: none; }
/* press and hold an answer to copy or share it */
.msg.assistant { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; transition: transform .15s ease, background-color .15s ease; }
.msg.assistant.held { transform: scale(.98); background: var(--surface-strong); }

/* Wishes: "Suggested for you", a carousel of three cards that snap into place */
.sugg-track { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 4px; scroll-padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sugg-track::-webkit-scrollbar { display: none; }
.sugg-card { flex: 0 0 86%; scroll-snap-align: start; display: flex; gap: 14px; padding: 16px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--canvas); min-width: 0; }
.sugg-card .bottle { width: 4px; border-radius: var(--r-full); align-self: stretch; flex: none; }
.sugg-main { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.sugg-why { margin: 8px 0 12px; font-size: var(--fs-small); color: var(--body); line-height: 1.4; flex: 1; }
.sugg-add { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); background: var(--canvas); color: var(--ink); border-radius: var(--r-full); padding: 7px 14px 7px 11px; font-size: var(--fs-small); font-weight: 500; cursor: pointer; }
.sugg-add svg { width: 15px; height: 15px; }
.sugg-add.done { border-color: var(--hairline); color: var(--muted); cursor: default; }
.sugg-card.loading { flex-basis: 100%; align-items: center; color: var(--muted); font-size: var(--fs-small); min-height: 120px; }
.sugg-dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0 0; }
.sugg-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--hairline); transition: background-color .2s ease, transform .2s ease; }
.sugg-dots i.on { background: var(--ink); transform: scale(1.15); }
.sugg-after { margin-top: 26px; }

/* On the warm pages: cards keep white with a warm edge; titles in the serif */
.view .wine, .view .tonight, .view .lots, .sugg-card { border-color: var(--page-line); }
.view .page-title, .view .section-head h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -.005em; }
.title-btn { background: var(--canvas); box-shadow: 0 0 0 1px var(--page-line); }

/* Cellar: nook's welcome — the mark, the day and season, a greeting for the time of day */
.view .eyebrow { margin: 12px 0 2px; font-size: var(--fs-caption); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.greeting { margin: 0 0 8px; font-family: var(--serif); font-size: var(--fs-hero); line-height: 1.1; font-weight: 600; letter-spacing: -.01em; }
.cellar-sum.after-greeting { margin: 0 0 14px; }
/* Vintages on the warm page: each country on its own white card, so the year tiles keep their contrast */
.vintages .vgroup { background: var(--canvas); border: 1px solid var(--page-line); border-radius: var(--r-md); padding: 12px 12px 4px; margin-bottom: 14px; }
.vintages .vgroup-head { margin-bottom: 6px; }
.vintages .vrow { border-top-color: var(--page-line); }
.vintages .vrow:first-of-type { border-top: 0; }

/* Tabs: each label reserves the width of its bold (active) version, so switching pages moves nothing */
.tab span { display: inline-flex; flex-direction: column; align-items: center; }
.tab span::after { content: attr(data-label); font-weight: 600; height: 0; visibility: hidden; overflow: hidden; pointer-events: none; }
/* Tonight's lists: no line above the first row (the card's own border is there) */
.tonight > .tonight-item:first-child, .tonight > .swipe:first-child .tonight-item { border-top: 0; }
/* Wishes: "Suggested for you" (or "Your wishes") is the page's first heading, in the page-title spot and size */
.wishlist-page > .section-head:first-child { margin: 4px 0 18px; }
.wishlist-page > .section-head:first-child h3 { font-size: var(--fs-title); }
/* Cellar: the greeting with a quiet gear beside it, centred on the line */
.greeting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.greeting-row .greeting { margin: 0; }
.settings-quiet { width: 36px; height: 36px; margin-right: -6px; background: none; color: var(--muted); box-shadow: none; }
.settings-quiet svg { width: 21px; height: 21px; }
.settings-quiet:active { background: var(--page-deep); }
/* Vintages (the page and the country cards): nothing to select, only tiles to slide over */
.vintages, .sheet[data-country] { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Wine and wish pages: the wine's name as a warm serif heading, the winery beneath; the region as label caps,
   the grapes in brown italic. Section headings in the same serif as the pages' headings. */
.detail-hero .eyebrow { font-size: var(--fs-label); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.detail-hero h2 { font-family: var(--serif); font-weight: 600; font-size: var(--fs-hero); line-height: 1.15; letter-spacing: -.005em; margin: 6px 0 4px; }
.detail-hero .wine-name { font-size: var(--fs-lead); font-weight: 500; color: var(--muted); }
.detail-hero .grapes { font-family: var(--serif); font-style: italic; font-size: var(--fs-body); color: var(--muted); }
.sheet .section-head h3, .about h4 { font-family: var(--serif); font-weight: 600; letter-spacing: -.005em; }

/* Filters: the drinking-window tiles have no icon row, so their label sits centred */
.seg-window button { justify-content: center; min-height: 56px; }
/* Match of the day: the dishes read like a menu */
.pair-dish b { font-family: var(--serif); font-style: italic; font-weight: 600; font-size: var(--fs-body); letter-spacing: 0; }
/* "Buy again" and other small tags: warm label caps, no grey pill */
.tag { background: none; padding: 0; margin-left: 8px; color: var(--muted); font-size: var(--fs-label); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
/* Tonight's bottles (Ready to open and Match of the day): winery, wine, then the details, each on its own line, like the cellar cards */
.tonight-title { white-space: normal; overflow: visible; }
.tonight-title span { display: block; margin-top: 1px; font-size: var(--fs-body); font-weight: 400; color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tonight-why { margin-top: 3px; }
.grape-report { margin: 4px 0 16px; font-size: var(--fs-small); color: var(--body); }
.grape-report h4 { margin: 12px 0 6px; font-size: var(--fs-body); font-weight: 600; color: var(--ink); }
.grape-report p { margin: 0 0 10px; line-height: 1.35; }
.grape-report small { display: block; font-size: var(--fs-caption); color: var(--muted); }

/* A right swipe ("Put back" on wishes from the cellar): its label on the left, the others hidden */
.swipe-bg .sw-back { display: none; align-items: center; gap: 8px; }
.swipe.swiping-right .swipe-bg { justify-content: flex-start; }
.swipe.swiping-right .sw-back { display: flex; }
.swipe.swiping-right .sw-drink, .swipe.swiping-right .sw-del { display: none; }

/* The bottle card: a small label, the wine in serif, the winery beneath; the question sits by the thumbs */
.atoast-kicker { font-size: var(--fs-label); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: color-mix(in srgb, var(--on-inverse) 55%, transparent); margin-bottom: 4px; }
.atoast-title { font-family: var(--serif); font-size: var(--fs-lead); font-weight: 600; line-height: 1.2; }
.atoast-sub { font-size: var(--fs-small); font-weight: 500; color: color-mix(in srgb, var(--on-inverse) 72%, transparent); margin-top: 2px; }
.atoast-ask { font-size: var(--fs-caption); font-weight: 500; color: color-mix(in srgb, var(--on-inverse) 60%, transparent); margin-right: 4px; }

/* Bulk refreshes on the server: the last run, its problems folded away */
.job-last { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--canvas); font-size: var(--fs-small); color: var(--body); }
.job-last > p { margin: 0; }
.job-problems { margin-top: 8px; }
.job-problems summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.job-problems p { margin: 10px 0 0; line-height: 1.35; }
.job-problems small { display: block; font-size: var(--fs-caption); color: var(--muted); }
.job-problems .btn { margin-top: 12px; }

/* Where the facts come from: quiet, on tap */
.ai-card .src { margin-top: 4px; font-size: var(--fs-caption); color: var(--muted-soft); }
.ai-card details.src summary { cursor: pointer; list-style: none; }
.ai-card details.src summary::-webkit-details-marker { display: none; }
.ai-card details.src span { display: block; margin-top: 2px; color: var(--muted); }
.lot-src { margin: -4px 4px 14px; font-size: var(--fs-caption); color: var(--muted-soft); }

/* Settings → AI usage */
.u-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; }
.u-head b { font-family: var(--serif); font-size: var(--fs-lead); font-weight: 500; color: var(--ink); }
.u-head .icon-btn { font-size: var(--fs-title); width: 40px; height: 40px; }
.u-head .icon-btn:disabled { opacity: .3; }
.u-total { text-align: center; margin: 4px 0 20px; }
.u-total span { display: block; font-family: var(--serif); font-size: var(--fs-display); color: var(--primary); line-height: 1.1; }
.u-total small { display: block; margin-top: 6px; font-size: var(--fs-caption); color: var(--muted); }
.u-list { border: 1px solid var(--hairline); border-radius: var(--r-md); background: var(--canvas); overflow: hidden; margin-bottom: 20px; }
.u-row { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border: 0; border-top: 1px solid var(--hairline); background: none; text-align: left; font: inherit; color: var(--body); }
.u-row:first-child { border-top: 0; }
.u-row .u-name { flex: 1; min-width: 0; }
.u-row b { display: block; font-weight: 600; color: var(--ink); font-size: var(--fs-body); }
.u-row small { display: block; font-size: var(--fs-caption); color: var(--muted); }
.u-row > span { font-variant-numeric: tabular-nums; font-size: var(--fs-body); color: var(--ink); }
.u-row > i { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--primary); opacity: .5; }
.u-month { cursor: pointer; }

/* Small helpers (instead of inline styles) */
.m0 { margin: 0; }
.lead-note { margin: 0 0 14px; } /* the short explanation at the top of a sheet */
.foot-note { margin: 16px 4px 0; }
.list-empty { padding: 14px 16px; margin: 0; } /* "Nothing yet" inside a list card */
.mt { margin-top: 24px; }
.mt-s { margin-top: 12px; }
.error-text { color: var(--error); }
.stack { display: grid; gap: 10px; margin-top: 16px; }
.center { text-align: center; }
.empty-state.compact { padding: 24px 8px; }
.head-spacer { min-width: 64px; }

/* Reduce motion (iPhone setting): no slides, pops or glides; spinners keep turning so loading still shows */
@media (prefers-reduced-motion: reduce) {
  *:not(.spinner):not(.rec-dot), *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Label caps: one style for every small uppercase label (the day above the greeting, the region above a
   wine, "Buy again", the bottle card's kicker, vintage sections). The wordmark's tagline is its wider cousin. */
.view .eyebrow, .detail-hero .eyebrow, .tag, .atoast-kicker, .vsection-head { font-size: var(--fs-label); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.view .eyebrow, .detail-hero .eyebrow, .tag, .vsection-head { color: var(--muted); }
