/* Tasting Journal — tokens first, light + dark. */
:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface-1: #fcfcfb;
  --surface-2: #f0efec;
  --border: #dedcd5;
  --text-primary: #1b1a17;
  --text-secondary: #52514e;
  --text-muted: #7a7872;
  --accent: #9a5b13;          /* amber, UI chrome only (not a data color) */
  --accent-ink: #ffffff;
  --good: #0ca30c;
  --critical: #d03b3b;
  --series-1: #2a78d6;        /* Bourbon */
  --series-2: #eb6834;        /* Rye */
  --series-3: #1baf7a;        /* Japanese */
  --series-other: #8a8983;    /* everything else */
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;
  --grid: #e6e4de;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 2px 8px rgb(0 0 0 / .04);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface-1: #1a1a19;
    --surface-2: #242422;
    --border: #383835;
    --text-primary: #f4f3ef;
    --text-secondary: #c3c2b7;
    --text-muted: #8f8e86;
    --accent: #e0a458;
    --accent-ink: #1a1a19;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-other: #8f8e86;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --grid: #2c2c2a;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface-1: #1a1a19;
  --surface-2: #242422;
  --border: #383835;
  --text-primary: #f4f3ef;
  --text-secondary: #c3c2b7;
  --text-muted: #8f8e86;
  --accent: #e0a458;
  --accent-ink: #1a1a19;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-other: #8f8e86;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --series-8: #e66767;
  --grid: #2c2c2a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text-primary); font-size: 14px; line-height: 1.45; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 17px; letter-spacing: .01em; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; width: 100%;
}
textarea { resize: vertical; min-height: 54px; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button {
  border: 1px solid var(--border); background: var(--surface-1); border-radius: 6px;
  padding: 6px 12px; cursor: pointer;
}
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.ghost { background: transparent; border-color: transparent; }
button:disabled { opacity: .5; cursor: default; }
label { display: block; font-size: 12px; color: var(--text-secondary); }
label > input, label > select, label > textarea { margin-top: 3px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 24px;
  padding: 10px 20px; background: var(--surface-1); border-bottom: 1px solid var(--border);
}
.tabs { display: flex; gap: 4px; flex: 1; }
.whoami { color: var(--text-secondary); font-size: 14px; white-space: nowrap; }
.mk-wrap.signin { max-width: 440px; padding-top: 12vh; }
.signin-card { display: grid; gap: 12px; padding: 28px; }
.signin-card .mk-btn { justify-self: start; text-decoration: none; }
.tab { border: none; background: transparent; padding: 6px 12px; border-radius: 6px; color: var(--text-secondary); }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text-primary); font-weight: 600; }

/* Review layout */
.view { padding: 20px; }
#view-review { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
#view-review > * { min-width: 0; }
.sidebar { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 6px; }
.session-item {
  text-align: left; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-1);
  border: 1px solid var(--border); display: grid; gap: 2px;
}
.session-item[aria-current="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.session-item .date { font-weight: 600; }
.session-item .place { color: var(--text-secondary); font-size: 13px; }
.session-item .place.unnamed { color: var(--text-muted); font-style: italic; }
.progress { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 4px; }
.progress > span { display: block; height: 100%; background: var(--good); border-radius: 2px; }
.empty { color: var(--text-muted); }

.session-head {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 12px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.session-head .meta { color: var(--text-secondary); }
.place-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.new-place { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto auto; gap: 8px; align-items: end; }

/* Tasting card */
.tasting {
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
  display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 20px;
}
.tasting > *, .session-head > * { min-width: 0; }
.tasting.confirmed { border-left: 4px solid var(--good); }
.tasting.rejected { opacity: .55; }
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; align-content: start; }
.photos img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; cursor: zoom-in;
  background: var(--surface-2);
}
.photos .kind { font-size: 11px; color: var(--text-muted); }
.tasting-body { display: grid; gap: 14px; min-width: 0; }
.tasting-title { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.tasting-title h2 { font-size: 17px; }
.tasting-title .time { color: var(--text-muted); font-size: 12px; }
.identity { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--text-secondary); }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; background: var(--surface-2);
        max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.id { max-width: 320px; font-family: ui-monospace, Menlo, monospace; font-size: 11px; }
.rating-row.unset input[type="range"] { opacity: .35; }
.chip.warn { border-color: var(--critical); }
.chip.tried { border-color: var(--accent); color: var(--text-primary); }
.subtitle { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }
.actions .merge select { width: auto; max-width: 240px; }
.evidence { font-size: 12px; color: var(--text-secondary); background: var(--surface-2); border-radius: 6px; padding: 8px 10px; }
.grid-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grid-fields .span2 { grid-column: span 2; }
.rating-row { display: grid; grid-template-columns: 80px 1fr; gap: 12px; align-items: center; }
.rating-row input[type="number"] { font-size: 20px; font-weight: 600; text-align: center; }
.rating-row input[type="range"] { accent-color: var(--accent); padding: 0; border: none; background: none; }
.notes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.saved { font-size: 12px; color: var(--text-muted); margin-right: auto; }
details summary { cursor: pointer; color: var(--text-secondary); font-size: 12px; }

/* People */
.people-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 3px; }
.people-row select { width: auto; }
.chip.person { display: inline-flex; align-items: center; gap: 4px; padding-right: 2px; font-size: 13px; }
.chip-x { padding: 0 6px; font-size: 11px; line-height: 1.6; }
.new-person { display: grid; grid-template-columns: 2fr 1fr auto auto; gap: 8px; align-items: end; margin-top: 8px; }

/* Journal */
.tl-figure { margin-bottom: 16px; }
.tl-track { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 10px; align-items: stretch; scroll-snap-type: x proximity; }
.tl-night { flex: none; display: flex; flex-direction: column; gap: 8px; scroll-snap-align: start;
            border-left: 2px solid var(--border); padding-left: 12px; }
.tl-night header { min-width: 0; }
.tl-date { font-weight: 600; font-size: 13px; }
.tl-place, .tl-person { color: var(--text-secondary); font-size: 12px; }
.tl-pours { display: grid; grid-auto-flow: column; grid-template-rows: repeat(2, auto); gap: 8px; }
.tl-pour { position: relative; width: 104px; padding: 0; border: none; background: none; text-align: left; display: grid; gap: 4px; }
.tl-pour img, .tl-noimg { width: 104px; height: 128px; object-fit: cover; border-radius: 6px; background: var(--surface-2); display: block; }
.tl-pour:hover img { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-name { font-size: 11px; line-height: 1.25; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tl-rating { position: absolute; top: 6px; right: 6px; background: var(--surface-1); color: var(--text-primary);
             font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 7px; box-shadow: var(--shadow); }
.tl-gap, .tl-year { flex: none; align-self: center; writing-mode: vertical-rl; transform: rotate(180deg);
                    color: var(--text-muted); font-size: 11px; letter-spacing: .04em; }
.tl-year { color: var(--text-primary); font-weight: 600; font-size: 13px; }
.filters { display: flex; gap: 16px; margin-bottom: 16px; }
.filters label { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.filters input { width: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.tile .value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .label { color: var(--text-secondary); font-size: 12px; }
.charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.chart {
  margin: 0; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; min-width: 0;
}
.chart.wide { grid-column: 1 / -1; }
.chart figcaption p { margin: 2px 0 8px; color: var(--text-secondary); font-size: 12px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-secondary); font-size: 11px; }
.chart .axis path, .chart .axis line { stroke: var(--border); }
.chart .grid line { stroke: var(--grid); }
.chart .grid path { display: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.legend span::before {
  content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: var(--c); margin-right: 5px; vertical-align: -1px;
}
.table-title { margin: 24px 0 8px; }
.table-sub { margin: -4px 0 8px; color: var(--text-secondary); font-size: 12px; }
td.trend { font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.table-wrap { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { color: var(--text-secondary); font-weight: 600; position: sticky; top: 0; background: var(--surface-1); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Overlays */
#lightbox {
  position: fixed; inset: 0; background: rgb(0 0 0 / .85); display: grid; place-items: center; z-index: 20;
}
#lightbox[hidden] { display: none; }
#lightbox img { max-width: 94vw; max-height: 94vh; border-radius: 6px; }
#lightbox .close { position: absolute; top: 12px; right: 16px; color: #fff; font-size: 20px; }
#tooltip {
  position: fixed; pointer-events: none; z-index: 30; background: var(--surface-1); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px;
  box-shadow: 0 4px 16px rgb(0 0 0 / .15); max-width: 260px;
}
#tooltip .muted { color: var(--text-secondary); }
#toast {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text-primary);
  color: var(--surface-1); padding: 8px 14px; border-radius: 8px; font-size: 13px; z-index: 40;
}

/* Narrow screens */
@media (max-width: 860px) {
  .view { padding: 16px; }
  #view-review { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; flex-direction: row; overflow-x: auto; }
  .session-item { min-width: 180px; }
  .tasting { grid-template-columns: minmax(0, 1fr); }
  .grid-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .notes-grid { grid-template-columns: minmax(0, 1fr); }
  .new-place, .new-person { grid-template-columns: 1fr 1fr; }
  .place-row { grid-template-columns: minmax(0, 1fr); }
  .tasting { padding: 12px; gap: 12px; }
  .actions { flex-wrap: wrap; }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .topbar { gap: 12px; padding: 10px 16px; }
}

/* Wrapped ------------------------------------------------------------------
   A tasting room after hours: char and oak fields, label-paper ivory text,
   copper rules framing each card like a printed whiskey label.
   Display: Libre Caslon Display. Text and data: Barlow Semi Condensed. */
#view-wrapped, .wr-player {
  --serif: "Libre Caslon Display", "Iowan Old Style", Georgia, serif;
  --sans: "Barlow Semi Condensed", "Avenir Next Condensed", ui-sans-serif, system-ui, sans-serif;
  --char: #17110D; --oak: #2A1C13; --oxblood: #4A1517; --glass: #1C3328;
  --ivory: #E8DCC4; --label: #EFE6D2; --ink: #2B1D14; --copper: #B87333; --amber: #C8862A;
  --wr-font: var(--sans);
}
#view-wrapped { font-family: var(--sans); max-width: 1240px; margin: 0 auto; }
.wr-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; font-size: 15px; }
.wr-bar label { display: inline-flex; gap: 8px; align-items: center; color: var(--text-secondary); font-size: 15px; }
.wr-bar select, .wr-bar input { width: auto; font-family: inherit; }

.wr-story { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.wr-card {
  --bg: var(--oak); --fg: var(--ivory); --accent: var(--copper); --data: var(--amber);
  background: var(--bg); color: var(--fg);
  border-radius: 6px; padding: 34px 34px 32px; min-width: 0;
  display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden; isolation: isolate;
}
/* the label frame: a hairline copper border inset from the edge */
.wr-card::after { content: ""; position: absolute; inset: 9px; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
                  border-radius: 3px; pointer-events: none; }
.wr-card.s12 { grid-column: span 12; } .wr-card.s8 { grid-column: span 8; } .wr-card.s7 { grid-column: span 7; }
.wr-card.s6 { grid-column: span 6; } .wr-card.s5 { grid-column: span 5; } .wr-card.s4 { grid-column: span 4; }
.wr-card.char    { --bg: var(--char); }
.wr-card.oak     { --bg: var(--oak); }
.wr-card.oxblood { --bg: var(--oxblood); --data: #D9A066; }
.wr-card.glass   { --bg: var(--glass); --data: #C9A55C; }
.wr-card.label   { --bg: var(--label); --fg: var(--ink); --accent: #9A5B26; --data: #8A4B22; }

.wr-line { margin: 0; font-size: 18px; line-height: 1.4; max-width: 48ch; opacity: .82; font-weight: 400; }
.wr-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.4vw, 46px);
            line-height: 1.04; letter-spacing: -.005em; max-width: 22ch; }
.wr-num { font-family: var(--serif); font-size: clamp(72px, 9.5vw, 136px); line-height: .9; font-weight: 400;
          letter-spacing: -.02em; font-variant-numeric: lining-nums tabular-nums; color: var(--data); }
.wr-num small { font-family: var(--sans); font-size: .22em; letter-spacing: .02em; font-weight: 500; margin-left: .35em; color: var(--fg); }
.wr-foot { margin: 0; font-size: 14px; opacity: .65; }
.wr-head { display: grid; gap: 8px; }
.wr-rule { height: 1px; background: color-mix(in srgb, var(--accent) 60%, transparent); border: none; margin: 4px 0; }
.wr-btn { font-family: var(--sans); font-weight: 600; font-size: 15px; border: 1px solid var(--accent); border-radius: 3px;
          padding: 8px 18px; background: transparent; color: var(--fg); cursor: pointer; letter-spacing: .02em; }
.wr-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.wr-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Opening card: the bottles themselves, dimmed and warmed, behind the title */
.wr-open { min-height: 460px; justify-content: space-between; background: var(--char); }
.wr-collage { position: absolute; inset: 0; z-index: -1; display: flex; flex-wrap: wrap; align-content: stretch; gap: 2px;
              filter: sepia(.6) saturate(.75) brightness(.42); overflow: hidden; }
/* two rows of bottles across the card, whatever its size */
.wr-collage img { flex: 1 0 calc(100% / 13 - 2px); height: calc(50% - 1px); object-fit: cover; min-width: 40px; }
.wr-stage .wr-collage img { flex-basis: calc(100% / 5 - 2px); height: calc(20% - 2px); }
.wr-open::before { content: ""; position: absolute; inset: 0; z-index: -1;
                   background:
                     linear-gradient(95deg, color-mix(in srgb, var(--char) 92%, transparent) 20%, color-mix(in srgb, var(--char) 55%, transparent) 62%, color-mix(in srgb, var(--char) 25%, transparent)),
                     linear-gradient(0deg, color-mix(in srgb, var(--char) 85%, transparent), transparent 55%); }
.wr-open .wr-title { font-size: clamp(52px, 8vw, 116px); max-width: 11ch; line-height: .98; }
.wr-open .wr-line { font-size: 20px; }
.wr-facts { display: flex; flex-wrap: wrap; gap: 16px 44px; }
.wr-facts div { display: grid; gap: 2px; }
.wr-facts b { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 5vw, 66px); line-height: 1; color: var(--amber);
              font-variant-numeric: lining-nums tabular-nums; }
.wr-facts span { font-size: 15px; opacity: .78; }
.wr-route { display: flex; align-items: center; flex-wrap: wrap; font-size: 17px; font-weight: 500; }
.wr-route .stop { display: inline-flex; align-items: baseline; gap: 8px; }
.wr-route .dot { width: 7px; height: 7px; transform: rotate(45deg) translateY(-2px); background: var(--copper); }
.wr-route .leg { width: 64px; height: 1px; background: var(--copper); opacity: .6; margin: 0 14px; }
.wr-route .nights { opacity: .65; font-weight: 400; }

/* Nights as stacks of bottles */
.wr-stacks { display: flex; align-items: flex-end; justify-content: space-around; gap: 18px; overflow-x: auto; padding-bottom: 4px; flex: 1; }
.wr-stack { display: flex; flex-direction: column-reverse; gap: 5px; align-items: center; flex: none; }
.wr-stack img, .wr-stack .ph { width: 54px; height: 70px; object-fit: cover; border-radius: 2px; display: block; cursor: pointer;
                               filter: sepia(.25) saturate(.9); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.wr-stack img:hover { filter: none; box-shadow: 0 0 0 2px var(--accent); }
.wr-stack .cap { font-size: 13px; text-align: center; line-height: 1.25; margin-top: 8px; max-width: 92px; opacity: .85; }
.wr-stack .cap b { display: block; font-family: var(--serif); font-weight: 400; font-size: 26px; color: var(--data); opacity: 1; }

/* Split bar */
.wr-split { display: flex; height: 46px; gap: 2px; }
.wr-split div { display: flex; align-items: center; padding: 0 14px; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; }
.wr-legend-row { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 15px; }
.wr-legend-row span::before { content: ""; display: inline-block; width: 9px; height: 9px; background: var(--c); margin-right: 7px; transform: rotate(45deg); }

/* Bars and lists inside cards */
.wr-bars { display: grid; gap: 10px; }
.wr-bars .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 15px; align-items: end; }
.wr-bars .track { grid-column: 1 / -1; height: 6px; background: color-mix(in srgb, var(--fg) 12%, transparent); }
.wr-bars .fill { height: 100%; background: var(--data); }
.wr-bars .row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.wr-pour { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 14px; align-items: center; cursor: pointer; }
.wr-pour img { width: 56px; height: 74px; object-fit: cover; border-radius: 2px; filter: sepia(.2);
               box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.wr-pour b { display: block; font-size: 18px; line-height: 1.2; font-weight: 600; }
.wr-pour span { font-size: 15px; opacity: .75; }
.wr-pick { display: grid; gap: 6px; font-size: 15px; }
.wr-pick .track { position: relative; height: 2px; background: color-mix(in srgb, var(--fg) 30%, transparent); margin: 8px 0 4px; }
.wr-pick .mark { position: absolute; top: -6px; width: 14px; height: 14px; background: var(--data); transform: translateX(-50%) rotate(45deg); }
.wr-waffle { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 5px; }
.wr-waffle span { aspect-ratio: 3 / 4; border-radius: 2px; background: var(--c); }
.wr-words { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; line-height: 1.05; }
.wr-words span { font-family: var(--serif); }
.wr-svg { width: 100%; height: auto; display: block; overflow: visible; }
.wr-svg text { fill: currentColor; font-family: var(--sans); }
.wr-svg .axis path, .wr-svg .axis line { stroke: currentColor; opacity: .3; }
.wr-svg .axis text { font-size: 13px; opacity: .7; }
.muted-inline { opacity: .6; }
.wr-thumbs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; }
.wr-thumbs img { width: 26px; height: 35px; object-fit: cover; border-radius: 1px; cursor: pointer; filter: sepia(.3); }
.wr-seq-wrap { margin-top: auto; display: grid; gap: 8px; }
.wr-seq { display: flex; gap: 14px; flex-wrap: wrap; }
.wr-seq .night { display: flex; gap: 3px; }
.wr-seq span { width: 16px; height: 26px; border-radius: 1px; cursor: pointer; }

/* Tree + mash: same room, chart colors drawn from the cask */
.wr-tree, .wr-paper { margin-bottom: 14px; }
.wr-tree { --bg: var(--char); }
.wr-paper { --bg: var(--label); --fg: var(--ink); --accent: #9A5B26; }
.tree-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tree-controls input[type="range"] { width: 240px; accent-color: var(--copper); padding: 0; border: none; background: none; }
.tree-night-label { font-size: 15px; opacity: .75; min-width: 240px; }
.seg { display: inline-flex; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); border-radius: 3px; overflow: hidden; margin-left: auto; }
.seg-btn { border: none; border-radius: 0; padding: 6px 14px; background: transparent; color: inherit; opacity: .7; font-family: inherit; font-size: 14px; }
.seg-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 25%, transparent); opacity: 1; font-weight: 600; }
.wr-tree .legend { color: var(--fg); opacity: .85; }
.tree-wrap { overflow-x: auto; }
.tree-wrap svg { display: block; }
.tree-wrap .node text { font-size: 14px; fill: var(--ivory); font-family: var(--sans); }
.tree-wrap .node .sub { fill: var(--ivory); opacity: .55; font-size: 12px; font-style: italic; }
.tree-wrap .link { fill: none; stroke: color-mix(in srgb, var(--copper) 45%, transparent); stroke-width: 1.2px; }
.tree-wrap .link.dashed { stroke-dasharray: 3 4; }
.tree-wrap .node, .tree-wrap .link { transition: opacity .45s ease; }
.tree-wrap .hidden { opacity: 0; pointer-events: none; }
.tree-wrap .fresh circle { stroke: var(--amber); stroke-width: 3px; }
.wr-paper table { font-family: var(--sans); font-size: 15px; }
.wr-paper .table-wrap { background: transparent; border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.wr-paper th { background: var(--label); color: var(--ink); }
.wr-paper td, .wr-paper th { border-bottom-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.mash-table td { white-space: normal; vertical-align: top; }
.mash-table .swatch { display: inline-block; width: 9px; height: 9px; margin-right: 8px; transform: rotate(45deg); }

@media (max-width: 960px) {
  .wr-card.s8, .wr-card.s7, .wr-card.s6, .wr-card.s5, .wr-card.s4 { grid-column: span 12; }
}
@media (max-width: 860px) {
  .wr-card { padding: 26px 22px 26px; }
  .wr-open { min-height: 0; }
  .seg { margin-left: 0; }
  .wr-stacks { gap: 8px; justify-content: space-between; }
  .wr-stack img, .wr-stack .ph { width: 38px; height: 50px; }
  .wr-stack .cap { font-size: 12px; max-width: 64px; }
  .wr-route { gap: 8px 18px; }
  .wr-route .leg { display: none; }
  .wr-facts { gap: 12px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .tree-wrap .node, .tree-wrap .link { transition: none; }
}

/* Story player -------------------------------------------------------------- */
.wr-play { font-family: var(--sans, inherit); font-weight: 600; font-size: 15px; border: 1px solid #B87333; border-radius: 3px;
           padding: 7px 18px; background: #17110D; color: #E8DCC4; margin-left: auto; cursor: pointer; letter-spacing: .02em; }
.wr-player { position: fixed; inset: 0; z-index: 50; background: #0b0806; display: grid; place-items: center; font-family: var(--sans); }
.wr-player[hidden] { display: none; }
.wr-stage { width: min(100vw, calc(100vh * 9 / 16)); height: min(100vh, calc(100vw * 16 / 9)); position: relative; }
.wr-stage .wr-card { position: absolute; inset: 0; border-radius: 0; padding: 76px 36px 44px; justify-content: center; gap: 22px; overflow-y: auto; }
.wr-stage .wr-card::after { inset: 14px; }
.wr-stage .wr-card .wr-title { font-size: clamp(34px, 4.8vh, 50px); max-width: none; }
.wr-stage .wr-card.wr-open .wr-title { font-size: clamp(56px, 9.5vh, 96px); }
.wr-stage .wr-num { font-size: clamp(88px, 15vh, 150px); }
.wr-stage .wr-stacks { flex: none; justify-content: space-between; gap: 6px; }
.wr-stage .wr-stack img, .wr-stage .wr-stack .ph { width: var(--tw, 40px); height: calc(var(--tw, 40px) * 1.3); }
.wr-stage .wr-stack .cap { max-width: calc(var(--tw, 40px) + 6px); font-size: 9px; overflow-wrap: anywhere; }
.wr-stage .wr-stack .cap b { font-size: 20px; }
.wr-stage .wr-seq-wrap { margin-top: 18px; }
.wr-stage .wr-card.enter { animation: wr-enter .9s ease both; }
.wr-stage .wr-card.enter > * { animation: wr-rise .9s ease both; }
.wr-stage .wr-card.enter > *:nth-child(2) { animation-delay: .15s; }
.wr-stage .wr-card.enter > *:nth-child(3) { animation-delay: .3s; }
.wr-stage .wr-card.enter > *:nth-child(n+4) { animation-delay: .45s; }
.wr-stage .wr-card.enter > .wr-collage { animation: wr-enter 1.4s ease both; }
@keyframes wr-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes wr-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.wr-progress { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); width: min(96vw, calc(100vh * 9 / 16) - 24px);
               display: flex; gap: 4px; z-index: 3; }
.wr-progress span { flex: 1; height: 2px; background: rgb(232 220 196 / .25); overflow: hidden; }
.wr-progress span i { display: block; height: 100%; width: 0; background: #C8862A; }
.wr-progress span.done i { width: 100%; }
.wr-close, .wr-pause { position: fixed; z-index: 4; border: 1px solid rgb(184 115 51 / .6); background: rgb(23 17 13 / .7); color: #E8DCC4;
                       border-radius: 3px; font-family: inherit; cursor: pointer; }
.wr-close { top: 22px; right: max(12px, calc(50vw - (100vh * 9 / 32) + 12px)); width: 34px; height: 34px; font-size: 14px; }
.wr-pause { bottom: 18px; left: 50%; transform: translateX(-50%); padding: 5px 16px; font-size: 14px; }
.wr-tap { position: fixed; top: 60px; bottom: 60px; width: 34vw; z-index: 2; background: transparent; border: none; cursor: pointer; }
.wr-tap.prev { left: 0; } .wr-tap.next { right: 0; }
.wr-tap:focus-visible, .wr-close:focus-visible, .wr-pause:focus-visible { outline: 2px solid #C8862A; }
.wr-player.export .wr-close, .wr-player.export .wr-pause, .wr-player.export .wr-tap { display: none; }
.wr-player.export { inset: auto; top: 0; left: 0; width: 540px; height: 960px; transform: scale(var(--export-scale, 2)); transform-origin: 0 0; }
.wr-player.export .wr-stage { width: 540px; height: 960px; }
.wr-player.export .wr-progress { width: 516px; }
@media (prefers-reduced-motion: reduce) {
  .wr-stage .wr-card.enter, .wr-stage .wr-card.enter > * { animation: none; }
}

/* Add tab -------------------------------------------------------------------- */
.add-wrap { max-width: 680px; margin: 0 auto; display: grid; gap: 14px; }
.add-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.add-head { display: flex; justify-content: space-between; align-items: center; }
.add-head h2, .add-phone h2 { font-size: 17px; }
.add-phone { grid-template-columns: 132px 1fr; align-items: center; }
.add-phone p { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; }
.add-qr svg { width: 132px; height: 132px; display: block; background: #fff; border-radius: 6px; }
.add-url { font-size: 12px !important; word-break: break-all; }
.add-drop { display: grid; place-items: center; gap: 6px; text-align: center; padding: 34px 16px; border: 2px dashed var(--border);
            border-radius: var(--radius); cursor: pointer; color: var(--text-primary); background: var(--surface-2); }
.add-drop.over, .add-drop:hover { border-color: var(--accent); }
.add-drop:focus-within { outline: 2px solid var(--accent); }
.add-drop-title { font-size: 20px; font-weight: 650; }
.add-drop-sub { font-size: 13px; color: var(--text-secondary); }
.add-progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.add-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.add-result { margin: 0; font-size: 14px; }
.night { border-top: 1px solid var(--grid); padding: 12px 0 4px; display: grid; gap: 8px; }
.night:first-child { border-top: none; padding-top: 0; }
.night-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.night-top b { display: block; }
.night-sub { color: var(--text-secondary); font-size: 13px; }
.night-actions { display: flex; gap: 6px; flex: none; }
.night-actions button { min-height: 40px; }
.night-place { display: flex; gap: 8px; flex-wrap: wrap; }
.night-place select { flex: 1; min-width: 180px; min-height: 40px; }
.night-status { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.pill.wait { border-color: var(--accent); }
.pill.done { border-color: var(--good); }
.night-hint { margin: 0; font-size: 12px; color: var(--text-secondary); }
.chip-btn { border-radius: 999px; padding: 8px 14px; min-height: 40px; background: var(--surface-1); border: 1px solid var(--border); }
.chip-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.chip-btn.small { min-height: 34px; padding: 5px 11px; font-size: 13px; }

/* Rate: one pour per screen */
.rate-panel { max-width: 680px; margin: 0 auto; display: grid; gap: 12px; padding-bottom: 90px; }
.rate-top { display: flex; align-items: center; gap: 10px; }
.rate-count { font-weight: 600; }
.rate-saved { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.rate-dots { display: flex; gap: 5px; flex-wrap: wrap; }
.rate-dots span { width: 22px; height: 6px; border-radius: 3px; background: var(--border); cursor: pointer; }
.rate-dots span.done { background: var(--good); }
.rate-dots span.cur { background: var(--accent); }
.rate-photos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); }
.rate-photos img { height: 300px; max-width: 86%; object-fit: cover; border-radius: var(--radius); scroll-snap-align: start; flex: none; background: var(--surface-2); }
.rate-name { font-size: 22px; line-height: 1.2; }
.rate-sub { margin: -6px 0 0; color: var(--text-secondary); font-size: 14px; }
.rate-score { display: grid; grid-template-columns: 76px 1fr; gap: 12px; align-items: center; }
.rate-value { font-size: 40px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.rate-inputs { display: grid; gap: 8px; }
.rate-chips { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
.rate-chips .chip-btn { padding: 8px 0; font-weight: 600; min-width: 0; }
.rate-inputs input[type="range"] { accent-color: var(--accent); padding: 0; border: none; background: none; height: 28px; }
.rate-field { font-size: 13px; }
.rate-field textarea { font-size: 16px; min-height: 52px; }   /* 16px stops iOS zoom-on-focus */
.rate-hint { margin: 0; font-size: 12px; color: var(--text-muted); }
.rate-vocab { display: flex; gap: 6px; flex-wrap: wrap; }
.rate-nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
            background: var(--surface-1); border-top: 1px solid var(--border); justify-content: center; z-index: 6; }
.rate-nav button { flex: 1; max-width: 320px; min-height: 48px; font-size: 16px; }
.wide { width: 100%; min-height: 46px; font-size: 16px; }
#paste-panel textarea { font-size: 16px; }
.paste-out { display: grid; gap: 10px; }
.proposal { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; }
.proposal-head { display: grid; gap: 6px; }
.proposal-head select { min-height: 40px; }
.proposal dl { margin: 0; display: grid; grid-template-columns: 64px 1fr; gap: 4px 10px; font-size: 14px; }
.proposal dt { color: var(--text-secondary); text-transform: capitalize; }
.proposal dd { margin: 0; }
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 8px 10px; }
  .topbar h1 { font-size: 14px; line-height: 1.15; max-width: 64px; }
  .tabs { gap: 0; }
  .tab { padding: 6px 8px; font-size: 14px; }
  .rate-score { grid-template-columns: 58px 1fr; }
  .rate-value { font-size: 32px; }
  .add-phone { grid-template-columns: 1fr; }
  .rate-photos img { height: 240px; }
  .night-top { flex-wrap: wrap; }
}

/* Collection + Market --------------------------------------------------------
   A cellar ledger: label-paper cards on the page tokens, Caslon headings, condensed
   figures, copper hairlines. Data colours stay semantic (--series-*); --accent is chrome. */
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; }
.mk {
  --serif: "Libre Caslon Display", "Iowan Old Style", Georgia, serif;
  --sans: "Barlow Semi Condensed", "Avenir Next Condensed", ui-sans-serif, system-ui, sans-serif;
  --rule: color-mix(in srgb, var(--accent) 45%, transparent);
  font-family: var(--sans); font-size: 15px;
}
.mk-wrap { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.mk-wrap > *, .mk-section > *, .mk-detail > *, .mk-review-part > *, .mk-empty > * { min-width: 0; }
.mk-section, .mk-detail { grid-template-columns: minmax(0, 1fr); }
.mk-head { border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
.mk-kicker { margin: 0; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.mk-title { font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 4vw, 42px); line-height: 1.05; }
.mk-hint { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }
.mk-count { font-size: 13px; color: var(--text-secondary); }
.mk-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.mk-tile { background: var(--surface-1); border: 1px solid var(--border); border-top: 2px solid var(--rule);
           border-radius: 4px; padding: 12px 14px; display: grid; gap: 2px; }
.mk-tile-value { font-family: var(--serif); font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mk-tile-label { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.mk-tile-sub { font-size: 12px; color: var(--text-muted); }
.mk-btn { font-family: var(--sans); font-weight: 600; font-size: 15px; border: 1px solid var(--accent); border-radius: 3px;
          padding: 8px 16px; min-height: 40px; background: transparent; color: var(--text-primary); text-decoration: none;
          display: inline-flex; align-items: center; justify-content: center; }
.mk-btn:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.mk-btn.primary { background: var(--accent); color: var(--accent-ink); }
.mk-btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, var(--text-primary)); }
.mk-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.mk-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 4px; padding: 14px; }
.mk-select { width: auto; min-height: 36px; }
.mk-search { min-height: 36px; max-width: 260px; }
.mk-filters { display: grid; gap: 8px; }
.mk-filterrow { display: flex; gap: 8px; flex-wrap: wrap; }
.mk-chipgroup { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mk-chiplabel { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; min-width: 46px; }
.mk-empty { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 4px; padding: 12px 14px; display: grid; gap: 6px; }
.mk-empty p { margin: 0; color: var(--text-secondary); }
.mk-empty code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; background: var(--surface-1); border: 1px solid var(--border);
                 border-radius: 3px; padding: 4px 8px; overflow-x: auto; white-space: nowrap; display: block; }
.mk-formtitle { font-family: var(--serif); font-weight: 400; font-size: 22px; }
.mk-formactions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.mk-addform { display: grid; gap: 6px; }
.mk-addform input, .mk-addform textarea, .coll-fields input, .coll-fields textarea { font-size: 16px; }   /* no iOS zoom */
.danger { color: var(--critical); }

/* Collection cards */
.coll-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 10px; }
.coll-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; background: var(--surface-1);
             border: 1px solid var(--border); border-radius: 4px; padding: 12px; align-items: start; }
.coll-card.flag-yes { box-shadow: inset 3px 0 0 var(--accent); }
.coll-card.flag-maybe { box-shadow: inset 3px 0 0 var(--rule); }
.coll-card.out { opacity: .6; }
.coll-thumb { width: 76px; height: 100px; object-fit: cover; border-radius: 2px; background: var(--surface-2); display: block; }
.coll-thumb.ph { display: grid; place-items: center; text-align: center; font-size: 11px; color: var(--text-muted); padding: 6px;
                 border: 1px dashed var(--border); }
.coll-body { display: grid; gap: 8px; min-width: 0; }
.coll-top { display: flex; gap: 8px; justify-content: space-between; align-items: start; }
.coll-name { min-width: 0; }
.coll-name h3 { font-family: var(--serif); font-weight: 400; font-size: 19px; line-height: 1.2; }
.coll-qty { font-family: var(--sans); font-size: 15px; color: var(--accent); }
.coll-facts { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); }
.coll-status { flex: none; font-size: 13px; padding: 4px 6px; }
.coll-market { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.coll-market b { font-weight: 600; }
.coll-sell { display: flex; gap: 6px; }
.coll-sell .chip-btn { flex: 1; }
.coll-details summary { font-size: 13px; padding: 4px 0; }
.coll-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 6px; }
.coll-fields .span2 { grid-column: 1 / -1; }
.coll-del { margin-top: 8px; text-align: right; }

/* Collection views: grouped ledger sections */
.coll-groups { display: grid; gap: 26px; }
.coll-group { display: grid; gap: 10px; min-width: 0; }
.coll-ghead { display: flex; align-items: baseline; justify-content: space-between; gap: 2px 12px; flex-wrap: wrap;
              border-bottom: 1px solid var(--rule); padding-bottom: 4px; }
.coll-ghead h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.15; }
.coll-gmeta { font-size: 13px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.coll-gmeta b { color: var(--text-primary); font-weight: 600; }
.coll-gmeta small, .coll-subhead small small { color: var(--text-muted); font-size: 12px; }
.coll-sub { display: grid; gap: 8px; min-width: 0; }
.coll-sub + .coll-sub { margin-top: 6px; }
.coll-subhead { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 12px; font-weight: 600;
                letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.coll-subhead > small { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-muted); font-size: 12px; }
.coll-subhead b { font-weight: 600; color: var(--text-secondary); }
.coll-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.mk-tag { font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 1px 6px; border-radius: 2px; line-height: 1.5;
          border: 1px solid var(--rule); color: var(--text-secondary); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.mk-tag.pick { border-color: var(--accent); color: var(--accent); }
.mk-tag.under { flex: none; align-self: flex-start; border-color: var(--accent); color: var(--accent); background: none;
                font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .06em; min-height: 0; cursor: pointer; }
.mk-tag.under[aria-expanded="true"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mk-under-note { margin: 4px 0 0; font-size: 12px; color: var(--text-secondary); border-left: 2px solid var(--accent); padding-left: 8px; }
.coll-statuswrap { display: grid; justify-items: end; gap: 2px; flex: none; }
.coll-sellrow { display: grid; gap: 2px; }
.coll-sellrow .sv { justify-self: end; }
.coll-field { display: grid; gap: 2px; align-content: start; }
.coll-flabel { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; min-width: 0; }
.coll-edited { font-size: 11px; color: var(--text-muted); text-align: right; letter-spacing: .02em; }
.coll-market .mk-conf { vertical-align: 1px; }

/* Save state, per field */
.sv { font-size: 11px; line-height: 16px; min-height: 16px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums;
      display: inline-flex; align-items: center; gap: 4px; transition: opacity .4s; }
.sv:empty { display: none; }
.sv.is-saving { opacity: .75; }
.sv.is-saved { color: var(--good); font-weight: 600; }
.sv.is-dot { animation: sv-fade .6s ease; }
.sv-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); display: inline-block; }
.sv.is-err { color: var(--critical); }
.sv-retry { border: none; background: none; padding: 0; min-height: 0; font: inherit; font-weight: 600; color: var(--critical);
            text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
@keyframes sv-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sv.is-dot { animation: none; } }

/* Market */
.mk-section { display: grid; gap: 10px; }
.mk-section-head h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; }
.mk-section-head p { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); max-width: 80ch; }
.mk-subhead { margin: 6px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-secondary); }
.mk-tablewrap { max-height: none; }
.mk-table { font-size: 14px; font-family: var(--sans); }
.mk-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; }
.mk-table th:has(.mk-sort) { padding: 0; }
.mk-sort { border: none; background: none; padding: 8px 10px; font: inherit; color: inherit; text-transform: inherit;
           letter-spacing: inherit; width: 100%; text-align: inherit; white-space: nowrap; }
.mk-table th.num .mk-sort { text-align: right; }
.mk-table td { vertical-align: top; }
.mk-table tbody tr.mk-row { cursor: pointer; }
.mk-table tbody tr.mk-row:hover, .mk-table tbody tr.mk-row:focus-visible { background: var(--surface-2); outline: none; }
.mk-table tr.current { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.mk-table tr.out { color: var(--text-muted); }
.mk-table th:first-child, .mk-table td:first-child { position: sticky; left: 0; background: var(--surface-1); z-index: 1; }
.mk-table tr.current td:first-child { background: color-mix(in srgb, var(--accent) 10%, var(--surface-1)); }
.mk-bottle { display: grid; min-width: 170px; white-space: normal; }
.mk-bottle b { font-weight: 600; }
.mk-bottle small, .mk-stack small { color: var(--text-muted); font-size: 12px; }
.mk-stack { display: grid; }
.mk-trend.up::first-letter { color: var(--good); }
.mk-trend.down::first-letter { color: var(--critical); }
.mk-trend { font-variant-numeric: tabular-nums; }
.mk-ws a { color: inherit; text-decoration-color: var(--rule); }
.mk-ws small { color: var(--text-muted); font-size: 12px; }
.mk-conf { display: inline-flex; gap: 2px; align-items: center; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.mk-conf .dots { letter-spacing: 1px; color: var(--text-muted); font-size: 10px; }
.mk-conf.high .dots { color: var(--good); }
.mk-more { justify-self: start; font-weight: 500; font-size: 14px; }
.mk-attrib { margin: 0; font-size: 12px; color: var(--text-muted); }
.mk-attrib a { color: var(--text-secondary); }

.mk-detail { display: grid; gap: 12px; background: var(--surface-1); border: 1px solid var(--border); border-top: 2px solid var(--accent); border-radius: 4px; padding: 16px; scroll-margin-top: 70px; }
.mk-detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.mk-detail-title { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; }
.mk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 18px;
            border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 10px 0; }
.mk-stat { display: grid; gap: 1px; min-width: 0; }
.mk-stat > span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.mk-stat > b { font-family: var(--serif); font-weight: 400; font-size: 24px; font-variant-numeric: tabular-nums; }
.mk-stat > small { font-size: 12px; color: var(--text-secondary); }
.mk-stat a { color: inherit; }
.mk-chart { margin: 0; background: transparent; border: none; padding: 0; box-shadow: none; }
.mk-chart figcaption h3 { font-size: 15px; }
.mk-legend span.lg-dot::before { background: var(--c); }
.mk-legend span.lg-ring::before { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.mk-legend span.lg-line::before { width: 16px; height: 2px; border-radius: 1px; vertical-align: 3px; background: var(--c); }
.mk-legend span.lg-band::before { width: 16px; height: 9px; border-radius: 2px; background: color-mix(in srgb, var(--c) 25%, transparent);
                                  box-shadow: inset 0 -2px 0 var(--c); }
.mk-legend span.lg-dash::before { width: 16px; height: 0; border-radius: 0; border-top: 1px dashed var(--c); background: none; vertical-align: 3px; }
.mk-lots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 8px; }
.mk-lot { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px;
          border: 1px solid var(--grid); border-radius: 4px; }
.mk-lot.unused { opacity: .5; }
.mk-lotimg { width: 56px; height: 72px; object-fit: cover; border-radius: 2px; background: var(--surface-2); display: block; }
.mk-lotbody { display: grid; gap: 2px; min-width: 0; }
.mk-lottitle { margin: 0; font-size: 14px; line-height: 1.3; }
.mk-lottitle a { color: inherit; }
.mk-lotprice { margin: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.mk-lotmeta { margin: 0; font-size: 12px; color: var(--text-muted); }

.mk-plan .mk-reserve { display: grid; gap: 2px; min-width: 130px; }
.mk-plan .mk-reserve input { width: 110px; font-size: 16px; min-height: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.mk-plan input.invalid { border-color: var(--critical); outline-color: var(--critical); }
.mk-reserve-msg { color: var(--critical); font-size: 12px; }
.mk-netat { color: var(--text-muted); font-size: 12px; }
.mk-plan-foot { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.mk-plan-totals { display: flex; gap: 10px 26px; flex-wrap: wrap; }
.mk-plan-totals div { display: grid; }
.mk-plan-totals span { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.mk-plan-totals b { font-family: var(--serif); font-weight: 400; font-size: 24px; font-variant-numeric: tabular-nums; }

.mk-review-part { display: grid; gap: 8px; margin-bottom: 8px; }
.mk-review-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 10px; }
.mk-review-card { display: grid; gap: 8px; align-content: start; }
.mk-review-top { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
.mk-review-top p { margin: 0 0 2px; }
.mk-cmptable { font-size: 13px; width: 100%; }
.mk-cmptable th, .mk-cmptable td { padding: 4px 6px; }
.mk-cmptable tbody th { color: var(--text-secondary); font-weight: 500; position: static; }
.mk-cmp.ok { color: var(--good); }
.mk-cmp.bad { color: var(--critical); }
.mk-cmp.unk { color: var(--text-muted); }
.mk-cands { display: grid; gap: 6px; }
.mk-cand { display: flex; gap: 8px; align-items: start; font-size: 14px; color: var(--text-primary); padding: 6px 8px;
           border: 1px solid var(--grid); border-radius: 4px; cursor: pointer; }
.mk-cand input { width: auto; margin-top: 3px; accent-color: var(--accent); }
.mk-cand small { color: var(--text-muted); }

/* This week: live lots */
#mk-live-lots { display: grid; gap: 10px; }
.mk-live { background: var(--surface-1); border: 1px solid var(--border); border-top: 2px solid var(--accent);
           border-radius: 4px; padding: 14px 16px 16px; }
.mk-live-line { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; color: var(--text-secondary); }
.mk-live-line b { color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
.mk-live-line .sep { color: var(--rule); }
.mk-live-stop { margin: 0 0 6px; padding: 8px 10px; border: 1px solid var(--critical); border-radius: 4px; font-size: 14px;
                color: var(--critical); background: color-mix(in srgb, var(--critical) 7%, transparent); }
.mk-live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 10px; }
.mk-live-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px;
                border: 1px solid var(--grid); border-radius: 4px; background: var(--bg); }
.mk-live-card .mk-lotimg { width: 64px; height: 84px; }
.mk-live-card.ext { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }
.mk-live-card.sold, .mk-live-card.unsold { opacity: .78; }
.mk-live-body { display: grid; gap: 4px; min-width: 0; align-content: start; }
.mk-live-top { display: flex; gap: 8px; align-items: start; justify-content: space-between; }
.mk-badge { flex: none; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
            padding: 2px 6px; border-radius: 2px; white-space: nowrap; }
.mk-badge.ext { color: var(--accent-ink); background: var(--accent); }
.mk-live-figs { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-top: 2px; }
.mk-live-price { display: grid; gap: 0; min-width: 0; }
.mk-live-price > span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.mk-live-price > b { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.mk-delta { white-space: normal; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.mk-delta.up::first-letter { color: var(--good); }
.mk-delta.down::first-letter { color: var(--critical); }
.mk-spark { flex: 0 1 132px; min-width: 64px; height: auto; overflow: visible; }
.mk-spark.empty { width: 132px; height: 36px; }
.mk-spark .line { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.mk-spark .dot { fill: var(--accent); }
.mk-spark .med { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.mk-live-foot { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--text-secondary); }
.mk-when.soon { color: var(--accent); font-weight: 600; }
.mk-reserve-flag.met { color: var(--good); }
.mk-reserve-flag.not { color: var(--text-muted); }

/* This week: watchlist strip, watch toggle, alerts bell */
.mk-live-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.mk-icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mk-bell-wrap { position: relative; flex: none; }
.mk-bell { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-radius: 3px;
           border: 1px solid var(--border); background: var(--bg); font-family: var(--sans); font-weight: 600; font-size: 14px; }
.mk-bell.unread { border-color: var(--accent); color: var(--accent); }
.mk-bell-n { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
             font-size: 12px; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.mk-bell-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(380px, calc(100vw - 32px));
                 max-height: 60vh; overflow: auto; background: var(--surface-1); border: 1px solid var(--border);
                 border-top: 2px solid var(--accent); border-radius: 4px; box-shadow: var(--shadow); padding: 10px 12px; }
.mk-bell-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-bottom: 6px;
                border-bottom: 1px solid var(--rule); }
.mk-bell-head small { color: var(--text-muted); font-size: 12px; }
.mk-bell-panel ul { list-style: none; margin: 0; padding: 0; }
.mk-alert { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.mk-alert:last-child { border-bottom: 0; }
.mk-alert p { margin: 0; font-size: 14px; line-height: 1.35; }
.mk-alert p a { color: inherit; text-decoration: none; }
.mk-alert p a:hover { text-decoration: underline; }
.mk-alert small { grid-column: 2; color: var(--text-muted); font-size: 12px; }
.mk-alert-kind { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 6px;
                 border-radius: 2px; height: fit-content; border: 1px solid var(--rule); color: var(--text-secondary); white-space: nowrap; }
.mk-alert.over_max .mk-alert-kind { color: var(--critical); border-color: var(--critical); }
.mk-alert.near_max .mk-alert-kind, .mk-alert.extended .mk-alert-kind { color: var(--accent); border-color: var(--accent); }
.mk-alert.new { background: color-mix(in srgb, var(--accent) 7%, transparent); margin: 0 -12px; padding: 8px 12px; }

.mk-watch { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 4px; background: var(--bg); }
.mk-watch-head { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; }
.mk-watch-head h4 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 20px; }
.mk-watch-head small { color: var(--text-muted); font-size: 13px; flex: 1; min-width: 12ch; }
.mk-btn.small { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.mk-watch-form { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, .8fr) minmax(0, 1fr) auto; gap: 8px; align-items: end;
                 padding: 10px 0 4px; border-top: 1px solid var(--grid); }
.mk-watch-form label { font-size: 12px; color: var(--text-secondary); }
.mk-watch-form input { font-size: 16px; min-height: 40px; }
.mk-watch-form .wide { grid-column: 1 / -1; }
.mk-watch-form label.wide { grid-column: 1; }
.mk-watch-list { list-style: none; margin: 0; padding: 0; display: grid; }
.mk-watch-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2.4fr) auto; gap: 6px 14px; align-items: center;
                padding: 8px 0; border-top: 1px solid var(--grid); }
.mk-watch-row.ext { box-shadow: inset 2px 0 0 var(--accent); padding-left: 8px; }
.mk-watch-name { display: grid; gap: 1px; min-width: 0; }
.mk-watch-name a, .mk-watch-name b { font-weight: 600; color: var(--text-primary); text-decoration: none; overflow-wrap: anywhere; }
.mk-watch-name a:hover { text-decoration: underline; }
.mk-watch-name small { color: var(--text-muted); font-size: 12px; }
.mk-watch-notes { font-style: italic; }
.mk-watch-kind { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.mk-watch-lots { display: grid; gap: 6px; min-width: 0; }
.mk-watch-lots .mk-hint { margin: 0; }
.mk-wl { display: grid; gap: 2px; min-width: 0; }
.mk-wl-title { font-size: 13px; color: var(--text-secondary); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-wl-figs { display: flex; flex-wrap: wrap; align-items: end; gap: 4px 16px; }
.mk-fig { display: grid; line-height: 1.1; }
.mk-fig small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.mk-fig b { font-family: var(--serif); font-weight: 400; font-size: 19px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk-fig b.ok { color: var(--good); }
.mk-fig b.over { color: var(--critical); }
.mk-fig b.soon { color: var(--accent); }
.mk-watch-max { display: flex; align-items: end; gap: 4px; }
.mk-maxlab { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.mk-max { width: 96px; min-height: 36px; font-size: 16px; text-align: right; font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; }
.mk-x { font-size: 20px; line-height: 1; min-width: 40px; min-height: 40px; color: var(--text-muted); }
.mk-x:hover { color: var(--critical); }

.mk-live-card.watching { border-color: var(--rule); box-shadow: inset 0 2px 0 var(--accent); }
.mk-watchbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; padding-top: 6px;
               border-top: 1px dashed var(--grid); font-size: 13px; color: var(--text-secondary); }
.mk-eye { display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 4px 10px; border-radius: 3px;
          border: 1px solid var(--border); background: transparent; font-family: var(--sans); font-weight: 600; font-size: 13px; }
.mk-eye:hover { border-color: var(--accent); }
.mk-eye.on { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.mk-eye.static { cursor: default; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-next b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.mk-room { font-variant-numeric: tabular-nums; font-weight: 600; }
.mk-room.ok { color: var(--good); }
.mk-room.over { color: var(--critical); }

/* Lot tags, date hints, effective (all-in) price, fees settings */
.mk-lotshead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.mk-lot.pick { border-style: dashed; }
.mk-legend span.lg-pick::before { width: 8px; height: 8px; border-radius: 1px; transform: rotate(45deg); background: color-mix(in srgb, var(--c) 35%, transparent);
                                  box-shadow: inset 0 0 0 1.25px var(--c); }
.mk-lottags { margin: 2px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.mk-quirk { font-size: 11px; color: var(--accent); border-bottom: 1px dotted var(--accent); cursor: help; white-space: nowrap; }
.mk-effbtn { font: inherit; color: inherit; background: none; border: none; padding: 0; min-height: 0; cursor: pointer;
             text-decoration: underline dotted var(--rule); text-underline-offset: 3px; font-variant-numeric: tabular-nums; }
.mk-effbtn:hover, .mk-effbtn[aria-expanded="true"] { text-decoration-color: var(--accent); color: var(--accent); }
.mk-effwarn { color: var(--accent); font-family: var(--sans); font-size: .7em; vertical-align: super; margin-left: 1px; }
.mk-wl-eff { margin: 0; font-size: 12px; color: var(--text-muted); }
.mk-maxall.over { color: var(--critical); }
.mk-wl-eff .mk-maxall { font-size: 12px; }
.mk-maxall { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.mk-live-eff { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; font-size: 13px; }
.mk-live-eff-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; }
.mk-live-eff .mk-effbtn { font-family: var(--serif); font-size: 19px; }
.mk-pop { position: fixed; z-index: 35; width: min(300px, calc(100vw - 32px)); background: var(--surface-1); color: var(--text-primary);
          border: 1px solid var(--border); border-top: 2px solid var(--accent); border-radius: 4px; box-shadow: var(--shadow);
          padding: 10px 12px; font-family: "Barlow Semi Condensed", "Avenir Next Condensed", ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
.mk-pop[hidden] { display: none; }
.mk-pop-title { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-secondary); font-weight: 600; }
.mk-pop-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.mk-pop-table th, .mk-pop-table td { padding: 3px 0; border: none; position: static; background: none; font-size: 14px; }
.mk-pop-table th { text-align: left; font-weight: 400; color: var(--text-secondary); text-transform: none; letter-spacing: 0; }
.mk-pop-table td { text-align: right; }
.mk-pop-table tr.sub th, .mk-pop-table tr.sub td { border-top: 1px solid var(--grid); }
.mk-pop-table tr.total th, .mk-pop-table tr.total td { border-top: 1px solid var(--rule); font-weight: 600; color: var(--text-primary); padding-top: 5px; }
.mk-pop-unknown { margin: 6px 0 0; font-size: 12px; color: var(--text-muted); font-style: italic; }

.mk-live-tools { display: flex; gap: 8px; align-items: start; flex: none; }
.mk-fees-wrap { position: relative; }
.mk-fees > summary { list-style: none; cursor: pointer; }
.mk-fees > summary::-webkit-details-marker { display: none; }
.mk-fees[open] > summary { border-color: var(--accent); color: var(--accent); }
.mk-fees-n { min-width: 20px; padding: 0 6px; border-radius: 10px; border: 1px solid var(--accent); color: var(--accent);
             font-size: 12px; line-height: 18px; text-align: center; }
.mk-fees-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(440px, calc(100vw - 32px));
                 background: var(--surface-1); border: 1px solid var(--border); border-top: 2px solid var(--accent);
                 border-radius: 4px; box-shadow: var(--shadow); padding: 10px 12px 12px; display: grid; gap: 8px; }
.mk-fee-group { border: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.mk-fee-group legend { padding: 0 0 4px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.mk-fee { display: grid; gap: 2px; font-size: 12px; color: var(--text-secondary); min-width: 0; }
.mk-fee-unit { font-style: normal; color: var(--text-muted); }
.mk-fee input { font-size: 16px; min-height: 36px; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; margin-top: 0; }
.mk-fee input::placeholder { color: var(--text-muted); opacity: .8; }

@media (max-width: 560px) {
  .mk-live { padding: 12px; }
  .mk-live-head { flex-direction: column; }
  .mk-bell-wrap { align-self: stretch; }
  .mk-bell { width: 100%; justify-content: center; }
  .mk-bell-panel { left: 0; right: auto; width: 100%; }
  .mk-live-tools { align-self: stretch; }
  .mk-live-tools > * { flex: 1; }
  .mk-fees-wrap, .mk-bell-wrap { position: static; }
  .mk-live-head { position: relative; }
  .mk-fees-panel { left: 0; right: 0; width: auto; }
  .mk-fees > summary { width: 100%; justify-content: center; }
  .mk-watch { padding: 10px; }
  .mk-watch-head small { order: 3; flex-basis: 100%; }
  .mk-watch-head h4 { flex: 1; }
  .mk-watch-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mk-watch-form label.wide, .mk-watch-form .wide { grid-column: 1 / -1; }
  .mk-watch-form button { grid-column: 1 / -1; }
  .mk-watch-row { grid-template-columns: minmax(0, 1fr) auto; }
  .mk-watch-row .mk-watch-lots { grid-column: 1 / -1; grid-row: 2; }
  .mk-fig b { font-size: 17px; }
  .mk-live-price > b { font-size: 24px; }
  .mk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-tile-value { font-size: 26px; }
  .mk-search { max-width: none; flex: 1; }
  .mk-detail { padding: 12px; }
  .mk-detail-title { font-size: 23px; }
  .mk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mk-bottle { min-width: 140px; }
  .coll-fields { grid-template-columns: minmax(0, 1fr); }
}

/* Bottle photos: per-bottle strip, unassigned area, file pickers */
.coll-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.coll-labelfacts { color: var(--text-muted); }
.coll-photostrip { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.coll-pthumb { margin: 0; display: grid; gap: 2px; justify-items: center; }
.coll-pthumb img, .coll-pthumb-ph { width: 64px; height: 84px; object-fit: cover; border-radius: 2px; background: var(--surface-2);
                                    display: grid; place-items: center; font-size: 11px; color: var(--text-muted); }
.coll-pthumb-acts { display: flex; gap: 2px; }
.coll-pthumb-acts button { font-size: 11px; padding: 2px 4px; min-height: 0; }
.coll-photoadd { display: flex; gap: 6px; flex-wrap: wrap; align-self: center; }
.coll-photos { display: grid; gap: 8px; }
.coll-photos .mk-hint { margin: 0; }
.coll-ugrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.coll-ucard { margin: 0; display: grid; gap: 6px; align-content: start; background: var(--surface-2); border: 1px solid var(--border);
              border-radius: 3px; padding: 8px; }
.coll-uimg { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 2px; display: block; background: var(--surface-1); }
.coll-uimg.ph { display: grid; place-items: center; color: var(--text-muted); font-size: 12px; }
.coll-ucard figcaption { display: grid; gap: 6px; }
.coll-ucard .mk-select { width: 100%; font-size: 16px; }   /* no iOS zoom */
.coll-uacts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: space-between; }
/* Label reading: per-photo status + "Read label", the "From photo" suggestions block */
.coll-readlabel { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: center; font-size: 11px; }
.coll-readlabel button { font-size: 11px; padding: 2px 4px; min-height: 0; }
.coll-sugg { margin: 8px 0; padding: 8px; border: 1px solid var(--border); border-left: 3px solid var(--accent);
             border-radius: 3px; background: var(--surface-2); display: grid; gap: 6px; }
.coll-sugg-head { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.coll-sugg-head .chip-btn { margin-left: auto; }
.coll-sugg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.coll-sugg-list li { display: grid; grid-template-columns: minmax(80px, auto) 1fr auto; gap: 8px; align-items: center; }
.coll-sugg-f { font-size: 12px; color: var(--text-secondary); }
.coll-sugg-v { min-width: 0; overflow-wrap: anywhere; }
.coll-sugg-acts { display: flex; gap: 4px; align-items: center; }
.coll-sugg-acts .ghost { font-size: 16px; line-height: 1; padding: 2px 8px; min-height: 0; }
.coll-sugg-note { display: block; font-size: 12px; color: var(--text-secondary); }

/* Comparables ladder: the rung line (valuation table, bottle detail) and the collapsed ladder list */
.mk-rung { display: block; font-size: 12px; }
.mk-ladder { margin: 10px 0 4px; font-size: 13px; }
.mk-ladder ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
.mk-ladder li { color: var(--text-secondary); }
.mk-ladder li.used { color: var(--text-primary); }
.mk-ladder li b { font-weight: 600; margin-right: 4px; }
.mk-ladder li .mk-tag { margin-right: 2px; }
.mk-ladder li.used .mk-tag { border-color: var(--accent); color: var(--accent); }
.mk-ladder ul { margin: 2px 0 0; padding-left: 16px; font-size: 12px; }

/* Admin tab (owner only): one card per user, counts, API usage, bottle table and photo statuses */
.adm-users { display: grid; gap: 12px; }
.adm-card { display: grid; gap: 10px; min-width: 0; }
.adm-head { display: flex; gap: 10px; justify-content: space-between; align-items: start; }
.adm-who { min-width: 0; }
.adm-who h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.2; }
.adm-sub { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.adm-seen { margin: 0; font-size: 13px; color: var(--text-secondary); }
.adm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.adm-stat { display: grid; gap: 0; }
.adm-stat-v { font-family: var(--serif); font-size: 22px; font-variant-numeric: tabular-nums; }
.adm-stat-l { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.adm-sts { display: flex; gap: 6px; flex-wrap: wrap; }
.adm-st.failed, .adm-st.skipped { border-color: var(--critical); }
.adm-st.pending, .adm-st.queued { border-color: var(--accent); }
.adm-usage { display: grid; gap: 4px; font-size: 13px; font-variant-numeric: tabular-nums; }
.adm-usage-line { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; color: var(--text-secondary); }
.adm-note { margin: 0; font-size: 12px; color: var(--text-muted); }
.adm-more summary { font-size: 14px; padding: 6px 0; cursor: pointer; }
.adm-detail { display: grid; gap: 10px; margin-top: 6px; min-width: 0; }
.adm-total { margin: 0; font-size: 14px; }
.adm-total b { font-family: var(--serif); font-weight: 400; font-size: 20px; }
.adm-sub2 { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.adm-unmatched { color: var(--text-muted); font-style: italic; }
.adm-table code { font-size: 12px; overflow-wrap: anywhere; }
.adm-h4 { margin: 4px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-secondary); }
.adm-photos { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.adm-photos li { border-top: 1px solid var(--border); padding-top: 8px; display: grid; gap: 2px; min-width: 0; }
.adm-photo-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.adm-err { font-size: 12px; color: var(--critical); overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Segment indexes (Market tab, owner only) */
.ix-chip.on { background: color-mix(in srgb, var(--c) 18%, var(--surface-1)); color: var(--text-primary); border-color: var(--c); }
.ix-key { display: inline-block; width: 14px; height: 2px; background: var(--c); vertical-align: 4px; margin-right: 6px; border-radius: 1px; }
