/* Small additions on top of Pico.css */
:root:not([data-theme=dark]), [data-theme=light] {   /* same selector as Pico, so ours wins */
  --pico-primary: #7b1e3a; --pico-primary-background: #7b1e3a;
  --pico-primary-hover: #5e1229; --pico-primary-hover-background: #5e1229;
  --pico-primary-underline: rgba(123, 30, 58, 0.5);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --pico-primary: #e3879f; --pico-primary-background: #9b2c4b;
    --pico-primary-hover: #f0a5b8; --pico-primary-hover-background: #b3385a;
  }
}
.brand { font-weight: 700; text-decoration: none; }
form.inline { margin: 0; }
button.link {
  background: none; border: none; padding: 0.25rem 0.5rem; margin: 0;
  color: var(--pico-primary); width: auto; font-size: 0.9rem;
}
button.link.active { font-weight: 700; text-decoration: underline; }
.narrow { max-width: 26rem; margin: 2rem auto; }
.big { font-size: 1.6rem; font-weight: 600; }
.error { color: #b00020; }
details.issues { border-left: 4px solid var(--pico-muted-border-color); padding-left: 0.75rem; }
details.issues.error { border-color: #b00020; }
details.issues.warning { border-color: #d48a00; }
details.issues li { margin-bottom: 0.25rem; }

/* ---- M1: browse, search, dashboard (phone first) ---------------------------------------------------------- */
:root { --wine: #7b1e3a; --muted: var(--pico-muted-color); --line: var(--pico-muted-border-color); }
.muted { color: var(--pico-muted-color); }
.ok { color: #2e7d32; font-weight: 600; }
.small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.back { text-decoration: none; font-size: 0.95rem; }
h1.hello { font-size: 1.5rem; margin-bottom: 0.75rem; }
main.container { padding-top: 0; }
section { margin-bottom: 1.75rem; }

/* colour dots */
.dot { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; flex: none;
       border: 1px solid rgba(0,0,0,.15); vertical-align: -0.05rem; }
.c-red { background: #8e1b3b; } .c-white { background: #e3c565; } .c-rose { background: #f08aa0; }
.c-orange { background: #e07b2f; } .c-sparkling { background: #b9c46a; } .c-sweet { background: #c7902a; }
.c-fortified { background: #7a4422; } .c-spirit { background: #6b5a4a; } .c-other { background: #9a9a9a; }

/* chips and badges */
.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.1rem 0.6rem; margin: 0 0.25rem 0.25rem 0;
        border: 1px solid var(--line); border-radius: 1rem; font-size: 0.85rem; text-decoration: none; }
.chip a { text-decoration: none; font-weight: 700; }
.badge { display: inline-block; padding: 0 0.45rem; border-radius: 0.4rem; font-size: 0.75rem; font-weight: 600;
         background: var(--pico-secondary-background); color: var(--pico-secondary-inverse); }
.badge.r-ready { background: #2e7d32; color: #fff; }
.badge.r-too_young { background: #1565c0; color: #fff; }
.badge.r-past_window { background: #c62828; color: #fff; }

/* search */
.searchbar input[type=search] { margin-bottom: 1rem; font-size: 1.05rem; }
kbd { font-size: 0.7rem; padding: 0.05rem 0.3rem; }

/* list rows: big tap targets, one line per vintage */
.list { border-top: 1px solid var(--line); }
a.row, div.row { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.25rem; min-height: 3.25rem;
        border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
a.row:hover, a.row:focus-visible, .row-link:hover { background: var(--pico-secondary-background); background: rgba(123,30,58,.06); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.row-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small { font-size: 0.8rem; }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; flex: none; }
.count { display: inline-block; min-width: 2rem; padding: 0.1rem 0.45rem; border-radius: 1rem; text-align: center;
         font-weight: 700; background: var(--wine); color: #fff; }
.count.zero { background: var(--line); color: var(--pico-muted-color); }
.avatar { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; flex: none;
          background: var(--wine); color: #fff; font-weight: 700; }
.group-title { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; font-size: 1.1rem;
               margin: 1.25rem 0 0.4rem; position: sticky; top: 0; background: var(--pico-background-color);
               padding: 0.4rem 0; z-index: 1; }
.summary { margin-bottom: 0.5rem; }
ul.plain { list-style: none; padding: 0; margin: 0 0 0.5rem; }
ul.plain li { list-style: none; margin-bottom: 0.35rem; }

/* filters */
.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; border: 0; padding: 0; margin-bottom: 0.75rem; }
.chip-toggle { margin: 0; }
.chip-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-toggle > span { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.65rem;
                    border: 1px solid var(--line); border-radius: 1.2rem; font-size: 0.9rem; cursor: pointer; }
.chip-toggle input:checked + span { border-color: var(--wine); background: var(--wine); color: #fff; }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--pico-primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; }
.grid-2 > a[role=button], .grid-2 > button { width: 100%; }
details.more summary { font-size: 0.95rem; }
#filters select, #filters input { margin-bottom: 0.6rem; }
.htmx-request #results, #results.htmx-request { opacity: 0.55; transition: opacity 0.2s; }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.kpi { display: flex; flex-direction: column; align-items: center; padding: 0.75rem 0.25rem; border-radius: 0.75rem;
       background: var(--pico-card-background-color); box-shadow: var(--pico-card-box-shadow);
       text-decoration: none; color: inherit; text-align: center; }
.kpi strong { font-size: 1.6rem; color: var(--pico-primary); line-height: 1.1; }
.kpi span { font-size: 0.75rem; color: var(--pico-muted-color); }
.charts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1rem; }
.charts article { min-width: 0; }
.charts article { margin-bottom: 1rem; }
.charts h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.chart-box { position: relative; height: 240px; }
.chart-box.square { height: 260px; }
.chart-box.short { height: 170px; }
.hint { background: var(--pico-card-sectioning-background-color); }
.memory h3 { margin: 0.1rem 0 0; font-size: 1.1rem; }
.memory header { margin-bottom: 0.6rem; }
.people { margin-bottom: 0.5rem; }
.dish { font-size: 0.9rem; margin-bottom: 0.25rem; }
article.compact { padding: 0.75rem 1rem; margin-bottom: 0.6rem; }

/* wine page */
.wine-head h1 { margin-bottom: 0.4rem; }
.wine-head p { margin-bottom: 0.4rem; }
.path a { text-decoration: none; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.split h2, .split h3 { margin: 0; }
.vintage { scroll-margin-top: 1rem; }
.vintage:target { box-shadow: 0 0 0 2px var(--wine); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem; margin: 0 0 0.75rem; }
dl.facts dt { color: var(--pico-muted-color); font-size: 0.9rem; }
dl.facts dd { margin: 0; }
.history li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.window { margin: 0.25rem 0 0.75rem; }
.window-track { position: relative; height: 0.7rem; border-radius: 0.35rem; background: var(--line); }
.window-range { position: absolute; top: 0; bottom: 0; border-radius: 0.35rem; background: #6fae73; }
.window-peak { position: absolute; top: 0; bottom: 0; border-radius: 0.35rem; background: #2e7d32; }
.window-now { position: absolute; top: -0.25rem; bottom: -0.25rem; width: 3px; margin-left: -1px;
              background: var(--pico-color); border-radius: 2px; }
.window-legend { display: flex; justify-content: space-between; color: var(--pico-muted-color); }

/* phone: tab bar at the bottom, under the thumb */
nav.tabs { display: none; }
@media (max-width: 767px) {
  .desktop-only { display: none; }
  body.with-tabs { padding-bottom: calc(4rem + env(safe-area-inset-bottom)); }
  nav.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0;
             z-index: 10; background: var(--pico-background-color); border-top: 1px solid var(--line);
             padding-bottom: env(safe-area-inset-bottom); }
  nav.tabs a { display: flex; flex-direction: column; align-items: center; padding: 0.45rem 0 0.4rem;
               font-size: 0.75rem; text-decoration: none; color: var(--pico-muted-color); }
  nav.tabs a span { font-size: 1.25rem; line-height: 1.3; }
  nav.tabs a[aria-current=page] { color: var(--pico-primary); font-weight: 700; }
  .kpi strong { font-size: 1.3rem; }
  .kpi span { font-size: 0.68rem; }
  header.container nav { padding-top: 0.25rem; }
  h1 { font-size: 1.6rem; }
}
@media (min-width: 768px) {
  .charts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .charts .wide { grid-column: span 2; }
}
.group-title small { white-space: nowrap; }

/* search box with drop-down suggestions */
.searchbox { position: relative; margin-bottom: 1rem; }
.searchbox input[type=search] { margin-bottom: 0; font-size: 1.05rem; }
.suggest:empty { display: none; }
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 0.35rem); z-index: 20; }
.suggest-panel { background: var(--pico-card-background-color); border: 1px solid var(--line); border-radius: 0.75rem;
                 box-shadow: 0 10px 30px rgba(0,0,0,.18); overflow: hidden; max-height: 70vh; overflow-y: auto; }
.suggest-item, .suggest-all { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.9rem;
                              color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.suggest-item:hover, .suggest-item.active, .suggest-all:hover, .suggest-all.active { background: rgba(123,30,58,.09); }
.suggest-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; flex: none; }
.suggest-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.suggest-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-title { font-weight: 600; }
.suggest-all { justify-content: space-between; border-bottom: 0; color: var(--pico-primary); font-weight: 600; font-size: 0.95rem; }
.suggest-note { margin: 0; padding: 0.6rem 0.9rem; color: var(--pico-muted-color); font-size: 0.9rem; }
mark { background: #f6d860; color: inherit; padding: 0 0.05em; border-radius: 0.15em; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) mark { background: #8a6d00; } }

/* buttons at the bottom of the filter form */
.form-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 0.75rem; margin: 0.5rem 0 1.25rem; }
.form-actions > * { width: 100%; margin: 0; text-align: center; white-space: nowrap; padding-left: 0.5rem; padding-right: 0.5rem; }
@media (max-width: 767px) {
  /* on a phone the two buttons stay under the thumb while the filter panel is open */
  #filters:has(details.more[open]) .form-actions { position: sticky; bottom: calc(4rem + env(safe-area-inset-bottom));
    background: var(--pico-background-color); padding: 0.6rem 0; z-index: 5; box-shadow: 0 -6px 12px -8px rgba(0,0,0,.25); }
}

/* ---- M2: events, add and open, quick − / + ---------------------------------------------------------------- */
.row-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem; color: inherit; text-decoration: none;
            align-self: stretch; }
button.count { border: 0; margin: 0; width: auto; cursor: pointer; font-size: 1rem; line-height: 1.5;
               min-width: 2.6rem; padding: 0.25rem 0.6rem; }
.stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--wine); border-radius: 1.4rem; overflow: hidden; }
.stepper[hidden] { display: none; }
.stepper button { background: none; border: 0; margin: 0; width: 2.6rem; height: 2.4rem; padding: 0; color: var(--pico-primary);
                  font-size: 1.4rem; font-weight: 700; line-height: 1; }
.stepper button:active { background: rgba(123,30,58,.12); }
.stepper .n { min-width: 1.6rem; text-align: center; font-weight: 700; }
.row.open { background: rgba(123,30,58,.05); }

/* live event banner */
.live-wrap { padding-top: 0; padding-bottom: 0; }
a.live { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.9rem; margin: 0 0 0.75rem; border-radius: 0.9rem;
         background: var(--wine); color: #fff; text-decoration: none; box-shadow: 0 4px 14px rgba(123,30,58,.25); }
a.live.buy { background: #2e6b4a; box-shadow: 0 4px 14px rgba(46,107,74,.25); }
.live-icon { font-size: 1.5rem; }
.live-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.live-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-text small { opacity: 0.85; font-size: 0.8rem; }
.live-go { background: rgba(255,255,255,.2); border-radius: 0.6rem; padding: 0.25rem 0.6rem; font-weight: 700; font-size: 0.85rem;
           white-space: nowrap; }
.live-badge { background: #c62828; color: #fff; }
.live-dot { position: absolute; margin: 0.1rem 0 0 1.4rem; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #c62828; }
nav.tabs a { position: relative; }

/* toast with Undo, above the tab bar */
.toast { position: fixed; left: 0.75rem; right: 0.75rem; bottom: calc(4.6rem + env(safe-area-inset-bottom)); z-index: 30;
         max-width: 34rem; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
         padding: 0.75rem 0.9rem; border-radius: 0.8rem; background: #22252c; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.3); }
.toast[hidden] { display: none; }
.toast form { margin: 0; }
.toast button.link { color: #f0a5b8; font-weight: 700; font-size: 1rem; }
@media (min-width: 768px) { .toast { bottom: 1.5rem; } }

/* quick adjust sheet: a bottom sheet on the phone */
#adjust article { width: 100%; max-width: 30rem; padding: 1rem 1.1rem 1.1rem; }
#adjust header { margin-bottom: 0.6rem; padding: 0 0 0.6rem; }
#adjust[data-action=out] .adj-in, #adjust[data-action=in] .adj-out { display: none; }
#adjust button { margin: 0; }
.adj-live { width: 100%; margin-bottom: 0.6rem !important; text-align: left; }
.adj-label { margin: 0.4rem 0 0.4rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pico-muted-color); }
.adj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.adj-grid .wide { grid-column: span 2; }
.adj-grid button { padding: 0.6rem 0.4rem; font-size: 0.95rem; }
.adj-formats { margin-bottom: 0.4rem; }
.adj-notes { margin: 0.75rem 0 0.25rem !important; }
.adj-more { margin: 0.4rem 0 0; text-align: right; font-size: 0.9rem; }
@media (max-width: 767px) {
  dialog#adjust { align-items: flex-end; padding: 0; }
  #adjust article { margin: 0; max-width: none; border-radius: 1.1rem 1.1rem 0 0;
                    padding-bottom: calc(1.1rem + env(safe-area-inset-bottom)); }
}

/* big action buttons (home, event page) */
.actions3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin-bottom: 1.25rem; }
.actions3 a[role=button] { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; padding: 0.7rem 0.3rem;
                           font-size: 0.95rem; line-height: 1.2; }
.actions3 b { font-size: 1.4rem; }
.actions3 a[role=button] { min-width: 0; text-align: center; overflow-wrap: anywhere; }
/* a long label goes to the next line instead of widening its box (24 Nov: the right box left the screen) */
.actions3 small { font-size: 0.72rem; opacity: 0.8; font-weight: 400; white-space: normal; max-width: 100%; }
a[role=button].wide, button.wide { display: block; width: 100%; text-align: center; margin-bottom: 0.75rem; }

/* events */
.ev-icon { font-size: 1.4rem; width: 2rem; text-align: center; flex: none; }
.event-head h1 { margin: 0.2rem 0 0.4rem; }
.event-head { margin-bottom: 1rem; }
button.remove { color: var(--pico-muted-color); font-size: 1.1rem; padding: 0.3rem 0.5rem; }
fieldset.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.45rem; border: 0; padding: 0; margin-bottom: 1rem; }
.tile { margin: 0; }
.tile input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile > span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.2rem; min-height: 4.4rem;
               padding: 0.5rem 0.25rem; border: 1.5px solid var(--line); border-radius: 0.8rem; text-align: center;
               font-size: 0.85rem; cursor: pointer; line-height: 1.15; }
.tile b { font-size: 1.5rem; font-weight: 400; }
.tile input:checked + span { border-color: var(--wine); background: rgba(123,30,58,.08); font-weight: 700; }
.tile input:focus-visible + span { outline: 2px solid var(--pico-primary); }

/* forms */
.form-wine { margin-bottom: 0; }
h1.form-title { margin-bottom: 1rem; }
.field-label { margin: 0 0 0.4rem; }
.qty { display: grid; grid-template-columns: repeat(5, 1fr) 1.3fr; gap: 0.4rem; margin-bottom: 0.9rem; }
.qty .chip-toggle > span { display: flex; justify-content: center; padding: 0.55rem 0; font-size: 1.1rem; font-weight: 700;
                           border-radius: 0.7rem; }
.qty input[type=number] { margin: 0; padding: 0.4rem; text-align: center; height: 100%; }
.grid-price { display: grid; grid-template-columns: 2fr 1fr; gap: 0 0.75rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.grid-2 label.check { align-self: end; margin-bottom: 1.2rem; }
.warn { background: #fff6e0; border: 1.5px solid #e0a800; border-radius: 0.8rem; padding: 0.75rem 0.9rem; margin: -0.4rem 0 1rem;
        color: #3a3000; }
.warn strong { display: block; margin-bottom: 0.4rem; }
.vintage-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.vintage-actions a[role=button] { margin: 0; }
.new-wine { margin-top: 1rem; }
/* layout fixes for the M2 forms */
.tile, .qty .chip-toggle { display: block; }
.qty .chip-toggle > span { width: 100%; }
.grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid-2 input, .grid-2 select { min-width: 0; }
.badge { white-space: nowrap; }
.warn label.check { align-items: flex-start; }
.similar-choices { display: grid; gap: 0.5rem; margin-top: 0.6rem; }
.similar-choices button { margin: 0; text-align: left; }
.warn label.check input { flex: none; margin-top: 0.2rem; }
#adjust article > header { margin: -1rem -1.1rem 0.75rem; padding: 0.9rem 3rem 0.75rem 1.1rem; position: relative; }
#adjust .adj-close { position: absolute; right: 1rem; top: 1rem; margin: 0; }
.tile > span { width: 100%; height: 100%; box-sizing: border-box; }
fieldset.tiles label.tile, .qty label.chip-toggle { width: 100%; }

/* ---- M3a: people, guests, invitations ------------------------------------------------------------------------ */
.chip.on { background: var(--wine); border-color: var(--wine); color: #fff; }
a.chip { color: inherit; }
a.chip.on { color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 0.1rem; margin: 0.25rem 0 0.75rem; }
.filters .chip { padding: 0.25rem 0.75rem; font-size: 0.9rem; }
.avatar.big { width: 3.4rem; height: 3.4rem; font-size: 1.4rem; }
.person-head { display: flex; align-items: center; gap: 0.9rem; margin: 0.5rem 0 0.75rem; }
.person-head h1 { margin: 0; }
.person-notes { display: block; }
blockquote.tastes { white-space: pre-line; margin: 0 0 1rem; padding: 0.6rem 0.9rem; border-left: 4px solid var(--wine); font-style: italic;
                    background: rgba(123, 30, 58, .05); border-radius: 0 0.5rem 0.5rem 0; }
.person-actions { margin: 0.75rem 0; gap: 0.5rem; }
.person-actions [role=button] { margin: 0; padding: 0.55rem 0.5rem; font-size: 0.95rem; }
fieldset.guests legend, fieldset legend { font-weight: 600; margin-bottom: 0.4rem; }
.guest-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.guest-chips .chip-toggle span { padding: 0.35rem 0.8rem; }
.guest-groups { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.25rem 0 1rem; }
button.group-chip { width: auto; margin: 0; padding: 0.35rem 0.8rem; background: none; color: var(--wine);
                    border: 1px dashed var(--wine); border-radius: 1.2rem; font-size: 0.9rem; }
.invite-card input[readonly] { font-family: ui-monospace, monospace; font-size: 0.85rem; }
.invite-card .grid-2 { gap: 0.5rem; }
.icon-input { width: 3.2rem !important; text-align: center; padding-left: 0.2rem !important; padding-right: 0.2rem !important; }
.group-row { gap: 0.5rem; align-items: center; }
.group-row input { margin: 0; }
.group-row .row-side { flex-direction: row; }
.pos-input { width: 4rem !important; text-align: center; padding-left: 0.2rem !important; padding-right: 0.2rem !important; }
textarea.notes-box { min-height: 12rem; resize: vertical; field-sizing: content; max-height: 70vh; }
.grid-new-group { display: flex; gap: 0.5rem; margin-top: 1rem; }
.grid-new-group input, .grid-new-group button { margin: 0; }
.grid-new-group button { width: auto; }
label.access-row { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; margin: 0; padding: 0.75rem 0;
                  border-bottom: 1px solid var(--line); }
.access-row input[role=switch] { margin: 0; flex: none; }
.grid-2 > :only-child { grid-column: span 2; }

/* ---- M3b: tasting notes -------------------------------------------------------------------------------------- */
.note-line { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0 0 0.6rem 1.55rem; margin-top: -0.3rem;
             border-bottom: 1px solid var(--line); }
.note-line .chip { margin: 0; padding: 0.2rem 0.65rem; }
.note-chip b { color: var(--wine); }
.chip.add { border-style: dashed; color: var(--wine); }
.list .row:has(+ .note-line) { border-bottom: none; }
.note-wine { margin-bottom: 0.25rem; }
.score-row { display: flex; align-items: center; gap: 0.75rem; }
.score-row input[type=range] { flex: 1; margin: 0; }
.score-num { width: 5.5rem !important; margin: 0 !important; font-size: 1.6rem; font-weight: 700; text-align: center;
             color: var(--wine); padding: 0.3rem !important; }
.score-chips { margin-top: 0.6rem; }
.score-chips .chip { width: auto; margin: 0; background: none; color: inherit; padding: 0.3rem 0.75rem; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 0.6rem; overflow: hidden; margin-bottom: 0.25rem; }
.seg label { flex: 1; margin: 0; text-align: center; border-right: 1px solid var(--line); cursor: pointer; }
.seg label:last-child { border-right: none; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: 2.6rem; padding: 0.35rem 0.2rem;
            font-size: 0.85rem; line-height: 1.15; }
.seg input:checked + span { background: var(--wine); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--pico-primary); outline-offset: -2px; }
.sheet fieldset { margin-bottom: 0.9rem; }
.sheet legend { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pico-muted-color);
                font-weight: 600; }
.sheet-top { margin: 0.25rem 0; font-size: 0.85rem; }
.sheet-top a { text-decoration: none; font-weight: 700; }
nav.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; margin: 0.4rem 0 1rem; }
nav.steps .step { margin: 0; padding: 0.45rem 0 0.2rem; background: none; border: none; border-top: 4px solid var(--line);
                  border-radius: 0; color: var(--pico-muted-color); font-size: 0.78rem; }
nav.steps .step.done { border-top-color: #c98aa0; }
nav.steps .step.current { border-top-color: var(--wine); color: var(--wine); font-weight: 700; }
.swatch-grid { display: grid; grid-template-columns: minmax(4.5rem, auto) repeat(3, minmax(0, 1fr)); gap: 0.35rem 0.5rem;
               align-items: center; justify-items: center; }
.swatch-grid .hue { justify-self: start; font-size: 0.85rem; }
.glass { margin: 0; cursor: pointer; line-height: 0; }
.glass input { position: absolute; opacity: 0; width: 1px; height: 1px; }
/* the wine seen from above in a tilted glass: deep in the middle, watery towards the rim, as on the Wine Folly chart */
.glass i { display: block; width: 3.4rem; height: 2.5rem; border-radius: 50%; border: 1px solid var(--line);
           background: radial-gradient(ellipse 70% 75% at 50% 58%, var(--wine-c) 0 42%,
             color-mix(in srgb, var(--wine-c) 70%, #fff) 72%, color-mix(in srgb, var(--wine-c) 22%, #fff) 100%); }
.glass input:checked + i { box-shadow: 0 0 0 3px var(--pico-background-color), 0 0 0 5px var(--wine); }
.glass input:focus-visible + i { outline: 2px solid var(--wine); outline-offset: 3px; }
details.family { border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.45rem 0.7rem; margin-bottom: 0.4rem; }
details.family summary { display: flex; justify-content: space-between; gap: 0.5rem; font-weight: 600; }
details.family summary small { font-weight: 400; text-align: right; }
details.family .guest-chips { margin: 0.5rem 0 0.1rem; }
.pts { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border-radius: 0.7rem;
       background: rgba(123, 30, 58, .07); margin: 0.75rem 0; }
.pts-label { flex: 1; font-weight: 600; line-height: 1.2; }
.pts-label small { font-weight: 400; font-size: 0.72rem; }
.pts .pts-btn { width: 2.3rem; height: 2.3rem; margin: 0; padding: 0; border-radius: 50%; background: #fff;
                color: var(--wine); border: 1px solid var(--line); font-size: 1.2rem; }
.pts .pts-input { width: 4rem; margin: 0; text-align: center; font-size: 1.4rem; font-weight: 700; color: var(--wine);
                  padding: 0.2rem; }
.inline-num { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.4rem; font-size: 0.9rem; }
.inline-num input { width: 5rem; margin: 0; }
.balance-chart svg { width: 100%; max-width: 22rem; display: block; margin: 0 auto; touch-action: none; cursor: crosshair; }
.b-ring { fill: rgba(123, 30, 58, .05); stroke: rgba(123, 30, 58, .25); stroke-width: 0.01; }
.b-centre { fill: rgba(123, 30, 58, .12); stroke: rgba(123, 30, 58, .35); stroke-width: 0.01; }
.b-shape { fill: none; stroke: var(--wine); stroke-width: 0.015; }
.b-axis { stroke: rgba(123, 30, 58, .35); stroke-width: 0.008; stroke-dasharray: 0.03 0.03; }
.b-label { font-size: 0.11px; font-weight: 700; fill: var(--wine); text-anchor: middle; }
.b-sector { stroke: rgba(123, 30, 58, .15); stroke-width: 0.006; }
.b-end { font-size: 0.14px; }
.b-zone { font-size: 0.085px; fill: var(--pico-muted-color); text-anchor: middle; dominant-baseline: middle; }
.b-dot { fill: var(--wine); stroke: #fff; stroke-width: 0.03; }
.b-result { text-align: center; margin: 0.25rem 0 0; }
.b-badge { font-size: 1rem; padding: 0.2rem 0.8rem; background: var(--wine); color: #fff; }
.b-badge.fault { background: #c62828; }
.window-tip { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.6rem 0.75rem; border-radius: 0.6rem;
              background: #fff8e6; border: 1px solid #f0d48a; color: #3a3020; font-size: 0.9rem; margin-bottom: 1rem; }
.window-tip input { margin-top: 0.15rem; flex: none; }
.total { display: flex; align-items: center; gap: 0.5rem; padding: 0.75rem; border-radius: 0.7rem;
         background: rgba(123, 30, 58, .07); margin-bottom: 1rem; }
.total > span:first-child { flex: 1; }
.total b { font-size: 2rem; color: var(--wine); }
.sheet-foot { display: flex; gap: 0.5rem; position: sticky; bottom: calc(4rem + env(safe-area-inset-bottom));
              background: var(--pico-background-color); padding: 0.5rem 0; }
.sheet-foot button { flex: 1; margin: 0; }
@media (min-width: 768px) { .sheet-foot { bottom: 0; } }
.note-card { padding: 0.7rem 0.9rem; margin-bottom: 0.6rem; }
.note-card p { margin: 0.3rem 0 0; }
article.waiting { border: 1px solid var(--wine); background: rgba(123, 30, 58, .04); }
article.waiting .row-side [role=button] { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.score-row input[type=range] { accent-color: var(--wine); }
.b-result { margin: 0 0 0.25rem; }
.compare { margin-bottom: 1rem; }
.compare-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 0.3rem; }
button.compare-row { display: grid; grid-template-columns: auto auto 1fr; grid-template-areas: "dot year score" ". meta meta";
  align-items: center; gap: 0.1rem 0.6rem; width: 100%; margin: 0 0 0.35rem; padding: 0.55rem 0.75rem; text-align: left;
  background: var(--pico-card-background-color); color: inherit; border: 1px solid var(--line); border-radius: 0.6rem; }
button.compare-row[aria-pressed=true] { border-color: var(--wine); box-shadow: 0 0 0 1px var(--wine); }
.compare-row .dot { grid-area: dot; } .compare-row strong { grid-area: year; }
.compare-score { grid-area: score; text-align: right; } .compare-score b { color: var(--wine); font-size: 1.15rem; }
.compare-meta { grid-area: meta; }
.compare-chart { height: 14rem; margin-top: 0.5rem; }

/* Settings > Relations: icon | name | order, then Save / ✕ on the right */
.rel-row { display: grid; grid-template-columns: 3.2rem 1fr 4rem auto; gap: 0.5rem; align-items: center;
           padding: 0.5rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.rel-row input, .rel-row button { margin: 0; }
.rel-row button { width: auto; padding: 0.2rem 0.4rem; }
.rel-row .row-main small { display: block; margin-top: 0.15rem; }
.rel-row .row-side { display: flex; flex-direction: row; gap: 0.4rem; align-items: center; }
@media (max-width: 420px) {
  .rel-row { grid-template-columns: 3.2rem 1fr 4rem; }
  .rel-row .row-side { grid-column: 2 / -1; justify-content: flex-end; flex-direction: row; }
}

/* Outside wine: show the field that matches the chosen source (no JS) */
.bring-form .src { display: none; }
.bring-form:has(input[name=source][value=venue]:checked) .src-venue,
.bring-form:has(input[name=source][value=estate]:checked) .src-estate,
.bring-form:has(input[name=source][value=person]:checked) .src-person,
.bring-form:has(input[name=source][value=other]:checked) .src-other { display: block; }
.bring-form:has(input[name=source][value=venue]:checked) .grid-price.src-venue,
.bring-form:has(input[name=source][value=estate]:checked) .grid-price.src-estate,
.bring-form:has(input[name=source][value=other]:checked) .grid-price.src-other { display: grid; }

/* Dinner sheet: the four parts of the full sheet as small headings on one page */
.dinner-step { font-size: 1rem; margin: 1.4rem 0 0.4rem; color: var(--wine); }

/* aroma wheel (aroma_wheel.js): unpicked aromas are a tint of their family colour, picked ones the full colour */
.aroma-modes { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
.aroma-modes .chip, .wheel-picked .chip { width: auto; margin: 0; padding: 0.2rem 0.7rem; font-size: 0.85rem; }
.aroma-modes .chip:not(.on) { background: none; color: inherit; }
#aroma-wheel { max-width: 440px; margin: 0 auto; }
svg.wheel { display: block; width: 100%; height: auto; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
svg.wheel:active { cursor: grabbing; }
.w-fam { fill: var(--c); stroke: var(--pico-background-color); stroke-width: 1.2; }
.w-fam-t { fill: #fff; font-weight: 700; pointer-events: none; }
.w-aro { fill: color-mix(in srgb, var(--c) 28%, var(--pico-background-color)); stroke: var(--pico-background-color); stroke-width: 0.8; }
.w-aro.on { fill: var(--c); }
.w-aro-t { fill: var(--pico-color); pointer-events: none; }
.w-aro-t.on { fill: #fff; font-weight: 700; }
.w-centre { fill: var(--pico-background-color); stroke: var(--line); }
.w-centre-n { font-size: 13px; fill: var(--wine); font-weight: 700; pointer-events: none; }
.wheel-hint { text-align: center; font-size: 0.8rem; margin: 0.2rem 0 0.5rem; }
.wheel-picked .chip.on { background: var(--c); border-color: var(--c); color: #fff; }
