:root {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-soft: #141b24;
  --card: #161d27;
  --card-2: #1b2431;
  --line: #253141;
  --text: #e6edf3;
  --muted: #93a1b1;
  --accent: #4c9aff;
  --accent-2: #7c5cff;
  --run: #2f6feb;
  --setup: #d99b1e;
  --fpa: #9b6bff;
  --late: #e5534b;
  --late-soft: rgba(229, 83, 75, 0.16);
  --ok: #3fb950;
  --warn: #d29922;
  --assumed: #d29922;
  --confirmed: #3fb950;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.35);
  /* the ground's own words: text on the accent buttons, the drawer's panel, the inset
     backgrounds, the table hairlines, and the banner inks — everything the light look
     has to retune sits in a variable so the two grounds stay one stylesheet */
  --on-accent: #04121f;
  --panel: #11161d;
  --well: #131a23;
  --grid-line: rgba(37, 49, 65, 0.55);
  --grid-line-faint: rgba(37, 49, 65, 0.45);
  --cell-grid: rgba(255, 255, 255, 0.03);
  --fold-bg: rgba(37, 49, 65, 0.35);
  --banner-ink: #cfe4ff;
  --banner-bad-ink: #ffcdc9;
  --banner-good-ink: #b7f0c1;
}

/* ---- the light look: one toggle, every screen (Braydon, 17 Nov) -------------------
   Same layout, same words, same colours with the same meanings — only the ground
   changes. A shop floor runs bright and wants the light look on its tablets; an
   office runs dim and wants the dark one. The machine's own preference is
   followed until the visitor chooses, and the choice lives in this browser.
   The palette keeps every text pair at WCAG AA or better on its ground. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-2: #eef1f6;
  --line: #d7dde6;
  --text: #101823;
  --muted: #57626f;
  --accent: #0969da;
  --accent-2: #8250df;
  --on-accent: #ffffff;
  --run: #1f6feb;
  --setup: #bf8700;
  --fpa: #8250df;
  --late: #cf222e;
  --late-soft: rgba(207, 34, 46, 0.1);
  --ok: #1a7f37;
  --warn: #9a6700;
  --assumed: #9a6700;
  --confirmed: #1a7f37;
  --panel: #ffffff;
  --well: #e9edf3;
  --grid-line: rgba(16, 24, 35, 0.14);
  --grid-line-faint: rgba(16, 24, 35, 0.1);
  --cell-grid: rgba(16, 24, 35, 0.05);
  --fold-bg: rgba(16, 24, 35, 0.06);
  --banner-ink: #0b4a8f;
  --banner-bad-ink: #8f1f16;
  --banner-good-ink: #0f5c25;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(16, 24, 35, 0.04), 0 8px 24px rgba(16, 24, 35, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 16px; margin: 0; letter-spacing: 0.01em; }
h2 { font-size: 14px; margin: 0; }
h3.mini-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 8px; }

/* ------------------------------- top bar ------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg-soft);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  font-weight: 800; letter-spacing: 0.08em; font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px;
}
.sub { color: var(--muted); font-size: 11.5px; margin: 2px 0 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.pill.warn { color: var(--warn); border-color: rgba(210, 153, 34, 0.4); background: rgba(210, 153, 34, 0.08); }
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
/* The account avatar and its menu (Braydon, 18 Nov): the account sits inside the nav's own box,
   same row, right end — sized to the tabs around it. Everything about the person — identity,
   account, admin, theme, sign out — opens under it. */
.account { position: relative; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--muted); font: inherit; font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.avatar:hover { border-color: var(--accent); color: var(--accent); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 220px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow, 0 8px 24px rgba(0, 0, 0, 0.25)); padding: 6px;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-name { font-size: 13px; font-weight: 600; color: var(--text); }
.menu-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.menu-item {
  display: block; width: 100%; text-align: left; background: transparent; border: 0; color: var(--text);
  font: inherit; font-size: 12.5px; padding: 8px 10px; border-radius: 6px; cursor: pointer;
  text-decoration: none;
}
a.menu-item { color: var(--text); }
.menu-item:hover { background: var(--bg-soft); color: var(--accent); }
.menu-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 10px; font-size: 12.5px; color: var(--text);
}
.tab {
  background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 12px;
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.tab.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

main { padding: 16px 20px 60px; }
.view { display: none; }
.view.active { display: block; }

/* -------------------------------- cards -------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.card-sub { color: var(--muted); font-size: 11.5px; margin: 0; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .two-up { grid-template-columns: 1fr; } }

/* ------------------------------ constraint ----------------------------- */
.constraint { display: grid; grid-template-columns: 1.4fr 2fr; gap: 18px; align-items: center; }
@media (max-width: 1000px) { .constraint { grid-template-columns: 1fr; } }
.constraint h2 { font-size: 15px; margin-bottom: 6px; }
.constraint .statement { font-size: 14.5px; line-height: 1.5; }
.constraint .statement b { color: var(--late); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile { background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tile .k { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.tile .v { font-size: 19px; font-weight: 650; margin-top: 2px; }
.runners { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.runner { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.runner b { color: var(--text); }

/* ---------------------------- reason codes ----------------------------- */
.codes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 1200px) { .codes { grid-template-columns: repeat(3, 1fr); } }
.code {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; cursor: pointer; transition: border-color 0.15s ease;
}
.code:hover { border-color: var(--accent); }
.code.sel { border-color: var(--accent); background: var(--card-2); }
.code .name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--accent); }
.code .count { font-size: 20px; font-weight: 650; margin-top: 3px; }
.code .val { font-size: 11px; color: var(--muted); }
.code .desc { font-size: 10.5px; color: var(--muted); margin-top: 4px; }

/* -------------------------------- tables ------------------------------- */
.table-wrap { overflow: auto; max-height: 640px; border: 1px solid var(--line); border-radius: 8px; }
.table-wrap.short { max-height: 320px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 12px; }
table.grid th {
  position: sticky; top: 0; background: var(--card-2); color: var(--muted); text-align: left;
  font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1;
}
table.grid td { padding: 7px 10px; border-bottom: 1px solid var(--grid-line); vertical-align: top; }
table.grid tr:hover td { background: rgba(76, 154, 255, 0.05); }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
table.grid td.action { color: var(--muted); max-width: 380px; }
table.grid td.late { color: var(--late); font-weight: 600; }
.more {
  margin-top: 10px; background: transparent; border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 11.5px; cursor: pointer;
}

/* --------------------------- chips / labels ---------------------------- */
.chip {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.chip.assumed { color: var(--assumed); border-color: rgba(210, 153, 34, 0.45); background: rgba(210, 153, 34, 0.08); }
.chip.confirmed { color: var(--confirmed); border-color: rgba(63, 185, 80, 0.4); background: rgba(63, 185, 80, 0.07); }
.chip.judgement { color: var(--accent); border-color: rgba(76, 154, 255, 0.4); }
.chip.code { background: rgba(229, 83, 75, 0.12); color: #ff9a94; border-color: rgba(229, 83, 75, 0.35); font-family: ui-monospace, monospace; }
.chip.rate-assumed { color: var(--assumed); border-color: rgba(210, 153, 34, 0.45); }
.assump-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
/* the date under a capture's BY cell — a chip on its own line, never glued to the name */
.who-at { display: block; margin-top: 3px; }
/* the Board's scope sentence, beside the work-centre picker */
.scope-note { color: var(--muted); font-size: 11.5px; }
.topbar .sub.note { color: var(--muted); font-size: 11px; margin-top: 2px; }

/* -------------------------------- board -------------------------------- */
.board-bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.board-bar-left, .board-bar-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.ctl { color: var(--muted); font-size: 11.5px; display: inline-flex; gap: 6px; align-items: center; }
select, input[type="number"] {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 8px; font: inherit; font-size: 12px;
}
.legend { color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.setup { background: var(--setup); }
.sw.fpa { background: var(--fpa); }
.sw.run { background: var(--run); }
.sw.late { background: var(--late); }
.sw.pinned { background: var(--ok); }
.btn {
  background: var(--accent); color: var(--on-accent); border: 0; border-radius: 6px;
  padding: 6px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
.btn:hover { filter: brightness(1.08); }
.banner {
  background: rgba(76, 154, 255, 0.1); border: 1px solid rgba(76, 154, 255, 0.35);
  color: var(--banner-ink); border-radius: 8px; padding: 8px 12px; font-size: 12px; margin-bottom: 10px;
}
.banner.bad { background: rgba(229, 83, 75, 0.1); border-color: rgba(229, 83, 75, 0.35); color: var(--banner-bad-ink); }

.board { border: 1px solid var(--line); border-radius: 10px; overflow: auto; background: var(--card); }
.board-head, .lane {
  display: grid;
  grid-template-columns: 210px repeat(var(--days, 8), minmax(110px, 1fr));
}
.board-head { position: sticky; top: 0; z-index: 12; background: var(--card-2); border-bottom: 1px solid var(--line); }
.board-head .cell { padding: 7px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); border-left: 1px solid var(--grid-line); }
.board-head .cell.lane-head { border-left: 0; }
.group-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(124, 92, 255, 0.09);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); position: sticky; left: 0;
}
.group-head .wc { font-weight: 700; font-size: 12.5px; letter-spacing: 0.02em; }
.group-head .desc { color: var(--muted); font-size: 11.5px; }
.group-head .load { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.badge {
  font-size: 10.5px; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--line); color: var(--muted);
}
.badge.bottleneck { color: var(--late); border-color: rgba(229, 83, 75, 0.5); background: var(--late-soft); font-weight: 600; }
.badge.load-badge { color: var(--text); }
.lane { border-top: 1px solid var(--grid-line); }
.lane-label {
  padding: 6px 8px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--line); background: var(--card); position: sticky; left: 0; z-index: 6;
}
.lane-label .machine { font-size: 12.5px; font-weight: 600; }
.lane-label .meta { font-size: 10.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.lane-label .downbtn {
  background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 4px;
  font-size: 9.5px; padding: 1px 5px; cursor: pointer;
}
.lane.down .lane-label { background: rgba(229, 83, 75, 0.08); }
.lane-cell {
  position: relative; border-left: 1px solid var(--grid-line); min-height: 34px;
  background-image: linear-gradient(to right, var(--cell-grid) 1px, transparent 1px);
  background-size: 25% 100%;
}
.lane-cell.drop-target { background-color: rgba(76, 154, 255, 0.12); }
/* where the dragged run will land, drawn before it does (18 Nov): the run's own shape from the
   drop hour, dashed so it reads as a promise rather than a block */
.drop-ghost {
  position: absolute; top: 3px; bottom: 3px; z-index: 4;
  border: 1px dashed var(--ok); border-radius: 4px;
  background: repeating-linear-gradient(45deg, rgba(105, 204, 133, 0.25), rgba(105, 204, 133, 0.25) 6px, transparent 6px, transparent 12px);
  pointer-events: none;
}
.drop-ghost .cont { position: absolute; right: 1px; top: 0; font-size: 9px; opacity: 0.9; color: var(--ok); }
.block {
  position: absolute; top: 3px; bottom: 3px; border-radius: 4px; overflow: hidden;
  display: flex; font-size: 11px; cursor: grab; border: 1px solid rgba(0, 0, 0, 0.35);
  background: var(--run); color: #eaf2ff;
}
.block.late { background: var(--late); color: #fff; }
.block.pinned { outline: 2px solid var(--ok); outline-offset: -1px; }
.block .seg { height: 100%; }
.block .seg.setup { background: var(--setup); }
.block .seg.fpa { background: var(--fpa); }
.block .seg.run { background: rgba(255, 255, 255, 0.06); }
.block .lbl { position: absolute; inset: 0; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; font-weight: 600; }
.block .cont { position: absolute; right: 1px; top: 0; font-size: 9px; opacity: 0.8; }
.os-block {
  position: absolute; top: 6px; height: 18px; border-radius: 4px; border: 1px dashed rgba(210, 153, 34, 0.7);
  background: rgba(210, 153, 34, 0.12); color: var(--warn); font-size: 10.5px; padding: 1px 4px; overflow: hidden;
}
.board-foot { color: var(--muted); font-size: 11px; margin-top: 8px; }

/* -------------------------------- rules -------------------------------- */
.rule-controls { display: grid; gap: 12px; }
.rule { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--card-2); }
.rule .row1 { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rule .name { font-weight: 600; font-size: 12.5px; }
.rule .src { color: var(--muted); font-size: 10.5px; margin-top: 4px; }
.repair-log { display: grid; gap: 8px; }
.pass { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--card-2); }
.pass.best { border-color: rgba(63, 185, 80, 0.5); }
.pass .n { font-weight: 700; color: var(--muted); font-size: 11px; width: 54px; }
.pass .order { flex: 1; font-size: 12px; }
.pass .num { font-variant-numeric: tabular-nums; font-size: 12px; }
ul.issues { margin: 0; padding-left: 18px; color: var(--muted); font-size: 11.5px; }
ul.issues li { margin-bottom: 3px; }

/* -------------------------------- dialog ------------------------------- */
.dialog {
  position: fixed; inset: 0; background: rgba(3, 8, 15, 0.6); z-index: 90;
  display: flex; align-items: center; justify-content: center;
}
.dialog[hidden] { display: none; }
.dialog-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 16px 18px; width: 520px; max-width: 92vw;
}
.dialog-rows { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.dialog-rows .ctl { flex-direction: column; align-items: flex-start; gap: 4px; }
.dialog-rows select { min-width: 150px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
/* the rationale card: four questions, each with its own head, and never a wall of prose */
.dialog-card.why-card { width: 640px; max-height: 84vh; overflow-y: auto; }
.why-body { margin-top: 10px; }
.why-section { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.why-section:first-of-type { border-top: 0; padding-top: 0; }
.why-line { font-size: 12.5px; color: var(--text); margin: 4px 0; line-height: 1.45; }
.navlink {
  background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 12px;
  padding: 5px 12px; border-radius: 6px; cursor: pointer; text-decoration: none;
}
.navlink:hover { color: var(--text); }
.block { user-select: none; }

/* -------------------------------- toast -------------------------------- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--card-2); color: var(--text); border: 1px solid var(--accent);
  border-radius: 8px; padding: 10px 16px; font-size: 12.5px; z-index: 100; box-shadow: var(--shadow);
}

/* ------------------------------ additions ------------------------------ */
.badge.warn-badge { color: var(--warn); border-color: rgba(210, 153, 34, 0.5); background: rgba(210, 153, 34, 0.1); font-weight: 600; }
.block.offcentre { box-shadow: inset 0 0 0 2px var(--fpa); }
.card.prompt { border-color: rgba(124, 92, 255, 0.45); background: rgba(124, 92, 255, 0.07); }
.card.prompt[hidden] { display: none; }
.banner b { color: var(--text); }

/* ------------------- intake / machines & rules / promise ------------------- */
.atrisk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.atrisk-grid .tile .desc { color: var(--muted); font-size: 10.5px; margin-top: 3px; }
.tile .v.late { color: var(--late); }
.owner-input { width: 160px; }
.capture-sequence { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; min-height: 22px; }
tr.wc-row td { background: rgba(124, 92, 255, 0.06); border-top: 1px solid var(--line); }
tr.press-row td { color: var(--muted); }
tr.press-row td.num, tr.press-row td.mono { color: var(--text); }
tr.press-row td.mono { padding-left: 22px; }
a.floor-link { color: var(--accent); font-size: 10.5px; margin-left: 8px; text-decoration: none; white-space: nowrap; }
a.floor-link:hover { text-decoration: underline; }

/* --------------------------------- floor ---------------------------------- */
body.floor { min-height: 100vh; }
.floor-top {
  display: flex; justify-content: space-between; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--bg-soft);
  position: sticky; top: 0; z-index: 20;
}
.floor-id { display: flex; align-items: center; gap: 12px; }
.floor-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.floor-main { padding: 14px 18px 60px; max-width: 1400px; margin: 0 auto; }
.floor-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.floor-card[hidden] { display: none; }
.floor-card h2 { font-size: 15px; margin-bottom: 6px; }
.floor-job { font-size: 22px; font-weight: 650; margin: 6px 0; }
.floor-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.floor-btn { font-size: 18px; padding: 14px 22px; border-radius: 10px; min-width: 150px; min-height: 56px; }
.floor-q {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.floor-reasons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.floor-reason {
  font-size: 16px; padding: 14px; display: flex; flex-direction: column; gap: 4px;
  align-items: flex-start; text-align: left; min-height: 64px;
}
.floor-reason .code { font-size: 10px; color: var(--muted); font-family: ui-monospace, monospace; }
.floor-note {
  width: 100%; margin-top: 10px; background: var(--card-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit; font-size: 15px;
}
.floor-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0; }
.floor-foot { margin-top: 10px; }
.floor-card .late, .floor-card b.late { color: var(--late); }
.floor-tables .card { margin-bottom: 14px; }
/* the tap sequence: a step the record already holds reads as done, never as a live button */
.floor-btn.step-done { border-color: var(--ok, var(--accent)); opacity: 0.75; }
.floor-btn .tick { font-size: 12px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.floor-btn[disabled] { cursor: not-allowed; }

/* the work-centre board (/floor): every press of a centre, its NOW job, its held hours */
.floor-board { display: flex; flex-direction: column; gap: 16px; }
.wc-group { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.wc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.wc-head .wc { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.wc-head .desc { font-size: 12px; color: var(--muted); }
.press-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.press-card {
  display: block; text-decoration: none; color: var(--text); background: var(--card-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.press-card:hover { border-color: var(--accent); }
.press-card.idle { opacity: 0.65; }
.press-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.press-card-head .press-id { font-size: 14px; font-weight: 700; font-family: ui-monospace, monospace; }
.press-now { font-size: 15px; font-weight: 600; margin: 2px 0; }
.press-card .sub { font-size: 11.5px; color: var(--muted); margin: 2px 0; }
.press-card b.late { color: var(--late); }
.press-held { margin: 8px 0 2px; font-size: 12px; }
.press-door { font-size: 11px; color: var(--accent); }
@media (max-width: 760px) {
  .floor-reasons { grid-template-columns: 1fr 1fr; }
  .floor-kpis { grid-template-columns: 1fr 1fr; }
  .floor-btn { min-width: 110px; font-size: 16px; }
  .atrisk-grid { grid-template-columns: 1fr; }
}

/* ------------------------------- presses ------------------------------- */
/* The Presses screen is a table, not a chart: every figure is a number in a column set in
   tabular figures, and the only colour is a flag somebody must act on (not level, late,
   placeholder rate). Neutral surfaces throughout; no bars, no gradients. */
.statement-card { display: grid; grid-template-columns: 1.35fr 1fr; gap: 22px; }
@media (max-width: 1100px) { .statement-card { grid-template-columns: 1fr; } }
.statement-card .statement { font-size: 13.5px; line-height: 1.5; margin: 6px 0 4px; }
.statement-card .statement b { color: var(--text); }
table.grid.presses td { vertical-align: middle; }
table.grid.presses tr.wc-row { cursor: pointer; }
table.grid.presses tr.wc-row.open td { background: var(--card-2); }
table.grid.presses tr.wc-row.fold td { background: var(--fold-bg); color: var(--text); font-size: 11.5px; text-align: left; }
table.grid.presses tr.wc-detail > td { background: var(--well); padding: 0 0 0 18px; border-bottom: 1px solid var(--line); }
table.subgrid { width: 100%; border-collapse: collapse; font-size: 11.5px; }
table.subgrid th {
  text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.05em; padding: 6px 10px; border-bottom: 1px solid var(--line); font-weight: 600;
}
table.subgrid td { padding: 5px 10px; border-bottom: 1px solid var(--grid-line-faint); }
table.subgrid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.subgrid td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
table.subgrid tr.idle td { color: var(--muted); }
.foot-note { color: var(--muted); font-size: 11px; margin: 8px 10px 10px; max-width: 1100px; }
.history-months { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.history-months:empty { display: none; }
.whatif { display: grid; gap: 6px; }
.whatif-table { display: grid; gap: 4px; }
.whatif-row {
  display: grid; grid-template-columns: 92px 1fr 1fr auto; gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--card-2);
  font-variant-numeric: tabular-nums; font-size: 12px;
}
.whatif-row.current { border-color: rgba(63, 185, 80, 0.5); }
.whatif-row .h { font-weight: 650; }
.whatif-row .num { color: var(--muted); }
.whatif-row .num b { color: var(--text); }
.spare { display: grid; gap: 4px; margin-top: 4px; }
.spare-row {
  display: grid; grid-template-columns: 76px 1fr 150px 130px auto; gap: 10px; align-items: baseline;
  border-bottom: 1px solid var(--grid-line); padding: 4px 0; font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.spare-row .wc { font-weight: 650; }
.spare-row .desc { color: var(--muted); }
.spare-row .num { color: var(--text); text-align: right; }

/* a Today row is a door into the Board: the row is clickable, and the block it lands on is marked */
table.grid tr.line-row { cursor: pointer; }
table.grid tr.line-row:hover td { background: rgba(76, 154, 255, 0.09); }
.block.flash { outline: 3px solid var(--accent); outline-offset: -1px; box-shadow: 0 0 0 3px rgba(76, 154, 255, 0.35); }
/* a block whose cycle time is the placeholder says so at a glance, not only on hover */
.block .tilde {
  position: absolute; top: -1px; right: 2px; font-size: 10px; font-weight: 700;
  color: #ffd479; background: rgba(20, 27, 36, 0.85); border-radius: 3px; padding: 0 2px; pointer-events: none;
}
.sw.assumed { background: #d29922; }
/* a measured rate is not an assumption: the marker is green, like the rest of the app's measured facts */
.sw.measured { background: #3fb950; }
.block .tilde.measured { color: #7ee787; border: 1px solid rgba(63, 185, 80, 0.45); }

/* ---- the parts drawer (UX spec §6): a read, opened from any part id ---- */
.part-id { cursor: pointer; border-bottom: 1px dotted currentColor; }
.part-id:hover { color: var(--accent); border-bottom-color: var(--accent); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw);
  background: var(--panel); border-left: 1px solid var(--line); z-index: 60;
  display: flex; flex-direction: column; box-shadow: -18px 0 40px rgba(0, 0, 0, 0.45);
}
.drawer[hidden] { display: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0 0 4px; font-size: 15px; letter-spacing: 0.01em; }
.drawer-body { padding: 14px 18px 28px; overflow-y: auto; }
.drawer h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 20px 0 8px; }
.drawer .coverage { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; }
.drawer .coverage .bar { flex: 1; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.drawer .coverage .bar i { display: block; height: 100%; background: var(--accent); }
.drawer .coverage .pct { font-size: 12px; font-variant-numeric: tabular-nums; }
.drawer .fact { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.drawer .fact .lbl { font-size: 12px; color: var(--muted); }
.drawer .fact .val { font-size: 13px; }
.drawer .fact .src { grid-column: 1 / -1; font-size: 11px; color: var(--muted); }
.drawer .prov { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 9px; border: 1px solid currentColor; align-self: start; }
.drawer .prov.confirmed { color: var(--ok); }
.drawer .prov.assumed { color: var(--warn); }
.drawer .prov.ours { color: var(--accent); }
.drawer .prov.absent { color: var(--muted); }
.drawer .taught { padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 13px; }
.drawer .taught .meta { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.drawer .ops { width: 100%; border-collapse: collapse; font-size: 12px; }
.drawer .ops th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11px; padding-bottom: 4px; }
.drawer .ops td { padding: 3px 0; font-variant-numeric: tabular-nums; }
.drawer .actions .act { display: block; width: 100%; text-align: left; margin: 6px 0; }
.drawer .empty { color: var(--muted); font-size: 13px; }

/* ---- refresh the demand: the folder, the diff, the button ---- */
.refresh-status { font-size: 13px; margin: 6px 0 10px; }
.refresh-status .dir { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; color: var(--muted); }
.refresh-status .waiting { color: var(--warn); }
.refresh-status .clean { color: var(--ok); }
#refresh-diff .statement { font-size: 13px; margin: 0 0 8px; }
#refresh-diff .buckets { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 10px; font-variant-numeric: tabular-nums; }
#refresh-diff .bucket b { font-size: 18px; display: block; }
#refresh-diff .bucket span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
#refresh-diff .table-wrap { max-height: 220px; }

/* ---- the promise view: a row expansion, three dates, the moves that land it ---- */
.promise-btn { margin-left: 8px; white-space: nowrap; }
tr.promise-row td.promise-cell { background: rgba(88, 166, 255, 0.06); padding: 10px 14px 14px; }
.promise-cell .dates { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.promise-cell .dates b { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); display: block; }
.promise-cell .dates .whatif { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); border: 1px dashed currentColor; border-radius: 9px; padding: 1px 7px; }
.promise-cell i.late { color: var(--late); font-style: normal; }
.promise-cell i.ok { color: var(--ok); font-style: normal; }
.promise-cell .statement { font-size: 13px; margin: 4px 0 10px; }
.promise-cell table.moves { width: 100%; font-size: 12px; }
.promise-cell table.moves th { text-align: left; color: var(--muted); font-weight: 500; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.promise-cell table.moves td { padding: 5px 8px 5px 0; vertical-align: top; }
.promise-cell .basis { font-size: 10px; margin-top: 8px; }

/* "why is this here?" — visible on hover, never in the way */
.block .why-ask {
  position: absolute; top: -1px; left: 2px; width: 11px; height: 11px; line-height: 11px; text-align: center;
  font-size: 9px; font-weight: 700; color: #0d1117; background: #8b949e; border-radius: 50%;
  opacity: 0; transition: opacity 0.12s; cursor: pointer;
}
.block:hover .why-ask { opacity: 0.9; }
.block .why-ask:hover { background: var(--accent); color: #0d1117; }
#why-banner { margin: 0 0 10px; }

/* ---- signing in, the account page, and the admin screen ------------------------
 * Three surfaces share one shape: a single card on the dark ground, the mark at the top, and a
 * form that reads as a form. The admin screen's tables are the same `.grid` the rest of the app
 * uses, so a role change and a floor report are read the same way.
 */
body.login-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px 64px;
}
.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}
.login-card.wide { max-width: 1080px; }
.login-mark {
  margin: 0 0 6px;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 12px;
  color: var(--accent);
}
.login-title { margin: 0 0 6px; font-size: 21px; letter-spacing: -0.01em; }
.login-card .sub { margin: 0 0 16px; }
.login-form { display: grid; gap: 8px; margin: 14px 0 0; }
.login-form label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.login-form input,
.login-form select {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 9px 11px;
  font: inherit;
}
.login-form input:focus,
.login-form select:focus { outline: none; border-color: var(--accent); }
.login-form .btn { margin-top: 8px; justify-self: start; }
.login-form.inline {
  grid-template-columns: auto minmax(120px, 1fr) auto minmax(120px, 1fr) auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.login-users { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.login-users table.grid { width: 100%; font-size: 12px; }
.login-foot { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.login-foot a { color: var(--accent); }
.linkish {
  background: none;
  border: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
}
ul.plain { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: var(--muted); }
ul.plain li b { color: var(--text); font-weight: 600; }
.banner.good { background: rgba(63, 185, 80, 0.1); border-color: rgba(63, 185, 80, 0.35); color: var(--banner-good-ink); }

/* the header's own account controls, and a control the role does not hold */
.pill.gated { opacity: 0.55; }
a.pill, button.pill {
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
a.pill:hover, button.pill:hover { color: var(--text); border-color: var(--accent); }
.btn.gated, .btn:disabled { opacity: 0.5; cursor: not-allowed; }
tr.muted-row td { color: var(--muted); opacity: 0.75; }
#admin-users .role-pick,
#admin-users .role-reason {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 6px;
  font: inherit;
  font-size: 11.5px;
}
#admin-users .role-reason { width: 150px; margin-left: 4px; }
#admin-users .btn { margin-left: 4px; padding: 4px 8px; font-size: 11px; }

/* A7 — the provenance mark: one letter, three kinds, never a colour a reader has to guess */
.prov {
  display: inline-block;
  min-width: 13px;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 13px;
  text-align: center;
  cursor: help;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--muted);
}
.prov.measured { border-color: rgba(84, 199, 140, 0.7); color: #54c78c; }
.prov.derived { border-color: rgba(120, 170, 255, 0.45); color: #78aaff; }
.prov.assumed { border-color: rgba(229, 178, 75, 0.7); color: #e5b24b; }
.provenance-legend { margin: 2px 0 12px; }
.provenance-legend .prov { cursor: default; }

/* B4 — one list at a time: the numbers stay above, the lists are tabs */
.subnav {
  display: flex;
  gap: 6px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}
.subnav .subtab {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.subnav .subtab.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(120, 170, 255, 0.12);
}
.tab-panel[hidden] { display: none; }

/* B5 — a chip is a count and a direction, or a sentence saying why there is no direction */
.chips-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 14px; }
.change-chip {
  flex: 1 1 210px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.02);
}
.change-chip .c { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.change-chip .l { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-top: 1px; }
.change-chip .d { font-size: 11.5px; margin-top: 5px; color: var(--text); }
.change-chip .d.none { color: var(--muted); }

/* C4 — red is load above capacity, and nothing else */
.over-capacity { color: var(--late); }
.capacity-fact { margin-top: 6px; }

/* ---- the Presses chart (Braydon, 16 Nov 28:16): the demand-versus-capacity bars ----
   One bar per work centre; the black line across each track is one week of its own capacity.
   Red runs past the line, green stays under it - the same fact the table's Level column prints. */
#presses-view-tabs { margin-top: 8px; }
.demand-chart { display: grid; gap: 5px; margin: 12px 0 4px; }
.demand-row { display: grid; grid-template-columns: 88px 1fr 52px minmax(230px, auto); align-items: center; gap: 10px; font-size: 12px; }
.demand-row .wc { font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demand-row .track { position: relative; height: 14px; background: var(--card-2); border: 1px solid var(--line); border-radius: 4px; }
.demand-row .track i { position: absolute; top: 0; bottom: 0; left: 0; display: block; border-radius: 3px 0 0 3px; }
.demand-row .track i.over { background: var(--late); }
.demand-row .track i.under { background: var(--ok); }
.demand-row .week-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: 0.65; }
.demand-row .num { text-align: right; white-space: nowrap; }
.demand-row .num.sub { color: var(--muted); font-size: 11px; }

/* ---- B10: a completed operation is the shop's own record, drawn as done ---- */
.block.completed { border-style: dashed; opacity: 0.75; }
.block.completed .seg.run { background: var(--muted); }
.block .chip.done { position: absolute; top: -9px; right: 2px; font-size: 9px; padding: 0 4px; background: var(--ok); color: #0d1117; border-radius: 6px; white-space: nowrap; }

/* ---- the light look, the last mile: inks that must change on a white ground -------
   These stay as small scoped overrides instead of variables because each is one
   class's own ink, not a word the whole ground uses. */
:root[data-theme="light"] .chip.code { color: #a0231c; }
:root[data-theme="light"] .drawer .fact,
:root[data-theme="light"] .drawer .taught { border-bottom-color: rgba(16, 24, 35, 0.1); }
:root[data-theme="light"] .drawer .coverage .bar { background: rgba(16, 24, 35, 0.1); }
:root[data-theme="light"] .prov { border-color: rgba(16, 24, 35, 0.25); }
:root[data-theme="light"] .prov.measured { color: #1a7f37; border-color: rgba(26, 127, 55, 0.7); }
:root[data-theme="light"] .prov.derived { color: #0550ae; border-color: rgba(5, 80, 174, 0.5); }
:root[data-theme="light"] .prov.assumed { color: #9a6700; border-color: rgba(154, 103, 0, 0.7); }
:root[data-theme="light"] .subnav .subtab { border-color: rgba(16, 24, 35, 0.18); }
:root[data-theme="light"] .change-chip { border-color: rgba(16, 24, 35, 0.12); background: rgba(16, 24, 35, 0.02); }
:root[data-theme="light"] .block .chip.done { color: #ffffff; }

/* the theme toggle on the single-card pages (sign in, account, admin): a fixed pill
   in the corner, the same pill every header carries */
.theme-corner { position: fixed; top: 14px; right: 16px; z-index: 50; }

/* ---- the print one-pager (Braydon, 17 Nov: "let me know when it's all deployed") ---------
   What a printed board is for: a one-pager somebody can hold in the Monday meeting or
   get in an email - the constraint sentence, the board as drawn, the footer that says
   which version and which day. The light ground is forced (ink on paper), the interactive
   chrome (tabs, pills, controls, this toggle) is dropped, and the board opens to its full
   width instead of scrolling. Landscape, one page, whatever view is active. */
@media print {
  :root,
  :root[data-theme="dark"] {
    color-scheme: light;
    --bg: #ffffff;
    --bg-soft: #ffffff;
    --card: #ffffff;
    --card-2: #f2f4f8;
    --line: #99a3b0;
    --text: #000000;
    --muted: #424d59;
    --panel: #ffffff;
    --well: #f2f4f8;
    --grid-line: rgba(16, 24, 35, 0.35);
    --grid-line-faint: rgba(16, 24, 35, 0.25);
    --banner-ink: #0b4a8f;
    --banner-bad-ink: #8f1f16;
    --banner-good-ink: #0f5c25;
    --shadow: none;
  }
  @page { size: landscape; margin: 10mm; }
  body { background: #ffffff; font-size: 11px; }
  .topbar, .topbar-right, .tabs, .subnav, .board-bar, .board-bar-left, .board-bar-right,
  .toast, .drawer, .dialog, .theme-corner, .pill, .btn, select, input, .more,
  .downbtn, .why-ask, .floor-actions, .account, .avatar, .menu { display: none !important; }
  main { padding: 0; }
  .view { display: none !important; }
  .view.active { display: block !important; }
  .board, .table-wrap { overflow: visible !important; max-height: none !important; }
  .board { border: 1px solid var(--line); }
  .block, .os-block { break-inside: avoid; }
  .card, .floor-card { box-shadow: none; break-inside: avoid; }
  .lane-cell { background-image: none; }
  .block .lbl { white-space: normal; }
}
