/* winecellar UI — the "Claude Design" wine visual language, matching the
   original cellar app: warm dark surfaces, oxblood/claret accent, Instrument
   Serif headings, mono labels. */
:root {
  --bg:          #0e0c0b;
  --panel:       #17130f;   /* elevated surface 1 */
  --panel-2:     #1f1a15;   /* elevated surface 2 */
  --line:        #2a2420;
  --line-strong: #3a3229;
  --text:        #f3ece0;   /* ink */
  --dim:         #cec3ae;   /* ink-dim */
  --muted:       #9a8e75;   /* ink-mute */
  --accent:      #b5442a;   /* oxblood / claret */
  --accent-hover:#c74e33;
  --accent-soft: #7a2f1e;
  --cool:        #4a9e9b;   /* teal — LED / live */
  --gold:        #c9a875;
  --ok:          #6a8e53;
  --bad:         #a0433a;
  --radius:      4px;
  --radius-lg:   8px;

  --font-body:  'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-mono:  'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.5 var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-serif); font-weight: 400; }

*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem 1.1rem; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand {
  font-family: var(--font-serif); font-size: 1.35rem; letter-spacing: .01em;
  color: var(--text);
}
.picker, .mode {
  color: var(--muted); display: flex; align-items: center; gap: .4rem;
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .1em;
}
select, input[type=text], input[type=password], input[type=email], input[type=number] {
  background: #0000002e; color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: .4rem .6rem; font: inherit;
}
select:focus, input:focus { outline: none; border-color: var(--accent-soft); }
.status { color: var(--muted); font-size: 11px; font-family: var(--font-mono);
          text-transform: uppercase; letter-spacing: .1em; }
.status.online { color: var(--cool); }
.status.offline { color: var(--bad); }
.spacer { flex: 1; }

/* buttons: primary = oxblood, ghost = quiet outline */
button {
  background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: var(--radius);
  padding: .45rem .8rem; font: inherit; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.ghost {
  background: transparent; color: var(--muted); border-color: var(--line-strong);
}
button.ghost:hover { background: transparent; color: var(--accent); border-color: var(--accent-soft); }
button:disabled { opacity: .45; cursor: default; }

/* ---------- layout ---------- */
.layout { display: flex; height: calc(100vh - 50px); }
.sidebar {
  width: 264px; flex: none; border-right: 1px solid var(--line);
  padding: 1.1rem; overflow-y: auto; background: var(--panel);
}
.sb-search input { width: 100%; }
.filters { margin: 1.1rem 0; display: flex; flex-direction: column; gap: .8rem; }
.filters .group label {
  display: block; margin-bottom: .25rem; color: var(--muted);
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .14em;
}
.filters select { width: 100%; }
.sb-actions { display: flex; gap: .5rem; }
.slice-info { margin-top: .9rem; color: var(--dim); font-size: 12px; }

.rack-pane { flex: 1; display: flex; flex-direction: column; padding: 1.3rem; overflow: auto; }
.rack { display: inline-grid; gap: 2px; padding: 2px; }
/* mirror affordance: muted while the LEDs are off, vibrant while mirroring */
.rack { filter: saturate(.55) brightness(.85); transition: filter .35s ease; }
.rack.leds-on { filter: saturate(1.15) brightness(1.05); }
/* flat, compact wine-colour swatches (no depth/gloss) */
.slot {
  width: var(--slot, 16px); height: var(--slot, 16px); border-radius: 2px;
  border: 1px solid #0000003a; background: #ffffff0a;
  cursor: pointer; transition: box-shadow .1s, opacity .1s, filter .1s;
}
.slot.empty { background: #0000002e; border-color: var(--line); cursor: default; }
/* filled = the inline wine backgroundColor; nothing else */
/* lit LED: matched slots glow warm + brighten; unmatched dim like an off strip */
.slot.match {
  box-shadow: 0 0 5px 1px rgba(201,168,117,.9), 0 0 0 1px var(--gold);
  filter: brightness(1.18); z-index: 1;
}
.slot.dim { opacity: .3; }

.detail {
  margin-top: 1.1rem; padding: .8rem 1rem; border: 1px solid var(--line);
  border-radius: var(--radius-lg); min-height: 3rem; color: var(--dim);
  max-width: 42rem; background: var(--panel);
  /* flex item in .rack-pane: don't squash to min-height when the pane is
     full — that pushes the content out over the wine list */
  flex-shrink: 0;
}
.detail strong { color: var(--text); }

/* ---------- climate ---------- */
.climate {
  margin-top: 1.1rem; max-width: 42rem;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: .9rem 1rem; background: var(--panel);
}
/* climate-head / reading / spark are generic so they also style the modal */
.climate-head { display: flex; align-items: center; gap: 1rem; }
.reading { font-family: var(--font-serif); font-size: 1.5rem; color: var(--text); }
.reading.muted { color: var(--muted); font-family: var(--font-body); font-size: 1rem; }
/* panel readings are buttons that open the graph modal */
.climate .reading-btn {
  background: transparent; border: none; border-radius: 0;
  padding: .1rem .15rem; cursor: pointer;
}
.climate .reading-btn:hover { background: transparent; border-color: transparent; }
.climate .reading-btn:hover .reading { color: var(--accent); }
.climate button.on, .climate-head button.on { border-color: var(--accent); color: var(--accent); }
.spark {
  width: 100%; height: 40px; display: block; margin-top: .6rem;
  background: #0000002e; border-radius: var(--radius);
}
.spark-label { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.spark.muted { color: var(--muted); font-size: 12px; padding: .4rem 0; }

/* ---------- wizard / admin overlay ---------- */
.wizard {
  position: fixed; inset: 0; background: #000000b0; display: flex;
  align-items: center; justify-content: center; z-index: 50;
}
.wizard.hidden { display: none; }
.wizard-card {
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); padding: 1.5rem;
  width: min(90vw, 30rem); max-height: 90vh; overflow: auto;
}
.wizard-card h2 { margin: 0 0 .6rem; font-size: 1.5rem; }
.wizard-card h3 {
  margin: 1.3rem 0 .3rem; font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
}
.wizard-card label {
  display: block; margin: .7rem 0 .2rem; color: var(--muted);
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .12em;
}
.wizard-card input { width: 100%; }
.wizard-card .muted { color: var(--muted); }
.wizard-card .w-actions { display: flex; gap: .5rem; margin-top: 1.3rem; justify-content: flex-end; }
.wizard-card .w-msg { color: var(--bad); margin-top: .6rem; min-height: 1em; font-size: 12px; }
/* picking basket in the sidebar */
.basket-box { margin-top: 1rem; }
.bk-head {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--gold);
  border-top: 1px solid var(--line); padding-top: .8rem;
}
.bk-list { list-style: none; margin: .4rem 0 .2rem; padding: 0; }
.bk-list li {
  display: flex; justify-content: space-between; align-items: center;
  gap: .4rem; padding: .25rem 0; border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.bk-wine { color: var(--dim); }
.bk-rm { padding: .05rem .4rem; font-size: 11px; }
.dt-basket { margin-top: .4rem; padding: .2rem .6rem; font-size: 12px; }

.adm-tabs {
  display: flex; gap: .2rem; margin: .8rem 0 0;
  border-bottom: 1px solid var(--line-strong);
}
.adm-tab {
  background: transparent; border: none; border-radius: 0;
  padding: .5rem .7rem; margin-bottom: -1px; cursor: pointer;
  color: var(--muted); font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .14em;
  border-bottom: 2px solid transparent;
}
.adm-tab:hover { background: transparent; border-color: transparent; color: var(--text); }
.adm-tab:hover { border-bottom-color: var(--line-strong); }
.adm-tab.on { color: var(--gold); border-bottom-color: var(--gold); }
.adm-panel.hidden { display: none; }
/* copy-pasteable Pi install command (rack creation / token regen) */
.rk-cmd {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5;
  background: #0000002e; border: 1px solid var(--line);
  border-radius: var(--radius); padding: .5rem .6rem; margin: .4rem 0 0;
  overflow-x: auto; white-space: pre; user-select: all;
}
.rk-token { display: block; }
.admin-users { margin: .3rem 0; padding-left: 1.1rem; }
.admin-users li { margin: .15rem 0; }
.ct-pending { list-style: none; margin: .3rem 0; padding: 0; }
.ct-pending li {
  display: flex; justify-content: space-between; align-items: center; gap: .6rem;
  padding: .3rem 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.ctp-wine { color: var(--dim); }
.ctp-actions { display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.ctp-actions a { color: var(--cool); text-decoration: none; font-family: var(--font-mono); font-size: 11px; }
.ctp-actions a:hover { color: var(--accent); }
.ctp-done { padding: .15rem .5rem; font-size: 12px; }
.cal-grid { display: grid; gap: 5px; margin: 1rem 0; justify-content: start; }
.cal-slot {
  width: 40px; height: 40px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; font-size: 9px; color: var(--muted); cursor: pointer;
  background: #ffffff08;
}
.cal-slot.on { background: var(--accent); color: #fff; font-weight: 700; border-color: var(--accent); }

/* ---------- inventory ---------- */
.inv {
  position: fixed; inset: 0; background: var(--bg); z-index: 60;
  display: flex; flex-direction: column;
}
.inv.hidden { display: none; }
.inv-topbar {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.inv-topbar h2 { margin: 0; font-size: 1.5rem; }
.inv-layout { display: flex; flex: 1; min-height: 0; }
.inv-sidebar {
  width: 250px; flex: none; border-right: 1px solid var(--line);
  padding: 1rem 1.1rem; overflow-y: auto; background: var(--panel);
}
.inv-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
/* collapsible facet headers */
.facet-header {
  display: flex; align-items: center; gap: .4rem; cursor: pointer;
  padding: .3rem 0; user-select: none;
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted);
}
.facet-header:hover { color: var(--dim); }
.facet-header.open { color: var(--dim); }
.facet-caret { color: var(--accent); font-size: 9px; width: .8em; flex: none; }
.facet-title { flex: 1; }
.facet-badge {
  background: var(--accent); color: #fff; border-radius: 8px;
  padding: 0 .4rem; font-size: 9px; letter-spacing: 0; line-height: 1.5;
}
.facet-body { margin: .1rem 0 .2rem; display: flex; flex-direction: column; gap: .3rem; }
.facet-narrow { width: 100%; font-size: 12px; padding: .25rem .45rem; }
/* facet checkbox lists */
.facet-list {
  max-height: 168px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: var(--radius); padding: .15rem .25rem; background: #00000024;
}
.facet-group .facet-list .facet-item {
  display: flex; align-items: center; gap: .45rem; margin: 0; padding: .12rem .25rem;
  font-family: var(--font-body); font-size: 12px; color: var(--dim);
  text-transform: none; letter-spacing: normal; cursor: pointer;
}
.facet-list .facet-item:hover { background: #ffffff08; }
.facet-item input { flex: none; margin: 0; }
.facet-val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facet-count { color: var(--muted); font-family: var(--font-mono); font-size: 10px; }
.facet-empty { font-size: 12px; padding: .2rem .25rem; }
.inv-count { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.inv-summary {
  display: flex; flex-direction: column; gap: .4rem; align-items: flex-start;
  padding: .5rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--panel);
}
.inv-sumrow { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.inv-bk-label {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .12em; color: var(--muted); margin-right: .2rem; align-self: center;
}
.inv-chip.more { color: var(--muted); border-style: dashed; }
.inv-stats {
  display: flex; gap: .7rem; align-items: center; margin-right: .3rem;
  padding-right: .7rem; border-right: 1px solid var(--line-strong);
}
.inv-stat { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.inv-stat b { color: var(--text); font-weight: 600; }
.inv-stat.ready b { color: var(--ok); }
.drink-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: .35rem; vertical-align: middle;
}
.drink-dot.ready { background: var(--ok); }
.drink-dot.hold  { background: var(--cool); }
.drink-dot.past  { background: var(--bad); }
.inv-chip {
  font-family: var(--font-mono); font-size: 11px; color: var(--dim);
  border: 1px solid var(--line-strong); border-radius: 3px; padding: .1rem .45rem;
  white-space: nowrap;
}
.inv-table-wrap { flex: 1; overflow: auto; padding: 0 1.1rem 1.1rem; }
table.inv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.inv-table thead th {
  position: sticky; top: 0; background: var(--panel); text-align: left;
  padding: .5rem .6rem; border-bottom: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); z-index: 1;
  cursor: pointer; user-select: none; white-space: nowrap;
}
.inv-table thead th:hover { color: var(--dim); }
.sort-caret { color: var(--accent); font-size: 9px; }
.inv-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--line); }
.inv-table tbody tr:hover { background: #ffffff06; }
.inv-table .vin { color: var(--gold); font-variant-numeric: tabular-nums; }
.inv-table .prod { color: var(--text); }
.inv-table .wine { color: var(--dim); }
.inv-table .muted { color: var(--muted); }
.type-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: .4rem; vertical-align: middle;
}
.badge {
  font-family: var(--font-mono); font-size: 10px; padding: .05rem .4rem;
  border-radius: 3px; border: 1px solid var(--line-strong); color: var(--muted);
}
.badge.assigned { color: var(--cool); border-color: var(--cool-soft, var(--line-strong)); }
.bd-clickable { cursor: pointer; }

/* ---------- bottle detail panel (slide-in) ---------- */
.bd {
  position: fixed; inset: 0; z-index: 70; background: #0000;
  pointer-events: none; transition: background .18s;
}
.bd.open { background: #0007; pointer-events: auto; }
.bd-card {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(93vw, 400px); background: var(--panel-2);
  border-left: 1px solid var(--line-strong); padding: 1.3rem 1.4rem;
  overflow-y: auto; transform: translateX(100%);
  transition: transform .18s ease; box-shadow: -12px 0 30px #0006;
}
.bd.open .bd-card { transform: translateX(0); }
.bd-close { position: absolute; top: .8rem; right: .9rem; padding: .2rem .55rem; }
.bd-head { display: flex; gap: .6rem; align-items: flex-start; margin: .3rem 2rem .2rem 0; }
.bd-head .type-dot { width: 12px; height: 12px; margin-top: .55rem; }
.bd-card h2 { margin: .1rem 0; font-size: 1.4rem; line-height: 1.15; }
.bd-vin { color: var(--gold); font-family: var(--font-mono); font-size: 12px; }
.bd-wine { color: var(--dim); font-size: 13px; }
.bd-card h3 {
  margin: 1.1rem 0 .35rem; font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: .2rem;
}
.bd-row { display: flex; justify-content: space-between; gap: 1rem; padding: .14rem 0; font-size: 13px; }
.bd-k { color: var(--muted); }
.bd-v { color: var(--text); text-align: right; }
.bd-scores { display: flex; flex-wrap: wrap; gap: .4rem; }
.bd-score {
  font-family: var(--font-mono); font-size: 11px; color: var(--dim);
  border: 1px solid var(--line-strong); border-radius: 3px; padding: .1rem .4rem;
}
.bd-score b { color: var(--accent); font-weight: 600; }
.bd-note { font-size: 13px; color: var(--dim); font-style: italic; line-height: 1.5; }
.bd-foot {
  margin-top: 1.2rem; padding-top: .6rem; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
}
.bd-foot a { color: var(--cool); text-decoration: none; }
.bd-foot a:hover { color: var(--accent); }
.bd-actions { margin-top: 1.3rem; }
.bd-consume {
  width: 100%; background: transparent; color: var(--bad);
  border: 1px solid var(--bad); border-radius: var(--radius); padding: .55rem;
}
.bd-consume:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.bd-consume:disabled { opacity: .5; cursor: default; }

/* module management screen */
.mod-preview {
  display: grid; gap: 2px; margin: .6rem 0 1rem; max-width: 340px;
}
.mod-block {
  border: 1px solid; border-radius: 4px; display: flex; align-items: center;
  justify-content: center; font-size: 9px; color: var(--dim);
  overflow: hidden; min-height: 14px;
}
.mod-block span {
  padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mod-list { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .6rem; }
.mod-row {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .55rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 13px; flex-wrap: wrap;
}
.mod-row.editing { border-color: var(--accent); }
.mod-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.mod-name { font-weight: 500; }
.mod-geo { font-size: 11px; }
.mod-badge {
  font-family: var(--font-mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: .06em; padding: .1rem .35rem; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted);
}
.mod-badge.ok, .mod-badge.on { color: #7bc47f; border-color: #7bc47f66; }
.mod-badge.warn { color: #f4a259; border-color: #f4a25966; }
.mod-badge.off { color: #d98a95; border-color: #d98a9566; }
.mod-form {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  margin-bottom: .6rem;
}
.mod-form label, .mod-row label { font-size: 11px; color: var(--muted); }
.mod-form input, .mod-row input { padding: .3rem .4rem; }
input.mini { width: 3.4rem; }

/* module drag-to-reposition */
.mod-hint { font-size: 11px; margin: .1rem 0 .35rem; }
.mod-block { cursor: grab; touch-action: none; user-select: none; }
.mod-block.dragging { cursor: grabbing; opacity: .85; z-index: 2; }
.mod-block.bad { outline: 2px solid #e2555a; outline-offset: -2px; }

/* wine list under the rack (../cellar-style) */
.wine-list { margin-top: 1.2rem; max-width: 42rem; }
.wl-head {
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted); margin-bottom: .4rem;
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
}
.wl-sort { display: flex; align-items: center; gap: .4rem; }
.wl-sort select {
  font-family: var(--font-mono); font-size: 11px; padding: .1rem .3rem;
  background: var(--panel); color: var(--dim);
}
/* drink-window + price filter, below the facet groups */
.facet-extra label {
  display: block; margin: .6rem 0 .2rem; color: var(--muted);
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: .12em;
}
.facet-extra select { width: 100%; }
.cf-price { display: flex; align-items: center; gap: .4rem; }
.cf-price input { width: 100%; min-width: 0; }
.cf-buckets { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.cf-bucket {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: .15rem .55rem; font-size: 11px;
  font-family: var(--font-mono); cursor: pointer;
}
.cf-bucket:hover { background: transparent; border-color: var(--gold); color: var(--gold); }
.cf-bucket.on { border-color: var(--gold); color: var(--gold); background: #c9a87514; }
#led-toggle.on { border-color: var(--gold); color: var(--gold); background: #c9a87514; }
.wl-empty { font-size: 13px; }
.wl-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wl-table tr { border-bottom: 1px solid var(--line); cursor: pointer; }
.wl-table tr:hover { background: #ffffff06; }
.wl-table tr.sel { background: #ffffff0d; box-shadow: inset 3px 0 0 var(--accent); }
.wl-table td { padding: .35rem .5rem; vertical-align: middle; }
.wl-vin { color: var(--muted); font-family: var(--font-mono); font-size: 12px; width: 3rem; }
.wl-dot { width: 1rem; }
.wl-drink, .wl-score {
  font-family: var(--font-mono); font-size: 11px; white-space: nowrap;
  color: var(--muted);
}
.wl-score b, .wl-score { letter-spacing: .02em; }
.dw-ready { color: var(--ok); }
.dw-hold  { color: var(--cool); }
.dw-past  { color: var(--bad); }
/* rack detail card: label/value grid + score chips */
.dt-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .1rem 1.2rem; margin-top: .4rem;
}
.dt-row { display: flex; gap: .6rem; font-size: 13px; padding: .12rem 0; }
.dt-k {
  color: var(--muted); font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: .12em; width: 6.5rem;
  flex: none; padding-top: .15rem;
}
.dt-scores { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.wl-add { width: 1.6rem; }
.wl-add-btn {
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 50%; width: 20px; height: 20px; padding: 0;
  font-size: 13px; line-height: 1; cursor: pointer;
}
.wl-add-btn:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.wl-add-btn:disabled { border-color: transparent; color: var(--gold); cursor: default; }
.wl-wine b { color: var(--text); }
.wl-reg { font-size: 12px; }
.wl-slot { font-family: var(--font-mono); font-size: 11px; text-align: right; white-space: nowrap; }

/* add-a-wine form */
.aw-barcode { display: flex; gap: .5rem; }
.aw-barcode input { flex: 1; }
.aw-row { display: flex; gap: .8rem; }
.aw-row > div { flex: 1; min-width: 0; }
.aw-row select, .aw-row input { width: 100%; }
.aw-video { width: 100%; max-height: 40vh; border-radius: var(--radius); margin-top: .5rem; background: #000; }
.wizard-card .w-msg.ok { color: var(--ok); }

/* Systembolaget search results in Add-a-Wine */
.aw-sb-results { max-height: 190px; overflow-y: auto; margin: .2rem 0 .5rem;
  border: 1px solid var(--line); border-radius: var(--radius); }
.aw-sb-results:empty { border: none; }
.aw-sb-item {
  display: grid; grid-template-columns: 2.6rem 1fr auto; gap: .5rem;
  align-items: baseline; padding: .3rem .45rem; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 13px;
}
.aw-sb-item:last-child { border-bottom: none; }
.aw-sb-item:hover { background: #ffffff08; }
.aw-sb-item .sb-vin { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.aw-sb-item .sb-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aw-sb-item .sb-org { font-size: 11px; text-align: right; white-space: nowrap; }
.aw-sb-empty { font-size: 12px; padding: .35rem .45rem; }

/* ---------- phone layout (companion-app / PWA) ---------- */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: .5rem; padding: .5rem .7rem; row-gap: .45rem; }
  .topbar .spacer { display: none; }
  .layout { flex-direction: column; height: auto; }
  .sidebar {
    width: auto; border-right: none; border-bottom: 1px solid var(--line);
    padding: .8rem;
  }
  /* scroll wide racks; "safe center" left-aligns when overflowing so the
     first columns stay reachable (plain center would hide them) */
  .rack-pane { padding: .8rem; overflow: visible; overflow-x: auto; }
  #rack { align-self: safe center; }
  body { overflow-y: auto; }
}

/* ---------- "⋯" actions menu ---------- */
.menu-wrap { position: relative; }
#more-btn { padding: .45rem .7rem; font-weight: 600; }
.more-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  display: flex; flex-direction: column; gap: .45rem; min-width: 190px;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); padding: .6rem;
  box-shadow: 0 10px 28px #000000aa;
}
.more-menu.hidden { display: none; }
.more-menu button { text-align: left; width: 100%; }
.more-menu .mode { padding: .2rem .1rem; }

/* hide chrome for panels with nothing to show */
.climate:empty, .detail:empty, .wine-list:empty { display: none; }


/* ---------- phone inventory ---------- */
@media (max-width: 720px) {
  .inv-layout { flex-direction: column; }
  .inv-sidebar {
    width: auto; border-right: none; border-bottom: 1px solid var(--line);
    padding: .8rem; max-height: 38vh; overflow-y: auto; flex: none;
  }
  .inv-table-wrap { padding: 0 .6rem .8rem; }
  /* drop Region (5), Size (6), Location (8) so the essentials fit */
  .inv-table th:nth-child(5), .inv-table td:nth-child(5),
  .inv-table th:nth-child(6), .inv-table td:nth-child(6),
  .inv-table th:nth-child(8), .inv-table td:nth-child(8) { display: none; }
  .inv-topbar { flex-wrap: wrap; gap: .5rem; padding: .5rem .7rem; }
}


/* inline progress spinner for lookups */
.spin {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  border-radius: 50%; vertical-align: -2px; margin-right: 6px;
  animation: wc-spin .8s linear infinite;
}
@keyframes wc-spin { to { transform: rotate(360deg); } }

/* find-bottle input (scan-to-find) */
#find-code { width: 100%; }

/* printable bottle labels: hidden on screen, the only thing on paper */
#label-print { display: none; }
@media print {
  body > *:not(#label-print) { display: none !important; }
  #label-print {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 4mm; padding: 6mm; background: #fff;
  }
  .label-item {
    border: 0.3mm dashed #bbb; border-radius: 1mm; padding: 2mm;
    text-align: center; page-break-inside: avoid; color: #000;
  }
  .label-item svg { max-width: 100%; }
  /* label-printer mode: one label per page — the DYMO/Brother driver's
     label size turns every page into one physical label */
  #label-print.strip { display: block !important; padding: 0; }
  #label-print.strip .label-item {
    border: none; border-radius: 0; padding: 1mm;
    page-break-after: always; break-after: page;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
  }
  .label-name {
    font: 9px/1.25 Helvetica, Arial, sans-serif; color: #000;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}

/* find-bottle row: code box + label-photo fallback button */
.find-row { display: flex; gap: 6px; }
.find-row input { flex: 1; min-width: 0; }
.find-row button { flex: 0 0 auto; padding: 6px 10px; }
