/* WLV Cellar – design tokens and base styles (CLAUDE.md §7, design/*.png) */

@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-latin.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-latin-ext.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  font-weight: 400 800; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-ext.woff2") format("woff2");
  font-weight: 400 800; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
    U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0,
    U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0F0D0E;
  --surface: #171415;
  --surface-2: #1C191A;
  --border: #2E2A2B;
  --text: #F2ECE4;
  --text-2: #A69C93;
  --muted: #8E857D;
  --gold: #D9B26A;
  --on-gold: #1A1411;
  --claret: #8E2B45;
  --delete: #B23A3A;
  --relocate: #3C5670;
  --edit: #4A4445;
  --heart: #EFA2B6;
  --saved: #86D1AB;

  --t-red: #D05A70;
  --t-white: #E6D48C;
  --t-rose: #EFA2B6;
  --t-sparkling: #A9CDE3;
  --t-sweet: #E3A24F;

  --d-now: #86D1AB;
  --d-later: #A3C0EA;
  --d-urgent: #F2A765;

  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-card: 16px;
  --r-input: 14px;
  --gutter: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.noscript { padding: 2rem; color: var(--text-2); }

/* --- building blocks ------------------------------------------------------ */

.serif { font-family: var(--serif); font-weight: 400; }
.mono { font-family: var(--mono); }
.gold { color: var(--gold); }
.muted { color: var(--muted); }

.input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;               /* >= 16px: no zoom on iOS */
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  outline: none;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--gold); }
.input.needs-input { border-color: var(--gold); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: var(--r-input);
  font-weight: 700; letter-spacing: .02em;
}
.btn-gold { background: var(--gold); color: var(--on-gold); }
.btn-claret { background: var(--claret); color: var(--text); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

.icon { width: 1.2em; height: 1.2em; flex: none; }

.error-text { color: var(--d-urgent); font-size: 14px; }

/* --- login ------------------------------------------------------------------ */

.login {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: calc(var(--safe-top) + 24px) var(--gutter) calc(var(--safe-bottom) + 24px);
}
.login form { width: min(100%, 360px); display: grid; gap: 16px; }
.login h1 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 64px; line-height: 1; }
.login .sub { margin: -8px 0 16px; color: var(--text-2); }

/* --- app shell ---------------------------------------------------------------- */

.shell { min-height: 100dvh; }
.home {
  max-width: 720px; margin: 0 auto;
  padding: calc(var(--safe-top) + 28px) var(--gutter) calc(var(--safe-bottom) + 112px);
}
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.page-head h1 {
  margin: 0; flex: 1; font-family: var(--serif); font-weight: 400;
  font-size: 52px; line-height: 1; letter-spacing: -.01em;
}
.page-head .totals { color: var(--text-2); font-size: 15px; white-space: nowrap; }

.boot { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.notice { padding: 24px 4px; color: var(--text-2); }
.empty { padding: 40px 0; text-align: center; color: var(--text-2); display: grid; gap: 12px; justify-items: center; }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--text-2);
}
.link-btn {
  border: 0; background: none; padding: 6px 0; color: var(--text-2);
  font-size: 14px; font-weight: 600;
}
.link-btn.gold, .link-btn.on { color: var(--gold); }

/* menu */
.menu { position: relative; }
.menu-pop {
  position: absolute; right: 0; top: 46px; z-index: 30; min-width: 190px;
  padding: 6px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-input); box-shadow: 0 12px 32px rgb(0 0 0 / .5);
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px;
  border: 0; border-radius: 10px; background: none; color: var(--text);
  text-decoration: none; font-size: 15px; font-weight: 600; text-align: left;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface); }

/* search */
.search-box {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; min-height: 52px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-input);
  color: var(--text-2);
}
.search-box:focus-within { border-color: var(--gold); }
.search-box input {
  flex: 1; min-width: 0; height: 50px; border: 0; outline: none; background: none;
  font-size: 17px; color: var(--text);
}
.search-box input::placeholder { color: var(--muted); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear {
  display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: var(--border); color: var(--text);
}
.search-clear .icon { width: 16px; height: 16px; }
.search-hint { margin: 8px 2px 18px; color: var(--muted); font-size: 13px; }
.hint-example {
  border: 0; background: none; padding: 0; font-size: 13px; color: var(--text); font-weight: 600;
}

/* filter tabs + chips */
.tabs {
  display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 0 12px; border: 0; background: none; color: var(--text-2);
  font-size: 16px; font-weight: 600; white-space: nowrap;
}
.tab .icon { width: 16px; height: 16px; }
.tab.on { color: var(--text); }
.tab.on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--gold); border-radius: 2px;
}
.tab[aria-pressed="true"] { color: var(--heart); }
.tab[aria-pressed="true"]::after { display: none; }
.tab.has::before {
  content: ""; position: absolute; top: 8px; right: -8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--gold);
}

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding: 14px var(--gutter) 4px;
}
.chips::-webkit-scrollbar { display: none; }
.chips-empty { padding: 10px 0; font-size: 14px; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-size: 15px; font-weight: 600; white-space: nowrap;
}
.chip.on { background: var(--text); color: var(--on-gold); border-color: var(--text); }
.chip-count { color: var(--muted); font-size: 12px; font-weight: 600; }
.chip.on .chip-count { color: #6b625a; }
.chip-icon .icon, .chip-star .icon { width: 16px; height: 16px; display: block; }
.chip-star { color: var(--gold); }

.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.dot-red { background: var(--t-red); }
.dot-white { background: var(--t-white); }
.dot-rose { background: var(--t-rose); }
.dot-sparkling { background: var(--t-sparkling); }
.dot-sweet { background: var(--t-sweet); }

.result-line {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 14px 2px 10px; color: var(--text-2); font-size: 14px;
}
.result-actions { display: flex; gap: 16px; }

/* list */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.row { position: relative; border-radius: var(--r-card); }
.row-main {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 12px 16px 12px 12px; border: 1px solid transparent; border-radius: var(--r-card);
  background: var(--surface); text-align: left;
}
.row.selected .row-main { border-color: var(--gold); }
.row-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.row-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.winery {
  font-size: 18px; font-weight: 700; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vintage { color: var(--gold); font-size: 17px; font-weight: 600; flex: none; }
.row-sub { color: var(--text-2); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; align-items: center; gap: 10px; min-height: 26px; }
.fav { color: var(--heart); display: inline-flex; }
.fav .icon { width: 16px; height: 16px; }
.row-count { flex: none; display: grid; justify-items: end; min-width: 52px; }
.row-count strong { font-size: 22px; font-weight: 700; line-height: 1.1; }
.row-count span { color: var(--text-2); font-size: 13px; }

/* tile */
.tile {
  --tc: var(--muted);
  flex: none; width: 52px; height: 52px; border-radius: 10px;
  display: grid; place-items: center; align-content: center;
  background: color-mix(in srgb, var(--tc) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tc) 22%, transparent);
  color: var(--tc); font-family: var(--serif); font-size: 26px; line-height: 1;
}
.tile-lg { width: 104px; height: 140px; border-radius: 14px; font-size: 48px; gap: 10px; }
.tile-caption { font-family: var(--sans); font-size: 11px; color: var(--text-2); }
.tile-red { --tc: var(--t-red); }
.tile-white { --tc: var(--t-white); }
.tile-rose { --tc: var(--t-rose); }
.tile-sparkling { --tc: var(--t-sparkling); }
.tile-sweet { --tc: var(--t-sweet); }

/* stars + pills */
.stars { display: inline-flex; gap: 2px; }
.stars .icon { width: 15px; height: 15px; stroke-width: 0; }
.stars .on { color: var(--gold); }
.stars .off { color: var(--border); }
.stars-lg .icon { width: 22px; height: 22px; }

.pill {
  --pc: var(--text-2);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
  color: var(--pc); background: color-mix(in srgb, var(--pc) 15%, transparent);
}
.pill .icon { width: 14px; height: 14px; }
.pill-plain { padding: 0; background: none; font-size: inherit; }
.pill-plain .icon { width: 1.1em; height: 1.1em; }
.drink-now { --pc: var(--d-now); color: var(--d-now); }
.drink-later { --pc: var(--d-later); color: var(--d-later); }
.drink-urgent { --pc: var(--d-urgent); color: var(--d-urgent); }

/* floating add button */
.fab {
  position: fixed; z-index: 20;
  right: max(var(--gutter), calc((100vw - 720px) / 2 + var(--gutter)));
  bottom: calc(var(--safe-bottom) + 24px);
  width: 64px; height: 64px; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: var(--on-gold); box-shadow: 0 10px 28px rgb(0 0 0 / .55);
}
.fab .icon { width: 30px; height: 30px; stroke-width: 2.2; }

/* overlay (detail / edit / new) */
.overlay {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: var(--bg);
  padding: calc(var(--safe-top) + 20px) var(--gutter) calc(var(--safe-bottom) + 40px);
}
.shell.has-overlay .home { visibility: hidden; }

/* --- detail ------------------------------------------------------------------ */

.detail { max-width: 720px; margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 20px; }
.back-link {
  display: inline-flex; align-items: center; gap: 2px; margin-left: -6px;
  border: 0; background: none; color: var(--gold); font-size: 18px; font-weight: 600;
}
.back-link .icon { width: 24px; height: 24px; }
.topbar-actions { display: flex; gap: 10px; }
.round-btn {
  display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
}
.round-btn.fav-on { color: var(--heart); }

.hero { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; }
.hero-text { min-width: 0; display: grid; gap: 4px; justify-items: start; }
.type-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px;
  border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600;
}
.hero-winery { margin: 2px 0 0; font-family: var(--serif); font-weight: 400; font-size: 38px; line-height: 1.02; }
.hero-name { margin: 0; color: var(--text-2); font-size: 17px; }
.hero-vintage { margin: 2px 0 0; color: var(--gold); font-size: 30px; font-weight: 700; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.fact {
  display: grid; gap: 4px; align-content: start; min-width: 0;
  padding: 12px 14px; border-radius: var(--r-card); background: var(--surface);
}
.fact-label { color: var(--text-2); font-size: 13px; }
.fact-value { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.fact-sub { color: var(--muted); font-size: 13px; }

.rating-input { gap: 0; margin-left: -4px; }
.rating-input button { border: 0; background: none; padding: 2px 4px; line-height: 0; }

.notes-card { padding: 12px 14px; border-radius: var(--r-card); background: var(--surface); margin-bottom: 26px; }
.notes-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.notes-input {
  width: 100%; margin-top: 6px; padding: 0; border: 0; outline: none; resize: none;
  background: none; font-size: 16px; line-height: 1.45; min-height: 48px;
}
.notes-input::placeholder { color: var(--text-2); }
.save-status { font-size: 12px; color: var(--muted); }
.save-status.ok { color: var(--saved); }
.save-status.err { color: var(--d-urgent); }

.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 0 0 12px; font-size: 20px; font-weight: 700;
}
.section-head span { color: var(--text-2); font-size: 15px; font-weight: 500; }

.bottles { margin-bottom: 26px; }
.bottle-card {
  display: grid; gap: 10px; padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface);
}
.bottle-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.slot-code { font-size: 30px; font-weight: 700; letter-spacing: .04em; line-height: 1.1; }
.slot-desc { color: var(--text-2); font-size: 13px; text-align: right; max-width: 12em; }
.bottle-info {
  display: flex; justify-content: space-between; gap: 12px; padding: 0;
  border: 0; background: none; color: var(--text-2); font-size: 14px; text-align: left;
}
.bottle-code { color: var(--muted); font-size: 12px; }
.bottle-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.bottle-actions .btn { min-height: 52px; }
.bottle-edit { display: grid; gap: 10px; padding: 12px 0 2px; border-top: 1px solid var(--border); }
.bottle-edit label { display: grid; gap: 6px; }
.field-label { color: var(--text-2); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.consumed-row {
  display: flex; justify-content: space-between; padding: 14px 16px; margin-bottom: 8px;
  border-radius: var(--r-card); background: var(--surface); color: var(--text-2);
}

/* --- swipe rows ------------------------------------------------------------------ */

.row { overflow: hidden; }
.row-main {
  position: relative; z-index: 1;
  touch-action: pan-y;                       /* vertical scroll stays native */
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.row-actions {
  position: absolute; top: 0; bottom: 0; display: flex; border-radius: var(--r-card); overflow: hidden;
  visibility: hidden;
}
.row[data-reveal="left"] .row-actions.left,
.row[data-reveal="right"] .row-actions.right { visibility: visible; }
.row-actions.left { left: 0; width: 192px; }
.row-actions.right { right: 0; width: 252px; }
.swipe-btn {
  flex: 1; display: grid; place-items: center; align-content: center; gap: 8px;
  border: 0; font-size: 13px; font-weight: 800; letter-spacing: .03em; color: var(--text);
}
.swipe-btn .icon { width: 24px; height: 24px; }
.a-locate { background: var(--gold); color: var(--on-gold); }
.a-consume { background: var(--claret); }
.a-relocate { background: var(--relocate); }
.a-edit { background: var(--edit); }
.a-delete { background: var(--delete); }
.swipe-btn:disabled { opacity: .45; }

/* --- sheets ----------------------------------------------------------------------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgb(0 0 0 / .55); animation: fade .15s ease;
}
.sheet {
  width: min(100%, 560px); max-height: 92dvh; overflow-y: auto; outline: none;
  padding: 10px var(--gutter) calc(var(--safe-bottom) + 18px);
  background: var(--surface); border: 1px solid var(--border); border-bottom: 0;
  border-radius: 22px 22px 0 0; animation: slide-up .2s ease;
}
@media (min-width: 700px) {
  .sheet-backdrop { align-items: center; }
  .sheet { border-radius: 22px; border-bottom: 1px solid var(--border); }
}
.sheet-grip { width: 40px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--border); }
.sheet-title { margin: 0 0 2px; font-size: 20px; font-weight: 700; }
.sheet-sub { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.sheet-cancel { width: 100%; margin-top: 14px; }
.sheet-buttons { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 16px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-up { from { transform: translateY(40px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet-backdrop, .toast { animation: none; }
}

.pick-list { display: grid; gap: 8px; }
.pick-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-input);
  background: var(--surface-2); text-align: left;
}
.pick-slot { font-size: 20px; font-weight: 700; }
.pick-meta { color: var(--text-2); font-size: 13px; text-align: right; }

.locate-slot { margin: 8px 0 4px; text-align: center; font-size: 52px; font-weight: 700; letter-spacing: .05em; color: var(--gold); }
.locate-desc { margin: 0; text-align: center; color: var(--text); }
.locate-note { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.menu-action {
  display: grid; place-items: center; gap: 8px; min-height: 84px; border: 0; border-radius: var(--r-input);
  color: var(--text); font-size: 14px; font-weight: 700;
}
.menu-action .icon { width: 24px; height: 24px; }
.menu-action:disabled { opacity: .4; }

/* slot picker */
.slot-picker { display: grid; gap: 10px; }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.segmented button {
  min-height: 52px; border: 1px solid var(--border); border-radius: var(--r-input);
  background: var(--surface-2); font-size: 20px; font-weight: 700;
}
.segmented button.on { background: var(--text); color: var(--on-gold); border-color: var(--text); }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 4px; }
.steppers > div { display: grid; gap: 8px; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.stepper > button:not(.stepper-value) {
  display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
}
.stepper-value {
  min-width: 56px; padding: 6px 4px; border: 0; background: none; text-align: center;
  font-size: 24px; font-weight: 700;
}
.stepper-input {
  width: 64px; padding: 6px 4px; text-align: center; font-size: 22px; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--gold); border-radius: 10px; outline: none;
}
.slot-preview { margin-top: 8px; text-align: center; font-size: 44px; font-weight: 700; letter-spacing: .05em; }
.slot-preview.none { color: var(--muted); font-size: 28px; }
.slot-hint { margin: -4px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.slot-clear { justify-self: center; }
.slot-warning {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 0; color: var(--d-urgent); font-size: 14px;
}

/* --- toast ------------------------------------------------------------------------- */

.toast {
  position: fixed; z-index: 50;               /* below sheets (60) */ left: 50%; translate: -50% 0;   /* not transform: the slide-in animation uses that */
  bottom: calc(var(--safe-bottom) + 20px); width: min(calc(100% - 2 * var(--gutter)), 560px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 14px 18px; border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--surface-2); box-shadow: 0 12px 32px rgb(0 0 0 / .55);
  animation: slide-up .2s ease;
}
.toast-error { border-color: var(--d-urgent); }
.toast-text { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-undo { border: 0; background: none; color: var(--gold); font-size: 16px; font-weight: 800; padding: 4px 2px; }
.toast-close { border: 0; background: none; color: var(--muted); padding: 2px; display: grid; }

/* --- form (new / edit) -------------------------------------------------------------- */

.form-page { max-width: 640px; margin: 0 auto; display: grid; gap: 18px; }
.form-head { display: grid; grid-template-columns: 46px 1fr auto; align-items: center; gap: 12px; }
.form-title { margin: 0; text-align: center; font-family: var(--serif); font-weight: 400; font-size: 30px; }
.form-status { min-width: 70px; text-align: right; }
.form-status .save-status.ok { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 700; }
.form-status .icon { width: 16px; height: 16px; }
.form-alert {
  padding: 12px 14px; border: 1px solid var(--gold); border-radius: var(--r-input);
  background: color-mix(in srgb, var(--gold) 10%, transparent); font-size: 14px;
}
.form-hint { margin: -8px 0 0; text-align: center; color: var(--muted); font-size: 13px; }
.field { display: grid; gap: 8px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-note { display: block; color: var(--muted); font-size: 13px; }
.field-note.center { text-align: center; }
.req { color: var(--gold); }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip-row::-webkit-scrollbar { display: none; }

.year-strip {
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
  margin: 0 calc(-1 * var(--gutter)); padding: 10px var(--gutter);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.year-strip::-webkit-scrollbar { display: none; }
.year {
  flex: none; scroll-snap-align: center; min-width: 64px; padding: 8px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--text-2); font-size: 18px; font-weight: 600;
}
.year.on { background: var(--text); color: var(--on-gold); }

.stepper-pill { gap: 14px; padding: 6px; border-radius: 999px; background: var(--surface-2); }
.stepper-pill > button:not(.stepper-value) { background: var(--surface); }
.stepper-inline { justify-content: flex-start; gap: 14px; }

.price-value {
  justify-self: start; padding: 0; border: 0; background: none;
  color: var(--gold); font-size: 34px; font-weight: 800;
}
.price-input { font-size: 22px; font-weight: 700; max-width: 180px; }
.slider { width: 100%; accent-color: var(--gold); height: 28px; }

.stars-xl .icon { width: 30px; height: 30px; }
.rating-input.stars-xl { gap: 6px; }
.rating-input.stars-xl button {
  padding: 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}

.drink-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.drink-tile {
  display: grid; place-items: center; gap: 6px; min-height: 78px;
  border: 1px solid var(--border); border-radius: var(--r-input); background: var(--surface);
  font-size: 15px; font-weight: 700; color: var(--pc);
}
.drink-tile .icon { width: 22px; height: 22px; }
.drink-tile.on { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 12%, var(--surface)); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 12px 14px; border: 0; border-radius: var(--r-input); background: var(--surface);
}
.toggle-label { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.toggle-label .icon { color: var(--heart); }
.switch { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--border); transition: background .15s; }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--text); transition: transform .15s;
}
.switch.on { background: var(--heart); }
.switch.on::after { transform: translateX(20px); }
.notes-area { resize: vertical; min-height: 110px; line-height: 1.45; }

.location-card {
  display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--r-card); background: var(--surface);
}
.location-title { margin: 0; font-size: 20px; font-weight: 700; }
.add-btn { width: 100%; min-height: 56px; font-size: 17px; }
.add-more { width: 100%; }
.sheet .field + .field, .sheet .field-row + .field { margin-top: 14px; }
.sheet .location-card { margin-top: 16px; }

/* --- wide screens: list | detail, and filters | list | detail ------------------------ */

.filter-panel, .overlay.placeholder { display: none; }

@media (min-width: 900px) {
  .shell {
    display: grid; grid-template-columns: minmax(380px, 1fr) minmax(440px, 1.15fr);
    height: 100dvh; overflow: hidden;
  }
  .shell.has-overlay .home { visibility: visible; }
  .home {
    max-width: none; width: 100%; height: 100dvh; overflow-y: auto; margin: 0;
    padding-bottom: 0;              /* sticky "+" measures from the padding edge */
  }
  .overlay {
    position: relative; inset: auto; z-index: auto; height: 100dvh;
    border-left: 1px solid var(--border);
  }
  .overlay.placeholder { display: grid; place-items: center; color: var(--muted); }
  /* the list column scrolls by itself: keep "+" at its bottom-right corner */
  .home-main .fab { position: sticky; right: auto; bottom: calc(var(--safe-bottom) + 24px); margin: 20px 0 0 auto; }
}

@media (min-width: 1280px) {
  .shell { grid-template-columns: minmax(600px, 1.35fr) minmax(460px, 1fr); }
  .home { display: grid; grid-template-columns: 250px 1fr; gap: 28px; align-items: start; }
  .filter-panel {
    display: grid; gap: 18px; align-content: start; position: sticky; top: 0;
    max-height: 100dvh; overflow-y: auto; padding: calc(var(--safe-top) + 34px) 4px 40px 0;
  }
  .home .tabs, .home .chips { display: none; }
  .panel-title { margin: 0; font-size: 20px; font-weight: 700; }
  .panel-group { display: grid; gap: 10px; }
  .panel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .panel-chips .chip { min-height: 34px; padding: 0 12px; font-size: 14px; }
  .panel-fav { justify-self: start; }
  .panel-fav .icon { color: var(--heart); width: 16px; height: 16px; }
}

/* --- label photos ---------------------------------------------------------------------- */

.tile-photo { padding: 0; overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.tile-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
button.tile-photo { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; cursor: zoom-out;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px);
  background: rgb(0 0 0 / .9); animation: fade .15s ease;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

.label-card {
  display: flex; gap: 14px; align-items: center; padding: 12px;
  border: 1px solid var(--border); border-radius: var(--r-card); background: var(--surface);
}
.label-thumb {
  position: relative; flex: none; width: 88px; height: 112px; padding: 0; overflow: hidden;
  display: grid; place-items: center; align-content: center; gap: 6px;
  border: 1px solid color-mix(in srgb, var(--t-white) 25%, transparent); border-radius: 12px;
  background: color-mix(in srgb, var(--t-white) 10%, var(--surface)); color: var(--t-white);
  font-size: 11px;
}
.label-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.label-thumb span { color: var(--text-2); }
.label-card.busy .label-thumb img { opacity: .45; }
.spinner {
  position: absolute; width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid rgb(255 255 255 / .25); border-top-color: var(--gold); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.label-text { min-width: 0; display: grid; gap: 4px; }
.label-title { margin: 0; font-weight: 700; }
.label-sub { margin: 0; color: var(--text-2); font-size: 13px; }
.label-sub.err { color: var(--d-urgent); }
.label-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.label-actions .icon { width: 15px; height: 15px; }
.found { color: var(--gold); letter-spacing: 0; }
.field-hint { color: var(--gold); font-size: 13px; }

/* --- QR sticker sheets (Avery L7651) -----------------------------------------------------
   Everything is a fraction of the 210 mm sheet width (cqw = 1 % of it), so the preview and
   the print are identical. Label 38.1 × 21.2 mm, 5 × 13, margins 10.7 / 5.75 mm, gap 2 mm. */

.stickers-page { padding: calc(var(--safe-top) + 20px) var(--gutter) calc(var(--safe-bottom) + 40px); }
.st-controls { max-width: 640px; margin: 0 auto 24px; display: grid; gap: 16px; }
.st-title { text-align: left; }
.st-summary { margin: 0; font-weight: 700; }
.print-area { display: grid; gap: 24px; justify-items: center; }

.a4 {
  container-type: inline-size;
  width: min(100%, 720px); aspect-ratio: 210 / 297; background: #fff; color: #000;
  box-shadow: 0 8px 30px rgb(0 0 0 / .5); overflow: hidden;
}
.a4-grid {
  display: grid; grid-template-columns: repeat(5, calc(38.1cqw * 100 / 210));
  column-gap: calc(2cqw * 100 / 210); row-gap: 0;
  padding: calc(10.7cqw * 100 / 210) calc(5.75cqw * 100 / 210);
  transform: translate(calc(var(--dx, 0) * 1cqw * 100 / 210), calc(var(--dy, 0) * 1cqw * 100 / 210));
}
.st-label {
  /* QR quiet zone ≈ 4 modules (≈ 3 mm): 2.5 mm to the sticker edge, 3.2 mm to the text */
  aspect-ratio: 38.1 / 21.2; display: flex; align-items: center; gap: calc(3.2cqw * 100 / 210);
  padding: 0 calc(2.5cqw * 100 / 210);
  outline: 1px dashed rgb(0 0 0 / .12); outline-offset: -1px;   /* screen only, see print */
}
.st-qr { height: 72%; aspect-ratio: 1; image-rendering: pixelated; }
.st-code {
  font-family: var(--mono); font-weight: 700; letter-spacing: .02em;
  font-size: calc(3cqw * 100 / 210); white-space: nowrap;
}

@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff; }
  .st-controls { display: none; }
  .stickers-page { padding: 0; }
  .print-area { display: block; }
  .a4 { width: 210mm; box-shadow: none; break-after: page; }
  .a4:last-child { break-after: auto; }
  .st-label { outline: none; }
}

/* --- guest view ------------------------------------------------------------------------ */

.guest-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: -6px 0 14px; padding: 10px 14px; border: 1px solid var(--gold); border-radius: var(--r-input);
  background: color-mix(in srgb, var(--gold) 8%, transparent); font-size: 14px;
}
.wish-btn {
  width: 100%; margin-bottom: 16px; min-height: 52px;
  border: 1px solid var(--gold); background: transparent; color: var(--gold);
}
.wish-btn.on { background: var(--gold); color: var(--on-gold); }
.wished-pill { --pc: var(--gold); }
.name-form { display: grid; gap: 12px; }

/* active filters in plain words ("Germany or Austria · White") */
.filter-summary { margin: 14px 2px -8px; color: var(--text); font-size: 14px; font-weight: 600; }

/* --- fridges (same look as the app and HA) ------------------------------------------------ */
.fridges-page { padding: calc(var(--safe-top) + 20px) var(--gutter) calc(var(--safe-bottom) + 40px); }
.fridges-page .page-head .totals { white-space: normal; font-size: 13px; color: var(--muted); }
.fridge-picker { max-width: 560px; margin: 0 auto 18px; }
.fridge-picker button { min-height: 40px; font-size: 14px; font-weight: 600; padding: 0 6px; }
.fridge-wall { display: grid; justify-content: center; gap: 22px; }
.fridge-col { display: none; width: min(100%, 520px); }
.fridge-col.current { display: block; }
@media (min-width: 1100px) {
  /* the whole wine wall side by side */
  .fridge-picker { display: none; }
  .fridge-wall { grid-template-columns: repeat(4, minmax(240px, 1fr)); align-items: start; justify-content: stretch; }
  .fridge-col { display: block; width: auto; }
}
.cabinet { margin: 0; }
.cabinet svg { display: block; width: 100%; height: auto; }
.cabinet .fridge-name { font-size: 14px; font-weight: 600; fill: var(--text-2); }
.cabinet .fridge-display { font: 11px var(--mono); fill: var(--gold); }
.cabinet .shelf-no { font: 11px var(--mono); fill: var(--muted); }
.cabinet .chip-no { font-size: 10px; fill: var(--gold); }
.cabinet .bottle { cursor: pointer; outline: none; }
.cabinet .bottle:hover .hit, .cabinet .bottle:focus-visible .hit { stroke: var(--gold); stroke-width: 2; }
.unplaced-list { margin-top: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; font-size: 14px; }
.unplaced-list p { margin: 0 0 6px; color: var(--text-2); }
.unplaced-list ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.unplaced-list a { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; }
.unplaced-list a:hover { color: var(--gold); }
.slot-link { color: inherit; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.slot-link:hover { color: var(--gold); }
