/* =========================================================
   Four Anjels Production Board
   Custom CSS — no framework. System fonts. Lightweight.
   ========================================================= */

:root {
  --brand-charcoal: #3a3a42;
  --brand-charcoal-dark: #1a1a2e;
  --brand-blue: #7AA9D0;            /* halo accent */
  --brand-blue-deep: #4A90D9;       /* deeper accent */
  --brand-blue-tint: #e8f4fd;       /* GF swim lane */
  --brand-cream: #fdfaf5;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e5ea;
  --border-strong: #cdd1d8;
  --text: #1f2433;
  --text-muted: #6b7280;
  --text-soft: #94a0b1;

  --rag-green: #28a745;
  --rag-amber: #ffc107;
  --rag-red:   #dc3545;
  --rag-grey:  #6c757d;

  --rag-green-tint: #e8f8ee;
  --rag-amber-tint: #fff7df;
  --rag-red-tint:   #fde7e9;
  --rag-grey-tint:  #eef0f3;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.18);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Brush Script MT", "Lucida Handwriting", "Apple Chancery", cursive;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-blue-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
.muted { color: var(--text-muted); font-size: 0.875rem; }

/* ---------- Staging banner ---------- */
.env-banner {
  background: linear-gradient(90deg, #ff8b1f, #ff6a00);
  color: #fff;
  text-align: center;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 6px 12px;
  font-size: 12px;
  text-transform: uppercase;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 8px rgba(255, 106, 0, .35);
}
.env-banner__icon { margin-right: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: 200px 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 4px 18px 4px 0;
  background: linear-gradient(135deg, #1a1a2e 0%, #232442 100%);
  color: #f5f5f7;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 14px rgba(0,0,0,0.18);
  min-height: 96px;
}
.body--board .env-banner ~ .topbar { top: 30px; }

.topbar__brand {
  display: flex; align-items: center; justify-content: center;
  padding: 0 14px;
  min-width: 0;
  align-self: stretch;
}
.brand { display: flex; align-items: center; gap: .5rem; max-width: 100%; }
.brand__logo {
  display: block;
  height: 42px;
  width: auto;
  object-fit: contain;
}
.brand__logo--large { height: 140px; }
.brand__logo--hero { height: 86px; max-width: 180px; }
.brand__logo--icon { height: 28px; }
.topbar .brand__logo { filter: drop-shadow(0 1px 6px rgba(122, 169, 208, .35)); }
.brand__tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-blue);
  font-weight: 600;
  opacity: .85;
}

.topbar__equipment {
  position: relative;
  display: flex; align-items: center;
  min-width: 0;
}

/* Batch F-0: collapsed summary indicator. Replaces the old inline pill row
   because Julie's full kit (44 items) won't fit on any topbar — clicking
   the summary opens .eq-panel with the full grouped list. */
.eq-summary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  color: #e6e9f0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.eq-summary:hover { background: rgba(255,255,255,.14); }
.eq-summary[aria-expanded="true"] { background: rgba(255,255,255,.14); }
.eq-summary__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--rag-green);
  box-shadow: 0 0 0 2px rgba(40,167,69,.3);
  transition: background .15s, box-shadow .15s;
}
.eq-summary__dot[data-status="limited"] { background: var(--rag-amber); box-shadow: 0 0 0 2px rgba(255,193,7,.35); }
.eq-summary__dot[data-status="down"]    { background: var(--rag-red);   box-shadow: 0 0 0 2px rgba(220,53,69,.4); }
.eq-summary__label  { color: #e6e9f0; opacity: .85; }
.eq-summary__counts { color: #cdd3df; }
.eq-summary__counts[data-severity="limited"] { color: #ffd97a; }
.eq-summary__counts[data-severity="down"]    { color: #ffb3bb; font-weight: 600; }
.eq-summary__chev { color: #98a3b8; font-size: 11px; }

/* Expanded panel — categorised list of all equipment */
.eq-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 250;
  min-width: 360px; max-width: min(640px, calc(100vw - 24px));
  max-height: 70vh; overflow-y: auto;
  background: #1f2238;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px 14px;
}
.eq-panel[hidden] { display: none; }
.eq-group { min-width: 0; }
.eq-group__title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #98a3b8;
  display: flex; align-items: center; gap: 6px;
}
.eq-group__count {
  display: inline-block;
  padding: 1px 7px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  font-size: 10px;
  color: #cdd3df;
}
.eq-group__pills {
  display: flex; flex-wrap: wrap; gap: 5px;
}

.eq-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  font-size: 12px;
  color: #e6e9f0;
  cursor: pointer;
  transition: background .15s, transform .15s;
  white-space: nowrap;
}
.eq-pill:hover { background: rgba(255,255,255,.14); }
.eq-pill__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--rag-green);
  box-shadow: 0 0 0 2px rgba(40,167,69,.25);
}
.eq-pill[data-status="limited"] .eq-pill__dot { background: var(--rag-amber); box-shadow: 0 0 0 2px rgba(255,193,7,.3); }
.eq-pill[data-status="down"] .eq-pill__dot   { background: var(--rag-red);   box-shadow: 0 0 0 2px rgba(220,53,69,.35); }
.eq-pill[data-status="down"] {
  background: rgba(220,53,69,.18);
  border-color: rgba(220,53,69,.4);
  color: #ffd5da;
}
.eq-pill[data-status="limited"] {
  background: rgba(255,193,7,.10);
  border-color: rgba(255,193,7,.30);
}

.topbar__meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.3; }
.topbar__meta .brand__tag { order: -1; margin-bottom: 2px; }
.clock {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: #d6dbe5;
  font-weight: 500;
}
.update-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: #98a3b8;
}
.update-indicator .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rag-green);
  box-shadow: 0 0 8px rgba(40,167,69,.6);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* 2026-05-01 — TV-mode "Last update" indicator. Hidden everywhere except
   ?display=tv. Shown alongside the live clock + update dot in the topbar. */
.last-update {
  font-size: 11px;
  color: #98a3b8;
  display: none;
}
.body--board-tv .last-update {
  display: inline-block;
  font-size: 13px;
}

.topbar__actions { display: flex; align-items: center; gap: .5rem; }

/* ---------- User menu ---------- */
.usermenu { position: relative; }
.usermenu__button {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #fff;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  font-size: 13px;
  transition: background .15s;
}
.usermenu__button:hover { background: rgba(255,255,255,.13); }
.usermenu__avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--brand-blue);
  color: var(--brand-charcoal-dark);
  font-weight: 700;
  font-size: 12px;
}
.usermenu__chev { font-size: 10px; opacity: .7; }
.usermenu__dropdown {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  min-width: 220px;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 50;
}
.usermenu__dropdown[hidden] { display: none; }
.usermenu__dropdown a {
  display: block;
  padding: 8px 14px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.usermenu__dropdown a:hover { background: var(--surface-2); text-decoration: none; }
.usermenu__dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.usermenu__info {
  padding: 10px 14px 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.usermenu__role { font-size: 11px; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  transition: background .15s, border-color .15s, transform .05s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
  background: var(--brand-blue-deep);
  color: #fff;
  border-color: var(--brand-blue-deep);
  box-shadow: 0 1px 3px rgba(74, 144, 217, .35);
}
.btn--primary:hover { background: #3779be; border-color: #3779be; }
.btn--ghost {
  background: transparent;
  color: rgba(255,255,255,.85);
  border-color: rgba(255,255,255,.18);
}
.btn--ghost:hover { background: rgba(255,255,255,.08); color: #fff; }
.btn--danger { background: var(--rag-red); color: #fff; border-color: var(--rag-red); }
.btn--danger:hover { background: #b22633; border-color: #b22633; }
.btn--block { width: 100%; }
.btn--big { padding: 14px 18px; font-size: 15px; min-height: 56px; }
.btn--lg  { padding: 12px 18px; font-size: 14px; min-height: 48px; }

/* ---------- Login ---------- */
.body--login {
  background: linear-gradient(135deg, #1a1a2e 0%, #232442 60%, #2d3155 100%);
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.body--login::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(900px 600px at 20% 0%, rgba(122, 169, 208, .15), transparent 60%),
    radial-gradient(700px 500px at 90% 100%, rgba(122, 169, 208, .12), transparent 60%);
  pointer-events: none;
}
.login-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 30px 60px rgba(0,0,0,.35);
  position: relative;
  z-index: 1;
}
.login-card__brand { text-align: center; margin-bottom: 24px; }
.login-card__brand .brand__logo { margin: 0 auto; height: 110px; }
.login-card__tag {
  margin: 8px 0 0;
  color: var(--text-muted);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
}
.login-form { display: grid; gap: 16px; margin-top: 8px; }
.login-card__intro {
  margin: 4px 0 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.login-card__hint {
  margin-top: 18px; padding: 12px 14px;
  background: var(--brand-blue-tint);
  border-radius: var(--radius-md);
  font-size: 12px; color: var(--text-muted);
  border-left: 3px solid var(--brand-blue);
}
.login-footer {
  text-align: center; padding: 18px;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  z-index: 1;
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-size: 12px; color: var(--text-muted);
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.field input, .field select, .field textarea {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-size: 14px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-blue-deep);
  box-shadow: 0 0 0 3px rgba(74,144,217,.18);
}
.field textarea { resize: vertical; min-height: 90px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.alert {
  padding: 10px 14px; border-radius: var(--radius-md);
  font-size: 13px; margin-bottom: 10px;
}
.alert--error { background: var(--rag-red-tint); color: #76151c; border-left: 3px solid var(--rag-red); }
.alert--info  { background: var(--brand-blue-tint); color: #19476b; border-left: 3px solid var(--brand-blue-deep); }
.alert--ok    { background: var(--rag-green-tint); color: #10522a; border-left: 3px solid var(--rag-green); }

/* ---------- Board ---------- */
.body--board { background: var(--bg); }
.board-root { padding: 0; }
.board-grid {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
}

/* Stage column header */
.board-table {
  display: grid;
  background: #fff;
  position: relative;
  overflow: auto;
  /* grid-template-columns set inline via JS based on stage count */
}
.board-cell { padding: 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); min-height: 70px; }
.board-cell--header {
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, #f1f3f7, #e6eaf2);
  /* 2026-05-01 — Task 6: bumped from 12px → 18px (~50% larger) for
     wall-mounted-TV legibility. TV-mode override below pushes further.
     "Mixing/Deposit" is the only stage name that overflows the column
     at 18px; we let it break after the slash via the explicit zero-width
     space the JS injects (see makeStageHeaderHTML in board.js).
     overflow-wrap stays at the default ('normal') so single-word stages
     like WEIGHED don't break mid-letter. line-height tight enough that
     the 2-line Mixing/Deposit doesn't blow out row height. */
  font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: .07em;
  line-height: 1.1;
  color: var(--text);
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-strong);
  text-align: center;
}
.board-cell--lane-label {
  position: sticky; left: 0; z-index: 6;
  background: var(--surface-2);
  border-right: 2px solid var(--border-strong);
  display: flex; flex-direction: column; justify-content: center;
  padding: 14px 16px;
  font-weight: 700; font-size: 14px;
  color: var(--text);
}
.board-cell--lane-label.is-allergen {
  background: var(--brand-blue-tint);
  border-left: 4px solid var(--brand-blue-deep);
}
.lane-label__sub {
  font-size: 11px; color: var(--text-muted); font-weight: 500;
  text-transform: uppercase; letter-spacing: .06em;
  margin-top: 2px;
}
.board-cell--header.is-final { background: linear-gradient(180deg, #e8e9ec, #d8dae0); }

/* Batch F-1: pre-production "To Be Weighed" column. Visually lighter and
   marked with a dashed top border to signal "not yet started". The cards
   in this cell render normally but their clocks are suppressed by board.js. */
.board-cell.is-pre-production,
.lane-cell.is-pre-production {
  background: repeating-linear-gradient(45deg, #fafbfd 0 8px, #f3f5f9 8px 16px) !important;
  border-top: 2px dashed #c8cdd6 !important;
}
.board-cell--header.is-pre-production {
  background: linear-gradient(180deg, #f4f5f8, #e6e8ee);
  color: #3a3f4a;
  font-style: italic;
  border-top: 2px dashed #a8aebb;
}
.is-pre-production .card { opacity: .95; }
.is-pre-production .card .card__slack { display: none; }
.is-pre-production .card .card__elapsed { display: none; }
.is-pre-production .card .card__meta .js-card-time { display: none; }

/* Product description line (e.g. "ALMOND DATE BAR" beneath the SG
   parent code). Originally TBW-only; now visible across all stages —
   the SG parent code is equally opaque mid-production as in TBW. */
.card__product-desc {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: -2px 0 4px;
}

/* Boxes per batch — small grey line under the qty count, e.g. "× 144 boxes".
   Hidden when boxes_per_batch is null (renders only when SG trays_per_batch
   AND product trays_per_box are both available). */
.card__boxes {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

/* F-1 follow-up (b): scheduled-date line. Hidden by default — only
   visible inside the To Be Weighed pre-production cell where it's the
   single most important fact for an operator planning the week. */
.card__sched-date { display: none; }
.is-pre-production .card .card__sched-date {
  display: block;
  margin: 4px 0 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1a1a2e;
  background: #eef1f7;
  border-radius: 6px;
  text-align: center;
  letter-spacing: .02em;
}

/* TBW date subgroup (the collapsible <details>). One per scheduled date,
   inside each lane × stage cell. Default-open dates are this week + next
   week (≤14d); further-out dates render collapsed for visual density. */
.tbw-group {
  margin-bottom: 6px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e3e6ec;
}
.tbw-group__summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #3a3f4a;
  list-style: none;          /* hide default disclosure triangle */
  user-select: none;
  border-radius: 6px;
}
.tbw-group__summary::-webkit-details-marker { display: none; }
.tbw-group__summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  color: #6b7280;
  transition: transform .12s;
}
.tbw-group[open] > .tbw-group__summary::before { transform: rotate(90deg); }
.tbw-group__date  { flex: 1; }
.tbw-group__count {
  font-weight: 600; font-size: 11px;
  color: #6b7280;
  background: #f1f3f8;
  padding: 1px 8px;
  border-radius: 999px;
}
/* Today / tomorrow / overdue accents on the date headline */
.tbw-group__summary.is-today    { color: #0f6e2c; background: #e7f3eb; }
.tbw-group__summary.is-today .tbw-group__count    { background: #d3eedc; color: #0f6e2c; }
.tbw-group__summary.is-tomorrow { color: #8a6500; background: #fff5d4; }
.tbw-group__summary.is-tomorrow .tbw-group__count { background: #ffe9a6; color: #8a6500; }
.tbw-group__summary.is-overdue  { color: #b91c1c; background: #fce7e7; }
.tbw-group__summary.is-overdue .tbw-group__count  { background: #f8ccd1; color: #8a1a26; }
.tbw-group__cards {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 2026-05-01 — Task 5: tablet (768-1024px) tap target ≥44×44px on TBW
   date pills. Desktop visual stays compact. We grow the pill itself
   only on tablet — explicit per the spec ("tablet UI gets fingers-friendly"). */
@media (min-width: 768px) and (max-width: 1024px) {
  .tbw-group__summary {
    min-height: 44px;
    padding: 12px 14px;
    font-size: 13px;
  }
}

.board-cell--corner {
  background: linear-gradient(135deg, #1a1a2e 0%, #232442 100%);
  border-right: 2px solid rgba(255,255,255,0.1);
  border-bottom: 2px solid var(--border-strong);
}

.lane-row.is-allergen .board-cell:not(.board-cell--lane-label) { background: var(--brand-blue-tint); }
.lane-row .board-cell { background: #fff; transition: background .15s; }
.lane-row .board-cell.is-final { background: #f6f7f9; }
.lane-row.is-allergen .board-cell.is-final { background: #dde9f3; }

.board-cell.drop-target {
  background: rgba(74,144,217,0.18) !important;
  outline: 2px dashed var(--brand-blue-deep);
  outline-offset: -4px;
}

/* SortableJS states */
.sortable-ghost {
  opacity: 0.35 !important;
  background: var(--brand-blue-tint) !important;
  border-left-color: var(--brand-blue-deep) !important;
}
.sortable-chosen {
  box-shadow: 0 0 0 2px var(--brand-blue-deep), var(--shadow-md) !important;
}
.sortable-drag {
  cursor: grabbing;
  transform: rotate(1deg);
  box-shadow: var(--shadow-lg) !important;
}
.card.is-landed {
  animation: kanban-flash 1.5s ease-out;
}
@keyframes kanban-flash {
  0%   { background: #fff7df; box-shadow: 0 0 20px rgba(245,158,11,0.55); transform: scale(1.03); }
  40%  { background: #fffbe8; box-shadow: 0 0 10px rgba(245,158,11,0.25); transform: scale(1.01); }
  100% { background: inherit;  box-shadow: var(--shadow-sm); transform: scale(1); }
}
/* Cards are grab-cursored when the board is editable (SortableJS handles drag) */
.board-root[data-role="admin"] .card:not(.is-final),
.board-root[data-role="edit"] .card:not(.is-final) { cursor: grab; }
.board-root[data-role="admin"] .card:not(.is-final):active,
.board-root[data-role="edit"] .card:not(.is-final):active { cursor: grabbing; }

/* ---------- Card ---------- */
.card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 4px solid var(--rag-grey);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
  transition: transform .15s, box-shadow .2s, border-color .15s;
  position: relative;
  /* Defensive: keep every child within the card's boundary. Rounded corners
     must clip the tag strip + individual pills on both sides, and long text
     can never push past the card's right edge. */
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.card.is-rag-green { border-left-color: var(--rag-green); }
.card.is-rag-amber { border-left-color: var(--rag-amber); background: #fffdf6; }
.card.is-rag-red {
  border-left-color: var(--rag-red);
  background: var(--rag-red-tint);
}
.card.is-rag-grey { border-left-color: var(--rag-grey); }
/* 2026-05-01: dwell-red shares the same visual as rag-red at MVP but is a
   conceptually distinct alert (elapsed in stage > stages.red_threshold_minutes,
   independent of expected_duration_minutes). Declared AFTER the rag rules so
   it wins the cascade when a card has both is-dwell-red and one of the
   rag classes (e.g. is-rag-grey when expected is null). Split the visual
   later if Julie reports confusion — see CLAUDE.md. */
.card.is-dwell-red {
  border-left-color: var(--rag-red);
  background: var(--rag-red-tint);
}
.card.is-final { opacity: .55; background: #f7f8fa; }
.card.is-final:hover { opacity: .85; }
.card.is-active { outline: 3px solid rgba(74,144,217,.55); outline-offset: 1px; }

.card__title {
  font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 2px;
  display: flex; justify-content: space-between; gap: 6px;
}
.card__code {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
  margin-bottom: 6px;
}
.card__meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.card__meta strong { color: var(--text); }
.card.is-rag-red .card__meta strong,
.card.is-dwell-red .card__meta strong { color: #8a1a26; }
.card__icons {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 4px; font-size: 11px;
}
.card__icon {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-blue-tint); color: var(--brand-blue-deep);
  border-radius: 999px; padding: 2px 6px; font-weight: 600; gap: 2px;
}
.card__icon--issue { background: var(--rag-red-tint); color: #8a1a26; }

/* Action bar */
.card-action-bar {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed var(--border-strong);
  display: grid; gap: 6px;
}
/* Buttons in the action bar must scale to whatever the column width allows.
   Override the default .btn nowrap and fixed sizing so labels wrap in narrow cards. */
.card-action-bar .btn {
  width: 100%;
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  line-height: 1.2;
  padding: 8px 10px;
  font-size: 13px;
  min-height: 40px;
  text-align: center;
}
.card-action-bar .btn--big {
  padding: 12px 10px;
  font-size: 14px;
  font-weight: 700;
  min-height: 52px;
}
/* On a narrow grid (≤ ~155px columns), tighten further */
@media (max-width: 1500px) {
  .card-action-bar .btn--big { font-size: 13px; min-height: 46px; padding: 10px 8px; }
  .card-action-bar .btn       { font-size: 12px; min-height: 36px; padding: 7px 6px; }
}
/* Override ghost styling inside cards — topbar ghost is white-on-dark,
   but cards need dark-on-light readable text. */
.card-action-bar .btn--ghost {
  background: var(--surface-2);
  color: var(--brand-charcoal-dark);
  border-color: var(--border-strong);
  font-weight: 600;
}
.card-action-bar .btn--ghost:hover {
  background: var(--brand-blue-tint);
  color: var(--brand-blue-deep);
  border-color: var(--brand-blue-deep);
}
/* Red/amber cards get a light ghost button that stays readable */
.card.is-rag-red .card-action-bar .btn--ghost,
.card.is-dwell-red .card-action-bar .btn--ghost,
.card.is-rag-amber .card-action-bar .btn--ghost {
  background: #fff;
  color: var(--brand-charcoal-dark);
}

/* Empty cell */
.cell-empty {
  height: 100%; min-height: 60px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-soft); font-size: 11px;
  opacity: 0;
  transition: opacity .15s;
}
.board-cell:hover .cell-empty { opacity: .5; }

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 300;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal__overlay {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.modal__panel {
  position: relative;
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: rise .25s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.modal__panel--small  { max-width: 440px; }
.modal__panel--medium { max-width: 560px; }
.modal__panel--large  { max-width: 880px; }
.modal__header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.modal__close {
  background: transparent; border: 0; font-size: 22px; line-height: 1;
  color: var(--text-muted); padding: 4px 10px;
  border-radius: var(--radius-sm);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--surface-2);
}
.modal__panel form.modal__body .modal__footer {
  margin: 18px -20px -18px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(20px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Detail timeline ---------- */
.timeline {
  display: grid;
  gap: 0;
  margin: 14px 0;
}
.timeline__row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto auto;
  gap: 10px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.timeline__row:last-child { border-bottom: 0; }
.timeline__dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--border-strong);
  margin: 0 auto;
  position: relative;
}
.timeline__row.is-done .timeline__dot { background: var(--rag-green); border-color: var(--rag-green); }
.timeline__row.is-current .timeline__dot {
  background: var(--brand-blue-deep); border-color: var(--brand-blue-deep);
  box-shadow: 0 0 0 4px rgba(74,144,217,.2);
}
.timeline__row.is-pending .timeline__dot { background: #fff; border-color: var(--border-strong); }
.timeline__stage { font-weight: 600; }
.timeline__time { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }
.timeline__actual { color: var(--text); font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; font-weight: 600; }
.timeline__row.is-pending .timeline__actual { color: var(--text-soft); }
.timeline__status { font-size: 12px; min-width: 130px; text-align: right; }
.timeline__status.early { color: var(--rag-green); }
.timeline__status.late  { color: var(--rag-red); }
.timeline__status.now   { color: var(--brand-blue-deep); font-weight: 600; }

.note-list { display: grid; gap: 10px; margin-top: 14px; }
.note {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  border-left: 3px solid var(--border-strong);
}
.note.is-issue { background: var(--rag-red-tint); border-left-color: var(--rag-red); }
.note__meta {
  display: flex; gap: 8px; font-size: 11px; color: var(--text-muted);
  margin-bottom: 4px; align-items: center;
}
.note__meta .stage-pill {
  background: #fff; border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 1px 8px; font-weight: 600;
  color: var(--text);
}

/* ---------- Detail header ---------- */
.detail-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.summary-tile {
  background: var(--surface-2); border-radius: var(--radius-md);
  padding: 10px 12px; border: 1px solid var(--border);
}
.summary-tile strong { display: block; font-size: 16px; }
.summary-tile span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }

/* Section heading inside modal */
.section-heading {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); font-weight: 700;
  margin: 18px 0 8px;
}

/* ---------- Handover ---------- */
.handover-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 10px; margin: 14px 0;
}
.handover-stats > div {
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 10px;
  text-align: center;
  border: 1px solid var(--border);
}
.handover-stats strong { display: block; font-size: 22px; font-weight: 700; }
.handover-stats span { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.handover-stats .rag-red    { border-left: 4px solid var(--rag-red); }
.handover-stats .rag-amber  { border-left: 4px solid var(--rag-amber); }
.handover-stats .rag-green  { border-left: 4px solid var(--rag-green); }
.handover-note {
  background: var(--brand-blue-tint);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 13.5px;
  border-left: 3px solid var(--brand-blue-deep);
  white-space: pre-wrap;
}
.handover-snapshot { margin-bottom: 12px; }
.handover-list-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.handover-list-table th, .handover-list-table td {
  padding: 6px 10px; text-align: left; border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.handover-list-table th { font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Toasts ---------- */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: grid; gap: 10px; z-index: 400;
}
.toast {
  background: var(--brand-charcoal-dark);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: slideIn .25s ease;
  max-width: 300px;
}
.toast.is-ok    { border-left: 3px solid var(--rag-green); }
.toast.is-error { border-left: 3px solid var(--rag-red); }
@keyframes slideIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; } }

/* ---------- Equipment popover (status change) ---------- */
.eq-popover {
  position: fixed;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-lg);
  width: 280px;
  z-index: 500;
  border: 1px solid var(--border);
  animation: rise .18s ease-out;
}
.eq-popover h4 { margin: 0 0 8px; font-size: 14px; }
.eq-popover .status-options {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin: 6px 0 10px;
}
.eq-popover .status-options button {
  padding: 10px 6px; border-radius: var(--radius-md); border: 2px solid var(--border);
  background: #fff; font-size: 13px; font-weight: 700; cursor: pointer;
  transition: transform .06s, box-shadow .15s, border-color .15s, background .15s;
  letter-spacing: .02em;
}
.eq-popover .status-options button:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.eq-popover .status-options button:active { transform: translateY(0); }

/* Colour-coded status options — each button previews the state it applies */
.eq-popover .eq-opt--ok      { color: #1e7a35; border-color: var(--rag-green-tint); background: var(--rag-green-tint); }
.eq-popover .eq-opt--limited { color: #8a6500; border-color: var(--rag-amber-tint); background: var(--rag-amber-tint); }
.eq-popover .eq-opt--down    { color: #8a1a26; border-color: var(--rag-red-tint);   background: var(--rag-red-tint); }
.eq-popover .eq-opt--ok:hover      { background: #c9ecd3; }
.eq-popover .eq-opt--limited:hover { background: #ffe9a6; }
.eq-popover .eq-opt--down:hover    { background: #f8ccd1; }

/* Current-status indicator — the active button has a stronger border */
.eq-popover .eq-opt[data-active="true"] { box-shadow: inset 0 0 0 2px currentColor; }

.eq-popover textarea { width: 100%; resize: vertical; }
.eq-popover .actions { display: flex; gap: 6px; margin-top: 4px; }
.eq-popover .btn--block { width: 100%; }

/* ---------- Laptop (~14"/15" class) ----------
   Equipment pills wrap to a second row so the brand, clock, and actions
   stay on one line. Kicks in well before the brand/meta/actions can
   crush the 1fr equipment column on a 1440px display. */
@media (max-width: 1600px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 8px; padding: 10px 12px; }
  /* Equipment summary is now a single button, so it stays inline on the
     middle row instead of dropping to a second row. */
  .topbar__equipment { justify-self: start; }
  .brand__logo { height: 36px; }
}

/* ---------- Narrow laptop / small tablet ----------
   The board-only actions (filter, sort, priority, handover, new trial)
   collapse into a kebab menu. Dashboard link + user menu stay visible. */
.topbar__kebab {
  display: none;
  background: rgba(255,255,255,.08);
  color: #f5f5f7;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  padding: 8px 12px;
  cursor: pointer;
}
.topbar__kebab:hover { background: rgba(255,255,255,.16); }
.topbar__board-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 1000px) {
  .topbar__kebab { display: inline-flex; align-items: center; justify-content: center; }
  .topbar__board-actions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 12px;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    padding: 10px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 220px;
    z-index: 200;
  }
  .topbar__board-actions.is-open { display: flex; }
  .topbar__board-actions .trial-filter,
  .topbar__board-actions .sort-toggle,
  .topbar__board-actions .tbw-range-filter,
  .topbar__board-actions .btn { width: 100%; }
  .topbar__board-actions .new-trial-group { align-items: stretch; gap: 4px; }
  .topbar__actions { position: relative; }
}

/* ---------- Phone ---------- */
@media (max-width: 768px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .topbar__meta { display: none; }
  .brand__tag { display: none; }
  /* Phone: hide the verbose count text, keep the dot + label only.
     Tap target stays usable; expanded panel opens full-width via the
     eq-panel max-width rule. */
  .eq-summary__counts { display: none; }
  .eq-panel { left: 0; right: 0; min-width: 0; max-width: none; }

  /* Phone board: tabs + vertical list per stage */
  .board-table { display: block; }
  .lane-tabs {
    display: flex; gap: 0; background: #fff; padding: 0; overflow-x: auto;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
  }
  .lane-tabs button {
    padding: 12px 16px; background: transparent; border: 0; border-bottom: 3px solid transparent;
    font-weight: 600; color: var(--text-muted); white-space: nowrap;
  }
  .lane-tabs button[aria-selected="true"] { color: var(--brand-blue-deep); border-bottom-color: var(--brand-blue-deep); }

  .stage-block {
    background: #fff; padding: 12px 12px; margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }
  .stage-block__head {
    font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    font-size: 12px; color: var(--text); margin-bottom: 8px; display: flex; justify-content: space-between;
  }
  .stage-block__count { color: var(--text-muted); font-weight: 500; font-size: 11px; }
  .stage-block:empty { display: none; }
  .modal__panel { max-width: 100%; max-height: calc(100vh - 80px); }
}

/* ---------- Tables ---------- */
.data-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm);
}
.data-table th, .data-table td {
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table th {
  background: var(--surface-2); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
}
.data-table tr:hover td { background: var(--surface-2); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; background: var(--surface-2);
}
.badge.green { background: var(--rag-green-tint); color: #1e7a35; }
.badge.amber { background: var(--rag-amber-tint); color: #8a6500; }
.badge.red   { background: var(--rag-red-tint);   color: #8a1a26; }
.badge.grey  { background: var(--rag-grey-tint);  color: #4a5260; }

/* ---------- Page wrapper for non-board pages ---------- */
.main { padding: 24px; max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }

/* ---------- Filters ---------- */
.filter-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  background: #fff; padding: 12px 14px; border-radius: var(--radius-md);
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.filter-bar .field { min-width: 140px; }

/* ---------- Stats overview ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.stat-card {
  background: #fff; padding: 14px; border-radius: var(--radius-md);
  border-left: 4px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.stat-card strong { display: block; font-size: 26px; font-weight: 700; }
.stat-card span   { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-card.is-rag-red   { border-left-color: var(--rag-red); }
.stat-card.is-rag-amber { border-left-color: var(--rag-amber); }
.stat-card.is-rag-green { border-left-color: var(--rag-green); }

/* =========================================================
   Batch A — 8-lane board, quarantine, packing, go-back
   ========================================================= */

/* Quarantine / On Hold lane appearance */
.board-cell--lane-label.is-quarantine-lane { background: #f2efe9; }
.board-cell.is-quarantine-row { background: #f7f5f0; }

/* Packing lanes share a warmer tint */
.board-cell--lane-label.is-packing-lane { background: #fbf4ee; }
.board-cell.is-packing-row { background: #fffaf4; }

/* Quarantined card visual: greyscale + dashed red left border, paused badge */
.card.is-quarantined {
  filter: grayscale(.75) contrast(.92);
  border-left: 4px dashed var(--rag-red) !important;
  background: #f6f5f2 !important;
  opacity: .85;
}
.card.is-quarantined .card__meta strong { color: var(--text-muted) !important; }
.card.is-rag-paused { border-left-color: var(--rag-red); }
.card__icon--paused {
  background: var(--rag-red);
  color: #fff;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
}

.card-action-bar__hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
  font-style: italic;
}

/* Small button variant for admin process editor */
.btn--small { padding: 4px 8px; font-size: 12px; }

/* Process editor table (admin/products.php) */
.process-editor { border-collapse: collapse; }
.process-editor th, .process-editor td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-strong);
  vertical-align: middle;
}
.process-editor select, .process-editor input[type="number"] {
  padding: 4px 6px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
}

/* Stage-history move-kind pills */
.move-kind {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: .03em;
  margin-left: 4px;
}
.move-kind--back { background: #fff7e6; color: #7a4b00; }
.move-kind--quarantine { background: #fbe6e6; color: #8a1a26; }
.move-kind--unquarantine { background: #e6f5ea; color: #1f6b3e; }
.move-kind--create { background: #e6eef5; color: #1f4b7a; }

/* =========================================================
   Batch B — Product tags + Trial mode
   ========================================================= */

/* Tag pills (used on cards, detail modal, admin) */
.tag-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #1a1a1a;
  white-space: nowrap;
  line-height: 14px;
}

/* Tag strip — horizontal row along the top edge of a card.
   Radius matches the card (8px) so the strip's colour follows the card's
   rounded top corners. The outer .card has overflow:hidden as a safety net
   for pills that end up flush with the strip edges. */
.card__tag-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin: -10px -12px 6px;
  padding: 4px 10px 4px;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  background: #fafaf7;
  border-bottom: 1px solid var(--border-strong);
  min-width: 0;
}
.card.is-rag-amber .card__tag-strip { background: #fdf8e8; }
.card.is-rag-red   .card__tag-strip,
.card.is-dwell-red .card__tag-strip { background: #fdecec; }
.card.is-trial     .card__tag-strip { background: rgba(255,255,255,.25); border-bottom-color: rgba(255,255,255,.3); }
.card.is-quarantined .card__tag-strip { background: #eeece7; }

/* Detail modal tag strip */
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 14px;
}
.detail-tags .tag-pill {
  font-size: 11px;
  padding: 3px 10px;
}

/* Trial badge (inline text badge, e.g. in modal title, shift handover table) */
.trial-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  background: #1f8a4e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-right: 4px;
}
.trial-badge-small {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  background: #1f8a4e;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Trial cards — green background + left border stripe; overrides tag colours */
.card.is-trial {
  background: linear-gradient(180deg, #e8f5ec 0%, #d3ecd9 100%) !important;
  border-left: 5px solid #1f8a4e !important;
  box-shadow: 0 1px 3px rgba(31,138,78,.18);
}
.card.is-trial .card__title { color: #0f4a2b; font-weight: 600; }
.card.is-trial .card__code { color: #1f8a4e; }
.card.is-trial .card__meta strong { color: #0f4a2b; }

/* NEW TRIAL button — distinct green primary */
.btn--trial {
  background: #1f8a4e !important;
  color: #fff !important;
  border: 1px solid #166a3c !important;
  font-weight: 700;
  letter-spacing: .03em;
}
.btn--trial:hover { background: #166a3c !important; }

.new-trial-group {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
}
.btn--link {
  background: transparent !important;
  color: #d7dbe0 !important;
  border: none !important;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,.3);
}
.btn--link:hover { color: #fff !important; }
.btn--tiny { padding: 2px 6px !important; font-size: 11px !important; line-height: 1.2 !important; }

/* Trial filter dropdown */
.trial-filter select {
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
.trial-filter select option { color: #1a1a1a; background: #fff; }

/* F-1 follow-up (b): TBW horizon filter — same visual weight as the
   trial-filter / sort-toggle dropdowns it sits next to. */
.tbw-range-filter select {
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
.tbw-range-filter select option { color: #1a1a1a; background: #fff; }

/* Board trial-filter hiding — handled via body[data-trial-filter] */
body[data-trial-filter="trials"]     .card:not(.is-trial) { display: none !important; }
body[data-trial-filter="production"] .card.is-trial        { display: none !important; }

/* Trial modal panel has a green top bar to match the theme */
.modal__panel--trial .modal__header {
  border-bottom: 2px solid #1f8a4e;
}

/* Trial indicator on detail summary */
.detail-summary.is-trial {
  background: linear-gradient(180deg, #e8f5ec 0%, #d3ecd9 100%);
  border-left: 4px solid #1f8a4e;
  padding-left: 12px;
}

/* Shift handover — trial stat tile */
.handover-stats > div.trial {
  background: linear-gradient(180deg, #e8f5ec 0%, #d3ecd9 100%);
  border-left: 3px solid #1f8a4e;
}

/* =========================================================
   Packing topology correction (fix to Batch A)
   Ready-to-Pack zones + Packing sub-columns
   ========================================================= */

/* Ready-to-Pack cell: stacked main/allergen sub-zones */
.board-cell--rtp {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
}
.rtp-zone {
  flex: 1;
  min-height: 40px;
  padding: 4px 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rtp-zone--main { background: #f9f9f6; }
.rtp-zone--allergen {
  background: repeating-linear-gradient(
    135deg,
    #fff4f0,
    #fff4f0 10px,
    #ffe8e0 10px,
    #ffe8e0 20px
  );
  border-top: 2px dashed #c2453c;
}
.rtp-zone__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 2px;
  border-bottom: 1px dotted rgba(0,0,0,.12);
}
.rtp-zone--allergen .rtp-zone__label { color: #8a1a26; }

/* Packing cell — horizontal sub-columns (legacy, left in for compat) OR
   vertical when consolidated (one packing line per row). */
.board-cell--pack {
  display: flex;
  flex-direction: row;
  gap: 2px;
  padding: 0;
}
.board-cell--pack.board-cell--pack-vertical {
  flex-direction: column;
}
.pack-sub {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  background: #fffaf4;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px dotted rgba(0,0,0,.1);
}
.board-cell--pack-vertical .pack-sub {
  border-right: none;
  border-bottom: 1px dotted rgba(0,0,0,.1);
  padding: 8px 6px;
}
.board-cell--pack-vertical .pack-sub:last-child { border-bottom: none; }
.pack-sub:last-child { border-right: none; }
.pack-sub__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 2px;
  border-bottom: 1px dotted rgba(0,0,0,.12);
  text-align: center;
}

.rtp-zone.cell-empty,
.pack-sub.cell-empty,
.finished-cell.cell-empty { /* noop — handled by JS inserting placeholder inside */ }

/* Detail modal — packing-line / zone hint inside the stage tile */
.summary-tile span { display: block; }

/* =========================================================
   Unified board grid
   One grid: lane-label | 7 production cols | RTP | Packing | Finished.
   Header row spans full width. The 3 post-production cells are tall
   single cells that row-span all lane rows (set inline via style=).
   A thick vertical divider on the RTP column header + cell marks the
   boundary between production and post-production.
   ========================================================= */

.board-table--unified {
  grid-auto-rows: minmax(90px, auto);
}
.board-table--unified .board-cell--header { grid-row: 1; }
.board-table--unified .board-cell--header-post { /* same header row, just tagged */ }

/* Section divider — thick left border on the first consolidated column */
.board-cell--divider-left {
  border-left: 3px solid var(--brand-blue-deep, #1a1a2e) !important;
}

/* Consolidated tall cells — flex container holding zone/line sub-cells */
.board-cell--consolidated {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #fafbfd;
  border-bottom: none;
  min-height: 0;
}
.board-cell--consolidated.board-cell--rtp      { background: #fafaf4; }
.board-cell--consolidated.board-cell--pack     { background: #fffaf4; }
.board-cell--consolidated.board-cell--finished { background: #f6f7f9; }

/* Finished: flat list */
.finished-cell {
  flex: 1;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Lane-identity chip on cards in consolidated columns */
.card__lane-chip-row {
  display: flex;
  justify-content: flex-start;
  margin: -4px 0 4px 0;
}
.lane-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  color: #fff;
  text-transform: uppercase;
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0,0,0,.25);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.15);
}

/* Phone view — consolidated block stacked under the production-per-lane view */
.phone-section { margin-bottom: 14px; }
.phone-section__head {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 8px 6px 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--brand-blue-deep, #1a1a2e);
}
.phone-section--postprod .phone-section__head {
  border-bottom-color: #1f4b7a;
  color: #1f4b7a;
}

/* =========================================================
   Batch C — Due-by datetime + slack + priority sort / panel
   ========================================================= */

/* Sort-mode dropdown in topbar (matches .trial-filter) */
.sort-toggle select {
  background: rgba(255,255,255,.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
}
.sort-toggle select option { color: #1a1a1a; background: #fff; }

/* Card slack clock (urgency channel, separate from stage-RAG border).
   Integrated inline in the card — no bounding box, no contrasting background.
   Urgency is communicated through text + icon colour; attention via a subtle
   pulse on the icon only so the card keeps a clean single-rectangle shape. */
.card__slack {
  display: block;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(0,0,0,.08);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
  line-height: 1.3;
  /* Short strings like "Due 20:40 · 1h 11m LATE" stay on one line; anything
     pathological wraps onto a second rather than clipping or overflowing. */
  white-space: normal;
  overflow-wrap: anywhere;
  color: #4a5360; /* ok default */
}
.card__slack .slack-icon { margin-right: 2px; }
.card__slack.is-slack-ok    { color: #4a5360; }
.card__slack.is-slack-amber { color: #8a5a00; }
.card__slack.is-slack-amber .slack-icon,
.card__slack.is-slack-red   .slack-icon {
  display: inline-block;
  animation: slack-pulse-icon 2.4s ease-in-out infinite;
}
.card__slack.is-slack-red   { color: #8a1a26; font-weight: 700; }
@keyframes slack-pulse-icon {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%      { opacity: .55;  transform: scale(1.08); }
}
.slack-paused {
  display: inline-block;
  margin-left: 4px;
  color: #8a1a26;
  font-size: 11px;
}

/* Detail-modal due-by box */
.detail-duebox {
  margin: 10px 0 16px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f7f8fb;
  border-left: 4px solid #aab4c2;
}
.detail-duebox.is-slack-amber { border-left-color: #e8c67a; background: #fffaee; }
.detail-duebox.is-slack-red   { border-left-color: #c0392b; background: #fdebeb; }
.detail-duebox.is-slack-none  { background: #f7f8fb; border-left-color: #d3d7de; }
.detail-duebox__row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}
.detail-duebox__slack { margin-top: 6px; font-size: 13px; }
.detail-duebox__edit { margin-top: 8px; }
.detail-duebox__edit summary { display: inline-block; cursor: pointer; }

/* Priority view panel */
.priority-list { display: flex; flex-direction: column; gap: 6px; }
.priority-row {
  display: grid;
  grid-template-columns: 140px 1.6fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border, #e1e4e8);
  border-radius: 4px;
  font-size: 13px;
  align-items: center;
  cursor: pointer;
  transition: background .1s;
}
.priority-row:hover { background: #f6f8fb; }
.priority-row__code { font-family: monospace; font-size: 12px; color: #444; }
.priority-row__name { font-weight: 600; }
.priority-row__stage { font-size: 12px; color: #666; }
.priority-row__lane { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.priority-row__slack { font-weight: 700; text-align: right; }
.priority-row.is-slack-amber .priority-row__slack { color: #6a4600; }
.priority-row.is-slack-red   .priority-row__slack { color: #8a1a26; }
.priority-row.is-slack-ok    .priority-row__slack { color: #3d4a57; }
@media (max-width: 720px) {
  .priority-row { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
  .priority-row__lane, .priority-row__stage { font-size: 11px; }
}

/* =========================================================
   Batch D — Wastage + Yield
   ========================================================= */

/* Wastage count + log button on the card icons row */
.card__icon--wastage {
  background: #eef2f6;
  color: #3d4a57;
}
.card__icon--wastage.is-over {
  background: #ffe1e1;
  color: #8a1a26;
  animation: slack-pulse-icon 2.4s ease-in-out infinite;
}
.card__icon--btn {
  background: #eef2f6;
  color: #3d4a57;
  border: 1px solid var(--border);
  font-family: inherit;
  cursor: pointer;
  padding: 1px 5px;
}
.card__icon--btn:hover { background: #dbe0e8; }

/* Over-threshold banner (admin + edit only) */
.wastage-banner {
  background: #fdecec;
  border-bottom: 2px solid #c0392b;
  color: #5a1a20;
  padding: 0;
  font-size: 13px;
}
.wastage-banner__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.wastage-banner__head:hover { background: #fbdada; }
.wastage-banner__list {
  border-top: 1px dashed #d79999;
}
.wastage-banner__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  border-bottom: 1px dashed #f0c9c9;
  align-items: center;
}
.wastage-banner__row:last-child { border-bottom: none; }
.wastage-banner__text { flex: 1; font-size: 12px; }
.wastage-banner__note { color: #7a4343; }
.wastage-banner__actions { display: flex; gap: 6px; }

/* Yield badge on card (Finished batches) */
.card__yield {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px dashed rgba(0,0,0,.08);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
}
.card__yield.is-yield-ok    { color: #2a6a3a; }
.card__yield.is-yield-amber { color: #8a5a00; }
.card__yield.is-yield-red   { color: #8a1a26; }

/* Detail-modal yield box */
.detail-yieldbox {
  margin: 6px 0 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f7f8fb;
  border-left: 4px solid #aab4c2;
}
.detail-yieldbox.is-yield-ok    { border-left-color: #2a6a3a; background: #f3faf5; }
.detail-yieldbox.is-yield-amber { border-left-color: #e8c67a; background: #fffaee; }
.detail-yieldbox.is-yield-red   { border-left-color: #c0392b; background: #fdebeb; }

/* Wastage modal — threshold hint */
#wastageThresholdHint {
  margin-top: -4px;
  color: #8a1a26;
  font-weight: 600;
}

/* ---- Admin sub-nav (Batch D rev 2) ---- */
.admin-subnav {
  background: #1a1a2e;
  color: #d7dbe0;
  padding: 6px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid #000;
}
.admin-subnav__link {
  color: #d7dbe0;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 4px;
  line-height: 1.1;
  transition: background .1s, color .1s;
}
.admin-subnav__link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.admin-subnav__link.is-current {
  background: #fff;
  color: #1a1a2e;
  font-weight: 700;
}
.admin-subnav__board {
  margin-right: 10px;
  border-right: 1px solid rgba(255,255,255,.2);
  padding-right: 16px;
  color: #a9d3ff;
}
.admin-subnav__board:hover { color: #fff; }

/* ---- Section heading with inline action button ---- */
.section-heading--with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* ---- Wastage banner click affordance ---- */
.wastage-banner__head {
  cursor: pointer;
  transition: background .12s;
}
.wastage-banner__chevron {
  display: inline-block;
  margin-left: 6px;
  transition: transform .2s ease;
  font-size: 10px;
}
.wastage-banner[data-expanded="1"] .wastage-banner__chevron {
  transform: rotate(180deg);
}
.wastage-banner__head:hover {
  background: #fbdada;
}
.wastage-banner__head:focus-visible {
  outline: 2px solid #c0392b;
  outline-offset: -2px;
}

/* ---- Batch E — Re-auth modal (session expired, in-place sign-in) ---- */
.modal--reauth .modal__overlay {
  /* Deliberately NOT a data-close-modal hook — only the successful submit
     dismisses this modal. We don't want a stray tap on the overlay to leave
     the board running against a dead session. */
  background: rgba(8, 10, 20, .6);
  pointer-events: all;
}
.modal--reauth { z-index: 9999; } /* Above every other overlay */
.modal--reauth .modal__panel {
  border-top: 4px solid var(--brand-blue-deep, #1a1a2e);
}
.modal--reauth .modal__header h2 { font-size: 18px; }
.modal--reauth .alert--error {
  margin-top: 8px;
  margin-bottom: 0;
}

/* =========================================================
   Batch H — Management dashboard
   ========================================================= */

.body--dashboard main { padding: 18px; }

.dashboard-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.dashboard-head h1 { margin: 0; font-size: 22px; }
.dashboard-controls {
  display: flex; align-items: center; gap: 12px;
}
.dashboard-updated { font-size: 12px; }

/* Period toggle — pill radio group */
.period-toggle { display: inline-flex; background: #eef2f6; border-radius: 6px; padding: 3px; }
.period-toggle input[type="radio"] { display: none; }
.period-toggle label {
  padding: 5px 12px;
  font-size: 13px; font-weight: 600;
  color: #4a5360;
  cursor: pointer;
  border-radius: 4px;
  user-select: none;
  transition: background .12s, color .12s;
}
.period-toggle input[type="radio"]:checked + label {
  background: var(--brand-blue-deep, #1a1a2e);
  color: #fff;
}
.period-toggle label:hover { background: rgba(0,0,0,.05); }
.period-toggle input[type="radio"]:checked + label:hover { background: var(--brand-blue-deep, #1a1a2e); }

/* Widget grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.widget {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  display: flex; flex-direction: column;
  min-height: 200px;
  min-width: 0;
}
.widget__head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}
.widget__title {
  margin: 0; font-size: 13px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted, #6b6b6b);
}
.widget__actions { display: flex; gap: 6px; }
.widget__export {
  font-size: 11px; padding: 3px 8px;
  background: #eef2f6; color: #3d4a57;
  border-radius: 4px; text-decoration: none;
  border: 1px solid var(--border);
}
.widget__export:hover { background: #dbe0e8; }

.widget__body {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; justify-content: center;
  min-height: 160px;
}
.widget__body canvas { max-height: 260px; }

.widget__loading, .widget__empty {
  text-align: center; margin: 0;
  font-size: 13px;
}
.widget__error { color: var(--rag-red, #c0392b); margin: 0; font-size: 13px; }

/* Big-number widgets */
.widget__big {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 14px 0;
}
.widget__big__value {
  font-size: 38px; font-weight: 800;
  color: var(--brand-blue-deep, #1a1a2e);
  line-height: 1.1;
}
.widget__big__sub { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.widget__big__delta {
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  margin-top: 4px;
}
.widget__big__delta.is-up   { color: #1f6b3e; background: #e6f5ea; }
.widget__big__delta.is-down { color: #8a1a26; background: #fdebeb; }

/* Table widgets */
.widget__table { width: 100%; border-collapse: collapse; font-size: 13px; }
.widget__table th, .widget__table td { padding: 5px 8px; text-align: left; border-bottom: 1px solid #eef2f6; }
.widget__table th { font-weight: 700; font-size: 11px; text-transform: uppercase; color: var(--text-muted, #6b6b6b); }

/* Raw fallback */
.widget__raw {
  font-size: 11px; max-height: 220px; overflow: auto;
  background: #0e1220; color: #cfd6e0;
  padding: 10px; border-radius: 4px;
}

/* Tier visual cue — Tier 3 muted slightly until yield data accumulates */
.widget.is-tier-3 { opacity: .94; }

/* Responsive — tablet stacks to 2 cols, phone to 1 */
@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 700px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-head { flex-direction: column; align-items: flex-start; }
}

/* =====================================================================
   Tablet density (768-1024px) — denser cards, admin chrome retained.
   Triggered by viewport width alone, no URL parameter. Touch targets
   stay ≥44px (drag handles, tag pills, icon buttons).
   ===================================================================== */
@media (min-width: 768px) and (max-width: 1024px) {
  .body--board .card { padding: 8px 10px; font-size: 12px; }
  .body--board .card__title { font-size: 12.5px; }
  .body--board .card__product-desc { font-size: 10.5px; }
  .body--board .card__code { font-size: 10px; }
  .body--board .card__meta { font-size: 11px; }
  /* Touch-target floor on tag pills + icon buttons */
  .body--board .tag-pill { min-height: 22px; padding: 3px 8px; }
  .body--board .card__icon { min-width: 28px; min-height: 28px; }
}

/* =====================================================================
   TV display mode — ?display=tv. Strictly additive over the default
   board layout: hides admin chrome and fits all lanes to viewport
   without scroll. Visual styling matches the default light theme
   exactly — TV mode is structural only (chrome-hide + auto-fit +
   TBW collapsed + 30s polling + read-only). board.js reads
   window.IS_TV_MODE to drop polling cadence and disable drag.
   ===================================================================== */

/* Hide admin chrome — env banner stays so staging is unmistakable, but
   board action controls + user menu + dashboard shortcut all go. The
   site logo, equipment indicator, brand tag and live clock all stay. */
.body--board-tv .topbar__board-actions,
.body--board-tv .topbar__kebab,
.body--board-tv .topbar__action--persistent,
.body--board-tv .admin-subnav { display: none !important; }

/* Lock the body to viewport — no body-level scrolling on the TV. Body
   becomes a flex column so main can claim whatever the env banner +
   topbar leave behind, regardless of their natural heights. */
.body--board-tv {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.body--board-tv .env-banner { flex: 0 0 auto; }
.body--board-tv .topbar     { flex: 0 0 auto; }
.body--board-tv main        { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.body--board-tv .board-root { flex: 1 1 auto; min-height: 0; display: flex; }
.body--board-tv .board-grid { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.body--board-tv .board-table {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;            /* no scroll — overflow pill in JS handles excess */
  /* Header stays auto-sized, every body row shares remaining height.
     minmax(0, 1fr) defeats grid's default min-content floor so rows
     actually shrink below content size when needed. */
  grid-template-rows: auto;
  grid-auto-rows: minmax(0, 1fr);
}
.body--board-tv .board-cell { min-height: 0; overflow: hidden; }
.body--board-tv .lane-cell  { min-height: 0; overflow: hidden; }
/* 2026-05-01 — Task 6: even larger stage column headers in TV mode for
   wall-mounted readability. Default board uses 18px, TV bumps to 20px.
   Tighter letter-spacing + reduced side padding so the longest single-word
   stage names (DECORATING) fit on one line in the 140px columns at the
   tested 1600×900 viewport. The Mixing/Deposit slash break is handled by
   the JS-injected ZWSP and the cell's natural line-height wraps it neatly. */
.body--board-tv .board-cell--header {
  font-size: 20px;
  padding: 14px 4px;
  letter-spacing: .02em;
}

/* Topbar layout — clock/title get the empty space the actions vacated.
   No colour change; light theme stays. */
.body--board-tv .topbar {
  grid-template-columns: 220px auto 1fr 220px;
}
.body--board-tv .topbar__meta {
  align-items: center; justify-content: center;
  flex-direction: column;
}
.body--board-tv .topbar__meta .brand__tag { font-size: 12px; }
.body--board-tv .clock { font-size: 22px; font-weight: 600; letter-spacing: .03em; }

/* TV is read-only — hide the per-card edit affordances. The drag
   cursor is suppressed by board.js setting canEdit=false; this kills
   the inline +batch / +wastage buttons that would otherwise show. */
.body--board-tv .card__icon--btn,
.body--board-tv .card-action-bar { display: none !important; }

/* TBW collapsed-pills-only in TV mode. The <details> elements still
   exist and carry the count; their card lists are CSS-hidden so the
   queue stays tidy and the active stages own the visual weight. */
.body--board-tv .lane-cell.is-pre-production .tbw-group__cards { display: none !important; }
.body--board-tv .lane-cell.is-pre-production .tbw-group__summary::before { display: none; }
.body--board-tv .lane-cell.is-pre-production .tbw-group__summary { cursor: default; }

/* Card-move pulse — applyDiff adds .is-tv-pulse for ~1.5 s when a card
   transitions stage on the TV. Cross-bakery-floor highlight using the
   brand blue halo so it pops without changing the card's resting look. */
.body--board-tv .card.is-tv-pulse {
  animation: tv-pulse 1.5s ease-out;
}
@keyframes tv-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(74, 144, 217, .55); }
  60%  { box-shadow: 0 0 0 14px rgba(74, 144, 217, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 144, 217, 0); }
}

/* Overflow pill — when a stage cell has more cards than fit (TV_CELL_CAP
   in board.js), JS hides the tail and appends a "+N more" pill. Light-
   theme styling matches the rest of the board. */
.tv-overflow-pill {
  display: inline-block;
  margin: 4px 0 0;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
}

