/* Layout: one narrow column of cards with a fixed bottom tab bar, built for phones first.
   Colour: charcoal, black and warm grey on white, with sand-tinted cards. */
:root {
  --bg: #ffffff; --card: #faf7f1; --ink: #1f1e1c; --muted: #69645c; --line: #d8cfbf;
  --accent: #2b2a28; --accent-soft: #ddd5c6; --on-accent: #f7f2e9; --bar: #1a1918; --on-bar: #f2ece2;
  --warn: #a94d1b; --warn-bg: #f6e3d6; --ok: #2f6b3a; --ok-bg: #e0ecdc; --info: #4b5760; --info-bg: #e2e4e1; --radius: 12px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #171615; --card: #211f1d; --ink: #efebe4; --muted: #a8a198; --line: #34312d; --accent: #e6dfd3; --accent-soft: #2e2b27; --on-accent: #1a1917; --bar: #0f0e0d; --on-bar: #efebe4; --warn: #f0a071; --warn-bg: #3b2a20; --ok: #8fd19b; --ok-bg: #1d3223; --info: #b9c2c8; --info-bg: #2a2e31; color-scheme: dark; } }
:root[data-theme="dark"] { --bg: #171615; --card: #211f1d; --ink: #efebe4; --muted: #a8a198; --line: #34312d; --accent: #e6dfd3; --accent-soft: #2e2b27; --on-accent: #1a1917; --bar: #0f0e0d; --on-bar: #efebe4; --warn: #f0a071; --warn-bg: #3b2a20; --ok: #8fd19b; --ok-bg: #1d3223; --info: #b9c2c8; --info-bg: #2a2e31; color-scheme: dark; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--bar); color: var(--on-bar); }
.brand { font-weight: 700; letter-spacing: .04em; }
#who { font-size: 13px; opacity: .85; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px 96px; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 5; }
nav a { flex: 1; text-align: center; padding: 14px 4px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
nav a.on { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.logged-out nav, .logged-out header #who { display: none; }
h1 { font-size: 24px; margin: 0; } h2 { font-size: 18px; margin: 24px 0 8px; } h3.group { font-size: 13px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin: 20px 0 6px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.sub { color: var(--muted); font-size: 14px; }
small { color: var(--muted); display: block; font-size: 12px; }
.back { display: inline-block; margin-bottom: 8px; color: var(--accent); text-decoration: none; font-weight: 600; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; margin: 6px 0;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; }
a.row:active { background: var(--accent-soft); }
.row .title, .card .title { font-weight: 600; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.num.small { font-size: 13px; color: var(--muted); font-weight: 500; }
.neg { color: var(--warn); } .pos { color: var(--ok); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 10px 0; }
details.card > summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details.card[open] > summary { margin-bottom: 10px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 12px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stat span { display: block; font-size: 12px; color: var(--muted); } .stat b { font-size: 18px; }
label { display: block; font-size: 14px; font-weight: 600; margin: 10px 0; }
label.inline { display: flex; align-items: center; gap: 8px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font: inherit; font-weight: 400;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
button, .button { display: inline-block; padding: 12px 16px; font: inherit; font-weight: 600; border-radius: 10px; border: 0;
  cursor: pointer; text-decoration: none; text-align: center; }
.primary { background: var(--accent); color: var(--on-accent); }
.secondary { background: var(--accent-soft); color: var(--accent); }
button:disabled { opacity: .6; }
button.icon { background: none; color: var(--muted); font-size: 22px; padding: 0 0 0 10px; line-height: 1; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
form > button.primary, form > button.secondary { margin-top: 6px; }
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0; padding-bottom: 2px; }
.chip { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--card); color: var(--muted); border: 1px solid var(--line); font-size: 13px; }
.chip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
input[type=search] { margin: 8px 0; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 4px;
  background: var(--accent-soft); color: var(--accent); vertical-align: middle; white-space: nowrap; }
.badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.info { background: var(--info-bg); color: var(--info); }
.private { display: inline; font-size: 11px; color: var(--warn); font-weight: 600; margin-left: 6px; }
.hint { color: var(--muted); font-size: 13px; }
.note { background: var(--accent-soft); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.warnbox { background: var(--warn-bg); color: var(--warn); padding: 12px; border-radius: 10px; }
.empty, .loading { color: var(--muted); text-align: center; padding: 24px 0; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); } tr.short td { background: var(--warn-bg); }
textarea[readonly] { font-family: ui-monospace, monospace; font-size: 13px; }
.login { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.login h1 { font-size: 34px; color: var(--accent); } .login form { text-align: left; margin-top: 24px; }
.login form button { width: 100%; } .login .actions { justify-content: center; }
#toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  max-width: 90vw; padding: 12px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); transition: .2s; z-index: 10; font-size: 14px; }
#toast.show { opacity: 1; transform: translateX(-50%); } #toast.error { background: var(--warn); color: var(--bg); } #toast.ok { background: var(--ok); color: var(--bg); }
.shortrow { border-color: var(--warn); }

.grow { flex: 1; min-width: 0; }
.row { justify-content: flex-start; } .row > .num, .row > div:last-child:not(.grow) { margin-left: auto; }
.thumb { flex: none; width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--accent-soft); display: block; }
.thumb.ph { background: radial-gradient(circle at 30% 50%, var(--accent) 0 4px, transparent 5px),
  radial-gradient(circle at 50% 50%, var(--accent) 0 4px, transparent 5px),
  radial-gradient(circle at 70% 50%, var(--accent) 0 4px, transparent 5px), var(--accent-soft); opacity: .7; }
.thumb.big { width: 100%; max-width: 360px; height: auto; aspect-ratio: 1; margin: 4px 0 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.tab { flex: 1 1 auto; padding: 11px 14px; border-radius: 10px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); font-weight: 600; }
.tab.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.count { font-weight: 600; color: var(--muted); letter-spacing: 0; }
section.group { margin-bottom: 8px; }
.addlink { display: inline-block; margin: 2px 0 8px; color: var(--accent); font-weight: 600; font-size: 14px; text-decoration: none; }
.empty.small { padding: 6px 0; text-align: left; font-size: 14px; }
.catrow { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.catrow input { margin: 0; } .catrow.sub { padding-left: 24px; } .catrow button { flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.searchrow { display: flex; gap: 8px; align-items: center; }
.searchrow input { flex: 1; min-width: 0; } .searchrow button { flex: none; margin-top: 4px; }
.scanner { position: fixed; inset: 0; z-index: 20; background: #000; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: env(safe-area-inset-top, 0px) 16px env(safe-area-inset-bottom, 0px); }
.scanner video { width: 100%; max-width: 520px; border-radius: 12px; }
.scanner .frame { position: absolute; width: min(70vw, 360px); height: 120px; border: 3px solid var(--on-bar); border-radius: 10px; }
.scanner p { color: var(--on-bar); margin: 0; }
.bar { height: 6px; border-radius: 99px; background: var(--accent-soft); margin-top: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
a.stat { color: inherit; text-decoration: none; }
.stat.alert { border-color: var(--warn); } .stat.alert b { color: var(--warn); }
.block { display: block; margin: 10px 0; color: inherit; text-decoration: none; }
.golden { display: flex; flex-direction: column; align-items: flex-start; }
.golden .thumb.big { max-width: 260px; }
.timer .title { margin-bottom: 6px; }
button.big { width: 100%; padding: 16px; font-size: 18px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 8px 12px; }
legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
.defects { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (max-width: 420px) { .defects { grid-template-columns: 1fr; } }
.defects label.check { margin: 6px 0; }
.code { flex: none; min-width: 52px; font-variant-numeric: tabular-nums; }
details > summary.group { cursor: pointer; }

.badges { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; } .badges .badge { margin-left: 0; }

/* Production blocks on the task page */
.blocks { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.blk { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.blk > summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; font-weight: 600; list-style: none; }
.blk > summary::-webkit-details-marker { display: none; }
.blkno { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 14px;
  background: var(--accent-soft); color: var(--ink); }
.blk.done .blkno { background: var(--ok); color: var(--on-accent); }
.blk.current { border-color: var(--accent); border-width: 2px; }
.blk.current .blkno { background: var(--accent); color: var(--on-accent); }
.blk.todo > summary { color: var(--muted); }
.blksum { font-size: 13px; color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.blkbody { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.bigcount { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bigcount span { font-size: 15px; font-weight: 500; color: var(--muted); }
.bar.big { height: 10px; margin-bottom: 10px; }
.inlineform { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inlineform label { flex: 1 1 160px; margin: 0; } .inlineform button { flex: none; }
/* Media */
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0; }
.media figure { margin: 0; position: relative; min-width: 0; }
.media img, .media video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--accent-soft); display: block; }
.media figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.media .linkitem .button { display: block; }
.media figure .icon { position: absolute; top: 4px; right: 4px; background: var(--card); border-radius: 50%; width: 28px; height: 28px; padding: 0; font-size: 18px; }
.mediaform summary { font-size: 14px; }
/* Product page */
.prodhead { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.prodhead .thumb { width: 72px; height: 72px; }
.prodhead h1 { font-size: 21px; }
.chips a.chip { text-decoration: none; }
.step .stephead { display: flex; gap: 10px; align-items: center; }
.stepno { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 700; }
.stepbody { margin: 10px 0 4px; }
.stepbtns { display: flex; gap: 4px; } .stepbtns .icon { font-size: 18px; padding: 4px 6px; }
.crit { margin: 6px 0; padding: 8px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.catrow.off input { color: var(--muted); text-decoration: line-through; }
.catrow { flex-wrap: wrap; } .catrow input { flex: 1 1 200px; }
#ptabs { flex-wrap: wrap; overflow: visible; }
.golden .thumb.big { max-width: 200px; }
.golden .media { max-width: 200px; grid-template-columns: 1fr; }

.actions.tight { margin: 0; gap: 6px; flex-wrap: nowrap; } .actions.tight .button { padding: 10px 12px; font-size: 14px; }

.kitline { border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 6px; }
.need .inlineform { margin-top: 8px; }

button.small { padding: 7px 12px; font-size: 13px; margin-top: 4px; }
button.small.on { background: var(--accent); color: var(--on-accent); }
.bcwrap { overflow-x: auto; background: #fff; border-radius: 8px; padding: 8px; margin: 8px 0; }
.bcwrap svg { display: block; max-width: 100%; height: auto; }

/* Category buttons on the Stock screens */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin: 12px 0; }
.tile { position: relative; display: block; padding: 16px 30px 16px 16px; min-height: 92px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.tile:active { background: var(--accent-soft); }
.tilename { font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.tile .chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 22px; color: var(--muted); }

.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
@media (max-width: 380px) { .three { grid-template-columns: 1fr; } }
.tiles.photo { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.phototile { padding: 10px 10px 14px; }
.phototile .tileimg { width: 100%; height: auto; aspect-ratio: 1; border-radius: 10px; margin-bottom: 8px; }
.phototile .tilename { font-size: 15px; }
h3.group + .tiles { margin-top: 6px; }

/* Kit labels on A4 label sheets (positions in mm, set in kits.js) */
.sheets { overflow-x: auto; margin-top: 12px; }
.a4sheet { position: relative; width: 210mm; height: 297mm; background: #fff; color: #000; box-shadow: 0 0 0 1px var(--line); margin-bottom: 16px; }
.a4label { position: absolute; box-sizing: border-box; padding: 1.5mm 2.5mm; overflow: hidden; outline: 1px dashed #ccc;
  font-size: 7.5pt; line-height: 1.2; display: flex; flex-direction: column; gap: 0.6mm; }
.a4label svg.barcode { width: 100%; height: 11mm; }
.labeltop { display: flex; justify-content: space-between; font-size: 9pt; }
.labelsub { font-size: 7pt; }
.labellist { font-size: 6.5pt; margin: 0; padding-left: 3mm; }
@media print {
  @page { size: A4; margin: 0; }
  header, nav, #toast, .noprint, .back { display: none !important; }
  html, body, main, #main { background: #fff !important; padding: 0 !important; margin: 0 !important; }
  .sheets { overflow: visible; margin: 0; }
  .a4sheet { box-shadow: none; margin: 0; page-break-after: always; }
  .a4label { outline: none; }
}
/* Weigh instead of count */
.weighbox { margin: 4px 0 8px; }
.weighbox summary { font-size: 13px; color: var(--muted, #666); cursor: pointer; }
.target .pick { width: 22px; height: 22px; margin-right: 8px; }
.target .makeqty { width: 64px; text-align: center; }
/* Reports */
.rangebar { display: grid; gap: 8px; }
table.report { font-size: 13px; }
table.report td.flag { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
button.small { padding: 6px 12px; font-size: 13px; margin: 6px 0 12px; }
nav a { font-size: 13px; }
.labelcode { font-family: monospace; font-size: 7pt; text-align: center; margin-top: -0.5mm; }
.checklist .chore { align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.checklist .chore input { width: 26px; height: 26px; flex: none; }
.printonly { display: none; }
@media print {
  .printonly { display: block; font-weight: 600; }
  .rangebar, [data-csv], .back, #vars button { display: none !important; }
  .tablewrap { overflow: visible; }
  table.report { font-size: 9pt; }
  details > *:not(summary) { display: block; }
}

/* Studio documents (Staff tab, Me -> Studio documents) */
.docbody { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 18px 12px; line-height: 1.55; font-size: 16px; }
.docbody h1 { font-size: 22px; } .docbody h2 { font-size: 19px; margin-top: 22px; } .docbody h3 { font-size: 17px; } .docbody h4 { font-size: 16px; }
.docbody li { margin: 4px 0; }
.docbody table { margin: 10px 0; } .docbody th, .docbody td { white-space: normal; vertical-align: top; border: 1px solid var(--line); }
.docbody .tablewrap, .docbody { overflow-x: auto; }
.docbody.editor { min-height: 160px; outline: 2px solid var(--accent-soft); }
.docbody.editor:focus { outline-color: var(--accent); }
.edtools { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.agreebox { margin-top: 18px; } .agreebox h2 { margin-bottom: 8px; }
.okbox { background: var(--ok-bg); color: var(--ok); padding: 12px; border-radius: 10px; }
.docsbanner { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.signblock { margin-top: 24px; } .signblock p { margin: 14px 0; }
table.grid td, table.grid th { white-space: normal; }
.obtick { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.obtick:last-child { border-bottom: 0; } .obtick .sub { display: block; }
@media (max-width: 420px) { nav a { font-size: 11.5px; padding: 13px 1px; } }
@media print {
  .docbody { border: 0; padding: 0; font-size: 12pt; }
  .agreebox { break-before: page; }
  .signblock { break-inside: avoid; }
}
@media (max-width: 400px) { nav a { font-size: 11px; padding: 13px 0; letter-spacing: -0.1px; } }

/* Website stock to-do */
.wsline { display: block; cursor: pointer; } .wsline.off { opacity: .7; }
.wshead { display: flex; gap: 10px; align-items: center; }
.wsnums { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 10px 0; font-size: 14px; color: var(--muted); }
.wsnums b { color: var(--ink); }
.wsset { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-weight: 600; }
.wsset .big { font-size: 24px; } .wsset .check { margin-left: auto; font-weight: 600; }
#wsday { width: auto; display: inline-block; padding: 4px 8px; }

.row.logbad { border-color: var(--warn); } .row small { color: var(--muted); }
