:root {
  --burgundy: #5b1a26;
  --burgundy-deep: #41121b;
  --gold: #c9a14a;
  --cream: #f6f1e7;
  --paper: #fffdf8;
  --ink: #2a2024;
  --muted: #8a7d74;
  --line: #e7ddcd;
  --danger: #b23b3b;
  --shadow: 0 6px 24px rgba(65, 18, 27, 0.12);
  --radius: 16px;
  /* Desktop field-column widths (Type, Emplacement, Producteur, Pays, Région,
     Cépage, Ville, Tag, Millésime, Prix, Note, Bouteilles, Entrée,
     Dégustation, Commentaires — same order as FILTER_FIELDS in app.js).
     Shared by the filter bar, the column-title row and every wine row so the
     three can never drift out of alignment; see .filter-fields/.card-meta. */
  --wine-cols: 80px 170px 150px 120px 130px 120px 100px 130px 80px 80px 70px 90px 100px 100px 220px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win, even over a class that sets `display`
   (e.g. the scan overlay below). Without this, hidden elements still show. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 110px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(160deg, var(--burgundy), var(--burgundy-deep));
  color: var(--cream);
  padding: calc(env(safe-area-inset-top) + 18px) 18px 16px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 32px; }
.topbar h1 { margin: 0; font-size: 26px; letter-spacing: 0.5px; font-weight: 600; }
.stats { margin: 2px 0 0; font-size: 13px; color: var(--gold); font-family: system-ui, sans-serif; }

/* Toggle switch: default cellar-only scope vs. showing every bottle. Sits on
   the dark burgundy topbar, so labels/colours are light-on-dark like .stats. */
.cellar-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  cursor: pointer;
}
.cellar-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.15s ease;
}
.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}
.cellar-switch input:checked + .switch-track { background: var(--gold); }
.cellar-switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.cellar-switch input:focus-visible + .switch-track { outline: 2px solid var(--cream); outline-offset: 2px; }
.switch-label { font-size: 13px; color: var(--cream); font-family: system-ui, sans-serif; }

/* flex-wrap so that on a narrow phone the fixed-size controls (sort, filter
   toggle, user badge, dashboard/invite/logout buttons) overflow onto a
   second line instead of squeezing the search input down to a sliver. */
.search-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.search {
  /* Force light-mode form-control rendering: without this, some mobile
     browsers (Android Chrome's forced-dark, iOS Safari dark mode) recolor
     the typed text to a light color while the background below stays the
     author-set near-white, making what you type invisible. */
  color-scheme: light;
  -webkit-appearance: none;
  appearance: none;
  /* Grow to fill the row and keep a real minimum width instead of shrinking
     to make room for the fixed-size buttons that follow it (see
     .search-row above) — that min-width is what was making the field tiny
     and unreadable on phones. */
  flex: 1 1 160px;
  min-width: 140px;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-family: system-ui, sans-serif;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  caret-color: var(--ink);
  -webkit-text-fill-color: var(--ink);
}
.search::placeholder { color: var(--muted); }

.filter-toggle {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex; /* centres the SVG icon; hidden on desktop below */
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 0 16px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--burgundy);
  cursor: pointer;
}
.sort-select {
  flex: 0 0 auto;
  width: auto;
  border: none;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  font-family: system-ui, sans-serif;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  cursor: pointer;
}
.filter-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--gold);
  color: var(--burgundy-deep);
  font-size: 11px;
  font-weight: 700;
  font-family: system-ui, sans-serif;
}

/* ---------- Filters panel ---------- */
.filters-panel {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 4px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-family: system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row input { width: 100px; }
.filter-actions { display: flex; justify-content: flex-end; padding-top: 12px; }

/* Filter bar (mobile only — see .filter-toggle/.filters-panel in the desktop
   media query): one dropdown per field, so a field with dozens of distinct
   values (producer, region…) doesn't have to dump every option inline. On
   desktop these same dropdown nodes are moved into the list's column-header
   row instead (see placeFilterControls() in app.js). */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; font-family: system-ui, sans-serif; }
.filter-dd { position: relative; }
.filter-dd[hidden] { display: none; }
.filter-dd-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
}
.filter-dd-toggle.open { border-color: var(--burgundy); color: var(--burgundy); }
.filter-dd-toggle .caret { font-size: 10px; color: var(--muted); }
.filter-dd-count {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--burgundy);
  color: var(--cream);
  font-size: 10px;
  font-weight: 700;
}
.filter-dd-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: max(220px, 100%);
  max-width: 80vw;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 8px;
}
.dd-search {
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
.dd-options { display: grid; gap: 2px; max-height: 240px; overflow-y: auto; }
.dd-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 6px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.dd-option:hover { background: var(--cream); }
.dd-option input { width: auto; padding: 0; }
.filter-dd-menu .range-row input { width: auto; flex: 1; }
.dd-sort { display: flex; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.dd-sort button {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: system-ui, sans-serif;
  white-space: nowrap;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.dd-sort button.active { background: var(--burgundy); border-color: var(--burgundy); color: var(--cream); }
.sort-arrow { color: var(--burgundy); font-weight: 700; }
.sort-name-btn {
  display: inline-flex; align-items: center; gap: 4px;
  border: none; background: none; padding: 0;
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
  cursor: pointer;
}

/* ---------- Tag editor (add/edit form) ---------- */
.tag-editor { display: grid; gap: 8px; }
.tag-editor .chips:empty { display: none; }
.chip.chip-removable { display: inline-flex; align-items: center; gap: 6px; padding-right: 8px; cursor: default; }
.chip-remove {
  border: none; background: none; cursor: pointer; color: inherit;
  font-size: 11px; line-height: 1; padding: 0; opacity: 0.7;
}
.chip-remove:hover { opacity: 1; }

/* ---------- Location editor (add/edit form) ---------- */
.location-editor { display: grid; gap: 8px; }
.location-editor .chips:empty { display: none; }
.location-add-row { display: flex; gap: 8px; align-items: center; }
.location-add-row select { flex: 1; min-width: 0; }
.location-add-row input { width: 76px; flex: none; }
.location-add-row .btn { flex: none; padding: 8px 14px; }
.location-total { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ---------- Viniou enrichment (read-only, in the add/edit dialog) ---------- */
.viniou-refresh { justify-self: start; }
.viniou-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  font-family: system-ui, sans-serif;
}
.viniou-title { font-size: 14px; font-weight: 700; color: var(--burgundy); }
.viniou-row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.viniou-key { color: var(--muted); }
.viniou-val { color: var(--ink); font-weight: 600; text-align: right; }
.viniou-val.viniou-phase-current { color: var(--burgundy); }
.viniou-phases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.viniou-phase {
  text-align: center;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}
.viniou-phase.current { border-color: var(--gold); background: #fbf3df; }
.viniou-phase-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.viniou-phase.current .viniou-phase-label { color: #6b551f; font-weight: 700; }
.viniou-phase-years { font-size: 13px; font-weight: 600; margin-top: 2px; }
.viniou-notes { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink); white-space: pre-line; }
.viniou-source { font-size: 13px; color: var(--burgundy); text-decoration: none; justify-self: start; }
.viniou-source:hover { text-decoration: underline; }

/* ---------- List ---------- */
.list {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 14px;
}
.empty {
  text-align: center;
  color: var(--muted);
  margin-top: 60px;
  line-height: 1.6;
  font-family: system-ui, sans-serif;
}

.card {
  display: flex;
  gap: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.08s ease;
}
.card:active { transform: scale(0.99); }
.row-num {
  flex: 0 0 26px;
  align-self: center;
  text-align: right;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.thumb {
  width: 64px;
  height: 84px;
  flex: 0 0 auto;
  border-radius: 10px;
  object-fit: cover;
  background: var(--cream);
  border: 1px solid var(--line);
}
.thumb.placeholder {
  display: grid;
  place-items: center;
  font-size: 30px;
  color: var(--gold);
}
/* Not ".spacer" (line ~458, flex:1) — that generic gap-filler class would
   make this grow and push the header row's title/columns far to the right
   instead of just standing in for a card's thumb width. */
.thumb.blank { background: none; border: none; }

/* Column header row, shown only on desktop (see media query below) — hidden
   here so it doesn't show up as a stray empty bar on the phone layout. */
.list-header { display: none; }

.card-body { flex: 1; min-width: 0; }
.card-name { margin: 2px 0 1px; font-size: 18px; font-weight: 600; }
.card-title { font-family: system-ui, sans-serif; }

/* Field columns: on mobile these are just a flex-wrapping cloud of chips
   (empty ones hidden); the desktop media query below turns them into a
   strict grid so the same field always lands in the same place down the
   list — see the ROW_FIELDS comment in app.js. */
.card-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-family: system-ui, sans-serif;
}
.col {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cream);
  border: 1px solid var(--line);
  color: var(--ink);
}
.col:empty { display: none; }
/* The type column carries its own colored badge instead of the plain-chip
   look, so the wrapping .col wouldn't just double it up as a pill-in-a-pill. */
.col.col-type { padding: 0; background: none; border: none; }
.type-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.map-pin { text-decoration: none; margin-left: 4px; }
.type-red { background: #7b2233; }
.type-white { background: #b79a4a; }
.type-rosé { background: #d98a8a; }
.type-sparkling, .type-champagne { background: #caa93f; }
.type-dessert { background: #9a6a2f; }
.type-fortified { background: #6a3b2a; }
.type-other { background: #7a6f66; }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  background: linear-gradient(to top, var(--cream) 60%, transparent);
}
.fab-btn {
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  font-size: 16px;
  font-family: system-ui, sans-serif;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.fab-btn.primary { background: var(--burgundy); color: var(--cream); }
.fab-btn.ghost { background: var(--paper); color: var(--burgundy); border: 1px solid var(--line); }

/* ---------- Dialog ---------- */
.dialog {
  border: none;
  border-radius: 20px 20px 0 0;
  padding: 0;
  width: 100%;
  max-width: 560px;
  margin: auto auto 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(40, 18, 24, 0.45); }
@media (min-width: 600px) {
  .dialog { border-radius: 20px; margin: auto; }
}
#wine-form { padding: 18px; display: grid; gap: 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head h2 { margin: 0; font-size: 22px; color: var(--burgundy); }
.icon-btn {
  border: none; background: none; font-size: 20px; cursor: pointer; color: var(--muted);
  width: 36px; height: 36px; border-radius: 50%;
}
.scan-banner {
  background: #fbf3df; border: 1px solid var(--gold); color: #6b551f;
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-family: system-ui, sans-serif;
}
/* Two photo slots (front/back) side by side when there's room, stacked on a
   narrow phone — each slot is its own column so one filled + one empty slot
   don't look lopsided. */
.form-photos { display: flex; gap: 12px; flex-wrap: wrap; }
.form-photo-slot { flex: 1 1 140px; display: grid; gap: 8px; align-content: start; }
.form-image img { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; background: var(--cream); }
.form-image { margin: 0; }
.form-photo-btn { justify-self: start; }

label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-family: system-ui, sans-serif; }
input, select, textarea {
  font-size: 16px;
  font-family: system-ui, sans-serif;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
textarea { resize: vertical; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.dialog-foot { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.spacer { flex: 1; }
.btn {
  border: none; border-radius: 10px; padding: 12px 18px; font-size: 15px; font-weight: 600;
  font-family: system-ui, sans-serif; cursor: pointer;
}
.btn.primary { background: var(--burgundy); color: var(--cream); }
.btn.ghost { background: var(--cream); color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: none; color: var(--danger); }

/* ---------- Scanning overlay ---------- */
.scanning {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(40, 18, 24, 0.55);
  display: grid; place-items: center;
}
.scan-card {
  background: var(--paper); border-radius: 16px; padding: 28px 36px;
  text-align: center; font-family: system-ui, sans-serif; box-shadow: var(--shadow);
}
.spinner {
  width: 40px; height: 40px; margin: 0 auto 14px;
  border: 4px solid var(--line); border-top-color: var(--burgundy);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.scan-back-card {
  position: relative;
  max-width: 320px;
  text-align: left;
}
.scan-back-close {
  position: absolute; top: 8px; right: 8px;
}
.scan-back-title { margin: 0 0 6px; font-weight: 700; color: var(--burgundy); }
.scan-back-hint { margin: 0 0 16px; font-size: 14px; color: var(--muted); }
.scan-back-actions { display: flex; flex-direction: column; gap: 8px; }
.scan-back-actions .btn { width: 100%; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-family: system-ui, sans-serif; font-size: 14px; z-index: 60; box-shadow: var(--shadow);
}

/* ---------- Login page ---------- */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--burgundy), var(--burgundy-deep));
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--paper);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}
.login-mark { display: block; margin: 0 auto 10px; }
.login-title { margin: 0; font-size: 30px; letter-spacing: 0.5px; font-weight: 600; color: var(--burgundy); }
.login-sub { margin: 4px 0 20px; font-size: 14px; color: var(--muted); font-family: system-ui, sans-serif; }
.login-form { display: grid; gap: 14px; }
.login-form input { text-align: center; }
.login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fbe6e6;
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 14px;
  font-family: system-ui, sans-serif;
}

.login-alt { margin: 16px 0 0; font-size: 13px; font-family: system-ui, sans-serif; }
.login-alt a { color: var(--burgundy); }

/* ---------- Invite dialog ---------- */
.invite-body { padding: 18px; display: grid; gap: 14px; }
.invite-hint { margin: 0; font-size: 14px; color: var(--muted); font-family: system-ui, sans-serif; }
.invite-row { display: flex; gap: 8px; align-items: stretch; }
.invite-row input { flex: 1; font-size: 14px; }
.invite-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* ---------- Current-user badge (topbar) ---------- */
.current-user {
  flex: 0 0 auto;
  font-family: system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--cream);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Logout control (topbar) ---------- */
.logout-form { flex: 0 0 auto; margin: 0; }
.logout-btn {
  flex: 0 0 auto;
  /* Links (📊 🥂 🍷 🛠) as well as buttons: centre the icon the same way —
     an <a> doesn't vertically centre its content like a <button> does. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1;
  border: none;
  border-radius: 12px;
  padding: 0 14px;
  height: 44px;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--burgundy);
  cursor: pointer;
}

/* ---------- Desktop / laptop layout ----------
   Below this width the app stays the single-column phone layout above;
   at this width and up, use the extra horizontal room instead of staying
   centered in a narrow phone-width column. */
@media (min-width: 900px) {
  .topbar {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 20px 32px;
  }
  .brand { flex: 0 0 auto; }
  .cellar-switch { flex: 0 0 auto; margin-top: 0; }
  .search-row { margin-top: 0; flex: 1; max-width: 640px; }

  /* The gear-triggered panel is the mobile filter UI; on desktop the same
     dropdowns live directly in the list's column-header row instead (see
     placeFilterControls() in app.js), so both the toggle and the panel are
     moot here. */
  .filter-toggle { display: none; }
  .filters-panel { display: none; }

  .list {
    max-width: none;
    padding: 24px 32px;
    overflow-x: auto;
  }

  /* One wine per row, its info spread horizontally along the row instead of
     stacked in a narrow card. Every field gets a fixed-width column (shared
     with .list-header below) so the same field lines up down the whole list
     even when a given wine leaves it blank. */
  .card, .list-header { align-items: center; }
  .thumb { width: 48px; height: 64px; }
  .card-body { display: flex; align-items: center; gap: 24px; min-width: max-content; }
  .card-title { flex: 0 0 260px; min-width: 0; }
  .card-meta {
    flex: none;
    margin-top: 0;
    display: grid;
    grid-template-columns: var(--wine-cols);
    column-gap: 10px;
    row-gap: 0;
    align-items: center;
  }
  /* Grid items default to a content-based min-width, so a long value (e.g. a
     wine sitting on several shelves) would otherwise stretch its column past
     its fixed track size — and by a different amount on every row, since it
     depends on that row's own content. min-width: 0 + ellipsis forces every
     row to actually respect the shared column widths instead. */
  .col {
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .col.col-type { padding: 0; }
  /* Blank fields still occupy their column, instead of collapsing it. */
  .col:empty { display: block; }
  .col-type, .col-shelf, .col-vintage, .col-price, .col-score, .col-quantity {
    text-align: center;
  }

  .list-header {
    display: flex;
    /* Same gap/padding/border-left as .card so its thumb-spacer and .card-body
       start at the exact same x-position as every data row beneath it. */
    gap: 14px;
    padding: 4px 12px 10px;
    border: 1px solid transparent;
    border-bottom: 1px solid var(--line);
  }
  .list-header .card-title,
  .list-header .col {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--muted);
  }
  .list-header .card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .list-header-reset {
    border: none;
    background: none;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
    padding: 2px;
  }
  .list-header-reset:hover { color: var(--burgundy); }
  /* These cells hold a live filter dropdown, not plain text — the ellipsis
     treatment above would clip its popup menu when open. */
  .list-header .col { overflow: visible; white-space: normal; text-overflow: clip; }
  .list-header .filter-dd-toggle { text-transform: none; letter-spacing: normal; }

  .fab { padding-left: 32px; padding-right: 32px; }
}

/* ---------- Contenu de l'étiquette (form, read-only) ---------- */
.label-text-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--paper);
  font-family: system-ui, sans-serif;
}
.label-text-box summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--burgundy); }
.label-text { margin: 10px 0 0; white-space: pre-wrap; font-size: 13px; line-height: 1.5; max-height: 280px; overflow-y: auto; }
.label-text.muted { color: var(--muted); font-style: italic; }

/* ---------- Admin page ---------- */
.admin-card { display: grid; gap: 12px; font-family: system-ui, sans-serif; }
.admin-card h2 { margin: 0; font-size: 18px; color: var(--burgundy); }
.admin-hint { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.admin-counts { margin: 0; font-size: 15px; font-weight: 600; }
.admin-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.admin-check input { width: auto; }
.admin-card .btn { justify-self: start; }
.admin-progress { display: grid; gap: 6px; }
.admin-progress progress { width: 100%; height: 12px; accent-color: var(--burgundy); }
.admin-progress p { margin: 0; font-size: 14px; }
.admin-failures { margin: 0; padding-left: 18px; font-size: 13px; color: var(--danger); }
.admin-card h3 { margin: 8px 0 0; font-size: 15px; color: var(--ink); }
.admin-card .kpi-row { margin: 0; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th,
.admin-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-table td:not(:first-child),
.admin-table th:not(:first-child) { text-align: right; }
.admin-table .admin-empty { text-align: left; color: var(--muted); font-style: italic; }
.admin-balance { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.admin-negative { color: var(--danger); }
.admin-balance-form summary { cursor: pointer; font-size: 14px; color: var(--burgundy); }
.admin-balance-form .admin-hint { margin: 8px 0; }
.admin-balance-fields { display: grid; gap: 10px; }
.admin-balance-fields label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.admin-balance-fields .btn { justify-self: start; }

/* ---------- Bouteilles bues (wine form) ---------- */
.drinks-box { display: grid; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--paper); font-family: system-ui, sans-serif; }
.drinks-head { font-size: 14px; font-weight: 600; color: var(--burgundy); }
.drinks-total { font-weight: 400; color: var(--muted); }
.drink-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.drink-row select, .drink-row input { width: auto; flex: 1 1 120px; }
.drink-row[hidden], .drink-row select[hidden] { display: none; }
.drinks-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: 13px; }
.drinks-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drinks-empty { color: var(--muted); font-style: italic; }
.drink-undo { border: none; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; cursor: pointer; padding: 0; }
.drink-undo:hover { color: var(--danger); }
.dd-option-unset { font-style: italic; color: var(--muted); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }

/* Inline SVG icons for symbols Android has no (or an inconsistent) glyph for
   — ⏻ shows as an empty box there; ⚙ ✉ 🛠 render at odd sizes/colours. */
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.logout-btn[hidden] { display: none; } /* keep the hidden attribute working (owner-only links) */
