/* Perkys Inventory Program */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --line: #e3e6ea;
  --accent: #2f6fde;
  --accent-ink: #ffffff;
  --ok-bg: #e5f5ea; --ok-ink: #1d6b35;
  --off-bg: #eceef1; --off-ink: #5b6270;
  --err-bg: #fde8e8; --err-ink: #9b1c1c;
  --danger: #c62828;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c; --surface: #1d2129; --text: #e7e9ee; --muted: #9aa1ad;
    --line: #2d333d; --accent: #5b8ff0;
    --ok-bg: #173523; --ok-ink: #8fd6a5; --off-bg: #2a2f38; --off-ink: #a3a9b4;
    --err-bg: #3d1a1a; --err-ink: #f5a3a3; --danger: #ef5350;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .75rem; }
.card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); font-weight: normal; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }

/* frozen top area: menu bar + page title (+ filters) stay put while scrolling */
.frozen {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.frozen-inner { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem .75rem; }
.frozen-inner .pagehead { margin-bottom: 0; }
.frozen-inner .filters { margin: .75rem 0 0; }
.frozen + main { padding-top: 1rem; }

/* table column headings freeze right under the frozen area */
thead th {
  position: sticky; top: var(--frozen-h, 0px); z-index: 5;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--line);
}

/* top bar */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); font-weight: 650; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand img { height: 36px; width: auto; border-radius: 6px; }
.topbar nav { display: flex; gap: .25rem; margin-left: auto; flex-wrap: wrap; }
.topbar nav a { color: var(--text); padding: .45rem .8rem; border-radius: 8px; }
.topbar nav a:hover { background: var(--bg); text-decoration: none; }
.topbar nav a.on { background: var(--accent); color: var(--accent-ink); }
.topbar nav a.logout { color: var(--muted); }
.topbar .navtoggle, .topbar .navbutton { display: none; }

main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem; flex: 1; }
main.narrow { max-width: 420px; padding-top: 10vh; }
/* frozen footer: stays at the bottom of the screen while the page scrolls */
footer {
  position: sticky; bottom: 0; z-index: 50;
  text-align: center; color: var(--muted); font-size: .85rem;
  padding: .6rem 1rem;
  background: var(--bg);
  border-top: 1px solid var(--line);
  box-shadow: 0 -2px 6px rgba(0,0,0,.06);
}

.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pagehead h1 { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
/* table cards: the box always stretches to cover the whole table */
.card.flush { padding: 0; min-width: 100%; width: fit-content; }
.login-logo { display: block; max-height: 80px; margin: 0 auto 1rem; }
main.narrow h1 { text-align: center; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.success { background: var(--ok-bg); color: var(--ok-ink); }
.flash.error { background: var(--err-bg); color: var(--err-ink); }
.notice { background: var(--surface); border: 1px dashed var(--accent); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }

/* forms */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .9rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem;
  font: inherit; font-weight: normal; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=checkbox] { display: inline; width: auto; margin: 0 .4rem 0 0; }
input[type=file] { background: transparent; border: 0; padding-left: 0; }
label.check { font-weight: normal; display: flex; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid2.tight { gap: 0 .75rem; }
.span2 { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.logo-preview { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.logo-preview img { max-height: 80px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: #fff; }
.logo-preview label { margin: 0; }

.btn {
  display: inline-block; padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: .3rem .65rem; font-size: .85rem; }
.btn.wide { width: 100%; margin-top: .5rem; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
form.danger { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 0 .25rem; }

/* dashboard */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; color: var(--text); }
a.tile:hover { border-color: var(--accent); text-decoration: none; }
.tile .num { display: block; font-size: 2rem; font-weight: 700; line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: .9rem; }

/* tables */
.filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters input, .filters select { width: auto; margin: 0; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.tablewrap { overflow: visible; }  /* visible so headings can freeze to the page */
table { width: 100%; border-collapse: collapse; }
/* Long names may wrap onto two lines so the table fits; numbers never wrap. */
th, td { text-align: left; padding: .6rem .9rem; border-bottom: 1px solid var(--line); white-space: normal; }
td.r, td.mono, .pill, .rowactions { white-space: nowrap; }
th { vertical-align: bottom; }
th.sortable a { white-space: normal; }

/* All lists: every heading centered over its column; the name column stays left */
.tablewrap table th, .tablewrap table td { text-align: center; }
.tablewrap table th:first-child, .tablewrap table td:first-child { text-align: left; }
.tablewrap td { font-variant-numeric: tabular-nums; }
.tablewrap td:first-child { min-width: 11rem; }      /* names get room before wrapping */
td.nowrap { white-space: nowrap; }
table.centered th.product-col { min-width: 13rem; }
th .arrow { white-space: nowrap; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.r, th.r { text-align: right; }
/* clickable column headings */
th.sortable a { color: inherit; text-decoration: none; display: inline-block; }
th.sortable a:hover { color: var(--accent); }
th.sorted { color: var(--text); }
th .arrow { font-size: .7rem; }
tbody tr:last-child td { border-bottom: 0; }
tr.dim td { opacity: .55; }
/* row buttons: stay a normal table cell so row lines match up */
td.rowactions { white-space: nowrap; }
.rowactions > * { display: inline-block; vertical-align: middle; margin: 0 .1rem; }
.rowactions form { margin: 0; }
.pill { font-size: .78rem; padding: .15rem .55rem; border-radius: 99px; font-weight: 600; }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.off { background: var(--off-bg); color: var(--off-ink); }
.count { padding: .6rem .9rem; margin: 0; border-top: 1px solid var(--line); font-size: .85rem; }
.empty { padding: 1.25rem; margin: 0; }

/* links like #cost land below the frozen top area, not under it */
[id] { scroll-margin-top: calc(var(--frozen-h, 0px) + 1rem);
       scroll-margin-bottom: calc(var(--footer-h, 0px) + 1rem); }
/* keyboard focus never hides behind the frozen top or bottom */
html { scroll-padding-top: var(--frozen-h, 0px); scroll-padding-bottom: var(--footer-h, 0px); }

/* small helpers */
.hint { font-size: .88rem; margin: -.25rem 0 1rem; }
.small:not(.btn) { display: block; font-size: .82rem; font-weight: normal; margin-top: .25rem; }
.strong { font-weight: 650; }
.pre { white-space: pre-wrap; }
ul.plain { list-style: none; padding: 0; margin: 0 0 .75rem; }
ul.plain li { padding: .25rem 0; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }
.grid2.cards { gap: 1rem; align-items: start; }
input:disabled { opacity: .8; }
.tile.warn .num { color: var(--danger); }
.filters-note { align-self: center; font-size: .9rem; }

/* supplier detail */
dl.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
dl.details dt { color: var(--muted); font-size: .9rem; }
dl.details dd { margin: 0; }

/* supply price */
.unitcost { margin: -.25rem 0 1rem; font-size: 1.05rem; }

/* product "what's in it" pickers */
.picks { border: 1px solid var(--line); border-radius: 8px; padding: .25rem .75rem; margin-bottom: 1rem; }
.pick-row {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 8.5rem 5.5rem 2.2rem;
  gap: .6rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line);
}
.picks > .pick-row:last-child { border-bottom: 0; }
.pick-name { font-weight: 600; font-size: .92rem; }
.pick-row select { margin: 0; }
.pick-row .qtybox { display: flex; align-items: center; gap: .35rem; font-size: .9rem; white-space: nowrap; }
.pick-row .qtybox input.qty { width: 4.5rem; }
.pick-row .linecost { font-weight: 600; font-variant-numeric: tabular-nums; }
.pick-row.included select { opacity: .45; }
.pick-row.included .qtybox { color: var(--ok-ink); font-weight: 600; }
.pick-add { display: flex; gap: .5rem; flex-wrap: wrap; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.extra-row .extra-desc { grid-column: 2 / 4; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .92rem; }
.extra-row input.qty { width: 5rem; }
.small-inline { font-size: .82rem; }
.copyfrom { margin-bottom: 1rem; }
.copyfrom label { max-width: 34rem; }
label.manual { font-weight: normal; margin: .25rem 0; }
.inline-label { font-weight: normal; margin: 0; }
input.price { width: 7rem; margin-left: auto; }
.totals { margin-bottom: 1rem; }

/* cost build-up */
form.inline { display: inline-flex; align-items: center; gap: .35rem; margin: 0; }
input.qty { width: 5.5rem; display: inline-block; margin: 0; padding: .3rem .5rem; text-align: right; }
.buildup td { vertical-align: middle; }
.addpart { display: flex; gap: .75rem; align-items: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.addpart label { flex: 1; min-width: 240px; margin: 0; }
.addpart .qtylabel { flex: 0 0 6rem; min-width: 0; }
.addpart .btn { margin-bottom: 1px; }
.addpart + .hint { margin-top: .6rem; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: .5rem; }
.totals h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); margin: 0 0 .4rem; }
table.mini td, table.mini th { padding: .35rem .25rem; white-space: normal; }
table.mini thead th { position: static; box-shadow: none; }
tr.grand td { font-weight: 700; font-size: 1.1rem; border-top: 2px solid var(--text); }
form.extra { display: flex; gap: .5rem; align-items: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }
form.extra label { margin: 0; flex: 0 1 22rem; }
form.extra + .hint { margin-top: .5rem; }

@media print {
  .topbar, .filters, .actions, footer { display: none !important; }
  .frozen { position: static; box-shadow: none; border: 0; }
  thead th { position: static; }
  body { background: #fff; }
  .card { border: 0; }
}

/* warehouse */
.pill.bad { background: var(--err-bg); color: var(--err-ink); }
.pill.warn { background: #fff1d6; color: #8a5300; }
.pill.info { background: #e3ecfd; color: #234e9e; }
@media (prefers-color-scheme: dark) {
  .pill.warn { background: #3d2e12; color: #f2c46d; }
  .pill.info { background: #1c2c4a; color: #9dbcf5; }
}
td.big { font-size: 1.05rem; }
td.pos { color: var(--ok-ink); }
td.neg, strong.neg { color: var(--danger); }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
.tile.warn .num { color: var(--danger); }
.tile .lbl a { font-weight: 600; }
.minmax { max-width: 40rem; }
.minmax-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.minmax-row label { margin: 0; flex: 1; min-width: 9rem; }
.warehouse-fields { max-width: 40rem; margin-bottom: 1.25rem; }
h2.section { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .5rem 0 .6rem; }
.narrow-card { max-width: 40rem; }
.segmented { display: flex; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.segmented .seg { margin: 0; flex: 1; min-width: 7rem; position: relative; }
.segmented .seg input {
  position: absolute; inset: 0; width: 1px; height: 1px; margin: 0; padding: 0;
  border: 0; opacity: 0; pointer-events: none; overflow: hidden;
}
.segmented .seg span {
  display: block; text-align: center; padding: .65rem .5rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600;
}
.segmented .seg.on span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.segmented .seg.removed.on span { background: var(--danger); border-color: var(--danger); }
.segmented .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.preview { padding: .7rem .9rem; background: var(--bg); border-radius: 8px; margin-bottom: 1rem; min-height: 1rem; }
.preview:empty { display: none; }

/* count sheet */
.areas { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .75rem; }
.area {
  padding: .4rem .8rem; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: .9rem;
}
.area:hover { text-decoration: none; border-color: var(--accent); }
.area.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.area .n { font-weight: normal; opacity: .7; margin-left: .2rem; }
.areas .step {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 1.6rem; height: 1.6rem; margin: auto .2rem auto 0; border-radius: 50%;
  background: var(--line); color: var(--muted); font-size: .8rem; font-weight: 700;
}
.areas.sizes { margin-top: .5rem; }
.notice.nextup { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; border-style: solid; }
.countbar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.countbar label { margin: 0; }
.countbar input[type=date] { width: auto; }
.countbar .progress { font-weight: 600; margin-left: auto; padding-bottom: .55rem; }
.countbar .btn { margin-bottom: .2rem; }
.plain-label { font-weight: normal; font-size: 1rem; margin: 0; }
.count-table td { padding-top: .45rem; padding-bottom: .45rem; }
.count-table td.expected { font-size: 1.05rem; color: var(--muted); }
.count-input {
  width: 6rem; margin: 0 auto; text-align: center; font-size: 1.15rem; font-weight: 700;
  padding: .45rem .5rem;
}
.count-table td.diff { font-weight: 700; min-width: 5rem; }
.count-table tr.match td.diff { color: var(--ok-ink); }
.count-table tr.off td.diff { color: var(--danger); }
.count-table tr.off .count-input { border-color: var(--danger); }
.count-table tr.bad td.diff { color: var(--danger); font-weight: normal; font-size: .85rem; }
.count-table .short { display: none; }

/* phones */
@media (max-width: 700px) {
  .topbar { padding: .6rem 1rem; }
  .topbar .navbutton { display: block; margin-left: auto; font-size: 1.5rem; cursor: pointer; margin-bottom: 0; }
  .topbar nav { display: none; width: 100%; flex-direction: column; margin: 0; }
  .topbar .navtoggle:checked ~ nav { display: flex; }
  /* count sheet on phones: everything fits the screen, no sideways swiping */
  .areas { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem; -webkit-overflow-scrolling: touch; }
  .area { white-space: nowrap; }
  .tablewrap table.count-table th, .tablewrap table.count-table td { white-space: normal; padding-left: .5rem; padding-right: .5rem; }
  .tablewrap table.count-table td:first-child { min-width: 0; position: static; box-shadow: none; }
  .tablewrap table.count-table th:nth-child(5), .tablewrap table.count-table td:nth-child(5) { display: none; }
  .tablewrap table.count-table td.diff { min-width: 0; }
  .tablewrap table.count-table .count-input { width: 3.8rem; padding-left: .25rem; padding-right: .25rem; }
  .tablewrap table.count-table th, .tablewrap table.count-table td { padding-left: .4rem; padding-right: .4rem; }
  .count-table .long { display: none; }
  .count-table .short { display: inline; }
  .countbar { gap: .5rem; }
  .tablewrap table .ph-hide { display: none; }
  .tablewrap table.price-table th, .tablewrap table.price-table td { white-space: normal; padding-left: .4rem; padding-right: .4rem; }
  .tablewrap table.price-table td:first-child { min-width: 0; position: static; box-shadow: none; }
  .tablewrap table.price-table .price-input { width: 4.6rem; padding-left: .25rem; padding-right: .25rem; font-size: .95rem; }
  .tablewrap table.count-table .price-input { width: 4.4rem; padding-left: .25rem; padding-right: .25rem; font-size: .95rem; }
  main { padding: 1rem; }
  .frozen-inner { padding: .75rem 1rem .6rem; }
  .frozen-inner h1 { font-size: 1.3rem; }
  .grid2, .totals { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 label:last-child { grid-column: 1 / -1; }
  /* pickers stack on phones: name + cost on top, menu below, qty under */
  .pick-row { grid-template-columns: 1fr auto 2.2rem; grid-template-areas: "n c x" "s s s" "q q q"; gap: .35rem .5rem; }
  .pick-row .pick-name { grid-area: n; }
  .pick-row .pick { grid-area: s; }
  .pick-row .qtybox { grid-area: q; }
  .pick-row .linecost { grid-area: c; }
  .pick-row > :last-child:not(.linecost):not(.qtybox):not(select) { grid-area: x; }
  .extra-row .extra-desc { grid-area: s; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .filters select, .filters .btn { flex: 1; }
  /* Phones: the table scrolls inside its own box (sideways and down),
     with headings frozen at the top of that box. */
  .tablewrap {
    overflow: auto;
    max-height: calc(100dvh - var(--frozen-h, 0px) - var(--footer-h, 0px) - 2rem);
  }
  .card.flush { width: auto; }                         /* box stays screen-width; table swipes inside it */
  .tablewrap th, .tablewrap td { white-space: nowrap; } /* one line per row on phones */
  .tablewrap thead th { top: 0; }
  /* freeze the first column (SKU) when swiping sideways */
  .tablewrap td:first-child, .tablewrap th:first-child {
    position: sticky; left: 0; background: var(--surface);
    box-shadow: inset -1px 0 0 var(--line);
  }
  .tablewrap td:first-child { z-index: 2; }
  .tablewrap th:first-child { z-index: 6; box-shadow: inset -1px -1px 0 var(--line); }
}

/* stores & farmstands */
.locmeta { display: flex; gap: .5rem 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.segmented.arr .seg { min-width: 10rem; }
.countbar label.grow { flex: 1; min-width: 12rem; }
.runtotal { font-weight: 700; color: var(--ok-ink); padding-bottom: .55rem; }
tr.grouphead td {
  background: var(--bg); font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding-top: .5rem; padding-bottom: .5rem;
}
.tablewrap table tr.grouphead td:first-child { text-align: left; }
.price-input { width: 6rem; font-size: 1rem; font-weight: 600; }
.sheet-table tr.match .qty-input { border-color: var(--ok-ink); }
.sheet-table tr.off .qty-input { border-color: var(--danger); }
.sheet-table tr.off td.linetotal { color: var(--danger); }
td.linetotal { font-weight: 600; min-width: 5rem; }
td.expected.neg { color: var(--danger); }
.small-caps { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }

/* printable slip */
.slip { max-width: 52rem; margin: 0 auto 1rem; padding: 2rem; }
.slip-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-bottom: 2px solid var(--text); padding-bottom: 1rem; }
.slip-from { display: flex; gap: 1rem; align-items: flex-start; }
.slip-logo { max-height: 70px; max-width: 120px; border-radius: 6px; }
.slip-company { font-size: 1.25rem; }
.slip-title { text-align: right; }
.slip-title h2 { margin: 0 0 .3rem; font-size: 1.4rem; text-transform: uppercase; letter-spacing: .05em; }
.slip-to { margin: 1.25rem 0; }
.slip-table { margin-bottom: 1rem; }
.slip-table th, .slip-table td { text-align: center; }
.slip-table th:first-child, .slip-table td:first-child { text-align: left; }
.slip-table thead th { position: static; box-shadow: none; border-bottom: 2px solid var(--line); }
.slip-table tfoot td { font-weight: 700; border-top: 2px solid var(--text); }
.slip-due { font-size: 1.15rem; text-align: right; }
.slip-sign { display: flex; gap: 2rem; margin-top: 3rem; }
.slip-sign div { flex: 1; color: var(--muted); font-size: .85rem; }
.slip-sign span { display: block; border-bottom: 1px solid var(--text); height: 2rem; margin-bottom: .3rem; }
@media print {
  .noprint, .flash { display: none !important; }
  .slip { border: 0; padding: 0; max-width: none; color: #000; background: #fff; }
  .slip .muted { color: #444; }
  main { padding: 0; max-width: none; }
}
@media print {
  .frozen { background: none !important; }
  .frozen-inner { padding: 0 !important; }
  .frozen-inner:has(.noprint:only-child) { display: none; }
}

/* kits */
.kit-choice { border-bottom: 1px solid var(--line); padding-bottom: .5rem; }
.kit-choice .pick-row { border-bottom: 0; }
.choice-list {
  margin: 0 0 .25rem 7.1rem; padding: .5rem .75rem; max-height: 16rem; overflow-y: auto;
  background: var(--bg); border-radius: 8px;
}
.choice-group { margin-top: .4rem; }
.choice-head { display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .3rem 0 .1rem; }
.choice-list label.check { margin: .15rem 0; font-size: .95rem; }
.split-table td { vertical-align: middle; }
.need-short td.need { color: var(--danger); font-weight: 700; }
@media (max-width: 700px) {
  .choice-list { margin-left: 0; }
}
.split-status.okc { color: var(--ok-ink); }
.split-status.bad { color: var(--danger); }
.wide-card { max-width: 46rem; }
.choice-list label.check .muted { margin-left: .4rem; }

/* reports */
.report-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.report-link { display: flex; flex-direction: column; gap: .35rem; color: var(--text); margin: 0; }
.report-link:hover { border-color: var(--accent); text-decoration: none; }
.report-link strong { font-size: 1.05rem; color: var(--accent); }
.filters .area { align-self: center; }
.inline-range { display: flex; align-items: center; gap: .4rem; margin: 0; font-weight: 600; }
.inline-range input { width: auto; margin: 0; }
.dash-samples { margin: -.25rem 0 1.25rem; }
/* keep the menu on one line on laptop screens */
@media (min-width: 701px) and (max-width: 1250px) {
  .topbar nav a { padding: .45rem .55rem; font-size: .95rem; }
  .brand span { font-size: 1rem; }
}
/* tablets / small laptops: use the ☰ menu instead of wrapping the menu bar */
@media (max-width: 1080px) {
  .topbar .navbutton { display: block; margin-left: auto; font-size: 1.5rem; cursor: pointer; margin-bottom: 0; }
  .topbar nav { display: none; width: 100%; flex-direction: column; margin: 0; }
  .topbar .navtoggle:checked ~ nav { display: flex; }
}

/* Set MIN / MAX for a group */
.setall { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.setall label { margin: 0; display: flex; align-items: center; gap: .4rem; font-weight: 600; }
.setall input { width: 6rem; }
.setall .muted { flex-basis: 100%; font-size: .9rem; }
input.mm { width: 5.5rem; text-align: center; }
input.mm.changed { background: #fff6d6; border-color: #d4a24c; font-weight: 600; }

/* Store payments */
.card.money { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.money-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; flex: 1 1 520px; }
.money-nums > div { display: flex; flex-direction: column; text-align: center; }
.money-nums .lbl { color: var(--muted); font-size: .9rem; }
.money-nums .num { font-size: 1.7rem; font-weight: 700; line-height: 1.2; }
.money-nums .bal.owed .num { color: var(--danger); }
.money-nums .bal.even .num { color: var(--ok-ink); }
.muted.small, .small.muted { font-size: .8rem; }
@media (max-width: 640px) {
  .money-nums { grid-template-columns: 1fr; gap: .75rem; }
  .card.money .btn { width: 100%; text-align: center; }
}

/* Type > Product > Size picker (Starting inventory) */
.card.picker { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr) 7rem auto; gap: .75rem; align-items: end; }
.card.picker label { margin: 0; }
.card.picker select, .card.picker input { width: 100%; box-sizing: border-box; }
.card.picker .qty input { text-align: center; }
.card.picker .hint { grid-column: 1 / -1; margin: 0; min-height: 1.2em; }
@keyframes flashrow { from { background: #fff1c2; } to { background: transparent; } }
tr.flash-row td { animation: flashrow 1.6s ease-out; }
@media (max-width: 760px) {
  .card.picker { grid-template-columns: minmax(0, 1fr) 7rem; }
  .card.picker label:nth-child(1), .card.picker label:nth-child(2), .card.picker #p_add { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .tablewrap table.start-table th:nth-child(5), .tablewrap table.start-table td:nth-child(5) { display: table-cell; }
}

/* Fill to MAX */
.fill-table tr.nomax td { color: var(--muted); }
@media (max-width: 700px) {
  .tablewrap table.fill-table th:nth-child(5), .tablewrap table.fill-table td:nth-child(5) { display: table-cell; }
}
@media print {
  .fill-table .count-input { border: 0; background: none; font-weight: 700; }
  .fill-table tbody tr:not(.match) { display: none; }   /* the bottling list shows only what to make */
}

/* Additive rows: amount + oz / g */
.pick-row select.addunit { width: 4.3rem; min-width: 4.3rem; padding-left: .45rem; padding-right: 1.3rem; background-position: right .35rem center; }
.additive-row .qtybox input.qty { width: 3.6rem; }
.additive-row .qtybox { gap: .3rem; }
/* oz | g buttons on additive rows */
.unitseg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex: none; }
.unitseg[hidden] { display: none; }
.unitseg .u { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: .85rem; font-weight: 600;
              padding: .35rem .55rem; min-width: 2.1rem; cursor: pointer; }
.unitseg .u + .u { border-left: 1px solid var(--line); }
.unitseg .u.on { background: var(--accent); color: var(--accent-ink); }

/* Made-here batch form */
.pick-row.batch-row { grid-template-columns: minmax(0, 1fr) 11rem 5.5rem 2.2rem; }
.batch-row .qtybox input.qty { width: 4.2rem; }
.batch-sum { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-end; justify-content: space-between;
             margin: 1.25rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.batch-sum label { margin: 0; }
.batch-sum .qtybox { display: flex; align-items: center; gap: .35rem; margin-top: .3rem; }
.batch-sum .qtybox input.qty { width: 5rem; }
.batch-totals { display: flex; gap: 2rem; }
.batch-totals > div { display: flex; flex-direction: column; text-align: right; }
.batch-totals .lbl { color: var(--muted); font-size: .85rem; }
.batch-totals .num { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: .3rem 0; }
@media (max-width: 640px) {
  .pick-row.batch-row { grid-template-columns: minmax(0, 1fr) 2.2rem; }
  .batch-row select { grid-column: 1 / -1; }
  .batch-totals { gap: 1rem; width: 100%; justify-content: space-between; }
}
