/* Laser Saga Technician's Toolkit — design system (spec §7, Brand Guidelines 2026) */

@font-face { font-family: 'PP Neue Montreal'; src: url('/brand/fonts/PPNeueMontreal-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'PP Neue Montreal'; src: url('/brand/fonts/PPNeueMontreal-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'PP Neue Montreal'; src: url('/brand/fonts/PPNeueMontreal-SemiBold.woff2') format('woff2'); font-weight: 600 700; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --red: #FF2800;          /* Laser Red — accents only */
  --black: #000000;        /* Real Black */
  --white: #FFFFFF;        /* Real White */
  --almost-white: #FFFEFE;
  --grey-light: #909090;   /* brand "Light Grey" */
  --grey-dark: #A9A9A9;    /* brand "Dark Grey" */

  --font-body: 'PP Neue Montreal', Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: 16px;
  --tap: 44px;
  --ease: cubic-bezier(.2, .8, .2, 1); /* fast in, hard clean stop — no bounce */
  --t: 180ms;
}

/* Default: dark */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--black);
  --fg: var(--almost-white);
  --fg-2: var(--grey-dark);
  --line: rgba(144, 144, 144, .38);
  --line-strong: rgba(144, 144, 144, .7);
  --panel: rgba(144, 144, 144, .10);
  --panel-2: rgba(144, 144, 144, .18);
  --border-w: 1px;
  --invert-bg: var(--white);
  --invert-fg: var(--black);
}

/* Sunlight: a true alternate theme for direct sun — white ground, black type, heavier rules. */
:root[data-theme="sun"] {
  color-scheme: light;
  --bg: var(--white);
  --fg: var(--black);
  --fg-2: var(--black);
  --line: var(--black);
  --line-strong: var(--black);
  --panel: rgba(144, 144, 144, .14);
  --panel-2: rgba(144, 144, 144, .26);
  --border-w: 2px;
  --invert-bg: var(--black);
  --invert-fg: var(--white);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* `hidden` must always win — a class with display:grid/flex would otherwise keep a "hidden" element on screen. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
:root[data-theme="sun"] body { font-size: 18px; font-weight: 500; }
img { max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
::selection { background: var(--red); color: var(--white); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--fg-2); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
code { overflow-wrap: anywhere; }
hr { border: 0; border-top: var(--border-w) solid var(--line); margin: 24px 0; }

/* ---------- Type ---------- */
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.15; }
.display-fallback { font-family: var(--font-body); font-weight: 600; letter-spacing: -.01em; }
h1.display-fallback { font-size: clamp(1.6rem, 6vw, 2.4rem); }
h2.display-fallback { font-size: 1.35rem; }
h3 { font-size: 1.1rem; font-weight: 600; }
/* Red eyebrow label (brand's "PART 01" device): small, bold, spaced caps */
.eyebrow { display: block; color: var(--red); font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
/* In direct sun small red type washes out: eyebrows go black, the red survives as a pixel marker. */
:root[data-theme="sun"] .eyebrow { color: var(--black); display: flex; align-items: center; gap: 8px; }
:root[data-theme="sun"] .eyebrow::before { content: ''; width: 8px; height: 8px; background: var(--red); flex: 0 0 auto; }
.key-number { color: var(--red); font-weight: 600; font-size: clamp(2.6rem, 12vw, 3.6rem); line-height: 1; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: var(--border-w) solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar-inner {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand actions" "search search";
  column-gap: 12px; align-items: center; max-width: 1100px; margin: 0 auto; padding: 0 var(--gutter);
}
/* Logo: clear space = one module (≈ character height) on all sides */
.brand { grid-area: brand; justify-self: start; display: block; padding: 17px 17px 17px 0; line-height: 0; }
.logo { height: 17px; width: auto; }
/* Single-colour brand files: white on dark, black in sunlight — swapped, never tinted. */
.logo-on-dark { display: block; }
.logo-on-light { display: none; }
:root[data-theme="sun"] .logo-on-dark { display: none; }
:root[data-theme="sun"] .logo-on-light { display: block; }
.topbar-actions { grid-area: actions; display: flex; gap: 8px; align-items: center; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: var(--tap); height: var(--tap); padding: 0 10px;
  background: transparent; color: var(--fg); border: var(--border-w) solid var(--line);
  font: inherit; font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; text-decoration: none; list-style: none;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.icon-btn::-webkit-details-marker { display: none; }
.icon-btn:hover { border-color: var(--fg); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn[aria-pressed="true"] { border-color: var(--red); }
.search-row { grid-area: search; padding-bottom: 12px; }
.search { display: flex; }
.search input {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px;
  background: var(--panel); color: var(--fg); border: var(--border-w) solid var(--line); border-right: 0;
  font: inherit; font-size: 1rem; border-radius: 0; -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--fg-2); opacity: .9; }
.search button { height: 48px; padding: 0 16px; border: var(--border-w) solid var(--line); background: var(--invert-bg); color: var(--invert-fg); font: inherit; font-weight: 600; cursor: pointer; border-radius: 0; }

@media (min-width: 820px) {
  .topbar-inner { grid-template-columns: auto 1fr auto; grid-template-areas: "brand search actions"; column-gap: 0; }
  .search-row { padding: 0 24px 0 0; }
  .logo { height: 26px; } /* brand minimum for the wide lockup: 279 × 26 px */
  .brand { padding: 26px 26px 26px 0; }
}

/* Account menu */
.menu { position: relative; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(300px, calc(100vw - 32px));
  background: var(--bg); border: var(--border-w) solid var(--line-strong); padding: 16px; z-index: 30;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.menu-panel .who { margin-bottom: 12px; }
.menu-panel .who strong { display: block; }
.menu-panel a, .menu-panel button.link { display: block; width: 100%; padding: 10px 0; text-align: left; background: none; border: 0; color: var(--fg); font: inherit; text-decoration: none; cursor: pointer; border-top: var(--border-w) solid var(--line); }
.menu-panel a:hover, .menu-panel button.link:hover { text-decoration: underline; text-decoration-color: var(--red); }

/* Edit Mode switch + strip */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: var(--border-w) solid var(--line); }
.switch { position: relative; width: 52px; height: 30px; border: var(--border-w) solid var(--line-strong); background: var(--panel); cursor: pointer; flex: 0 0 auto; padding: 0; }
.switch::after { content: ''; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; background: var(--fg-2); transition: transform var(--t) var(--ease), background var(--t) var(--ease); }
.switch[aria-checked="true"] { border-color: var(--red); }
.switch[aria-checked="true"]::after { transform: translateX(22px); background: var(--red); }
.edit-strip { background: var(--panel); border-bottom: 2px solid var(--red); }
.edit-strip .inner { max-width: 1100px; margin: 0 auto; padding: 8px var(--gutter); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; font-size: .9rem; }
.edit-strip .inner::before { content: ''; width: 10px; height: 10px; background: var(--red); flex: 0 0 auto; }
.edit-strip .inner span { flex: 1; }

/* ---------- Layout ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 20px var(--gutter) calc(48px + env(safe-area-inset-bottom)); }
.page-head { margin-bottom: 20px; }
.page-nav { display: flex; gap: 8px; margin: -4px 0 16px; }
.page-nav .btn { min-height: var(--tap); gap: 6px; padding: 0 14px 0 10px; }
.crumbs { font-size: .85rem; color: var(--fg-2); margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--fg-2); }
.crumbs span[aria-hidden] { opacity: .6; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row > .grow { flex: 1 1 200px; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Home ---------- */
.home-hero { position: relative; padding: 28px 0 24px; margin-bottom: 8px; min-height: 120px; }
.home-hero h1 { position: relative; z-index: 1; max-width: 70%; }
.section-card {
  position: relative; display: block; padding: 20px; min-height: 140px;
  border: var(--border-w) solid var(--line); background: var(--panel); text-decoration: none;
  transition: border-color var(--t) var(--ease);
}
.section-card:hover { border-color: var(--fg); }
.section-card h2 { margin-bottom: 6px; }
.section-card p { margin: 0; color: var(--fg-2); font-size: .95rem; }
.section-card .num { position: absolute; top: 16px; right: 18px; color: var(--red); font-weight: 600; font-size: .85rem; letter-spacing: .1em; }
.section-card .sub { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .9rem; }
.section-card .sub span::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--fg-2); margin-right: 7px; vertical-align: middle; }
.section-card.admin { border-style: dashed; }

/* ---------- Motif (red pixel squares) ---------- */
/* Irregular, never grid-aligned, near the top; sizes 70 / 50 / 30 / 20 (brand p.29). */
.motif { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.motif img { position: absolute; image-rendering: pixelated; animation: px-lock 260ms var(--ease) both; }
.motif .p1 { width: 30px; top: 6px; right: 17%; animation-delay: 40ms; }
.motif .p2 { width: 50px; top: 31px; right: 4%; animation-delay: 100ms; }
.motif .p3 { width: 20px; top: 70px; right: 28%; animation-delay: 160ms; }
.motif .p4 { width: 36px; top: 0; right: 41%; transform: rotate(180deg); animation-delay: 220ms; }
/* Login: squares live in a top band above the logo so they never enter its clear space. */
.motif-login { bottom: auto; height: 100px; }
.motif-login .p1 { width: 30px; top: 18px; left: 7%; right: auto; }
.motif-login .p2 { width: 50px; top: 38px; left: 19%; right: auto; }
.motif-login .p3 { width: 20px; top: 12px; right: 30%; }
.motif-login .p4 { width: 36px; top: 46px; right: 9%; left: auto; transform: rotate(180deg); }
@keyframes px-lock { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }

/* ---------- Cards / panels ---------- */
.panel { border: var(--border-w) solid var(--line); background: var(--panel); padding: 16px; }
.panel > :last-child { margin-bottom: 0; }
.empty { border: var(--border-w) dashed var(--line); padding: 20px; color: var(--fg-2); }
.empty strong { color: var(--fg); }
.flag { border-left: 4px solid var(--red); background: var(--panel); padding: 12px 14px; font-weight: 600; }
.flag.ok { border-left-color: var(--fg-2); font-weight: 500; }
.note { border-left: 4px solid var(--line-strong); padding: 8px 12px; color: var(--fg-2); font-size: .9rem; background: transparent; }
.notice { border: var(--border-w) solid var(--line-strong); padding: 12px 14px; }
.error-box { border: var(--border-w) solid var(--red); padding: 12px 14px; font-weight: 600; }

/* ---------- Tabs / chips ---------- */
.tabs { display: flex; gap: 0; border-bottom: var(--border-w) solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
.tabs a { flex: 1 0 auto; text-align: center; padding: 12px 6px; text-decoration: none; color: var(--fg-2); font-weight: 600; font-size: .9rem; border-bottom: 3px solid transparent; margin-bottom: calc(-1 * var(--border-w)); white-space: nowrap; }
@media (min-width: 640px) { .tabs a { flex: 0 0 auto; padding: 12px 16px; font-size: 1rem; } }
.tabs a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--red); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 12px 4px 4px;
  border: var(--border-w) solid var(--line); text-decoration: none; font-size: .9rem; font-weight: 500; background: transparent;
}
.chip.no-icon { padding-left: 12px; }
.chip[aria-current="true"] { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.filter-group + .filter-group { margin-top: 14px; }
.filter-group > .eyebrow { margin-bottom: 8px; }

/* ---------- Forms ---------- */
label, .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.field .help { font-size: .82rem; color: var(--fg-2); margin-top: 4px; }
.field .err { margin-top: 6px; font-size: .88rem; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.field .err::before { content: ''; width: 8px; height: 8px; background: var(--red); flex: 0 0 auto; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
input[type="text"], input[type="number"], input[type="password"], input[type="url"], input[type="email"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  background: var(--panel); color: var(--fg); border: var(--border-w) solid var(--line); border-radius: 0;
  font: inherit; font-size: 1rem; -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--fg) 50%), linear-gradient(135deg, var(--fg) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
/* Native dropdown lists: style group headings and disabled entries too, or some browsers draw them white-on-white. */
select option, select optgroup { background: var(--bg); color: var(--fg); }
select optgroup { font-weight: 600; font-style: normal; }
select option:disabled { color: var(--fg-2); }
textarea { min-height: 120px; resize: vertical; }
textarea.markdown { min-height: 360px; font-family: ui-monospace, 'SF Mono', Consolas, monospace; font-size: .9rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--fg); }
input[readonly].computed { border-color: var(--red); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 18px;
  border: var(--border-w) solid var(--line-strong); background: transparent; color: var(--fg);
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; border-radius: 0;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.btn:hover { border-color: var(--fg); }
.btn-primary { background: var(--invert-bg); color: var(--invert-fg); border-color: var(--invert-bg); }
.btn-primary:hover { background: var(--fg); }
.btn-danger { border-color: var(--red); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline { display: inline; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: var(--border-w) solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: var(--border-w) solid var(--line); vertical-align: top; }
th { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2); font-weight: 600; background: var(--panel); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }
.group-head:first-child { margin-top: 0; }
.group-head h2 { margin: 0; }
.status-valid, .status-imported { font-weight: 600; }
.status-invalid, .status-failed { font-weight: 600; }
.status-invalid::before, .status-failed::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--red); margin-right: 6px; }
tr.row-saved td { background: var(--panel-2); }
/* Collapsible machine / DMX-mode groups */
.collapse-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.fold { border: var(--border-w) solid var(--line); margin-bottom: 10px; }
.fold[open] { border-color: var(--line-strong); }
.fold-head { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; cursor: pointer; list-style: none; user-select: none; }
.fold-head::-webkit-details-marker { display: none; }
.fold-head::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--fg); border-bottom: 2px solid var(--fg); transform: rotate(45deg); margin: -4px 4px 0 auto; transition: transform var(--t) var(--ease); flex: 0 0 auto; }
.fold[open] > .fold-head::after { transform: rotate(-135deg); margin-top: 4px; }
.fold[open] > .fold-head { border-bottom: var(--border-w) solid var(--line); }
.fold[open] > .fold-head::before { content: ''; width: 8px; height: 8px; background: var(--red); flex: 0 0 auto; }
.fold-title { font-weight: 600; font-size: 1.05rem; }
.fold-count { font-size: .82rem; color: var(--fg-2); white-space: nowrap; }
.fold-body { padding: 12px 14px 4px; }
.fold-sub { margin: 0 0 10px; }
.fold-sub .fold-head { min-height: 48px; }
.fold-sub .fold-title { font-size: .95rem; }
@media (max-width: 639px) { .fold-body { padding: 10px 10px 2px; } }

/* Reference tables become one card per row on phones: long manual text needs the full width. */
@media (max-width: 639px) {
  .table-wrap:has(> table.stack-mobile) { border: 0; overflow: visible; }
  table.stack-mobile thead { display: none; }
  table.stack-mobile tr { display: block; border: var(--border-w) solid var(--line); background: var(--panel); padding: 10px 12px; margin-bottom: 10px; }
  /* Label in a fixed left column; the value flows as normal inline text (so "1–2" or "name · 200 g bag" stay on one line). */
  table.stack-mobile td { display: block; position: relative; padding: 4px 0 4px 94px; min-height: 26px; border: 0; text-align: left; }
  table.stack-mobile td::before { content: attr(data-label); position: absolute; left: 0; top: 7px; width: 84px; font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2); }
  table.stack-mobile td.title { font-weight: 600; }
  table.stack-mobile td.lead strong { font-size: 1.25rem; }
  table.stack-mobile td.actions { display: flex; gap: 8px; padding: 8px 0 0; }
  table.stack-mobile td.actions::before { content: none; }
  table.stack-mobile td:empty { display: none; }
}

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; border-top: var(--border-w) solid var(--line); }
.list li { border-bottom: var(--border-w) solid var(--line); }
.list a.item, .list .item { display: flex; align-items: center; gap: 12px; padding: 14px 4px; text-decoration: none; min-height: 56px; }
.list .item .grow { flex: 1; min-width: 0; }
.list .item .title { font-weight: 600; display: block; }
.list .item .meta { font-size: .85rem; color: var(--fg-2); }
.list .item .go { color: var(--fg-2); }
.contact { padding: 14px 4px; display: grid; gap: 4px; }
.contact .name { font-weight: 600; font-size: 1.05rem; }
.contact .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }

/* ---------- Article ---------- */
.article { max-width: 760px; }
.article h3 { margin-top: 1.6em; }
.article table { margin: 12px 0; border: var(--border-w) solid var(--line); }
.article img { display: block; margin: 16px 0; border: var(--border-w) solid var(--line); background: #fff; }
.article blockquote { margin: 16px 0; padding: 10px 14px; border-left: 4px solid var(--red); background: var(--panel); }
.article blockquote p { margin: 0; }
.article blockquote p + p { margin-top: 6px; }
.article code { font-family: ui-monospace, Consolas, monospace; background: var(--panel-2); padding: 1px 5px; }

/* ---------- Tools ---------- */
.tool-result { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tool-result .unit { font-weight: 600; font-size: 1.1rem; }
.dips { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin: 8px 0 4px; }
.dip { display: flex; flex-direction: column; align-items: center; gap: 6px; background: none; border: 0; padding: 0; color: var(--fg); font: inherit; cursor: pointer; }
.dip .slot { position: relative; width: 100%; max-width: 40px; height: 84px; border: var(--border-w) solid var(--line-strong); background: var(--panel); }
.dip .knob { position: absolute; left: 4px; right: 4px; height: 36px; bottom: 4px; background: var(--fg-2); transition: bottom var(--t) var(--ease), background var(--t) var(--ease); }
.dip[aria-pressed="true"] .knob { bottom: calc(100% - 40px); background: var(--fg); }
.dip[aria-pressed="true"] .slot { border-color: var(--red); }
.dip .n { font-weight: 600; font-size: .9rem; }
.dip .v { font-size: .72rem; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.dip-legend { display: flex; justify-content: space-between; font-size: .75rem; color: var(--fg-2); letter-spacing: .1em; text-transform: uppercase; }
/* Home: favourites / recently viewed */
.quick { margin: 0 0 20px; display: grid; gap: 14px; }
.quick-row .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.quick-row .chip { white-space: nowrap; flex: 0 0 auto; }

/* Favourite star */
.fav-btn[aria-pressed="true"] { color: var(--red); border-color: var(--red); }
@media (max-width: 639px) { .tabs a { padding: 12px 4px; font-size: .85rem; } }

/* ---------- Show Builder ---------- */
/* Six show tabs: two tidy rows on a phone rather than hiding DMX/Packing off-screen. */
.tabs-scroll { flex-wrap: wrap; overflow: visible; }
.tabs-scroll a { flex: 1 0 30%; padding-left: 6px; padding-right: 6px; }
@media (min-width: 640px) { .tabs-scroll a { flex: 0 0 auto; padding-left: 14px; padding-right: 14px; } }
.tab-badge { display: inline-block; min-width: 20px; padding: 0 5px; margin-left: 4px; font-size: .72rem; line-height: 18px; text-align: center; background: var(--panel-2); color: var(--fg); }
.tab-badge.err { background: var(--red); color: var(--black); }
a.show-issues { display: grid; text-decoration: none; margin-bottom: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 960px) { .stat-grid { grid-template-columns: repeat(6, 1fr); } }
.stat-tile { display: grid; gap: 2px; padding: 12px; border: var(--border-w) solid var(--line); background: var(--panel); text-decoration: none; }
a.stat-tile:hover { border-color: var(--fg); }
.stat-tile .label { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2); font-weight: 600; margin: 0; }
.stat-tile .value { font-size: 1.45rem; font-weight: 600; }
.stat-tile .sub { font-size: .8rem; color: var(--fg-2); }
.issue-list { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 6px; }
.issue > a, .issue > span { display: block; padding: 10px 12px; border: var(--border-w) solid var(--line); text-decoration: none; font-size: .92rem; }
.issue-error > a, .issue-error > span { border-left: 5px solid var(--red); }
.issue-warn > a, .issue-warn > span { border-left: 5px solid var(--fg); }
.issue-info > a, .issue-info > span { border-left: 5px solid var(--line-strong); }
.issue-tag { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; margin-right: 8px; border: 1px solid currentColor; }
.issue-error .issue-tag { background: var(--red); color: var(--black); border-color: var(--red); }
.issue-dot { width: 10px; height: 10px; background: var(--red); flex: 0 0 auto; }
.show-actions { margin: 0 0 18px; }
.qty-pill { font-weight: 600; font-size: 1.05rem; min-width: 38px; }
.kv { display: grid; gap: 4px; margin: 0 0 12px; }
.kv > div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; }
.kv dt { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); font-weight: 600; padding-top: 2px; }
.kv dd { margin: 0; }
.status-pill { font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border: 1px solid var(--line-strong); white-space: nowrap; }
.status-pill.status-confirmed { border-color: var(--red); }
.status-pill.status-done { color: var(--fg-2); }
.status-pill.status-incomplete { border-color: var(--red); }
.load-over { color: var(--red); font-weight: 600; }
.load-high { color: var(--fg); font-weight: 600; }
tr.row-conflict td { background: rgba(255, 40, 0, .18); }
.pack-list { list-style: none; margin: 0 0 18px; padding: 0; border-top: var(--border-w) solid var(--line); }
.pack-item { display: flex; align-items: center; gap: 8px; border-bottom: var(--border-w) solid var(--line); }
.pack-check { flex: 1; display: flex; align-items: center; gap: 14px; padding: 12px 4px; margin: 0; font-weight: 400; cursor: pointer; min-height: 52px; }
.pack-check input { width: 26px; height: 26px; accent-color: var(--red); flex: 0 0 auto; }
.pack-text { display: grid; }
.pack-check input:checked + .pack-text strong { text-decoration: line-through; color: var(--fg-2); }
input.qty { width: 80px; }

/* Show Builder: circuit split, feeds/phases, stock */
.split-box { border: var(--border-w) solid var(--line); padding: 10px 12px 4px; margin: 0 0 12px; }
.split-box legend { font-weight: 600; padding: 0 6px; }
.split-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.split-cell { display: grid; gap: 4px; margin: 0; font-weight: 400; }
.split-name { font-size: .8rem; font-weight: 600; line-height: 1.2; }
.split-cell input { width: 100%; }
.split-status { margin: 8px 0; }
.split-status.split-over { color: var(--red); font-weight: 600; }
.split-status.split-done { font-weight: 600; }
.phase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 12px; margin-bottom: 10px; }
.phase-head { flex-wrap: wrap; font-size: .9rem; }
.phase-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.phase .small { margin: 4px 0 0; }
.feed-suggest { margin-bottom: 0; }
.stock-tag { display: inline-block; font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; border: 1px solid currentColor; white-space: nowrap; }
.stock-error { background: var(--red); color: var(--black); border-color: var(--red); }
.stock-warn { border-color: var(--red); }
.stock-info { color: var(--fg-2); }
.stock-row { margin-top: 8px; }

/* Printable show sheet: dense, black on white with a little Laser Red */
.sheet { max-width: 1000px; margin: 0 auto; padding: 20px var(--gutter) 40px; font-size: 13px; background: #fff; color: #000; }
.sheet h1 { font-size: 2rem; margin: 0; line-height: 1.1; }
.sheet h2 { font-size: 1.05rem; margin: 26px 0 8px; padding-bottom: 5px; border-bottom: 2px solid #000; display: flex; align-items: baseline; gap: 10px; text-transform: uppercase; letter-spacing: .06em; }
.sheet { counter-reset: sec; }
.sheet h2 .sec-no { color: var(--red); font-variant-numeric: tabular-nums; }
.sheet h2 .sec-no::before { counter-increment: sec; content: counter(sec, decimal-leading-zero); }
.sheet h3 { font-size: .9rem; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; padding: 12px; border: 1px solid #999; }
.sheet-actions .opts { display: flex; flex-wrap: wrap; gap: 6px 14px; width: 100%; font-size: 12px; }
.sheet-actions .opts label { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: 400; }
.sheet-head { display: grid; gap: 14px; padding-bottom: 14px; border-bottom: 5px solid var(--red); }
.sheet-brand { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.sheet-logo { width: 300px; max-width: 60%; height: auto; display: block; }
.sheet-doc { text-align: right; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.sheet-doc strong { display: block; font-size: 14px; color: var(--red); letter-spacing: .14em; }
.sheet-meta { margin: 4px 0 0; font-size: 14px; }
.sheet-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 14px; border: 1px solid #000; }
.sheet-info > div { padding: 6px 8px; border-right: 1px solid #000; border-bottom: 1px solid #000; white-space: pre-wrap; min-height: 42px; }
.sheet-info > div:nth-child(3n) { border-right: 0; }
.sheet-info > div:nth-last-child(-n+3) { border-bottom: 0; }
.sheet-label { display: block; font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #555; white-space: normal; }
.sheet-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 14px; }
.sheet-stats div { border: 1px solid #000; border-top: 4px solid var(--red); padding: 6px 8px; display: grid; }
.sheet-stats strong { font-size: 16px; }
.sheet-stats small { font-size: 10px; color: #555; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-bottom: 4px; }
.sheet-table th, .sheet-table td, .sheet-table tr:last-child td { border: 1px solid #000; padding: 4px 6px; }
.sheet-table th { background: #000; color: #fff; font-size: 10px; letter-spacing: .08em; }
.sheet-table tfoot td { font-weight: 600; background: #f0f0f0; }
.sheet-table .tick { width: 30px; text-align: center; }
.sheet-table .box { display: inline-block; width: 13px; height: 13px; border: 1.5px solid #000; vertical-align: middle; }
.sheet-table td.group-row { background: #f0f0f0; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; border-left: 4px solid var(--red); }
.sheet-bad td { background: #ffe3dc; font-weight: 600; }
.sheet .over { color: var(--red); font-weight: 700; }
.sheet-issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.sheet-issues li { padding: 3px 6px; border-left: 4px solid #999; }
.sheet-issues li.lvl-error { border-left-color: var(--red); }
.sheet-tag { display: inline-block; min-width: 46px; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.lvl-error .sheet-tag { color: var(--red); }
.sheet-small { font-size: 11px; color: #333; }
.sheet-notes { white-space: pre-wrap; border: 1px solid #000; padding: 8px; }
.sheet-pack { columns: 2; column-gap: 24px; list-style: none; margin: 0; padding: 0; }
.sheet-pack li { break-inside: avoid; display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; border-bottom: 1px solid #ccc; }
.sheet-pack .box { flex: 0 0 auto; width: 14px; height: 14px; border: 1.5px solid #000; margin-top: 1px; text-align: center; line-height: 11px; font-size: 11px; }
.sheet-pack .sub { display: block; font-size: 10px; color: #555; }
.sheet-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 10px; }
.sheet-sign div { border-bottom: 1px solid #000; height: 44px; display: flex; align-items: flex-end; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #555; }
.sheet-foot { margin-top: 24px; padding-top: 6px; border-top: 2px solid var(--red); display: flex; justify-content: space-between; font-size: 10px; color: #555; }
.sheet.new-pages .sheet-section + .sheet-section { break-before: page; }
@media (max-width: 700px) {
  .sheet-info { grid-template-columns: 1fr; }
  .sheet-info > div { border-right: 0; border-bottom: 1px solid #000; }
  .sheet-stats { grid-template-columns: repeat(2, 1fr); }
  .sheet-pack { columns: 1; }
  .sheet-table { display: block; overflow-x: auto; }
}
@media print {
  .no-print, .topbar, .page-nav, .offline-strip, .edit-strip { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sheet { padding: 0; max-width: none; }
  .sheet-break { break-before: page; }
  .sheet-table tr, .sheet-issues li { break-inside: avoid; }
  .sheet h2, .sheet h3 { break-after: avoid; }
  .sheet-table thead { display: table-header-group; }
  @page { margin: 12mm 12mm 14mm; @bottom-right { content: "Page " counter(page) " of " counter(pages); font-size: 9px; color: #555; } }
}
/* Offline banner */
.offline-strip { background: var(--fg); color: var(--bg); font-weight: 600; font-size: .9rem; padding: 8px var(--gutter); text-align: center; }

/* Camera barcode scanner */
.scan-dialog { width: min(480px, calc(100vw - 24px)); padding: 0; border: 2px solid var(--line-strong); background: var(--bg); color: var(--fg); }
.scan-dialog::backdrop { background: rgba(0, 0, 0, .8); }
.scan-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: var(--border-w) solid var(--line); }
#scan-reader { width: 100%; min-height: 240px; background: #000; }
#scan-reader video { width: 100% !important; display: block; }
.scan-dialog #scan-status { padding: 10px 12px; margin: 0; }

/* Capacity warning: short and loud. Solid red bar = definite; outlined = possible; neutral = info. */
.cap-alert { display: grid; gap: 2px; padding: 14px 16px; background: var(--red); color: var(--black); border: 2px solid var(--red); } /* black on Laser Red passes WCAG AA */
.cap-alert-title { font-size: 1.05rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.cap-alert-text { font-weight: 600; }
.cap-alert.maybe { background: transparent; color: var(--fg); }
.cap-alert.maybe .cap-alert-title { color: var(--red); }
.cap-alert.info { background: var(--panel-2); color: var(--fg); border-color: var(--line-strong); }
.cap-dialog { max-width: min(360px, calc(100vw - 32px)); padding: 0; border: 3px solid var(--red); background: var(--bg); color: var(--fg); }
.cap-dialog::backdrop { background: rgba(0, 0, 0, .7); }
.cap-dialog form { padding: 20px; display: grid; gap: 12px; }
.cap-dialog p { margin: 0; font-weight: 600; }
.cap-dialog .cap-dialog-title { color: var(--red); font-size: 1.2rem; letter-spacing: .06em; text-transform: uppercase; }
.cc-packs { font-size: 1.3rem; font-weight: 600; margin-top: 6px; }
.cc-range { border-top: var(--border-w) solid var(--line); }
.cc-row { display: grid; grid-template-columns: 90px 1fr; gap: 2px 12px; padding: 10px 0; border-bottom: var(--border-w) solid var(--line); }
.cc-row .label { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2); font-weight: 600; margin: 3px 0 0; }
.cc-amt { font-weight: 600; }
.cc-why { grid-column: 2; }
.cc-load { border-left: 4px solid var(--fg); padding: 8px 12px; font-weight: 600; margin: 0; background: var(--panel-2); }
.converter { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.converter .eq { padding-bottom: 12px; font-weight: 600; color: var(--fg-2); }
.circuit-list { list-style: none; padding: 0; margin: 0; border-top: var(--border-w) solid var(--line); }
.circuit-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: var(--border-w) solid var(--line); }
.circuit-list .qty { width: 72px; min-height: 40px; text-align: center; }
.meter { height: 10px; background: var(--panel-2); position: relative; margin-top: 8px; }
.meter span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--fg); transition: width var(--t) var(--ease); }
.meter.over span { background: var(--red); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat .label { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-2); margin: 0; font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login-wrap { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 130px var(--gutter) 40px; max-width: 440px; margin: 0 auto; }
.login-logo { width: 240px; max-width: 70%; margin: 0 0 40px; }
.login-logo img, .login-tagline img { width: 100%; height: auto; }
.login-tagline { margin-top: 48px; width: 180px; }
.app-name { margin-bottom: 24px; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 8px; align-items: center; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
