:root {
  --ink: #2b2024;
  --muted: #6f6266;
  --accent: #7b1e3a;
  --bg: #faf7f5;
  --paper: #fff;
  --line: #e4dcd8;
  --warn: #b35c00;
  --bad: #b3261e;
  --good: #2e7d32;
  --sync: #1f5fa8;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
.site-header { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; padding: .6rem 1.5rem; background: var(--accent); }
.brand { color: #fff; font-weight: 600; text-decoration: none; }
.header-actions { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
.muted-light { color: #f1dfe5; font-size: .85rem; }
.tool-switch { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-right: auto; padding-left: .5rem; }
.tool-switch a { color: #f1dfe5; text-decoration: none; }
.tool-switch a[aria-current] { color: #fff; font-weight: 600; }
.tool-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; align-items: baseline; padding: .45rem 1.5rem;
  background: var(--paper); border-bottom: 1px solid var(--line); font-size: .92rem; }
.tool-nav-name { font-weight: 600; margin-right: .25rem; }
.tool-nav a { text-decoration: none; }
.tool-nav a[aria-current] { font-weight: 600; text-decoration: underline; text-underline-offset: .25em; }
.tool-list { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.tool-card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.25rem; }
.tool-card p { margin: .4rem 0 0; }
.tool-name { font-size: 1.15rem; font-weight: 600; }
.tool-links { font-size: .9rem; }
.container { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1.5rem; }
.flash { padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 1rem; background: var(--paper); }
.flash-error { border-color: var(--bad); }
.flash-success { border-color: var(--good); }
button { font: inherit; padding: .4rem .8rem; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 4px; cursor: pointer; }
/* No double-tap zoom on phones (tapping + quickly) */
button, .btn, input, select, a { touch-action: manipulation; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-light { background: #fff; color: var(--accent); border-color: #fff; }
.btn-small { padding: .15rem .5rem; font-size: .8rem; background: #fff; color: var(--accent); }
form.inline { display: inline; }
.btn-quiet { color: var(--muted); border-color: var(--line); }
.chg-add { color: var(--good); white-space: nowrap; }
.chg-remove { color: var(--bad); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: .85rem; }

/* status + panels */
.status-bar { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: .6rem 1rem; margin-bottom: 1rem; }
.panel summary { cursor: pointer; font-weight: 600; }
.panel-attention { border-color: var(--warn); }
table.attention { width: 100%; border-collapse: collapse; margin-top: .5rem; }
table.attention td { border-top: 1px solid var(--line); padding: .4rem .3rem; vertical-align: top; }
.flag-list { margin: .2rem 0 0 1.1rem; padding: 0; color: var(--warn); font-size: .85rem; }

/* badges */
.badge { display: inline-block; font-size: .7rem; padding: .05rem .4rem; border-radius: 999px; border: 1px solid; vertical-align: middle; margin-right: .2rem; white-space: nowrap; }
.badge-reserve { color: #6a4c00; border-color: #c9a227; background: #fdf6dc; }
.badge-sync { color: var(--sync); border-color: var(--sync); background: #eaf2fb; }
.badge-flag { color: var(--warn); border-color: var(--warn); background: #fff3e6; }
.badge-text { color: var(--muted); border-color: var(--line); }
.badge-ok { color: var(--good); border-color: var(--good); }

/* menu visualization (print-like) */
/* Two columns whose sections line up: each column is a subgrid sharing the
   rows (list title, then one row per section), so a section starts at the same
   height on both sides. Narrow screens stack the columns instead. */
.menu-columns { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(var(--menu-rows), auto); column-gap: 1.5rem; }
.menu-columns > .menu-page { display: grid; grid-row: 1 / -1; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
@media (max-width: 900px) {
  .menu-columns { display: block; }
  .menu-columns > .menu-page { display: block; margin-bottom: 1.5rem; }
}
.menu-page { background: var(--paper); border: 1px solid var(--line); padding: 1.25rem 1.5rem; font-family: Georgia, "Times New Roman", serif; }
.list-title { text-align: center; letter-spacing: .12em; text-transform: uppercase; font-size: 1.15rem; margin: 0 0 .5rem; }
.section-title { text-align: center; font-weight: normal; font-style: italic; border-bottom: 1px solid var(--line); padding-bottom: .2rem; margin: 1.25rem 0 .4rem; }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-row { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 0 .75rem; padding: .35rem .25rem; border-left: 3px solid transparent; }
/* Scroll-target marker: kept out of the grid so it doesn't take a cell. */
.menu-row > span[id] { position: absolute; top: 0; }
.menu-row:hover { background: #fbf8f6; }
.menu-row.is-unsynced { border-left-color: var(--sync); }
.menu-row:target, .menu-row:has(span:target) { background: #fff8d6; }
.menu-name { color: var(--ink); text-decoration: none; font-weight: 600; }
.menu-name:hover { text-decoration: underline; }
.menu-detail { font-style: italic; color: var(--muted); font-size: .9rem; }
.menu-meta { font-family: system-ui, sans-serif; }
.menu-price { font-weight: 600; text-align: right; }
.menu-actions { grid-column: 1 / -1; font-family: system-ui, sans-serif; }
.menu-row .menu-actions { opacity: .6; }
.menu-row:hover .menu-actions, .menu-row:focus-within .menu-actions { opacity: 1; }
.on-glass-note { font-size: .8rem; color: var(--muted); }
.too-long { text-decoration: underline wavy var(--warn); }
.empty { color: var(--muted); font-style: italic; padding: .3rem; }

/* wine page */
.fill-row { margin: -.4rem 0 .6rem; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.5rem; align-items: start; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 1rem 1.25rem; }
.card h2 { font-size: 1rem; margin: 1rem 0 .5rem; }
.card h2:first-of-type { margin-top: 0; }
.card label { display: block; margin-bottom: .6rem; font-size: .9rem; }
.card input:not([type=checkbox]), .card select { display: block; width: 100%; padding: .4rem; font: inherit; border: 1px solid var(--line); border-radius: 4px; margin-top: .2rem; }
.card label.check { display: flex; gap: .4rem; align-items: center; }
input.too-long { border-color: var(--warn) !important; text-decoration: none; }
span.too-long { color: var(--warn); text-decoration: none; font-weight: 600; }
table.kv th { text-align: left; padding-right: 1rem; color: var(--muted); font-weight: normal; vertical-align: top; }
.chg-add { color: var(--good); } .chg-remove { color: var(--bad); }
.description { white-space: pre-line; font-size: .9rem; color: var(--muted); }

/* seed review */
.sticky { position: sticky; top: env(safe-area-inset-top, 0px); background: var(--bg); padding: .5rem 0; z-index: 1; border-bottom: 1px solid var(--line); }
table.review { width: 100%; border-collapse: collapse; background: var(--paper); margin-bottom: 1.5rem; }
table.review th, table.review td { border-bottom: 1px solid var(--line); padding: .4rem; text-align: left; vertical-align: top; }
table.review select { max-width: 22rem; font: inherit; font-size: .85rem; }
details.custom-text { margin-top: .4rem; font-size: .85rem; }
.export-diff .is-unchanged td { padding-top: .15rem; padding-bottom: .15rem; }
.export-diff .is-added { background: #f1f8f1; }
.export-diff .is-removed { background: #fbefef; }
.export-diff .is-changed td:last-child { background: #eef4fb; }
details.custom-text summary { cursor: pointer; color: var(--accent); }
details.custom-text[open] { background: #fbf8f6; border: 1px solid var(--line); border-radius: 4px; padding: .4rem .5rem; }
details.custom-text label { display: block; margin-top: .3rem; }
details.custom-text input[type=text] { display: block; width: 100%; min-width: 18rem; padding: .25rem; font: inherit; }
details.custom-text .hint, details.custom-text .custom-start { margin: .3rem 0; }
tr.is-doubtful { background: #fff8ec; }
.note { font-size: .8rem; color: var(--warn); }
label.check { display: inline-flex; gap: .4rem; align-items: center; }
.btn-link { display: inline-block; padding: .4rem .8rem; border-radius: 4px; text-decoration: none; border: 1px solid #fff; }

/* Sign-in and background jobs */
.signed-in { display: flex; align-items: center; gap: .5rem; }
.login-box { max-width: 26rem; margin: 3rem auto; padding: 1.5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); text-align: center; }
.job-running { display: flex; align-items: center; gap: .6rem; }
.spinner { width: 1rem; height: 1rem; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Invoices */
.upload-box { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; }
.upload-box p { flex-basis: 100%; margin: 0; }
.num { text-align: right; }
.container.container-wide { max-width: 1600px; }
.invoice-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 2fr) minmax(0, 4fr); align-items: start; }
@media (max-width: 1100px) { .invoice-layout { grid-template-columns: minmax(0, 1fr); } }
.invoice-file { position: sticky; top: env(safe-area-inset-top, 0px); }
.invoice-file summary { cursor: pointer; font-weight: 600; margin-bottom: .4rem; }
.invoice-file summary a { font-weight: normal; margin-left: .5rem; }
.invoice-file iframe { width: 100%; height: 80vh; border: 1px solid var(--line); background: var(--paper); }
.invoice-file img { width: 100%; height: auto; border: 1px solid var(--line); }
.invoice-lines { min-width: 0; overflow-x: auto; }
.invoice-table td { vertical-align: top; font-size: .9rem; }
.invoice-table select { max-width: 15rem; }
.invoice-table select[name$="-kind"] { max-width: 9rem; }
.invoice-table td:first-child { min-width: 12rem; }
.invoice-table input.bottles { width: 4.5rem; }
.invoice-table tr.is-quiet td { color: var(--muted); }
.invoice-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; }
.price-card { margin-bottom: 1rem; }
.price-head { display: flex; flex-wrap: wrap; gap: .4rem .75rem; align-items: baseline; margin-bottom: .5rem; }
.price-option[hidden] { display: none; }
table.prices { border-collapse: collapse; margin: .4rem 0; font-size: .9rem; }
table.prices th { font-weight: normal; color: var(--muted); font-size: .8rem; }
table.prices td, table.prices th { padding: .15rem .4rem; }
.card table.prices input { width: 5.5rem; display: inline-block; padding: .2rem .3rem; text-align: right; }
.menu-place { font-size: .85rem; }
ul.near { margin: .2rem 0 .4rem 1rem; padding: 0; }

/* Invoices on phones and narrow screens: the invoice folds away (not pinned), the lines become cards. */
@media (max-width: 1100px) {
  .invoice-file { position: static; border: 1px solid var(--line); border-radius: 6px; padding: .5rem .75rem;
    background: var(--paper); }
  .invoice-file img { width: auto; max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; }
  .invoice-file iframe { height: 70vh; }
}
.invoice-lines h1, .invoice-lines td, table.kv td { overflow-wrap: anywhere; }
h1 { overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .invoice-lines { overflow-x: visible; }
  .invoice-table thead { display: none; }
  .invoice-table, .invoice-table tbody, .invoice-table tr, .invoice-table td { display: block; width: 100%; }
  .invoice-table { background: none; }
  .invoice-table tr { background: var(--paper); border: 1px solid var(--line); border-radius: 6px;
    margin-bottom: .75rem; padding: .5rem .75rem; }
  .invoice-table tr.is-doubtful { background: #fff8ec; }
  .invoice-table td { border: 0; padding: .25rem 0; text-align: left; white-space: normal; }
  .invoice-table td:first-child { min-width: 0; font-weight: 600; }
  .invoice-table td[data-label]::before { content: attr(data-label); display: block; font-size: .75rem;
    color: var(--muted); font-weight: normal; }
  .invoice-table select, .invoice-table select[name$="-kind"] { width: 100%; max-width: 100%; font-size: 1rem; }
  .invoice-table input.bottles { font-size: 1rem; }
  .invoice-lines .status-bar { position: sticky; bottom: 0; background: var(--bg); padding: .5rem 0;
    padding-bottom: calc(.5rem + env(safe-area-inset-bottom, 0px)); }
  .card table.prices input { width: 4.8rem; font-size: 1rem; }
}
@media (max-width: 760px) {
  .container { padding-left: .75rem; padding-right: .75rem; }
  .card.price-card { padding: .6rem .6rem; }
  table.prices td:first-child { overflow-wrap: anywhere; }
  .card table.prices input { width: 4.2rem; }
  .invoice-layout > * { min-width: 0; }
}
.table-scroll { overflow-x: auto; }
input[type=text] { max-width: 100%; }
@media (max-width: 760px) {
  .invoice-list .opt { display: none; }
  .invoice-list td, .invoice-list th { padding: .4rem .3rem; }
  .invoice-list td:first-child { overflow-wrap: anywhere; }
}

/* Invoice review steps: 1 check the reading, 2 match and price. */
ol.steps { display: flex; flex-wrap: wrap; gap: .3rem 1rem; list-style: none; padding: 0; margin: 0 0 1rem; font-size: .9rem; }
ol.steps li { color: var(--muted); padding-bottom: .2rem; border-bottom: 3px solid transparent; }
ol.steps li.is-done { color: var(--ink, inherit); }
ol.steps li.is-current { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
a.btn-small { display: inline-block; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.enter-default { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.read-head { display: grid; gap: .5rem .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); margin-bottom: .5rem; }
.read-head label { font-size: .8rem; color: var(--muted); }
.read-head input { display: block; width: 100%; font: inherit; font-size: .95rem; padding: .3rem; color: var(--ink, inherit);
  border: 1px solid var(--line); border-radius: 4px; box-sizing: border-box; }
.reading-table input[type=text], .reading-table input[type=number] { font: inherit; font-size: .9rem; padding: .2rem .3rem;
  border: 1px solid var(--line); border-radius: 4px; box-sizing: border-box; }
.reading-table input.read-desc { width: 100%; }
.read-fields { display: grid; gap: .3rem .5rem; grid-template-columns: 1fr 1fr; margin-top: .3rem; }
.read-fields label { font-size: .72rem; color: var(--muted); font-weight: normal; }
.read-fields input { display: block; width: 100%; }
.reading-table td:first-child { min-width: 15rem; }
.reading-table td { white-space: normal; }
.reading-table input.w-qty { width: 3.5rem; }
.reading-table input.w-money { width: 6rem; text-align: right; }
.reading-table select[name$="-unit"] { max-width: 6rem; }
.previous { margin-top: .4rem; padding: .4rem .6rem; border-left: 3px solid var(--accent); background: #fdf8fa; font-size: .85rem; }
ul.previous-prices { display: flex; flex-wrap: wrap; gap: .1rem 1rem; list-style: none; padding: 0; margin: .2rem 0; }
.price-card .previous { margin: 0 0 .6rem; }
@media (max-width: 760px) {
  .reading-table td:first-child { min-width: 0; font-weight: normal; }
  .reading-table input[type=text], .reading-table input[type=number] { font-size: 1rem; }
  .reading-table input.w-money { text-align: left; }
}
.model-choice { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--accent); border-radius: 6px; overflow: hidden; margin: 0 0 .6rem; }
.card .model-choice label { display: flex; align-items: center; gap: .35rem; padding: .35rem .8rem; margin: 0; cursor: pointer; color: var(--accent); font-size: .95rem; }
.card .model-choice label + label { border-left: 1px solid var(--accent); }
.card .model-choice label:has(input:checked) { background: var(--accent); color: #fff; }
.card .model-choice input[type=radio] { display: inline; width: auto; margin: 0; }
.wine-type { display: flex; flex-wrap: wrap; gap: .3rem .75rem; align-items: center; margin: .35rem 0; }
.wine-type[hidden] { display: none; }
.invoice-table .wine-type select { max-width: 9rem; }
select.is-missing { border: 2px solid var(--warn, #b5651d); }
@media (max-width: 760px) { .invoice-table .wine-type select { width: auto; max-width: 60%; } }
.adopt { margin: 0 0 .6rem; display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; }

/* Label images (Wine Menu → wine → Label image) */
.label-current { display: flex; flex-wrap: wrap; gap: .75rem; }
.label-current figure { margin: 0; }
.label-current img { max-width: 220px; max-height: 220px; border: 1px solid var(--line); display: block; }
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.label-grid-small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.label-result { display: flex; flex-direction: column; gap: .15rem; background: var(--paper); border: 1px solid var(--line);
  border-radius: 6px; padding: .4rem; text-decoration: none; min-width: 0; }
.label-result .hint { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.label-result img { width: 100%; height: 150px; object-fit: contain; display: block; background: #f3efed; }
.label-grid-small .label-result img { height: 110px; }
.label-pick { padding: 0; border: 0; background: none; cursor: pointer; }
.label-pick:hover img, .label-result:hover img { outline: 2px solid var(--accent); }
.small-image { color: var(--warn); }
.upload-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.upload-row input[type=file] { display: inline; width: auto; flex: 1 1 12rem; }
.crop-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
@media (max-width: 760px) { .crop-layout { grid-template-columns: 1fr; } }
.crop-stage { position: relative; display: inline-block; max-width: 100%; touch-action: none; user-select: none; cursor: crosshair; line-height: 0; overflow: hidden; }
.crop-stage img { max-width: 100%; max-height: 75vh; display: block; }
.crop-box { position: absolute; border: 2px solid #fff; outline: 1px solid rgba(0,0,0,.6);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; box-sizing: border-box; }
.crop-handle { position: absolute; width: 14px; height: 14px; background: #fff; border: 1px solid #000; }
.crop-handle[data-h=nw] { left: -2px; top: -2px; cursor: nwse-resize; }
.crop-handle[data-h=ne] { right: -2px; top: -2px; cursor: nesw-resize; }
.crop-handle[data-h=sw] { left: -2px; bottom: -2px; cursor: nesw-resize; }
.crop-handle[data-h=se] { right: -2px; bottom: -2px; cursor: nwse-resize; }
.crop-preview { max-width: 100%; border: 1px solid var(--line); display: block; margin-bottom: .3rem; }
.badge-new { color: #fff; border-color: var(--good); background: var(--good); }
.send-line.is-done { opacity: .7; }
.send-head { font-size: 1rem; }
.send-log { margin-bottom: .4rem; font-size: .9rem; }
.card.send-vendor, .card.send-line { margin-bottom: 1rem; }
.description-edit { display: block; width: 100%; font: inherit; padding: .4rem; border: 1px solid var(--line); border-radius: 4px; box-sizing: border-box; }
.finish-card { margin-bottom: 1rem; }
.finish-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .6rem; }
.finish-body { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 600px) { .finish-body { grid-template-columns: 1fr; } }
.finish-image { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.finish-image img { max-width: 160px; max-height: 160px; border: 1px solid var(--line); }
.finish-noimage { width: 160px; height: 110px; display: grid; place-items: center; background: #f3efed; color: var(--muted); font-size: .85rem; }
.menu-links { font-size: .9rem; }
.draft-note { margin: .3rem 0; padding: .3rem .5rem; border-left: 3px solid var(--warn); background: #fff3e6; font-size: .85rem; }
.found-head { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.slack-status p { margin: .3rem 0; }
.slack-thread { margin: .2rem 0 .5rem 1.2rem; padding: 0; }
.slack-post { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; max-width: 48rem; }
.slack-post input[name="text"] { flex: 1 1 18rem; min-width: 0; }
.slack-post .hint { flex-basis: 100%; margin: 0; }
.found-list td { vertical-align: top; }
.sender-list { margin: .3rem 0 .5rem 1.1rem; padding: 0; font-size: .9rem; }

/* Inventory: counts on a phone */
.inv-locations { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.inv-location h2 { margin: 0 0 .3rem; font-size: 1.1rem; }
.inv-places { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; }
.inv-places a { padding: .35rem .7rem; border: 1px solid var(--line, #ccc); border-radius: 999px; text-decoration: none; }
.inv-places a[aria-current="page"] { background: var(--ink, #222); color: #fff; border-color: transparent; }
.inv-n { font-size: .75rem; opacity: .75; }
.inv-rows { list-style: none; margin: 0; padding: 0; }
.inv-row { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; justify-content: space-between;
  padding: .5rem 0; border-bottom: 1px solid var(--line, #e5e5e5); }
.inv-name { flex: 1 1 14rem; min-width: 0; }
.inv-qty { display: flex; align-items: center; gap: .3rem; }
.inv-qty input { width: 4.2rem; text-align: center; font-size: 1.1rem; padding: .35rem; }
.inv-qty .btn-small { min-width: 2.4rem; min-height: 2.4rem; font-size: 1.1rem; }
.inv-saved { min-width: 1.2rem; font-size: .85rem; color: var(--good); }
.inv-saved.inv-error { color: var(--bad); }
.inv-add { margin: 1rem 0; }
.inv-add input { width: 100%; max-width: 32rem; font-size: 1rem; padding: .45rem; }
.inv-results { list-style: none; margin: .3rem 0; padding: 0; max-width: 32rem; }
.inv-results button { display: block; width: 100%; text-align: left; padding: .5rem .3rem; background: none; border: 0;
  border-bottom: 1px solid var(--line, #eee); cursor: pointer; font: inherit; color: inherit; }
.inv-actions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin: 1rem 0; }
.inv-list { list-style: none; padding: 0; }
.inv-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border-bottom: 1px solid var(--line, #eee); }
.inv-tools, .inv-place-list li { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.inv-place-list { padding-left: 1.2rem; }
.inv-place-list li { margin: .3rem 0; }
.inv-setup.is-archived, .inv-place-list .is-archived { opacity: .6; }
a.btn, a.btn-small { display: inline-block; border: 1px solid var(--accent); border-radius: 4px; text-decoration: none; }
a.btn { padding: .4rem .8rem; background: var(--accent); color: #fff; }
.inv-period { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; margin: .5rem 0 1rem; }
.inv-period label { display: flex; flex-direction: column; font-size: .85rem; gap: .2rem; }
.inv-totals { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: .8rem 0; font-size: 1.05rem; }
.inv-report td.num { white-space: nowrap; }
.inv-report tr.inv-short td:nth-last-child(2) { color: var(--bad); }
.inv-value { margin: .3rem 0 0; }
.inv-wastage-form { display: grid; gap: .6rem; max-width: 32rem; }
.inv-wastage-form label { display: flex; flex-direction: column; gap: .2rem; }
.inv-wastage-form .inv-chosen { font-weight: 600; }
.inv-kind { display: flex; flex-wrap: wrap; gap: .3rem 1rem; border: 0; padding: 0; margin: 0; }
.inv-kind legend { font-size: .85rem; padding: 0; }
@media (max-width: 700px) {
  .inv-report th:first-child, .inv-report td:first-child { position: sticky; left: 0; z-index: 1; background: var(--paper);
    min-width: 8.5rem; max-width: 9.5rem; font-size: .85rem; box-shadow: 1px 0 0 var(--line); }
}
.inv-wastage-form .inv-kind label { flex-direction: row; align-items: center; gap: .35rem; }
.inv-wastage-form [hidden] { display: none; }   /* the flex rules above would show a hidden label or fieldset */
.inv-wastage-form label.inv-tick { flex-direction: row; align-items: center; gap: .35rem; font-weight: 600; }
.inv-log .panel { display: grid; gap: .5rem; margin: 0; }
.inv-log .panel p { margin: 0; }
.inv-value + form, .inv-value + p { margin-top: .6rem; }
.inv-report:not(.inv-by-loc) .inv-loc { display: none; }
.inv-report .inv-loc { background: var(--bg); font-size: .9rem; }
.inv-expand { margin-left: .3rem; font-size: .75rem; padding: .1rem .35rem; white-space: nowrap; }
.inv-photos { margin: .5rem 0 1rem; }
.inv-take { display: inline-block; padding: .55rem 1rem; border: 1px solid var(--accent); border-radius: 4px;
  background: var(--accent); color: #fff; cursor: pointer; font-size: 1rem; }
.inv-take:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }
.inv-take input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.inv-shots { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .8rem; }
.inv-shot { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: .6rem; }
.inv-shot summary { cursor: pointer; }
.inv-pic { position: relative; display: inline-block; max-width: 100%; margin: .4rem 0; }
.inv-pic img { display: block; max-width: 100%; max-height: 22rem; border-radius: 4px; }
.inv-box { position: absolute; border: 2px solid rgba(255, 255, 255, .85); outline: 1px solid rgba(0, 0, 0, .4);
  border-radius: 3px; pointer-events: none; }
.inv-box.is-on { border-color: #ffd54a; outline: 2px solid var(--accent); }
.inv-props { list-style: none; margin: 0; padding: 0; }
.inv-prop { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; justify-content: space-between;
  padding: .45rem 0; border-top: 1px solid var(--line); }
.inv-prop.is-done { opacity: .6; }
.inv-already { flex-basis: 100%; font-size: .85rem; color: var(--accent); font-weight: 600; }
.inv-prop .inv-name { cursor: pointer; }
.inv-prop .inv-qty input { width: 3.6rem; }
.inv-step { display: inline-flex; align-items: center; gap: .3rem; }
.inv-step input { width: 3.6rem; text-align: center; }
.inv-prop .inv-step .btn-small { min-width: 2.2rem; font-size: 1rem; }
.inv-prop .btn-small { min-height: 2.2rem; font-size: .85rem; }
.inv-shot-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .4rem; }
.inv-sheet { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); display: flex;
  align-items: flex-start; justify-content: center; padding: .8rem; }
.inv-sheet[hidden] { display: none; }
.inv-sheet-box { background: var(--paper, #fff); border-radius: 8px; padding: .8rem; width: 100%; max-width: 34rem;
  max-height: calc(100dvh - 1.6rem); overflow-y: auto; overscroll-behavior: contain; }
.inv-sheet-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.inv-sheet input { width: 100%; font-size: 1rem; padding: .45rem; }
body.inv-sheet-open { overflow: hidden; }
.inv-cases { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .9rem; }
.inv-cases input { width: 3.6rem; text-align: center; font-size: 1.1rem; padding: .35rem; }

/* --- Cheese Labels --------------------------------------------------------------------------------------------- */
.cheese-list { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--line); }
.cheese-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .3rem .8rem;
  padding: .5rem 0; border-bottom: 1px solid var(--line); }
.cheese-all { display: flex; gap: .6rem; align-items: center; margin: .6rem 0; font-weight: 600; }
.cheese-all input { width: 1.2rem; height: 1.2rem; }
.cheese-pick { display: flex; gap: .6rem; align-items: flex-start; }
.cheese-pick input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; }
.cheese-pick .hint { display: block; }
.cheese-state { display: flex; gap: .3rem; flex-wrap: wrap; }
.cheese-edit { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; margin-top: 1rem; }
.cheese-fields { flex: 1 1 20rem; display: grid; gap: .7rem; max-width: 34rem; }
.cheese-fields label { display: grid; gap: .2rem; font-weight: 600; }
.cheese-fields label .hint { font-weight: 400; }
.cheese-fields label.cheese-check { display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: center; }
.cheese-fields label.cheese-check .hint { flex-basis: 100%; }
.cheese-fields label.cheese-check input { width: auto; }
.cheese-fields input, .cheese-fields textarea { font: inherit; font-weight: 400; font-size: 1rem; padding: .4rem; width: 100%; }
.cheese-fields fieldset { border: 1px solid var(--line); border-radius: 6px; display: grid; gap: .4rem; }
.cheese-pair { display: grid; grid-template-columns: 1fr 1.6fr; gap: .4rem; }
.cheese-preview { flex: 0 0 auto; max-width: 100%; overflow-x: auto; display: grid; gap: .3rem; }
.cheese-preview .hint { margin: .6rem 0 0; }
.cheese-sizes { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.cheese-sizes a { padding: .3rem .7rem; border: 1px solid var(--accent); border-radius: 999px; text-decoration: none; }
.cheese-sizes a[aria-current] { background: var(--accent); color: #fff; }

/* The card: 4" × 2", the same on screen and on paper. */
/* A grid, not a flex column: the PDF maker (WeasyPrint) and browsers lay it out alike. The notes take what's left. */
.cheese-card { width: 4in; height: 2in; padding: .16in .2in; background: #fff; color: #1d1a1b; overflow: hidden;
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr);
  /* Palatino, or P052 (the same letter widths) on the server that makes the PDF: preview and PDF wrap alike. */
  font-family: Palatino, "Palatino Linotype", P052, "Book Antiqua", Georgia, serif; border: 1px dashed #b9b0ac; }
.cheese-card--short { height: 2in; padding: .1in .2in .09in; }
.cheese-card--short .cheese-card-price { height: .38in; }
.cheese-card--short .cheese-card-foot { margin-top: .03in; }
/* Room for three lines of notes: cut at whole lines (with "…"), never through a line. */
.cheese-card--short .cheese-card-name { font-size: 14pt; }
.cheese-card--short .cheese-card-meta { font-size: 9.5pt; margin-top: .02in; }
.cheese-card--short .cheese-icon { width: .22in; height: .22in; }
.cheese-card--short .cheese-card-notes { font-size: 9pt; line-height: 1.17; max-height: 3.51em; display: -webkit-box;
  -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; margin-top: .03in; }
.cheese-card--short .cheese-card-wines { font-size: 8pt; line-height: 1.17; }
.cheese-card--short .cheese-card-head { font-size: 6.5pt; }
/* Short without the wines: the same 2" with bigger text, and up to four lines of notes (cut at whole lines). */
.cheese-card--plain { height: 2in; padding: .12in .2in; grid-template-rows: auto auto minmax(0, 1fr); }
.cheese-card--plain .cheese-card-name { font-size: 17pt; }
.cheese-card--plain .cheese-card-meta { font-size: 11pt; margin-top: .05in; }
.cheese-card--plain .cheese-icon { width: .3in; height: .3in; }
.cheese-card--plain .cheese-card-notes { font-size: 10.5pt; line-height: 1.22; max-height: 4.88em; display: -webkit-box;
  -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; margin-top: .07in; }
/* Fold-out: the plain card, two light fold lines ⅛" apart, and a ½" flap with the pairings. */
.cheese-fold { width: 4in; height: 2.625in; background: #fff; color: #1d1a1b; border: 1px dashed #b9b0ac; overflow: hidden;
  display: grid; grid-template-rows: 2in .125in minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
  font-family: Palatino, "Palatino Linotype", P052, "Book Antiqua", Georgia, serif; }
.cheese-fold > .cheese-card { width: auto; border: 0; padding-bottom: .17in; }   /* the bottom ⅛" is covered once
                                                                                      folded: nothing printed there */
.cheese-fold-strip { border-top: 1px dashed #d8d0cc; border-bottom: 1px dashed #d8d0cc; }
.cheese-fold-flap { margin: 0; padding: .04in .2in; overflow: hidden; display: flex; align-items: center; }
.cheese-fold-flap .cheese-card-wines { font-size: 8pt; line-height: 1.15; width: 100%; }
.cheese-fold-flap .cheese-card-head { display: none; }      /* the flap only ever holds the wines */
.cheese-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .12in; }
.cheese-card-name { margin: 0; font-size: 16pt; line-height: 1.1; color: #7b1e3a; }
.cheese-card-meta { margin: .04in 0 0; font-size: 10.5pt; font-style: italic; color: #4a4245; display: flex; align-items: center;
  gap: .06in; }
.cheese-icons { display: inline-flex; gap: .02in; flex: 0 0 auto; }
.cheese-icons:empty { display: none; }
.cheese-icon { width: .27in; height: .27in; }
.cheese-card-notes { margin: .06in 0 0; font-size: 9.2pt; line-height: 1.25; min-height: 0; overflow: hidden; }
.cheese-card-foot { margin-top: .05in; }
.cheese-card-wines { font-size: 8.8pt; line-height: 1.25; }
.cheese-card-head { display: block; font-size: 7pt; letter-spacing: .08em; text-transform: uppercase; color: #7b1e3a; }
.cheese-card-wines ul { list-style: none; margin: 0; padding: 0; }
.cheese-card-unit { position: absolute; right: .05in; bottom: .02in; font-size: 7.5pt; color: #4a4245; }
.cheese-card-dollar { position: absolute; left: .05in; top: .02in; font-size: 8pt; color: #4a4245; }
.cheese-card-price { position: relative; flex: 0 0 auto; width: 1.1in; height: .44in; border: 1.5px solid #7b1e3a; border-radius: 5px; }

.cheese-print { background: #e9e5e2; }
.cheese-print-bar { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; padding: .6rem 1rem; background: #fff;
  border-bottom: 1px solid var(--line); }
.cheese-sheet { display: grid; grid-template-columns: repeat(2, 4in); grid-auto-rows: 2in; justify-content: center;
  width: 8.5in; min-height: 11in; margin: 1rem auto; padding: .5in .25in; background: #fff; }
.cheese-sheet--fold { grid-auto-rows: 2.625in; padding: .25in; }
@media print {
  @page { size: letter; margin: 0; }
  .cheese-print { background: #fff; }
  .cheese-print-bar { display: none; }
  .cheese-sheet { margin: 0; height: 11in; overflow: hidden; break-after: page; }
  .cheese-sheet:last-child { break-after: auto; }
}
#heroku-command { word-break: break-all; }
