/* Bourbon Intelligence web app — visual mirror of the old iOS app
   (DESIGN-MIRROR.md). iOS grouped-list look: cool grey grouped
   background #F2F2F7, white cards at radius 14 with a soft shadow,
   system font stack, flat amber primaries (the brand gradient is
   reserved for the Welcome screen and the Home hero). Radii: cards 14,
   photos/buttons 12, thumbnails 6, chips are capsules. */

:root {
  --bg: #f6eedd;               /* iOS systemGroupedBackground (light) */
  --bg-card: #ffffff;          /* iOS systemBackground (light) */
  --bg-card-hover: #f7f7fa;
  --fill: rgba(120, 120, 128, 0.16);  /* iOS secondarySystemFill */
  --track: rgba(118, 118, 128, 0.12); /* segmented control track */
  --text: #171310;
  --text-muted: rgba(60, 60, 67, 0.72);  /* iOS .secondary, solid-ish */
  --text-dim: rgba(60, 60, 67, 0.45);    /* iOS .tertiary */
  --border: rgba(60, 60, 67, 0.14);      /* hairline separators */
  --border-hover: rgba(60, 60, 67, 0.28);
  --amber: #A66A1F;              /* brand deep amber */
  --amber-bright: #D9962C;       /* brand bright amber */
  --charcoal: #211A13;           /* brand charcoal */
  --ink: #171310;                /* brand ink */
  --cream: #F6EEDD;              /* brand cream */
  --leather: #6B4226;            /* brand leather */
  --green: #248a3d;
  --orange: #ff9500;
  --destructive: #d70015;
  --gradient-hero: linear-gradient(135deg, #171310, #211a13, #6b4226);
  --gradient: linear-gradient(180deg, #6b4226, rgba(107, 66, 38, 0.6)); /* vintage chart bars, old app parity */
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 3px 6px rgba(0, 0, 0, 0.05);
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
/* Fix round 1, A12: the hidden attribute must always win — a display
   rule on any class (.btn is inline-block, .bottom-nav is flex) must
   never resurrect an element the JS hid. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
}
h1, h2, h3 { font-family: var(--font-body); line-height: 1.2; }
h1 { font-size: 1.65rem; font-weight: 700; margin: 0.4em 0; }
h2 { font-size: 1.25rem; font-weight: 700; margin: 0 0 0.5em; }
h3 { font-size: 1.05rem; font-weight: 600; margin: 0 0 0.5em; }
a { color: var(--amber); }
.muted { color: var(--text-muted); }
.error { color: var(--amber); font-weight: 500; }

/* Top bar (web chrome above the mirrored content) */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.topbar__logo { height: 30px; width: auto; }
.badge { font-size: 0.75rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); }
.badge--ok { color: var(--green); border-color: rgba(36, 138, 61, 0.35); }
.badge--off { color: var(--amber); border-color: rgba(166, 106, 31, 0.35); }
.badge--muted { color: var(--text-dim); }

.offline-banner {
  background: rgba(166, 106, 31, 0.08);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px; font-size: 0.9rem; color: var(--text);
}

.install-hint {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px; font-size: 0.9rem; color: var(--text);
}
.install-hint[hidden] { display: none; }

.main { max-width: 760px; margin: 0 auto; padding: 16px; }
/* The fixed bottom tab bar must never cover the end of a long view —
   on the Add/Edit form the last fields and the submit button sit at the
   very bottom (walkthrough finding). */
.view { padding-bottom: 32px; }
#view-form { padding-bottom: 64px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Cards + buttons */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin: 14px 0;
}
.card--danger { box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(166, 106, 31, 0.3); }
.btn {
  display: inline-block; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600;
  padding: 12px 22px; border-radius: 12px; text-decoration: none; text-align: center;
}
.btn--primary { background: var(--amber); color: #fff; }
.btn--secondary { background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn--danger { background: var(--destructive); color: #fff; }
.btn--sm { padding: 8px 16px; font-size: 0.9rem; }
.btn--block { display: block; width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn--filters-on { color: var(--amber); border-color: rgba(166, 106, 31, 0.4); background: rgba(166, 106, 31, 0.08); }

/* Grouped list rows (More, Settings shortcuts, detail actions) */
.list-card { padding: 0; overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border);
  font-size: 1rem; background: none; width: 100%; text-align: left;
}
.list-card > :last-child { border-bottom: none; }
a.list-row:hover { background: var(--bg-card-hover); }
.list-row__label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.list-row__trail { color: var(--text-muted); font-size: 0.75rem; min-width: 0; overflow-wrap: anywhere; }
.list-row__chev { color: var(--text-dim); font-size: 1.15rem; line-height: 1; }
button.list-row { font: inherit; cursor: pointer; border-top: none; border-left: none; border-right: none; }
.list-row--action { justify-content: center; color: var(--amber); font-weight: 600; }
.list-row--green { color: var(--green); }
.list-row--danger { color: var(--destructive); }
.list-row--current { color: var(--text); font-weight: 600; }

/* Segmented control (iOS): grey track, white selected thumb */
.segmented {
  display: flex; gap: 2px; padding: 2px;
  background: var(--track); border-radius: 10px;
}
.seg {
  flex: 1; font: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer;
  padding: 7px 10px; border: none; border-radius: 8px;
  background: transparent; color: var(--text);
}
.seg--active { background: #fff; font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.14); }

/* Forms */
.field { display: block; margin: 0 0 14px; }
.field span { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.field input, .field select, .field textarea,
.inline-form input, .toolbar input[type="search"] {
  width: 100%; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 12px;
}
.field input:focus, .field select:focus, .field textarea:focus,
.inline-form input:focus, .toolbar input[type="search"]:focus {
  outline: none; border-color: var(--leather);
}
.field input[disabled] { opacity: 0.55; }
/* Phase 3: reference search + label scan at the top of the bottle form */
.ref-search { border-bottom: 1px solid var(--border); padding-bottom: 14px; margin-bottom: 14px; }
.ref-actions { margin: 0 0 4px; }
.ref-candidates { display: grid; gap: 8px; margin-top: 8px; }
.ref-candidate {
  text-align: left; font: inherit; color: var(--text); cursor: pointer; width: 100%;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px;
}
.ref-candidate:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.ref-candidate__name { font-size: 1rem; font-weight: 600; }
.ref-candidate__sub { color: var(--text-muted); font-size: 0.9rem; }
.ref-candidate__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.scan-box {
  margin-top: 10px; padding: 12px;
  border-radius: 12px;
  background: rgba(107, 66, 38, 0.05);
}
.scan-box[hidden] { display: none; }
.scan-box p { margin: 0 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scan-hint { margin: 6px 0 0; font-size: 0.85rem; }
.scan-detail { font-size: 0.9rem; }
.scan-warnings-list { margin: 0 0 8px; padding-left: 20px; font-size: 0.9rem; }
.scan-warnings-list li { margin-bottom: 4px; }
.scan-retake { margin-top: 8px; font-size: 0.9rem; }
.field .field-source {
  display: inline-block; margin: 4px 0 0; padding: 1px 8px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px;
}

/* AI-ENRICH-1: the collapsed optional section of the bottle form, and
   the provenance tags on the bottle detail page. */
/* The Add flows separate by the hidden attribute (applyFormMode);
   pin display:none so a future display rule on these sections can
   never leak one flow's controls into another. */
#flowScan[hidden], #flowSearch[hidden], #formIdentity[hidden],
#formBasics[hidden], #formDetails[hidden], #formSubmit[hidden] { display: none; }
.form-details { margin: 4px 0 14px; }
.form-details > summary {
  cursor: pointer; font-weight: 600; padding: 10px 2px;
  color: var(--amber);
}
.form-details[open] > summary { margin-bottom: 6px; }
.source-tag {
  display: inline-block; margin-left: 6px; padding: 1px 8px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap; vertical-align: middle;
}
.detail-group h3 .source-tag { margin-left: 8px; }
.enrich-note { margin: 8px 16px 12px; }

.field--check { display: flex; align-items: center; gap: 10px; }
.field--check input { width: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { flex: 1; }
#bottleForm[hidden] { display: none; }

/* Add chooser (AddBottleView) */
.chooser-head { text-align: center; padding: 18px 16px 6px; }
.chooser-head svg { width: 48px; height: 48px; fill: rgba(166, 106, 31, 0.3); }
.chooser-head h2 { font-size: 1.4rem; margin: 8px 0 4px; }
.chooser-head p { margin: 0; }
.choice-card {
  display: flex; align-items: center; gap: 12px; width: 100%;
  font: inherit; text-align: left; cursor: pointer;
  background: var(--bg-card); color: var(--text);
  border: none; border-radius: var(--radius); box-shadow: var(--shadow-card);
  padding: 16px; margin: 0 0 12px;
}
.choice-card svg {
  width: 26px; height: 26px; flex: 0 0 32px;
  fill: none; stroke: var(--amber); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.choice-card__text { flex: 1; min-width: 0; }
.choice-card__text strong { display: block; font-size: 1rem; font-weight: 600; }
.choice-card__text small { display: block; font-size: 0.75rem; color: var(--text-muted); margin-top: 1px; }
.choice-card__chev { color: var(--text-dim); font-size: 1.15rem; }
.choice-card--primary { background: var(--amber); color: #fff; }
.choice-card--primary svg { stroke: #fff; }
.choice-card--primary .choice-card__text small { color: rgba(255, 255, 255, 0.8); }
.choice-card--primary .choice-card__chev { color: rgba(255, 255, 255, 0.5); }

/* Toolbar + filter panel + chips */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 4px; }
.toolbar input[type="search"] { flex: 1 1 100%; }
.sort-label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-muted); margin-left: auto; }
.sort-label select {
  font: inherit; font-size: 0.9rem; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
}
.filter-panel h3 { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin: 14px 0 6px; }
.filter-panel h3:first-child { margin-top: 0; }
.filter-selects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; margin-top: 6px; }
@media (max-width: 620px) { .filter-selects { grid-template-columns: 1fr; } }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; padding-right: 24px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: 0 0 auto; font: inherit; font-size: 0.85rem; cursor: pointer;
  min-height: 38px; padding: 7px 14px; border-radius: 999px;
  background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border);
}
.chip--active { background: rgba(166, 106, 31, 0.12); color: var(--amber); border-color: rgba(166, 106, 31, 0.3); font-weight: 600; }
#collectionSummary { font-size: 0.72rem; margin: 10px 2px 0; }
.segmented-wrap { margin: 12px 0 2px; }

/* Bottle list — one grouped card on the phone face (iOS inset-grouped),
   individual cards in a grid on the wide face. */
.bottle-list {
  display: grid; gap: 0; margin-top: 12px;
  /* The single phone column must be capped at the container width:
     an unconstrained grid track sizes to the widest card's
     max-content, and the cards' nowrap sub-lines then stretched every
     row to ~650px, pushing the quantity column off the card edge
     (UX audit walkers 2 + 5). minmax(0, 1fr) lets the track shrink so
     the name/sub ellipsis inside the card can do its job. */
  grid-template-columns: minmax(0, 1fr);
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); overflow: hidden;
}
.bottle-card {
  display: flex; gap: 12px; align-items: flex-start; min-width: 0;
  background: var(--bg-card); padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.bottle-list > .bottle-card:last-child { border-bottom: none; }
a.bottle-card:hover { background: var(--bg-card-hover); }
.bottle-card__thumb {
  flex: 0 0 50px; width: 50px; height: 50px; object-fit: cover;
  border-radius: 6px; background: var(--fill);
  display: flex; align-items: center; justify-content: center;
}
.bottle-card__thumb--empty svg { width: 22px; height: 22px; fill: var(--text-dim); }
.bottle-card__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bottle-card__line1 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bottle-card__name {
  font-size: 0.94rem; font-weight: 600; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.style-capsule {
  flex: 0 0 auto; font-size: 0.69rem; font-weight: 500; line-height: 1;
  padding: 3px 6px; border-radius: 999px;
  background: rgba(166, 106, 31, 0.12); color: var(--amber);
}
.style-capsule--wish { background: rgba(107, 66, 38, 0.12); color: var(--leather); }
.bottle-card__sub {
  color: var(--text-muted); font-size: 0.75rem; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bottle-card__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; align-items: center; }
.tag-chip {
  font-size: 0.75rem; font-weight: 500; padding: 4px 10px; border-radius: 999px;
  background: rgba(107, 66, 38, 0.10); color: var(--leather);
}
.tag-chip--sm { font-size: 0.56rem; padding: 2px 6px; }
.tag-more { font-size: 0.56rem; font-weight: 500; color: var(--text-dim); }
.bottle-card__right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.bottle-card__rating { font-size: 0.69rem; font-weight: 500; color: var(--text-muted); }
.bottle-card__rating .star { color: var(--orange); font-size: 0.62rem; }
.bottle-card__loc, .bottle-card__qty { font-size: 0.69rem; color: var(--text-dim); }
.bottle-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { font-size: 0.72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--fill); color: var(--text-muted); }
.drank-stars { color: var(--amber); font-size: 0.75rem; letter-spacing: 1px; }
.empty { text-align: center; padding: 40px 0; color: var(--text-muted); }

/* Bottle detail (grouped sections, iOS style) */
.detail-head { padding: 6px 2px 0; }
.detail-name { font-size: 1.4rem; font-weight: 700; margin: 0; }
.detail-distillery { font-size: 1.25rem; color: var(--text-muted); margin: 2px 0 0; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; font-size: 0.94rem; color: var(--text-muted); }
.detail-meta .style-capsule { font-size: 0.75rem; padding: 4px 10px; }
.detail-stars { margin-top: 8px; font-size: 0.94rem; }
.detail-stars .stars { color: var(--orange); letter-spacing: 2px; }
.detail-stars__val { font-weight: 500; color: var(--text-muted); }
.tag-flow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.detail-edit-row { margin: 12px 0 0; }
.detail-photo-card { padding: 0; overflow: hidden; }
.detail-photo-card img { display: block; width: 100%; height: auto; }
.detail-group h3 { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.detail-text { margin: 0; white-space: pre-wrap; }
.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin: 0; }
/* Grid/flex text cells must be allowed to shrink below their content
   (min-width: 0) and break long unbroken values (URLs, timestamps),
   or the value runs off the card edge — Sean's Settings > Connection
   screenshot, 2026-11-02. Same treatment on .list-row and
   .manage-list text cells below; test_app_shell.py guards all three. */
.detail-list dt { color: var(--text-muted); font-size: 0.94rem; min-width: 0; overflow-wrap: anywhere; }
.detail-list dd { margin: 0; font-size: 0.94rem; text-align: right; min-width: 0; overflow-wrap: anywhere; }
/* The Connection card's server URL carries <wbr> break points after
   its slashes (set in renderSettings); anywhere-wrapping would split
   it mid-word instead (UX audit walker 2). The status timestamp is
   rendered with a space instead of the ISO 'T' for the same reason:
   both wrap at real break points, never mid-word (fix round 1, A12). */
#settingsServer { overflow-wrap: break-word; word-break: normal; }
#settingsStatus { overflow-wrap: break-word; word-break: normal; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.label-upload { margin-top: 10px; }

/* Manage lists */
.manage-list { list-style: none; margin: 0; padding: 0; }
.manage-list li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.manage-list li:last-child { border-bottom: none; }
.manage-list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mini-btn {
  font: inherit; font-size: 0.8rem; cursor: pointer; padding: 9px 14px; min-height: 38px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
}
.mini-btn--danger { color: var(--amber); border-color: rgba(166, 106, 31, 0.3); }

/* Welcome / setup — the old app's WelcomeView: full gradient screen. */
body.on-setup { background: var(--gradient-hero); padding-bottom: 32px; }
body.on-setup .topbar { display: none; }
body.on-setup .main { max-width: 560px; }
body.on-setup .error { color: #ff9d94; }
.hero-mini { text-align: center; padding: 26px 0 6px; }
.hero-mini__logo {
  height: 120px; width: auto; max-width: 82%;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 44px rgba(255, 255, 255, 0.5));
}
.hero-mini h1 {
  font-family: var(--font-display); font-size: 1.75rem; font-weight: 700;
  color: #fff; margin: 26px 0 0;
}
.welcome-sub { color: rgba(255, 255, 255, 0.8); font-size: 1.06rem; padding: 0 32px; margin: 10px 0 0; }
.welcome-features {
  list-style: none; margin: 34px 0 0; padding: 0 40px;
  text-align: left; display: grid; gap: 16px;
}
.welcome-features li { display: flex; align-items: center; gap: 14px; color: rgba(255, 255, 255, 0.9); font-size: 0.94rem; }
.welcome-features svg {
  width: 24px; height: 24px; flex: 0 0 24px;
  fill: none; stroke: var(--amber); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.welcome-note { color: rgba(255, 255, 255, 0.5); font-size: 0.72rem; padding: 0 40px; margin: 26px 0 4px; }

.share-code {
  font-size: 1.3rem; font-weight: 700; letter-spacing: 0.04em;
  text-align: center; padding: 14px; margin: 12px 0 0;
  border: 1px dashed var(--leather); border-radius: var(--radius-sm);
  background: rgba(107, 66, 38, 0.06);
  word-break: break-all;
}

/* Bottom tab bar — the five iOS tabs */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: flex-start;
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
/* The hidden attribute must WIN over the display:flex above: without
   this rule the tab bar painted over the setup screen (where
   markNav hides it until sign-in) and its dead tabs covered the
   form (UX audit walker 1). Attribute+class specificity beats the
   single class rule. */
.bottom-nav[hidden] { display: none; }
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #8e8e93; text-decoration: none; font-size: 0.62rem; font-weight: 500;
  padding: 2px 10px; min-width: 56px;
}
.bottom-nav a svg { width: 24px; height: 24px; fill: currentColor; }
.bottom-nav a.active { color: var(--amber); }
.bottom-nav a.bottom-nav__add { color: var(--amber); }
.bottom-nav a.bottom-nav__add svg { width: 28px; height: 28px; }

.back-link { font-weight: 600; text-decoration: none; }

/* Dialog */
.dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; max-width: 420px; width: calc(100% - 32px); }
.dialog::backdrop { background: rgba(26, 26, 46, 0.45); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }

/* ===== Two-face responsive layout =====
   Phone (below 900px, incl. the installed home-screen app): bottom tab
   bar, single column — the iOS app face.
   Laptop/desktop (900px and up): the same five sections move to a top
   navigation bar, content centres in an 1100px container, the collection
   list becomes a card grid, and the bottle form / detail spread into two
   columns. Same routes, views and data. */
.top-nav { display: none; align-items: center; gap: 4px; }
.top-nav a {
  display: flex; align-items: center; gap: 7px;
  color: var(--text-muted); text-decoration: none; font-weight: 600;
  font-size: 0.95rem; padding: 8px 12px; border-radius: 999px;
}
.top-nav a svg { width: 19px; height: 19px; fill: currentColor; }
.top-nav a.active { color: var(--amber); background: rgba(166, 106, 31, 0.08); }
.top-nav a.top-nav__add { color: var(--amber); }

@media (min-width: 900px) {
  .top-nav:not([hidden]) { display: flex; }
  .bottom-nav { display: none; }
  body { padding-bottom: 24px; } /* no bottom bar to clear */
  .view { padding-bottom: 16px; }
  #view-form { padding-bottom: 24px; }
  .main { max-width: 1100px; }
  .bottle-list {
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 12px; background: transparent; box-shadow: none; overflow: visible;
  }
  .bottle-card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
  /* Detail lists stay one label/value pair per row at every width: the
     old 4-column variant flowed two pairs onto one line, which read as a
     run-on (UI-CHECK-2). The old app's DetailRow is one pair per row. */
  .form-cols { display: grid; grid-template-columns: 3fr 2fr; gap: 0 28px; align-items: start; }
}

/* ===== Bourbon Intelligence additions ===== */
/* Wrap-safe cards: long names, places and notes wrap inside the card at
   every phone width (430/390/360); nothing may push the card wider. */
.bottle-card, .bottle-card * { min-width: 0; }
.bottle-card { overflow-wrap: anywhere; word-break: break-word; }
.detail-list dd { overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.home-hero {
  background: var(--gradient-hero); color: var(--cream);
  border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px;
}
.home-hero h1 { color: var(--cream); margin-top: 0; }
.hero-counts { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-count {
  flex: 1 1 90px; background: rgba(246, 238, 221, 0.1);
  border: 1px solid rgba(246, 238, 221, 0.25); border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.hero-count strong { display: block; font-size: 1.5rem; color: var(--amber-bright); }
.hero-count span { font-size: 0.85rem; }
.value-line { margin: 12px 0 0; font-size: 0.95rem; }
.fill-stepper { display: flex; gap: 8px; flex-wrap: wrap; }
.fill-stepper .chip--active { background: var(--amber); color: #fff; border-color: var(--amber); }
.source-tag {
  display: inline-block; font-size: 0.72rem; padding: 1px 7px; margin-left: 6px;
  border-radius: 999px; background: rgba(217, 150, 44, 0.18); color: var(--leather);
  border: 1px solid rgba(166, 106, 31, 0.35); vertical-align: middle;
}
.label-photo { width: 100%; max-height: 320px; object-fit: contain; border-radius: 12px; background: var(--charcoal); }
.tier-head { color: var(--leather); margin: 18px 0 6px; }
.hunt-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hunt-row .hunt-name { flex: 1 1 140px; overflow-wrap: anywhere; }
/* Hunt drag-to-reorder: the grip is the only drag starter and carries
   touch-action:none, so a touch that starts on a row still scrolls the
   page while a touch that starts on the grip drags. The placeholder is
   the drop slot made visible; the dragged card itself is lifted to
   <body> as position:fixed (see .hunt-card--dragging in app.js). */
.hunt-drag {
  touch-action: none; -webkit-touch-callout: none; user-select: none;
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin: -4px 0 -4px -8px; padding: 0;
  background: none; border: none; color: var(--text-muted); cursor: grab;
}
.hunt-drag:active { cursor: grabbing; }
.hunt-drag svg { fill: currentColor; display: block; }
.hunt-placeholder {
  border: 2px dashed rgba(166, 106, 31, 0.45); border-radius: var(--radius-sm);
  background: rgba(217, 150, 44, 0.08);
}
.hunt-card--dragging {
  position: fixed; z-index: 1000; margin: 0; pointer-events: none;
  border-radius: var(--radius-sm); box-shadow: 0 10px 28px rgba(28, 20, 10, 0.35);
}
/* While a drag runs, a tier group emptied by the drag keeps a drop
   zone instead of collapsing to nothing. */
#huntList.hunt-dragging .bottle-list { min-height: 52px; }
.guest-link-box {
  background: var(--cream); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; overflow-wrap: anywhere; font-size: 0.9rem;
}
.builder-flight { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 12px; }
.builder-bottle { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; min-width: 0; max-width: 100%; }
/* Fix round 1, A12 / walker-4 D1: a native select sizes to its longest
   option (a long bottle name blew the builder out to 591px at every
   phone width). Form selects are capped at their container. */
.field select { width: 100%; max-width: 100%; }
.builder-bottle input, .builder-bottle select { flex: 1 1 120px; }
.builder-bottle select { width: 100%; max-width: 100%; min-width: 0; }
.standings-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.standings-row:last-child { border-bottom: none; }
.star-row { font-size: 1.3rem; letter-spacing: 2px; }
.star-row button { background: none; border: none; font-size: 1.3rem; padding: 2px; color: var(--text-dim); cursor: pointer; }
.star-row button.on { color: var(--amber-bright); }
.seg-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Bourbon card layout: name block + wrapping chip row (the base card's
   nowrap ellipsis lines are overridden here so cards stay wrap-safe). */
.bottle-card { flex-wrap: wrap; }
.bottle-card__main { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bottle-card__main strong { overflow-wrap: anywhere; }
.bottle-card .bottle-card__sub { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
.bottle-card--static { cursor: default; }
.chip--static { cursor: default; }
.check-field { display: flex; align-items: center; gap: 8px; }
.check-field input { width: auto; }
