/* Ma cave — styles mobile-first (SPEC §5). Palette en variables CSS, clair/sombre. */

:root {
  color-scheme: light dark;
  --bg: #F7F1E8;
  --card: #FFFFFF;
  --ink: #2B1D1F;
  --muted: #6E5F61;
  --primary: #6B1F2B;
  --on-primary: #FFFFFF;
  --accent: #C9A45C;
  --btn-bg: #6B1F2B;
  --btn-fg: #FFFFFF;
  --line: rgba(43, 29, 31, 0.12);
  --line-strong: rgba(43, 29, 31, 0.28);
  --danger: #A32626;
  --warn: #C2660F;
  --toast-bg: #2B1D1F;
  --toast-fg: #F7F1E8;
  --toast-error-bg: #A32626;
  --toast-error-fg: #FFFFFF;
  --badge-urgent-bg: #FBE7D6;  --badge-urgent-fg: #7A3E0D;
  --badge-ready-bg: #DDEFE3;   --badge-ready-fg: #1F4B34;
  --badge-keep-bg: #EDE6E7;    --badge-keep-fg: #4A3D3F;
  --badge-unknown-bg: #F1E9D2; --badge-unknown-fg: #6B5320;
  --badge-low-bg: #F8DADA;     --badge-low-fg: #7A1D1D;
  --wine-rouge: #7A1F2B;
  --wine-blanc: #EFE2A8;
  --wine-rose: #F2A9B4;
  --wine-effervescent: #F6EBC3;
  --wine-doux: #C98B2A;
  --wine-autre: #A09A9B;
  --tabbar-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 29, 31, 0.06), 0 4px 12px rgba(43, 29, 31, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1214;
    --card: #26191C;
    --ink: #F3EAE6;
    --muted: #B3A3A5;
    --primary: #D98A96;
    --on-primary: #1A1214;
    --accent: #D9B76A;
    --btn-bg: #6B1F2B;
    --btn-fg: #F3EAE6;
    --line: rgba(243, 234, 230, 0.12);
    --line-strong: rgba(243, 234, 230, 0.30);
    --danger: #F2A0A0;
    --warn: #F0A35E;
    --toast-bg: #F3EAE6;
    --toast-fg: #1A1214;
    --toast-error-bg: #7A1D1D;
    --toast-error-fg: #F3EAE6;
    --badge-urgent-bg: #4A2A10;  --badge-urgent-fg: #F5C89A;
    --badge-ready-bg: #1E3A2B;   --badge-ready-fg: #A8D9BA;
    --badge-keep-bg: #3A2F31;    --badge-keep-fg: #CFC2C4;
    --badge-unknown-bg: #3E3320; --badge-unknown-fg: #E2CE95;
    --badge-low-bg: #4A1E1E;     --badge-low-fg: #F2B3B3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.25);
  }
}

/* ------------------------------------------------------------------ base */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.35 -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-weight: 600; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0 0 8px; }
a { color: var(--primary); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.help { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.noscript { padding: 24px; text-align: center; }

.clamp2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  opacity: 0;
  pointer-events: none;
}

/* ------------------------------------------------------------------ mise en page */

#app { min-height: 100vh; }

.screen {
  padding: calc(12px + var(--safe-t)) 16px calc(var(--tabbar-h) + var(--safe-b) + 96px);
  max-width: 720px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.page-head .stats { color: var(--muted); font-size: 15px; margin: 0; }

.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tab {
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 2px 0;
  cursor: pointer;
}
.tab svg { width: 22px; height: 22px; flex: none; }
.tab[aria-current="page"] { color: var(--primary); }
.tab:active { opacity: 0.6; }

.fab {
  position: fixed;
  right: 16px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  z-index: 41;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 20px 0 16px;
  border: 0;
  border-radius: 26px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.fab svg { width: 24px; height: 24px; }
.fab:active { transform: scale(0.97); filter: brightness(0.9); }

/* ------------------------------------------------------------------ icônes SVG */

.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ boutons */

.btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  color: var(--ink);
  background: var(--card);
}
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn.secondary { background: var(--card); color: var(--primary); border-color: var(--primary); }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.block { width: 100%; }
/* Variante compacte : padding réduit seulement (cible 44 px et 16 px conservés, SPEC §5). */
.btn.small { padding: 0 14px; font-size: 16px; }
.btn:active { transform: scale(0.98); filter: brightness(0.92); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; filter: none; }
.btn.busy { color: transparent; }
.btn.busy::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: var(--btn-fg) transparent var(--btn-fg) transparent;
  animation: spin 0.8s linear infinite;
}
.btn.secondary.busy::after, .btn.ghost.busy::after { border-color: var(--primary) transparent var(--primary) transparent; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.btn-row .btn { flex: 1 1 140px; }

.icon-btn {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--ink);
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.icon-btn:active { background: var(--line); }

@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}
.spinner.big { width: 44px; height: 44px; border-width: 3px; }

/* ------------------------------------------------------------------ formulaires */

input, select, textarea, button { font-size: 16px; font-family: inherit; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
textarea { padding: 10px 12px; resize: vertical; min-height: 88px; }
select {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
input.flag { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: searchfield-cancel-button; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-hint { font-size: 13px; color: var(--muted); }
.field-hint.warn { color: var(--warn); font-weight: 600; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; margin: 4px 0 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--primary);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  flex: none;
}
.stepper-btn:disabled { opacity: 0.4; }
.stepper-btn:active { background: var(--line); }
.stepper input.stepper-input { width: 64px; text-align: center; font-weight: 600; }

details.advanced { border-top: 1px solid var(--line); padding-top: 4px; }
details.advanced > summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; color: var(--primary); cursor: pointer; list-style: none; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "▸"; margin-right: 8px; transition: transform 0.15s; }
details.advanced[open] > summary::before { transform: rotate(90deg); }
details.advanced .form { padding-top: 8px; }

/* ------------------------------------------------------------------ cartes, listes */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.tappable { cursor: pointer; }
.tappable:active { filter: brightness(0.95); }

.bottle-card { display: flex; align-items: flex-start; gap: 10px; min-height: 64px; }
.bottle-card .dot { margin-top: 4px; }
.card-main { flex: 1; min-width: 0; }
.card-title { font-size: 17px; font-weight: 700; }
.card-sub { color: var(--ink); font-size: 15px; margin-top: 2px; }
.card-meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.card-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }

.group-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 6px;
  margin: 4px 0 4px;
  background: var(--bg);
  font-weight: 700;
  font-size: 15px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--muted);
  flex: none;
  display: inline-block;
}
.dot[data-color="rouge"] { background: var(--wine-rouge); }
.dot[data-color="blanc"] { background: var(--wine-blanc); }
.dot[data-color="rose"] { background: var(--wine-rose); }
.dot[data-color="effervescent"] { background: var(--wine-effervescent); }
.dot[data-color="doux"] { background: var(--wine-doux); }
.dot[data-color="autre"] { background: var(--wine-autre); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.3;
}
.badge.urgent { background: var(--badge-urgent-bg); color: var(--badge-urgent-fg); }
.badge.ready { background: var(--badge-ready-bg); color: var(--badge-ready-fg); }
.badge.keep { background: var(--badge-keep-bg); color: var(--badge-keep-fg); }
.badge.unknown { background: var(--badge-unknown-bg); color: var(--badge-unknown-fg); }
.badge.low { background: var(--badge-low-bg); color: var(--badge-low-fg); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty .empty-title { color: var(--ink); font-size: 18px; font-weight: 600; }

.callout {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 15px;
  background: var(--badge-keep-bg);
  color: var(--badge-keep-fg);
}
.callout.warn { background: var(--badge-urgent-bg); color: var(--badge-urgent-fg); }
.callout.info { background: var(--badge-unknown-bg); color: var(--badge-unknown-fg); }
.callout.ok { background: var(--badge-ready-bg); color: var(--badge-ready-fg); }
.callout .radio-row label { color: inherit; }

/* Sections repliables (À boire) */
details.section { margin-bottom: 8px; }
details.section > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  list-style: none;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: "▾"; color: var(--muted); transition: transform 0.15s; }
details.section:not([open]) > summary::before { transform: rotate(-90deg); }
details.section > summary .count { color: var(--muted); font-weight: 600; font-size: 15px; }

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
}
.row .row-main { flex: 1; min-width: 0; }
.row .reason { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Barre de fenêtre (timeline) */
.wchart { margin: 10px 0 6px; }
.wbar-legend { font-size: 13px; color: var(--muted); margin-top: 4px; }
.mchart { display: block; width: 100%; height: auto; overflow: visible; font-family: inherit; }
.mchart .area { opacity: 0.18; }
.mchart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mchart.ready .area, .mchart.ready .nowdot { fill: var(--badge-ready-fg); }
.mchart.ready .line { stroke: var(--badge-ready-fg); }
.mchart.urgent .area, .mchart.urgent .nowdot { fill: var(--badge-urgent-fg); }
.mchart.urgent .line { stroke: var(--badge-urgent-fg); }
.mchart.keep .area, .mchart.keep .nowdot { fill: var(--badge-keep-fg); }
.mchart.keep .line { stroke: var(--badge-keep-fg); }
.mchart .peak { fill: var(--accent); opacity: 0.28; }
.mchart .axis { stroke: var(--line-strong); stroke-width: 1; }
.mchart .tick { stroke: var(--muted); stroke-width: 1; }
.mchart .lbl { font-size: 11px; fill: var(--muted); }
.mchart .peak-lbl { fill: var(--ink); font-weight: 600; }
.mchart .vint { fill: var(--muted); }
.mchart .now { stroke: var(--primary); stroke-width: 1.5; stroke-dasharray: 3 3; }
.mchart .nowdot { stroke: var(--card); stroke-width: 1.5; }
.mchart .nowlbl { font-size: 11px; font-weight: 700; fill: var(--primary); }
.mchart.mini { width: 96px; height: 16px; flex: none; }
.mchart.mini .now { stroke-width: 1.2; stroke-dasharray: 2 2; }
.card-side .mchart.mini { margin-top: 2px; }
.mdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.mdot.urgent { background: var(--badge-urgent-fg); }
.mdot.ready { background: var(--badge-ready-fg); }
.mdot.keep { background: var(--badge-keep-fg); }
.mdot.unknown { background: var(--badge-unknown-fg); }
.chip-count { font-size: 13px; opacity: 0.7; margin-left: 2px; }
.chips + .chips { padding-top: 0; }
.row-main .mchart.mini { margin-top: 6px; }

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

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: var(--safe-t);
}
.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 56px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.sheet-title { flex: 1; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 48px; text-align: center; }
.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px 32px;
}
.sheet-foot {
  flex: none;
  display: flex;
  gap: 12px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: var(--card);
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.sheet-foot:empty { display: none; }
.sheet-foot .btn { flex: 1 1 auto; }
.sheet-foot .foot-note { flex-basis: 100%; font-size: 13px; color: var(--danger); font-weight: 600; text-align: center; margin: 0; }
.sheet-foot .foot-note:empty { display: none; }

.sheet-label { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.sheet-section { margin: 20px 0 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }

/* ------------------------------------------------------------------ scanner */

.thumb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 22px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.photo-preview { position: relative; margin: 8px 0 12px; border-radius: 12px; overflow: hidden; max-height: 260px; background: var(--line); }
.photo-preview img { width: 100%; max-height: 260px; object-fit: cover; display: block; }

.waiting { text-align: center; padding: 40px 8px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.chrono { font-family: Georgia, serif; font-size: 34px; font-variant-numeric: tabular-nums; }
.wait-msg { font-size: 17px; font-weight: 600; margin: 0; }

.review-card { padding: 0; overflow: hidden; }
.review-head { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 0; }
.review-toggle {
  flex: 1;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}
.review-toggle .review-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.review-card.collapsed .review-body { display: none; }
.review-card.ignored { opacity: 0.55; }
.review-card.error { outline: 2px solid var(--danger); }
.review-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.evidence { font-size: 13px; color: var(--muted); font-style: italic; }
.vintage-row { display: flex; gap: 8px; align-items: flex-end; }
.vintage-row .field { flex: 1; }
.vintage-row .btn { flex: none; }

/* ------------------------------------------------------------------ accord */

.dish { font-size: 22px; margin: 4px 0 14px; }
.pick-card { display: flex; flex-direction: column; gap: 8px; }
.pick-head { display: flex; align-items: center; gap: 10px; }
.rank {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: var(--accent);
  color: #2B1D1F;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.location { font-weight: 700; font-size: 16px; color: var(--primary); }
.why { font-size: 15px; }
.serve { font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------------ journal */

.event-row { display: flex; align-items: center; gap: 10px; }
.event-line1 { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; }
.event-type { font-weight: 700; }
.event-type.added { color: var(--badge-ready-fg); }
.event-type.consumed { color: var(--primary); }
.stars { color: var(--accent); font-size: 18px; letter-spacing: 1px; white-space: nowrap; }
.star-row { display: flex; justify-content: center; gap: 4px; margin: 12px 0; }
.star {
  width: 48px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
}
.star:active { transform: scale(1.15); }

/* ------------------------------------------------------------------ toasts, bannière, calque */

#toasts {
  position: fixed;
  top: calc(var(--safe-t) + 12px);
  left: 16px;
  right: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--toast-bg);
  color: var(--toast-fg);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}
.toast.error { background: var(--toast-error-bg); color: var(--toast-error-fg); }
.toast.show { opacity: 1; transform: none; }

.banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: calc(8px + var(--safe-t)) 16px 8px;
  background: var(--accent);
  color: #2B1D1F;
  font-weight: 600;
  font-size: 15px;
}
.banner .btn { background: #2B1D1F; color: #F7F1E8; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-title { color: var(--primary); font-size: 30px; }

[hidden] { display: none !important; }

@media (min-width: 600px) {
  .thumb-grid { grid-template-columns: repeat(4, 1fr); }
  .sheet { max-width: 720px; margin: 0 auto; box-shadow: 0 0 40px rgba(0, 0, 0, 0.2); }
}
