/* Cellar — one stylesheet, no framework, no build step.
   Colours are tokens on :root so the dark scheme only has to restate them. */

:root {
  --wine:      #6b1030;
  --wine-deep: #4a0a20;
  --wine-soft: #f6ecef;
  --ink:       #24191c;
  --ink-soft:  #6d5f63;
  --page:      #faf7f5;
  --card:      #ffffff;
  --line:      #e6dcdd;
  --ok:        #2f6d4f;
  --warn:      #9a4b12;
  --danger:    #a32020;
  --bar:       #6b1030;   /* the header band — deep in both schemes */
  --radius:    10px;
  --shadow:    0 1px 2px rgba(36, 25, 28, .06), 0 4px 14px rgba(36, 25, 28, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --wine:      #c2547a;
    --wine-deep: #8d1f43;
    --wine-soft: #2a1a20;
    --ink:       #f0e8ea;
    --ink-soft:  #b0a0a5;
    --page:      #171215;
    --card:      #211a1e;
    --line:      #3a2d32;
    --ok:        #6cc295;
    --warn:      #e0a267;
    --danger:    #e57373;
    --bar:       #40101f;
    --shadow:    0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1 { font-size: 1.6rem; margin: 0 0 .2em; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .6em; letter-spacing: -.005em; }
a  { color: var(--wine); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .95em; }
.big { font-size: 1.4rem; letter-spacing: .08em; }

.wrap { max-width: 1080px; margin: 0 auto; padding: .9rem 1rem 4rem; }
.wrap.narrow { max-width: 660px; }
.muted { color: var(--ink-soft); }
.sub   { color: var(--ink-soft); font-size: .85rem; }
.hint  { display: block; color: var(--ink-soft); font-size: .82rem; margin-top: .25rem; }
.num   { text-align: right; font-variant-numeric: tabular-nums; }
.only-narrow { display: none; }   /* shown only where .col-drop hides */
.tight { white-space: nowrap; }

/* ── navigation ───────────────────────────────────────────────────────────
 * Three renderings of one menu: a sidebar on desktop, and on a phone a sticky
 * top bar plus a fixed bottom tab bar. Only one set is ever visible.
 * ----------------------------------------------------------------------- */

/* Mobile top bar */
.topnav {
  position: sticky; top: 0; z-index: 100;
  background: var(--bar); height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: 0 1rem;
}
.topnav-brand { color: #fff; font-weight: 600; font-size: 1rem; text-decoration: none; }
.topnav-right { display: flex; align-items: center; gap: .75rem; }
.topnav-right a { font-size: 1.05rem; text-decoration: none; opacity: .75; }
.topnav-right a.active { opacity: 1; }
.topnav-right .linkish { color: rgba(255, 255, 255, .72); font-size: .8rem; text-decoration: none; }
.topnav form { display: inline; }

/* Mobile bottom tabs */
.tabnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; height: 60px;
  box-shadow: 0 -4px 20px rgba(36, 25, 28, .07);
  padding-bottom: env(safe-area-inset-bottom);   /* clears the iPhone home bar */
}
.tabnav a {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink-soft);
  font-size: 11px; font-weight: 600;
}
.tabnav a .tab-icon { font-size: 20px; line-height: 1; }
.tabnav a.active { color: var(--wine); }

/* Which cellar you are in: a thin strip below the header, at the top of the
   content column. Context for the page rather than part of the chrome. */
.cellar-strip {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  max-width: 1080px; margin: 0 auto; padding: .7rem 1rem 0;
  color: var(--ink-soft); font-size: .85rem;
}
.cellar-strip span { font-weight: 600; letter-spacing: .01em; }
.cellar-strip a { font-size: .8rem; }

/* Desktop sidebar — laid out but hidden until the media query below */
.sidebar { display: none; }
.main-content { min-width: 0; }

/* Content has to clear the fixed tab bar */
body { padding-bottom: calc(60px + env(safe-area-inset-bottom) + .5rem); }

@media (min-width: 768px) {
  .topnav, .tabnav { display: none; }
  body { padding-bottom: 0; }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 220px; z-index: 100;
    display: flex; flex-direction: column; overflow-y: auto;
    background: var(--bar); padding-bottom: 1rem;
  }
  .sidebar-brand {
    padding: 1.3rem 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .1); margin-bottom: .5rem;
  }
  .sidebar-brand .brand-title {
    display: block; color: #fff; text-decoration: none;
    font-size: 1.1rem; font-weight: 600; margin-bottom: .4rem;
  }
  .sidebar-brand .brand-name { color: rgba(255, 255, 255, .62); font-size: .82rem; font-weight: 500; }

  .sidebar-nav { flex: 1; padding: .25rem .6rem; }
  .sidebar-nav a {
    display: flex; align-items: center; gap: .6rem;
    padding: .65rem .8rem; margin-bottom: 2px; border-radius: 9px;
    color: rgba(255, 255, 255, .68); text-decoration: none;
    font-size: .92rem; font-weight: 500;
    transition: background .15s, color .15s;
  }
  .sidebar-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
  .sidebar-nav a.active { background: rgba(255, 255, 255, .95); color: var(--wine-deep); font-weight: 600; }
  .sidebar-nav a .nav-icon { font-size: .95rem; width: 1.2rem; text-align: center; }

  .sidebar-footer {
    padding: .8rem 1.1rem 0; border-top: 1px solid rgba(255, 255, 255, .1);
    display: flex; flex-direction: column; align-items: flex-start; gap: .35rem;
  }
  .sidebar-footer a, .sidebar-footer .linkish {
    color: rgba(255, 255, 255, .5); font-size: .78rem; font-weight: 500;
    text-decoration: none; padding: 0;
  }
  .sidebar-footer a:hover, .sidebar-footer .linkish:hover { color: rgba(255, 255, 255, .85); }
  .sidebar-footer .version { color: rgba(255, 255, 255, .32); font-size: .7rem; letter-spacing: .03em; margin-top: .3rem; }

  .main-content { margin-left: 220px; }
  .cellar-strip { padding-top: 1rem; }
}
/* ── cards, tiles ────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; margin: 0 0 1.1rem; box-shadow: var(--shadow);
}
.card.danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.two-col { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .two-col { grid-template-columns: 1fr 1fr; } }

/* Centre-aligned, not baseline: the action beside a heading is a control, and
   baseline alignment leaves it sitting low against the cap height. */
.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: .7rem;
}
.page-head h1, .page-head h2 { margin-bottom: 0; }
.crumb { margin: 0 0 .6rem; font-size: .9rem; }

.tiles { display: grid; gap: .8rem; grid-template-columns: repeat(2, 1fr); margin: 0 0 1.1rem; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .85rem .9rem; display: flex; flex-direction: column; gap: .1rem; box-shadow: var(--shadow);
}
.tile-n { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.tile-l { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.tile-s { font-size: .82rem; color: var(--ink-soft); }

/* ── lists ───────────────────────────────────────────────────────────── */
ul.plain, ul.winelist, ul.notes, ul.history, ul.cellar-list { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .25rem 0; }

.winelist li {
  display: flex; justify-content: space-between; gap: .8rem; align-items: baseline;
  padding: .45rem 0; border-bottom: 1px solid var(--line);
}
.winelist li:last-child { border-bottom: 0; }
.wl-name { text-decoration: none; font-weight: 500; }
.wl-name:hover { text-decoration: underline; }
.wl-meta { color: var(--ink-soft); font-size: .84rem; white-space: nowrap; }

.cellar-list li {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .75rem .9rem; margin-bottom: .55rem; box-shadow: var(--shadow);
}
.cellar-list li.on { border-color: var(--wine); }

.history li { padding: .35rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.history li:last-child { border-bottom: 0; }

.notes li { padding: .6rem 0; border-bottom: 1px solid var(--line); }
.notes li:last-child { border-bottom: 0; }
.notes p { margin: .3rem 0 0; }
.note-head { display: flex; align-items: center; gap: .5rem; }
.score {
  background: var(--wine); color: #fff; border-radius: 6px;
  padding: .1rem .45rem; font-weight: 700; font-size: .85rem;
}

/* ── wine detail head ────────────────────────────────────────────────── */
.winehead { display: flex; gap: 1.1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1.1rem; }
.winehead-body { flex: 1 1 18rem; }
.winehead-meta { margin: .1rem 0 .4rem; color: var(--ink-soft); font-size: .92rem; }
.winehead-stats { margin: 0 0 .5rem; }
.winenotes { margin: .5rem 0 0; }
img.label, .label-none {
  width: 130px; height: 180px; object-fit: cover; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--wine-soft); box-shadow: var(--shadow);
}
.label-none { display: grid; place-items: center; font-size: 2.4rem; }
.label-thumb { max-width: 160px; border-radius: var(--radius); border: 1px solid var(--line); }

/* ── tables ──────────────────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.grid th, table.grid td { padding: .5rem .55rem; text-align: left; vertical-align: top; }
table.grid thead th {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); border-bottom: 1px solid var(--line); font-weight: 600;
}
table.grid tbody tr { border-bottom: 1px solid var(--line); }
table.grid tbody tr:last-child { border-bottom: 0; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.row-out { opacity: .55; }

table.bars .barcol { width: 28%; min-width: 90px; }
.bar { display: block; height: 8px; border-radius: 4px; background: var(--wine); opacity: .75; }

/* ── pills & type dots ───────────────────────────────────────────────── */
.pill {
  display: inline-block; border-radius: 999px; padding: .08rem .5rem;
  font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: var(--wine-soft); color: var(--wine-deep); vertical-align: middle;
}
.pill-urgent, .pill-high     { background: #fdeae0; color: #8a3c0b; }
.pill-ready, .pill-owner     { background: #e4f2ea; color: #1f5c40; }
.pill-young, .pill-member    { background: #e7eef7; color: #2b4c72; }
.pill-past, .pill-lost       { background: #fbe3e3; color: #8d1c1c; }
.pill-viewer, .pill-low,
.pill-drunk, .pill-gifted,
.pill-sold                   { background: #ece7e8; color: #5c5054; }
@media (prefers-color-scheme: dark) {
  .pill-urgent, .pill-high  { background: #4a2a12; color: #f0bd90; }
  .pill-ready, .pill-owner  { background: #1d3a2c; color: #93d8b4; }
  .pill-young, .pill-member { background: #1f2f42; color: #9dc2e8; }
  .pill-past, .pill-lost    { background: #45201f; color: #f0a0a0; }
  .pill-viewer, .pill-low,
  .pill-drunk, .pill-gifted,
  .pill-sold                { background: #322a2d; color: #bfb1b5; }
}
h2.with-pill { display: flex; align-items: center; gap: .5rem; }

.dot {
  display: inline-block; width: .62rem; height: .62rem; border-radius: 50%;
  margin-right: .35rem; vertical-align: baseline; background: var(--ink-soft);
}
.dot-red       { background: #7b1330; }
.dot-white     { background: #d9c46a; }
.dot-rose      { background: #e08fa0; }
.dot-sparkling { background: #b9d2d6; }
.dot-dessert   { background: #c98b2e; }
.dot-fortified { background: #5a2412; }
.dot-other     { background: #9b8f92; }

/* ── forms ───────────────────────────────────────────────────────────── */
label { display: block; font-size: .88rem; color: var(--ink-soft); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: .45rem .55rem;
  width: 100%; margin-top: .15rem;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--wine) 45%, transparent); outline-offset: 1px;
}
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: .7rem; margin-top: .6rem; }
/* A column form stretches its children; a button should still fit its label. */
.stack > .btn, .stack > button { align-self: flex-start; }
.row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.row > label { flex: 0 1 auto; }
.row > label.grow { flex: 1 1 10rem; }
.row > label.year { flex: 0 0 6.5rem; }
label.check { display: flex; align-items: center; gap: .35rem; font-size: .88rem; }
label.check input { width: auto; margin: 0; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem 1rem; margin: 0; }
fieldset + fieldset { margin-top: .9rem; }
legend { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft); padding: 0 .3rem; }
fieldset .stack, fieldset label + label { margin-top: .6rem; }

/* ── filter bar ───────────────────────────────────────────────────────────
 * A single row of small pills rather than a panel of full-width controls: the
 * list is the page, and the filters should not out-shout it. The secondary
 * filters live behind the Filters pill; whatever is active comes back as a chip
 * that removes itself when clicked.
 * ----------------------------------------------------------------------- */
.filterbar {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  margin: 0 0 .7rem;
}
.filterbar > form { display: inline-flex; align-items: center; margin: 0; }

.searchpill, .fpill, .chip {
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font-size: .82rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap;
}
.searchpill { flex: 1 1 12rem; min-width: 9rem; padding: 0 .3rem 0 .7rem; }
.searchpill input {
  border: 0; background: none; margin: 0; padding: .38rem .2rem;
  font-size: .84rem; font-weight: 500; width: 100%; color: var(--ink);
}
.searchpill input:focus { outline: none; }
.searchpill:focus-within { border-color: var(--wine); }
.searchclear { text-decoration: none; padding: 0 .35rem; font-size: 1rem; line-height: 1; }

.fpill { padding: .38rem .8rem; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.fpill:hover { border-color: var(--wine); color: var(--wine); }
.fpill.on { border-color: var(--wine); background: var(--wine-soft); color: var(--wine-deep); }
.fcount {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: 999px;
  background: var(--wine); color: #fff; font-size: .68rem;
}

/* Sort: two segments in the same pill language as everything else, so the bar
   holds no dropdowns at all. Each segment is a link to this same view ordered
   differently — no form, and nothing to submit. */
.sortset {
  display: inline-flex; align-items: center; gap: .25rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); padding: .18rem .25rem .18rem .7rem;
}
.sortset-label { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.segpill {
  border-radius: 999px; padding: .2rem .6rem; text-decoration: none;
  font-size: .8rem; font-weight: 600; color: var(--ink-soft); white-space: nowrap;
}
.segpill:hover { color: var(--wine); background: var(--wine-soft); }
.segpill.on { background: var(--wine); color: #fff; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .38rem .7rem; text-decoration: none; background: var(--wine-soft);
  color: var(--wine-deep); border-color: transparent;
}
.chip:hover { border-color: var(--wine); }
.chip-x { font-weight: 700; opacity: .6; }

/* The sheet: a dropdown on a desktop, a sheet across the foot on a phone. */
details.filterbox { position: relative; display: inline-block; }
details.filterbox > summary { list-style: none; }
details.filterbox > summary::-webkit-details-marker { display: none; }
.fsheet {
  position: absolute; left: 0; top: calc(100% + .4rem); z-index: 200; width: 23rem;
  display: flex; flex-direction: column; align-items: stretch; text-align: left;
  max-height: 70vh;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(36, 25, 28, .18);
}
.fsheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .75rem .9rem; border-bottom: 1px solid var(--line);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-soft);
}
.fsheet-body { overflow-y: auto; padding: 0 .9rem; -webkit-overflow-scrolling: touch; }
.fsheet-foot {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem; border-top: 1px solid var(--line);
}

/* A group of options is a grid of tappable pills, each wrapping a hidden radio.
   Nesting a dropdown inside a dropdown is the thing this avoids. */
.fgroup { padding: .8rem 0; }
.fgroup + .fgroup { border-top: 1px solid var(--line); }
.fgroup-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: .45rem;
}
.pillgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.pillgrid.compact { grid-template-columns: repeat(auto-fit, minmax(5.2rem, 1fr)); }
.optpill {
  position: relative; display: inline-flex; align-items: center;
  min-height: 2.3rem; padding: .4rem .6rem; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--page); color: var(--ink-soft);
  font-size: .78rem; font-weight: 600; line-height: 1.2; text-align: left;
  cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s;
}
.optpill input { position: absolute; opacity: 0; pointer-events: none; }
.optpill:hover { border-color: color-mix(in srgb, var(--wine) 45%, var(--line)); }
.optpill:has(input:checked) {
  border-color: var(--wine); background: var(--wine-soft); color: var(--wine-deep);
}
.optpill:has(input:checked)::after { content: "✓"; margin-left: auto; padding-left: .35rem; font-weight: 800; }
.optpill:focus-within { outline: 2px solid color-mix(in srgb, var(--wine) 40%, transparent); outline-offset: 1px; }
.pillgrid.compact .optpill { justify-content: center; text-align: center; }
.pillgrid.compact .optpill:has(input:checked)::after { content: none; }

@media (max-width: 600px) {
  /* Anchored to the viewport above the tab bar, so a long list of regions is
     still reachable with a thumb. */
  .fsheet {
    position: fixed; left: .5rem; right: .5rem; width: auto; top: auto;
    bottom: calc(60px + env(safe-area-inset-bottom) + .5rem);
    max-height: 68vh;
  }
}
.listsum { margin: 0 0 .7rem; color: var(--ink-soft); font-size: .9rem; }

/* ── buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-block; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: .45rem .9rem; font: inherit; font-weight: 500;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--wine); color: var(--wine); }
.btn-primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-deep); border-color: var(--wine-deep); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; opacity: .9; }
.btn-quiet { background: transparent; color: var(--ink-soft); }
.btn-small { padding: .28rem .6rem; font-size: .86rem; }
.btn-block { width: 100%; text-align: center; }
.btn[disabled] { opacity: .5; cursor: default; }
.linkish {
  background: none; border: 0; padding: 0 .3rem; font: inherit; font-size: .86rem;
  color: var(--wine); cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
form.inline { display: inline; }

/* ── disclosure menus ────────────────────────────────────────────────── */
details.rowmenu, details.adder { position: relative; display: inline-block; }
details.adder { display: block; margin-top: .8rem; }
details > summary { cursor: pointer; list-style: none; display: inline-block; }
details > summary::-webkit-details-marker { display: none; }
.popform {
  position: absolute; right: 0; z-index: 200; width: 17rem; margin-top: .4rem;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem; box-shadow: 0 8px 24px rgba(36, 25, 28, .18);
  display: flex; flex-direction: column; gap: .5rem; text-align: left;
}
.popform p { margin: 0; font-size: .85rem; }
@media (max-width: 600px) { .popform { position: static; width: auto; } }

/* ── messages ────────────────────────────────────────────────────────── */
.flash { border-radius: 8px; padding: .55rem .8rem; margin: 0 0 .8rem; font-size: .93rem; border: 1px solid; }
.flash-ok   { background: color-mix(in srgb, var(--ok) 10%, var(--card));   border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.flash-warn { background: color-mix(in srgb, var(--warn) 10%, var(--card)); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.empty, .note {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 1.1rem; color: var(--ink-soft); text-align: center;
}
.note { text-align: left; }
.empty-state { text-align: center; }
.handover { border-color: var(--wine); }

/* ── sign-in ─────────────────────────────────────────────────────────── */
body.signin { display: grid; place-items: center; min-height: 100vh; padding-bottom: 0; }
.signin-card {
  width: min(24rem, calc(100vw - 2rem)); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.6rem 1.5rem; box-shadow: var(--shadow);
}
.signin-card h1 { display: flex; align-items: center; gap: .5rem; }
.signin-card form { display: flex; flex-direction: column; gap: .8rem; margin-top: 1rem; }

/* ── narrow content ──────────────────────────────────────────────────────
 * Seven columns need room a phone does not have — and neither does a small
 * laptop once the 220px sidebar has taken its share. The columns that drop
 * out are repeated in the .sub line under the wine, so nothing is lost.
 * ----------------------------------------------------------------------- */
@media (max-width: 1000px) {
  table.grid .col-drop { display: none; }
  .only-narrow { display: block; }
  table.grid th, table.grid td { padding: .5rem .35rem; }
}
/* ── narrow screens ──────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .winelist li { flex-direction: column; align-items: flex-start; gap: .1rem; }
  .wl-meta { white-space: normal; }
  .cellar-list li { flex-direction: column; }
  h1 { font-size: 1.35rem; }
  img.label, .label-none { width: 96px; height: 132px; }
}

/* ── bottle check ────────────────────────────────────────────────────────
 * The camera button is the whole point of the page on a phone, so it is the
 * largest thing on it. The file input is hidden inside the label.
 * ----------------------------------------------------------------------- */
.shoot {
  display: flex; flex-direction: column; align-items: center; gap: .2rem;
  padding: 1.6rem 1rem; cursor: pointer; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--wine-soft); color: var(--ink);
}
.shoot:hover { border-color: var(--wine); }
.shoot input[type="file"] { display: none; }
.shoot-icon { font-size: 2rem; line-height: 1; }
.shoot-label { font-weight: 600; }
.or {
  display: flex; align-items: center; gap: .75rem;
  color: var(--ink-soft); font-size: .85rem; margin: .2rem 0;
}
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.matched + .matched { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
dl.facts { margin: .5rem 0 0; display: grid; gap: .3rem .9rem; }
dl.facts > div { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
dl.facts dt { color: var(--ink-soft); font-size: .85rem; margin: 0; }
dl.facts dd { margin: 0; font-weight: 500; text-align: right; }
.est-figure { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; margin: .2rem 0; }
.est-figure .muted { font-size: .9rem; font-weight: 400; letter-spacing: 0; }
/* ── working overlay ──────────────────────────────────────────────────────
 * Shown while a form that talks to the label reader is in flight. Nothing
 * here renders until app.js adds .working, so a JS-less browser is unaffected.
 * ----------------------------------------------------------------------- */
html.is-working { cursor: progress; }
html.is-working body { overflow: hidden; }
.working {
  position: fixed; inset: 0; z-index: 500;
  display: grid; place-items: center;
  background: rgba(20, 12, 15, .72);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: working-in .18s ease-out;
}
@keyframes working-in { from { opacity: 0; } to { opacity: 1; } }
.working-box {
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
  padding: 1.8rem 2rem; border-radius: var(--radius); max-width: 17rem; text-align: center;
  background: var(--card); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.working-ring {
  width: 2.6rem; height: 2.6rem; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--wine) 22%, transparent);
  border-top-color: var(--wine);
  animation: working-spin .8s linear infinite;
}
@keyframes working-spin { to { transform: rotate(360deg); } }
.working-what { margin: 0; font-weight: 600; }
.working-note { margin: 0; font-size: .82rem; color: var(--ink-soft); }

/* Someone who asked for less motion gets a pulse instead of a spin. */
@media (prefers-reduced-motion: reduce) {
  .working { animation: none; }
  .working-ring { animation: working-pulse 1.4s ease-in-out infinite; }
  @keyframes working-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
}
