/* =====================================================
   LBCT - Loading Bay Control Tower
   Atlas theme, split shell. Quiet internal-tool aesthetic.

   The shell is dark, the content is light. That split is
   deliberate:

   - Chrome (masthead, nav) is near-black with a red rule under
     it. Red is used for brand, primary action and accent rules
     only. It never encodes a job state.
   - Content sits on white paper, where the Atlas hairlines and
     the four --st-* state marks were designed to work. All four
     clear 4.5:1 on white, so each is legible as mark and as text.
     Every state also ships a text label, so colour is never the
     only channel.
   - The live bay zone is the one exception: a dark well holding
     white bay cards. It is the operator's focus area on a wall
     display, and the contrast step is what makes it read as one.
     Colour is not doing that work, so the state marks stay
     unchanged inside it.
   - Surfaces are flat: 1px hairlines, 2-3px radii, no shadows
     except the modal. Depth comes from borders and one step of
     surface value, not from elevation.
   ===================================================== */
:root {
  color-scheme: light;

  /* Brand - chrome only */
  --brand:        #E60012;
  --brand-dark:   #B7000E;
  --brand-ink:    #FFFFFF;
  --brand-red:    #E60012;
  --ops-ink:      #161616;
  --ops-ink-2:    #252525;

  /* The dark well behind the live bays, and its hairlines. */
  --well:         #1A1D21;
  --well-line:    #2E3238;

  /* Surfaces */
  --surface:      #FFFFFF;
  --page:         #F4F4F2;
  --soft:         #F8F8F7;
  --inset:        #F3F3F1;
  --track:        #E4E4E1;

  /* Ink */
  --ink:          #161616;
  --ink-2:        #555555;
  --ink-3:        #808080;

  /* Lines */
  --line:         #E1E1DE;
  --line-strong:  #CFCFCC;

  /* State marks - Atlas status hues */
  --st-info:      #27679C;
  --st-good:      #277A45;
  --st-warn:      #A56400;
  --st-warn-ink:  #8A5300;
  --st-crit:      #C0392B;
  --st-idle:      #8A8A85;

  /* State tints (badge / chip backgrounds) */
  --tint-info:    #EDF3F8;
  --tint-good:    #EDF4EF;
  --tint-warn:    #FAF3E6;
  --tint-crit:    #FDF1EF;
  --tint-idle:    #F1F1EE;

  /* Radius - deliberately tight */
  --r-sm: 2px; --r-md: 3px; --r-lg: 3px; --r-pill: 999px;

  /* Shadow - only the modal earns one */
  --sh-1: none;
  --sh-2: none;
  --sh-3: 0 8px 24px rgba(0, 0, 0, 0.16);

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px;

  /* Hong Leong Yamaha Motor — Smart Board palette.
     Industrial dark mode for the dashboard only. Admin/reports
     stay on the light Atlas surfaces above. */
  --yl-bg:        #0E1117;   /* deep midnight */
  --yl-bg-2:      #141821;   /* card silver/aluminum (dark) */
  --yl-surface:   #1B2029;   /* raised card */
  --yl-surface-2: #232934;   /* inset / footer */
  --yl-line:      #2C333F;   /* hairline on dark */
  --yl-line-2:    #3A4250;   /* stronger hairline */
  --yl-blue:      #0066CC;   /* Yamaha blue — primary accent */
  --yl-blue-dim:  #0A4A99;   /* blue hover/active dark */
  --yl-blue-glow: rgba(0,102,204,0.18);
  --yl-red:       #E60012;   /* Yamaha red — critical only */
  --yl-ink:       #F0F2F5;   /* bright white for metrics */
  --yl-ink-2:     #B8BFCA;   /* light gray body */
  --yl-ink-3:     #7A8290;   /* muted labels */
  --yl-good:      #2BB673;   /* green — complete/ready */
  --yl-warn:      #F0A020;   /* amber — waiting */

  --sans: "Segoe UI", Arial, Helvetica, sans-serif;
  --mono: Consolas, "Cascadia Mono", "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { width: 100%; min-height: 100%; }

body {
  font-family: var(--sans);
  background: var(--page);
  color: #2C2C2C;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* ============ Header ============ */
header {
  background: var(--ops-ink);
  color: var(--brand-ink);
  padding: var(--s-3) var(--s-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  flex-wrap: wrap;
  border-bottom: 3px solid var(--brand-red);
  position: relative;
  z-index: 100;
}

.brand { display: flex; align-items: center; gap: var(--s-3); }
.brand-mark {
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  padding: 7px 10px;
  border-radius: 0;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
}
.brand-name {
  font-size: 0.94rem;
  font-weight: 650;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--brand-ink);
}
.brand-tag {
  background: transparent;
  color: #CFCFCF;
  font-weight: 700;
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 0;
  letter-spacing: 1.2px;
  border: 1px solid #4A4A4A;
}

.head-right { display: flex; align-items: center; gap: var(--s-3); }
.nav-link {
  background: transparent;
  border: 1px solid #4A4A4A;
  color: #D0D0D0;
  padding: 6px 13px;
  border-radius: var(--r-sm);
  font-size: 0.74rem;
  font-weight: 650;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  letter-spacing: 0.2px;
}
.nav-link:hover { color: #fff; background: var(--ops-ink-2); border-color: #777; }
.nav-link.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.nav-link.nav-icon {
  padding: 6px 0;
  width: 30px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1;
}

.clock {
  text-align: right;
  border-left: 1px solid #3A3A3A;
  padding-left: var(--s-4);
}
.clock-time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--brand-ink);
  line-height: 1;
}
.clock-date {
  font-size: 0.62rem;
  color: #AFAFAF;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

/* ============ Main ============ */
main {
  flex: 1;
  padding: var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  max-width: 1920px;
  margin: 0 auto;
  width: 100%;
}

.page-title {
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: 0.2px;
  color: var(--ink);
}

/* ============ KPI strip (stat tiles) ============ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-3);
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--st-idle);
  border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  box-shadow: none;
  min-height: 74px;
  transition: background 0.15s, border-color 0.15s;
}
.kpi-card:hover { background: #FCFCFB; }
.kpi-card.completed { border-left-color: var(--st-good); }
.kpi-card.avg       { border-left-color: var(--st-info); }
.kpi-card.waiting   { border-left-color: var(--st-warn); }
.kpi-card.delayed   { border-left-color: var(--st-crit); }

.kpi-ico {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.54rem; font-weight: 800; letter-spacing: 0.4px;
  flex-shrink: 0;
  background: var(--tint-idle);
  color: var(--ink-2);
  font-family: var(--mono);
}
.kpi-card.completed .kpi-ico { background: var(--tint-good); color: var(--st-good); }
.kpi-card.avg .kpi-ico       { background: var(--tint-info); color: var(--st-info); }
.kpi-card.waiting .kpi-ico   { background: var(--tint-warn); color: var(--st-warn-ink); }
.kpi-card.delayed .kpi-ico   { background: var(--tint-crit); color: var(--st-crit); }

.kpi-meta { min-width: 0; }
.kpi-label {
  font-size: 0.66rem;
  color: var(--ink-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Proportional figures: a standalone value reads loose in tabular at this size. */
.kpi-value {
  font-size: 1.62rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-top: 2px;
  letter-spacing: -0.02em;
}
.kpi-value .unit { font-size: 0.66rem; font-weight: 650; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }

/* ============ Section heading ============ */
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s-3);
}
.sec-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.sec-meta { font-size: 0.74rem; color: var(--ink-2); font-weight: 600; }

.live-dot {
  width: 7px; height: 7px;
  background: var(--st-good);
  border-radius: 50%;
  animation: livePulse 1.8s infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(39, 122, 69, 0.4); }
  70%  { box-shadow: 0 0 0 6px rgba(39, 122, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(39, 122, 69, 0); }
}

/* ============ Landscape operations board ============ */
.control-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-areas:
    "current next"
    "driver wave"
    "queue queue";
  gap: var(--s-4);
  align-items: start;
}

.current-panel { grid-area: current; }
.next-panel { grid-area: next; }
.queue-panel { grid-area: queue; }
.wave-panel { grid-area: wave; }
.driver-panel { grid-area: driver; }

/* ---- Driver self-service slots ----
   Read from standing distance: the QR must be scannable without the driver
   leaning into the screen, so it holds a floor size rather than shrinking
   with the panel. One slot per bay. */
.driver-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s-3);
}
.dslot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3);
  min-height: 196px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.dslot-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font: 700 0.68rem var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.dslot-pill {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font: 700 0.6rem var(--mono);
  letter-spacing: 0.04em;
}
.dslot-pill.wait { background: var(--tint-warn); color: var(--st-warn-ink); }
.dslot-pill.live { background: var(--tint-good); color: var(--st-good); }
.dslot-img {
  width: 100%;
  max-width: 210px;
  height: auto;
  aspect-ratio: 1;
  background: #FFFFFF;
  padding: var(--s-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.dslot-note { font-size: 0.72rem; color: var(--ink-3); }
.dslot-empty { justify-content: center; border-style: dashed; border-color: var(--line-strong); }
.dslot-tap { width: 100%; min-height: 62px; font-size: 1rem; }
.dslot-live { border-left: 3px solid var(--st-good); }
.dslot-driver { font: 700 1.12rem var(--sans); color: var(--ink); }
.dslot-lorry { font: 700 1.3rem var(--mono); letter-spacing: 0.02em; color: var(--ink); }
.dslot-job { font: 600 0.76rem var(--mono); color: var(--ink-3); }

/* Driver name sits under the plate on a live bay card. */
.driver-line { font-size: 0.8rem; color: var(--ink-2); margin-top: 2px; }

.current-body { padding: var(--s-4); }
.queue-body { padding: var(--s-3) var(--s-4); }

.bays-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--s-4);
  align-items: stretch;
}

/* ============ Bay card ============ */
.bay-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 300px;
  position: relative;
}
.bay-card::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--st-info);
}
.bay-card.overtime::before { background: var(--st-crit); }
.bay-card.idle::before     { background: var(--line-strong); }

.bay-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-5) var(--s-3);
}
.bay-num {
  background: var(--inset);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.82rem;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  letter-spacing: 0.8px;
  border: 1px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
}
.off-plan {
  background: var(--tint-crit);
  color: var(--st-crit);
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.6px;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.wave-tag {
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--ink-2);
  background: var(--surface);
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  white-space: nowrap;
}

.bay-body {
  padding: var(--s-4) var(--s-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.truck-plate {
  font-family: var(--mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
  line-height: 1;
  margin-bottom: var(--s-2);
}
.bp-name {
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 2px;
}
.bp-dest {
  font-size: 0.82rem;
  color: var(--ink-2);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.bp-dest::before { content: '\25B8'; color: var(--ink-3); font-size: 0.76rem; }

/* Meter: fill carries severity, track is a neutral step of the same ramp. */
.progress-track {
  background: var(--track);
  height: 6px;
  border-radius: 0;
  overflow: hidden;
  margin-top: var(--s-4);
}
.progress-fill {
  height: 100%;
  background: var(--st-info);
  border-radius: 0;
  transition: width 1s linear;
}
.progress-fill.over { background: var(--st-crit); }

/* Idle bay */
.bay-card.idle { box-shadow: none; background: var(--soft); }
.bay-card.idle .bay-body { align-items: center; text-align: center; gap: var(--s-2); }
.idle-label {
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: 5px;
  color: var(--ink-3);
}
.idle-sub { font-size: 0.76rem; font-weight: 600; color: var(--ink-3); }
/* Two classes: .bay-foot-row is declared later and would otherwise win the tie. */
.bay-foot-row.bay-foot-idle { justify-content: center; }
.idle-foot { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px; color: var(--ink-3); }

/* Bay footer */
.bay-foot {
  background: var(--soft);
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.bay-foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
}

.status-pill {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status-pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.loading { background: var(--tint-info); color: var(--st-info); }
.status-pill.over    { background: var(--tint-crit); color: var(--st-crit); }
.status-pill.loading::before { animation: livePulse 1.8s infinite; }

/* Running clock: tabular so digits do not jitter each tick. */
.timer {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.timer.over { color: var(--st-crit); }

/* ============ Panels ============ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: none;
  overflow: hidden;
}

.panel-head {
  padding: var(--s-3) var(--s-4);
  background: var(--inset);
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
}
.panel-title {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5C5C5C;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.panel-count {
  font-size: 0.66rem;
  background: var(--surface);
  color: var(--ink-2);
  padding: 2px 9px;
  border-radius: var(--r-sm);
  font-weight: 700;
  font-family: var(--mono);
  border: 1px solid var(--line-strong);
}
.panel-body { padding: var(--s-4) var(--s-5); flex: 1; }

/* ============ Next job ============ */
.next-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-sm);
  padding: var(--s-4);
}
.next-id {
  font-family: var(--mono);
  font-size: 1.42rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.5px;
}
.next-sub {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: 0.7rem;
  font-weight: 650;
  color: var(--ink-2);
  margin: var(--s-1) 0 var(--s-3);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.next-bp { font-size: 0.96rem; font-weight: 650; color: var(--ink); }
.next-dest { font-size: 0.78rem; color: var(--ink-2); font-weight: 600; margin: 2px 0 var(--s-3); }
.next-hint {
  margin-top: var(--s-3);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-2);
  line-height: 1.45;
}
.linkish {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
}

.prep-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-1);
  margin-bottom: var(--s-3);
}
.prep-chip {
  font-size: 0.62rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-radius: var(--r-sm);
}
.prep-chip.ok { background: var(--tint-good); color: var(--st-good); }
.prep-chip.no { background: var(--tint-warn); color: var(--st-warn-ink); }

.ready-pill {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--s-3);
}
.ready-pill.go { background: var(--tint-good); color: var(--st-good); }
.ready-pill.no { background: var(--tint-warn); color: var(--st-warn-ink); }

/* ============ Queue ============ */
.queue-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
.queue-empty {
  color: var(--ink-3);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  padding: var(--s-5) var(--s-3);
}

.q-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  transition: border-color 0.15s, background 0.15s;
}
.q-row:hover { border-color: var(--line-strong); background: var(--soft); }

.q-num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-3);
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
}
.q-info { min-width: 0; flex: 1; }
.q-id {
  font-family: var(--mono);
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-meta {
  font-size: 0.66rem;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.q-right { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }

.rd-bar { width: 48px; height: 4px; background: var(--track); border-radius: 0; overflow: hidden; }
.rd-fill { height: 100%; background: var(--st-good); border-radius: 0; }
.rd-fill.warn { background: var(--st-warn); }
.rd-text { font-size: 0.58rem; font-weight: 800; text-align: right; color: var(--st-good); letter-spacing: 0.3px; }
.rd-text.warn { color: var(--st-warn-ink); }

/* ============ Wave mini ============ */
.wave-list { display: flex; flex-direction: column; gap: var(--s-1); }
.wave-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-weight: 600;
}
.wave-row .w-name { color: var(--ink); font-weight: 650; }
.wave-row .w-stat { color: var(--ink-2); font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 0.72rem; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-weight: 650;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 40px;
  padding: 9px 16px;
  text-decoration: none;
  letter-spacing: 0.1px;
}
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-go { background: var(--st-good); color: #fff; border-color: var(--st-good); }
.btn-go:hover { background: #1F5F36; border-color: #1F5F36; }
.btn-danger { background: var(--st-crit); color: #fff; border-color: var(--st-crit); }
.btn-danger:hover { background: #9E2E22; border-color: #9E2E22; }
.btn-warn { background: var(--st-warn-ink); color: #fff; border-color: var(--st-warn-ink); }
.btn-warn:hover { background: #6F4300; border-color: #6F4300; }
.btn-ghost { background: var(--surface); color: #444; border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--soft); color: var(--ink); border-color: #B9B9B5; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: inherit; }
.btn-sm { min-height: 30px; padding: 5px 11px; font-size: 0.7rem; }
.btn-lg { min-height: 46px; padding: 12px 20px; font-size: 0.88rem; }
.btn-block { width: 100%; }

/* ============ Status badges ============ */
.badge, .status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.badge::before, .status-badge::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.badge.planning,  .status-badge.planning  { background: var(--tint-idle); color: #5C5C5C; }
.badge.picking,   .status-badge.picking   { background: var(--tint-warn); color: var(--st-warn-ink); }
.badge.ready,     .status-badge.ready     { background: var(--tint-good); color: var(--st-good); }
.badge.loading,   .status-badge.loading   { background: var(--tint-info); color: var(--st-info); }
.badge.completed, .status-badge.completed { background: var(--tint-good); color: var(--st-good); }

/* ============ Admin ============ */
.admin-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: var(--s-5);
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: none;
}
.card h3, .rpt-card h3 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #5C5C5C;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  letter-spacing: 0.1em;
}
.fg { margin-bottom: var(--s-3); }
/* Direct child only. A bare `.fg label` also matches the checkbox labels inside
   .prep-checks and, being more specific than .check-row, forced display:block on
   them - which dropped every prep label onto the line below its checkbox. */
.fg > label {
  display: block;
  font-size: 0.7rem;
  font-weight: 650;
  color: #3C3C3C;
  margin-bottom: var(--s-1);
}
.fg input, .fg select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #BFBFBF;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink);
  min-height: 38px;
  outline: none;
}
.fg input::placeholder { color: #9A9A96; }
.fg input:focus, .fg select:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(230, 0, 18, 0.07); }
.fg input:disabled, .fg select:disabled { background: var(--inset); color: var(--ink-3); }
.prep-checks { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.check-row { display: flex; align-items: center; gap: var(--s-2); font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.check-row input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--brand); }
.form-actions { display: flex; gap: var(--s-2); margin-top: var(--s-4); }

/* ============ Tables ============ */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 0;
  overflow: hidden;
}
.tbl th, .tbl td {
  padding: 10px var(--s-4);
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.tbl th {
  background: var(--inset);
  color: #5C5C5C;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #FAFAF8; }
/* The flex container must be a wrapper, never the <td> itself - display:flex on
   a cell removes it from the table box model and detaches it from its row. */
.tbl .actions { white-space: nowrap; }
.actions-wrap { display: flex; gap: var(--s-1); flex-wrap: wrap; align-items: center; }
/* Columns of figures align vertically, so these are tabular. */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.readonly-row td { background: var(--soft); color: var(--ink-2); }

/* ============ Reports ============ */
.rpt-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: var(--s-5);
  margin-bottom: var(--s-5);
  box-shadow: none;
}
.rpt-bar {
  display: flex; gap: var(--s-3); align-items: center;
  margin-bottom: var(--s-4); flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4);
}
.rpt-bar label { font-size: 0.72rem; font-weight: 650; color: #3C3C3C; }
.rpt-bar input {
  padding: 8px 10px; border: 1px solid #BFBFBF;
  border-radius: var(--r-sm); font-family: inherit; font-size: 0.84rem; font-weight: 600;
  background: var(--surface); color: var(--ink); outline: none;
}
.rpt-bar input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(230, 0, 18, 0.07); }

/* ============ Modal ============ */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(22, 22, 22, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.18s; padding: var(--s-5);
}
.modal-bg.on { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--surface);
  border: 1px solid #CFCFCF;
  border-top: 3px solid var(--brand);
  border-radius: var(--r-sm);
  max-width: 440px; width: 100%;
  box-shadow: var(--sh-3);
  transform: translateY(12px); transition: transform 0.18s;
  overflow: hidden;
}
.modal-bg.on .modal { transform: translateY(0); }
.modal-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  font-size: 0.96rem; font-weight: 650; color: var(--ink);
}
.modal-body { padding: var(--s-5); font-size: 0.86rem; line-height: 1.5; }
.modal-body .m-row {
  display: flex; justify-content: space-between; gap: var(--s-4);
  padding: var(--s-2) 0; border-bottom: 1px solid var(--line);
}
.modal-body .m-row:last-child { border-bottom: none; }
.modal-body .m-label { font-weight: 600; color: var(--ink-2); }
.modal-body .m-val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.modal-foot { padding: var(--s-3) var(--s-5) var(--s-4); display: flex; justify-content: flex-end; gap: var(--s-2); }

/* ============ Toast ============ */
.toast {
  position: fixed; top: 84px; right: var(--s-6);
  z-index: 1100; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-sm); font-weight: 650; font-size: 0.82rem;
  color: #fff; box-shadow: var(--sh-3);
  transform: translateX(140%); transition: transform 0.28s;
  max-width: 380px;
}
.toast.on { transform: translateX(0); }
.toast.info    { background: var(--ops-ink); }
.toast.success { background: var(--st-good); }
.toast.warning { background: var(--st-warn-ink); }
.toast.error   { background: var(--st-crit); }

/* ============ Empty state ============ */
.empty {
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  padding: var(--s-8) var(--s-6);
  text-align: center;
}
.empty h3 { font-size: 1.06rem; font-weight: 650; color: var(--ink); margin-bottom: var(--s-2); }
.empty p { color: var(--ink-2); font-weight: 500; margin-bottom: var(--s-5); }
.empty-actions { display: flex; gap: var(--s-3); justify-content: center; flex-wrap: wrap; }

/* ============ Workload (boxes / dealers / shipments) ============ */
.workload {
  margin-top: var(--s-3);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--st-info);
  background: var(--tint-info);
  border-radius: var(--r-sm);
  padding: 5px 9px;
  display: inline-block;
}
.next-card .workload { font-size: 0.72rem; margin-top: 0; margin-bottom: var(--s-3); }
.q-time { color: var(--ink-3); font-weight: 600; margin-left: 4px; }
.sub-cell { color: var(--ink-2); font-size: 0.72rem; font-weight: 600; }

/* ============ Notes ============ */
.card-note {
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-2);
  margin-bottom: var(--s-4);
}
.card-note code {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 5px;
}
.modal-note {
  margin-top: var(--s-3);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink-2);
}

/* File input: the native control is styled through its button pseudo-element. */
.fg input[type="file"] {
  padding: 7px 9px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.fg input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  color: #444;
  background: var(--inset);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 5px 11px;
  margin-right: var(--s-3);
  cursor: pointer;
}
.fg input[type="file"]::file-selector-button:hover { background: var(--track); }

/* ============ Init failure banner ============ */
.init-error {
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  background: var(--st-crit); color: #fff;
  padding: 14px; border-radius: var(--r-sm);
  font-weight: 650; font-size: 0.82rem; z-index: 2000;
  box-shadow: var(--sh-3);
}

/* ============ Utility ============ */
.t-muted  { color: var(--ink-2); }
.t-danger { color: var(--st-crit); font-weight: 700; }
.t-go     { color: var(--st-good); font-weight: 700; }
.prep-cell { font-weight: 700; font-size: 0.76rem; }
.prep-cell.ok   { color: var(--st-good); }
.prep-cell.part { color: var(--st-warn-ink); }
.sum-row td { background: var(--inset); font-weight: 700; }

/* ============ Responsive ============ */
@media (max-width: 1280px) {
  .control-board {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .admin-grid { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  header { flex-direction: column; align-items: flex-start; }
  .head-right { width: 100%; justify-content: space-between; }
  .clock { border-left: none; padding-left: 0; text-align: left; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .control-board {
    grid-template-columns: 1fr;
    grid-template-areas: "current" "next" "driver" "wave" "queue";
  }
  .bays-grid { grid-template-columns: 1fr; }
  .queue-list { grid-template-columns: 1fr; }
  .truck-plate { font-size: 1.8rem; }
  .tbl th, .tbl td { padding: var(--s-2); font-size: 0.74rem; }
  .prep-grid { grid-template-columns: 1fr 1fr; }
  main { padding: var(--s-4); }
}

/* Large wall display: push the operator-critical numbers up. */
@media (min-width: 1900px) {
  .kpi-value { font-size: 1.9rem; }
  .truck-plate { font-size: 2.7rem; }
  .timer { font-size: 1.85rem; }
}

/* ============ Print (reports) ============ */
@media print {
  body { background: #fff; }
  header, .rpt-bar, .btn, .nav-link { display: none !important; }
  main { padding: 0; max-width: none; }
  .rpt-card, .tbl, .kpi-card { box-shadow: none; border-color: #999; break-inside: avoid; }
  .kpi-row { grid-template-columns: repeat(5, 1fr); }
  /* Paper is white: the live well loses its dark fill so the bay cards
     inside it stay readable in ink. */
  .dashboard-page .current-panel .panel-head { background: #F3F3F1; }
  .dashboard-page .current-panel .panel-title { color: #161616; }
  .dashboard-page .current-body { background: #fff; }
}

/* =====================================================
   Dashboard - Industrial Cockpit  (Yamaha Smart Board v32)
   Command-center dark mode for a 65" 4K touch smartboard.
   Layout: header + ticker | dominant split bay cards (left)
   + QR/queue side rail (right) | dominant KPI strip (bottom).
   Zero-scroll. Flat industrial surfaces, Yamaha blue + red.
   ===================================================== */
.dashboard-page {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(0,102,204,0.10), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(230,0,18,0.06), transparent 55%),
    var(--yl-bg);
  color: var(--yl-ink-2);
  color-scheme: dark;
}

/* Subtle motorcycle silhouette watermark — one fixed SVG, no image fetch. */
.dashboard-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='110' viewBox='0 0 220 110' fill='none'%3E%3Cpath d='M30 80 Q40 55 70 55 L95 55 Q100 40 120 38 L150 38 Q165 40 170 55 L195 55 Q205 70 195 82 L180 82 M70 80 a14 14 0 1 0 -0.1 0 Z M175 80 a14 14 0 1 0 -0.1 0 Z' stroke='%23ffffff' stroke-width='1.4' fill='none' opacity='1'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 92% 88%;
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}

.dashboard-page .ops-header {
  min-height: 58px;
  padding: 9px 24px;
  background: linear-gradient(180deg, #0A0E14 0%, #06080C 100%);
  border-bottom: 1px solid var(--yl-line);
  box-shadow: 0 3px 0 var(--yl-blue), 0 10px 24px -12px rgba(0,0,0,0.8);
  position: relative; z-index: 2;
}

.dashboard-page .brand-mark {
  width: 46px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--yl-red);
  color: #fff;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset, 0 6px 16px -8px rgba(230,0,18,0.7);
}
.dashboard-page .yl-fork { width: 26px; height: 26px; }

.dashboard-page .brand-stack { display: flex; flex-direction: column; gap: 1px; }
.dashboard-page .brand-name { font-size: 0.92rem; font-weight: 650; letter-spacing: 0.3px; color: #fff; }
.dashboard-page .brand-sub { color: #8A93A0; font-size: 0.64rem; font-weight: 500; letter-spacing: 0.2px; }

.dashboard-page .system-state {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(43,182,115,0.35);
  background: rgba(43,182,115,0.10);
  border-radius: var(--r-pill);
  color: var(--yl-good);
  font: 800 0.58rem var(--mono);
  letter-spacing: 0.14em;
}
.dashboard-page .system-state span {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--yl-good);
  box-shadow: 0 0 0 0 rgba(43,182,115,0.6);
  animation: yl-pulse 2s infinite;
}
@keyframes yl-pulse {
  0% { box-shadow: 0 0 0 0 rgba(43,182,115,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(43,182,115,0); }
  100% { box-shadow: 0 0 0 0 rgba(43,182,115,0); }
}

.dashboard-page .nav-link {
  background: transparent;
  border: 1px solid var(--yl-line-2);
  color: var(--yl-ink-2);
}
.dashboard-page .nav-link:hover { color: #fff; background: var(--yl-surface); }
.dashboard-page .nav-link.active { background: var(--yl-blue); border-color: var(--yl-blue); color: #fff; }

.dashboard-page .clock { border-left: 1px solid var(--yl-line-2); }
.dashboard-page .clock-time { font-size: 1.2rem; font-weight: 700; color: var(--yl-ink); }
.dashboard-page .clock-date { color: var(--yl-ink-3); }

.dashboard-page main {
  max-width: 1920px;
  padding: 14px 20px 16px;
  gap: 12px;
  position: relative;
  z-index: 1;
}

/* No-scroll shell: fills viewport, board takes remaining height. */
.dashboard-page { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.dashboard-page main { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

/* ---- Context strip: title + live ticker + updated ---- */
.dashboard-page .ops-context {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  min-height: 46px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--yl-line);
  flex-shrink: 0;
}
.dashboard-page .ops-context-left { flex-shrink: 0; }
.dashboard-page .ops-eyebrow {
  color: var(--yl-blue);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}
.dashboard-page .ops-context h1 {
  margin-top: 2px;
  color: var(--yl-ink);
  font-size: 1.34rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

/* Live ticker — the ops pulse, front and center. */
.dashboard-page .ops-ticker {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.dashboard-page .tick {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 5px 14px;
  background: var(--yl-surface);
  border: 1px solid var(--yl-line);
  border-left: 3px solid var(--yl-line-2);
  border-radius: var(--r-sm);
}
.dashboard-page .tick:nth-child(1) { border-left-color: var(--yl-blue); }
.dashboard-page .tick:nth-child(2) { border-left-color: var(--yl-good); }
.dashboard-page .tick:nth-child(3) { border-left-color: var(--yl-warn); }
.dashboard-page .tick:nth-child(4) { border-left-color: var(--yl-ink-3); }
.dashboard-page .tick span {
  color: var(--yl-ink-3);
  font-size: 0.52rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.dashboard-page .tick strong {
  color: var(--yl-ink);
  font: 700 1.32rem var(--mono);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.dashboard-page .ops-context-right { display: flex; gap: 0; flex-shrink: 0; }
.dashboard-page .ops-context-right > div {
  min-width: 96px;
  padding: 3px 12px;
  border-left: 1px solid var(--yl-line);
}
.dashboard-page .ops-context-right span,
.dashboard-page .ops-context-right strong { display: block; }
.dashboard-page .ops-context-right span {
  color: var(--yl-ink-3);
  font-size: 0.52rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.dashboard-page .ops-context-right strong {
  margin-top: 2px;
  color: var(--yl-ink);
  font: 700 0.72rem var(--mono);
}

/* =====================================================
   Cockpit grid: dominant bays (left) + QR/queue rail (right).
   Bay column is the operator's primary focus; rail is glanceable.
   ===================================================== */
.dashboard-page .control-board {
  /* Bays dominant; fills all remaining height. KPI is a thin strip below. */
  flex: 1;
  min-height: 0;
  display: grid;
  /* Bays take ~4/5, side rail ~1/5 (bigger QR + queue). */
  grid-template-columns: minmax(0, 4fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  /* Reset the light-theme board's area/align inheritance so both columns
     stretch to full height and align top+bottom cleanly. */
  grid-template-areas: none;
  align-items: stretch;
  gap: 12px;
  overflow: hidden;
}
.dashboard-page .current-panel,
.dashboard-page .side-rail,
.dashboard-page .side-rail .driver-panel,
.dashboard-page .side-rail .queue-panel { grid-area: auto; }
.dashboard-page .side-rail {
  display: grid;
  grid-template-columns: 1fr;
  /* QR self-service (top) sized a touch smaller; queue takes the rest.
     Both share the exact height of the bay column beside them. */
  grid-template-rows: minmax(0, 0.9fr) minmax(0, 1.1fr);
  grid-template-areas: none;
  align-items: stretch;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

/* Next panel is retired on the smartboard layout. */
.dashboard-page .next-panel { display: none; }

/* ---- Panels (dark) ---- */
.dashboard-page .panel {
  background: var(--yl-surface);
  border: 1px solid var(--yl-line);
  border-radius: var(--r-md, 10px);
  box-shadow: 0 10px 30px -20px rgba(0,0,0,0.9);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dashboard-page .panel-head {
  padding: 8px 14px;
  background: var(--yl-surface-2);
  border-bottom: 1px solid var(--yl-line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  min-height: 38px;
  flex-shrink: 0;
}
.dashboard-page .panel-body { flex: 1; min-height: 0; }
.dashboard-page .panel-title {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yl-ink-2);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.dashboard-page .panel-count {
  font-size: 0.6rem;
  background: transparent;
  color: var(--yl-ink-3);
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-weight: 800;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  border: 1px solid var(--yl-line-2);
}
.dashboard-page .live-dot,
.dashboard-page .qr-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dashboard-page .live-dot { background: var(--yl-good); box-shadow: 0 0 8px var(--yl-good); animation: yl-pulse 2s infinite; }
.dashboard-page .qr-dot { background: var(--yl-blue); box-shadow: 0 0 8px var(--yl-blue); }

/* ---- Current loading panel (left, dominant) ---- */
.dashboard-page .current-panel { border-top: 3px solid var(--yl-blue); }
.dashboard-page .current-panel .panel-title { color: var(--yl-ink); }
.dashboard-page .current-body {
  padding: 12px;
  overflow: hidden;
}
.dashboard-page .bays-grid {
  /* Bay 1 | Bay 2 side by side — the dominant elements. */
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  height: 100%;
}
.dashboard-page .bays-grid[data-bays="1"] { grid-template-columns: 1fr; }

/* ---- Bay card: SPLIT layout (identity left, gauge right) ---- */
.dashboard-page .bay-card {
  background:
    linear-gradient(90deg, rgba(0,102,204,0.06), transparent 30%),
    var(--yl-surface);
  border: 1px solid var(--yl-line-2);
  border-radius: var(--r-md, 10px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02), 0 12px 30px -22px rgba(0,0,0,1);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
/* Tall card body: identity + gauge (row) on top, info stack below. */
.dashboard-page .bay-land {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px 18px;
  min-height: 0;
}
.dashboard-page .bay-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* Identity + gauge sit in one row at the top of the card. */
.dashboard-page .bay-headrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
}
.dashboard-page .bay-card.overtime {
  border-color: rgba(230,0,18,0.5);
  background: linear-gradient(180deg, rgba(230,0,18,0.08), transparent 40%), var(--yl-surface);
}
.dashboard-page .bay-card.idle {
  background: var(--yl-bg-2);
  border-color: var(--yl-line);
  border-style: dashed;
}

/* Top bar: BAY tag + wave + status pill in one strip. */
.dashboard-page .bay-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--yl-line);
  background: var(--yl-surface-2);
}
.dashboard-page .bay-num {
  background: var(--yl-blue);
  color: #fff;
  font-family: var(--mono);
  font-weight: 800;
  font-size: 0.86rem;
  padding: 5px 12px;
  border-radius: 6px;
  letter-spacing: 0.06em;
}
.dashboard-page .bay-card.overtime .bay-num { background: var(--yl-red); }
.dashboard-page .bay-card.idle .bay-num { background: var(--yl-line-2); color: var(--yl-ink-2); }
.dashboard-page .bay-wave {
  font: 700 0.66rem var(--mono);
  letter-spacing: 0.06em;
  color: var(--yl-ink-3);
}
.dashboard-page .bay-topbar .status-pill {
  margin-left: auto;
  font: 800 0.6rem var(--mono);
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border-radius: var(--r-pill);
}
.dashboard-page .status-pill.loading { background: var(--yl-blue-glow); color: #6FB4FF; border: 1px solid rgba(0,102,204,0.4); }
.dashboard-page .status-pill.over { background: rgba(230,0,18,0.18); color: #FF6B78; border: 1px solid rgba(230,0,18,0.5); }
.dashboard-page .off-plan {
  font: 800 0.56rem var(--mono);
  letter-spacing: 0.08em;
  color: #FF6B78;
  background: rgba(230,0,18,0.16);
  border: 1px solid rgba(230,0,18,0.4);
  padding: 3px 8px; border-radius: var(--r-pill);
}

/* (Retired vertical split styles — landscape uses .bay-land/.bay-info.) */
.dashboard-page .bay-id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dashboard-page .bay-id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dashboard-page .truck-plate {
  font-family: var(--mono);
  font-size: 2.9rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1;
  text-shadow: 0 0 20px rgba(0,102,204,0.24);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dashboard-page .driver-line {
  color: var(--yl-ink-2); font-size: 0.74rem; font-weight: 600;
  display: flex; align-items: center; gap: 6px; margin-top: 1px;
}
.dashboard-page .driver-line span {
  font: 800 0.5rem var(--mono); letter-spacing: 0.08em;
  color: var(--yl-ink-3); background: var(--yl-surface-2);
  padding: 1px 5px; border-radius: 4px; border: 1px solid var(--yl-line-2);
}
.dashboard-page .bp-name { color: var(--yl-ink); font-size: 1.25rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-page .bp-dest { color: var(--yl-ink-2); font-size: 1rem; }
.dashboard-page .bp-dest::before { content: '↳ '; color: var(--yl-ink-3); }

/* Radial gauge: compact glanceable timer. */
.dashboard-page .bay-gauge {
  position: relative;
  width: 150px; height: 150px;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.dashboard-page .gauge-ring { width: 150px; height: 150px; transform: rotate(-90deg); }
.dashboard-page .gr-track { fill: none; stroke: var(--yl-surface-2); stroke-width: 8; }
.dashboard-page .gr-arc {
  fill: none; stroke: var(--yl-blue); stroke-width: 8; stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
  filter: drop-shadow(0 0 5px rgba(0,102,204,0.5));
}
.dashboard-page .gr-arc.over { stroke: var(--yl-red); filter: drop-shadow(0 0 5px rgba(230,0,18,0.6)); }
.dashboard-page .gauge-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dashboard-page .timer {
  font: 800 1.7rem var(--mono);
  font-variant-numeric: tabular-nums;
  color: #fff; line-height: 1; letter-spacing: -0.01em;
}
.dashboard-page .timer.over { color: #FF6B78; }
.dashboard-page .gauge-sub {
  margin-top: 4px;
  font: 800 0.58rem var(--mono); letter-spacing: 0.06em;
  color: var(--yl-ink-3); text-transform: uppercase;
}
.dashboard-page .gauge-sub.over { color: #FF6B78; }

/* Progress bar: loading % across the bottom half. */
.dashboard-page .bay-progress { display: flex; align-items: center; gap: 10px; }
.dashboard-page .bp-track {
  flex: 1; height: 8px; border-radius: 4px;
  background: var(--yl-surface-2); overflow: hidden;
}
.dashboard-page .bp-fill {
  height: 100%; background: var(--yl-blue);
  box-shadow: 0 0 8px rgba(0,102,204,0.5);
  transition: width 0.6s ease;
}
.dashboard-page .bp-fill.over { background: var(--yl-red); box-shadow: 0 0 8px rgba(230,0,18,0.5); }
.dashboard-page .bp-pct { font: 800 1.3rem var(--mono); color: #fff; min-width: 54px; text-align: right; font-variant-numeric: tabular-nums; }

/* Metrics strip: boxes / dealers / shipments — the useful numbers. */
.dashboard-page .bay-metrics {
  display: flex;
  gap: 1px;
  background: var(--yl-line);
  border: 1px solid var(--yl-line);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.dashboard-page .bmetric {
  flex: 1;
  padding: 8px 8px;
  background: var(--yl-surface);
  text-align: center;
}
.dashboard-page .bm-val { font: 800 1.7rem var(--mono); color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.dashboard-page .bm-lbl { margin-top: 5px; font: 800 0.6rem var(--mono); letter-spacing: 0.1em; color: var(--yl-ink-3); }

/* Timeline strip: ETA / started / est. done. */
.dashboard-page .bay-timeline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.dashboard-page .btl { display: flex; flex-direction: column; gap: 3px; }
.dashboard-page .btl span { font: 800 0.58rem var(--mono); letter-spacing: 0.08em; color: var(--yl-ink-3); }
.dashboard-page .btl strong { font: 800 1.05rem var(--mono); color: var(--yl-ink); }
.dashboard-page .btl strong.late { color: #FF6B78; }

.dashboard-page .bay-complete {
  margin-top: auto;
  min-height: 52px;
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

/* Idle bay. */
.dashboard-page .bay-idle {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
}
.dashboard-page .idle-ico { font: 300 3rem var(--mono); color: var(--yl-line-2); line-height: 1; }
.dashboard-page .idle-label { color: var(--yl-ink-3); font: 800 1rem var(--mono); letter-spacing: 0.4em; }
.dashboard-page .idle-sub { color: var(--yl-ink-3); font-size: 0.72rem; }

/* =====================================================
   Side rail: QR self-service (one slot per bay, stacked).
   Compact for the right rail; big enough to scan.
   ===================================================== */
.dashboard-page .driver-panel { border-top: 3px solid var(--yl-blue); }
.dashboard-page .driver-panel .panel-body {
  padding: 10px;
  overflow: hidden;
}
.dashboard-page .driver-slots {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}
.dashboard-page .dslot {
  flex: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--yl-line-2);
  border-radius: var(--r-sm);
  background: var(--yl-surface);
  position: relative;
  min-height: 0;
}
.dashboard-page .dslot.dslot-empty { border-style: dashed; background: var(--yl-bg-2); flex-direction: column; align-items: stretch; justify-content: center; text-align: center; gap: 8px; }
.dashboard-page .dslot.dslot-live { border-left: 3px solid var(--yl-good); }
.dashboard-page .dslot.dslot-qr { border-color: var(--yl-blue); }
.dashboard-page .dslot-head {
  font: 800 0.58rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yl-ink-2);
  display: flex; align-items: center; gap: 6px;
}
.dashboard-page .dslot-empty .dslot-head { justify-content: center; }
.dashboard-page .dslot-pill {
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font: 800 0.52rem var(--mono);
}
.dashboard-page .dslot-pill.wait { background: rgba(240,160,32,0.18); color: var(--yl-warn); }
.dashboard-page .dslot-pill.live { background: rgba(43,182,115,0.18); color: var(--yl-good); }
.dashboard-page .dslot-img {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  background: #FFFFFF;
  padding: 5px;
  border-radius: var(--r-sm);
}
.dashboard-page .dslot-qr { flex-direction: row; }
.dashboard-page .dslot-qr .dslot-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.dashboard-page .dslot-note { font-size: 0.62rem; color: var(--yl-ink-3); line-height: 1.3; }
.dashboard-page .dslot-tap {
  width: 100%;
  min-height: 48px;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: var(--yl-blue);
  color: #fff;
  border: 1px solid var(--yl-blue);
}
.dashboard-page .dslot-tap:active { background: var(--yl-blue-dim); }
.dashboard-page .dslot-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.dashboard-page .dslot-driver { font: 800 0.96rem var(--sans); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-page .dslot-lorry { font: 800 1.1rem var(--mono); color: var(--yl-blue); }
.dashboard-page .dslot-job { font: 700 0.6rem var(--mono); color: var(--yl-ink-3); }

/* =====================================================
   Bottom: 5 KPI cards with sparkline (dominant strip).
   ===================================================== */
.dashboard-page .kpi-row {
  /* Secondary metrics: a thin strip under the dominant bays. */
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  flex: 0 0 auto;
  margin-top: 12px;
}

/* ---- NEXT UP strip: on-deck trucks + prep readiness ---- */
.dashboard-page .nextup-strip {
  flex: 0 0 auto;
  margin-top: 12px;
  background: var(--yl-surface);
  border: 1px solid var(--yl-line);
  border-radius: var(--r-md, 10px);
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
}
.dashboard-page .nextup-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.dashboard-page .nextup-title {
  font: 800 0.64rem var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--yl-ink-2); display: flex; align-items: center; gap: 8px;
}
.dashboard-page .nu-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--yl-blue);
  box-shadow: 0 0 8px rgba(0,102,204,0.7);
}
.dashboard-page .nextup-hint { font: 700 0.6rem var(--mono); letter-spacing: 0.06em; color: var(--yl-ink-3); text-transform: uppercase; }
.dashboard-page .nextup-track {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.dashboard-page .nextup-empty {
  grid-column: 1 / -1; text-align: center; padding: 14px;
  font: 700 0.8rem var(--mono); color: var(--yl-ink-3); letter-spacing: 0.04em;
}
.dashboard-page .nextup-card {
  background: var(--yl-surface-2);
  border: 1px solid var(--yl-line-2);
  border-left: 3px solid var(--yl-line-2);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 9px;
}
.dashboard-page .nextup-card.ready { border-left-color: var(--yl-good); }
.dashboard-page .nu-lead { display: flex; align-items: center; gap: 10px; }
.dashboard-page .nu-pos {
  width: 26px; height: 26px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--yl-surface); border: 1px solid var(--yl-line-2); border-radius: 6px;
  font: 800 0.82rem var(--mono); color: var(--yl-ink-2);
}
.dashboard-page .nu-idblock { flex: 1; min-width: 0; }
.dashboard-page .nu-id {
  font: 800 1rem var(--mono); color: #fff; letter-spacing: 0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dashboard-page .nu-sub {
  font-size: 0.68rem; color: var(--yl-ink-3); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dashboard-page .nu-badge {
  flex-shrink: 0; font: 800 0.62rem var(--mono); letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 5px;
}
.dashboard-page .nu-badge.ok { background: rgba(43,182,115,0.16); color: var(--yl-good); border: 1px solid rgba(43,182,115,0.3); }
.dashboard-page .nu-badge.wait { background: rgba(240,160,32,0.14); color: var(--yl-warn); border: 1px solid rgba(240,160,32,0.28); }
.dashboard-page .nu-tasks { display: flex; gap: 5px; }
.dashboard-page .nu-task {
  flex: 1; display: flex; align-items: center; gap: 5px;
  font: 700 0.56rem var(--mono); letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--yl-ink-3);
  padding: 4px 6px; border-radius: 4px; background: var(--yl-surface);
  border: 1px solid var(--yl-line); white-space: nowrap; overflow: hidden;
}
.dashboard-page .nu-task.on { color: var(--yl-ink); border-color: rgba(43,182,115,0.25); }
.dashboard-page .nu-tdot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--yl-line-2);
}
.dashboard-page .nu-task.on .nu-tdot { background: var(--yl-good); box-shadow: 0 0 5px rgba(43,182,115,0.6); }
.dashboard-page .kpi-card {
  background: linear-gradient(180deg, var(--yl-surface-2), var(--yl-surface));
  border: 1px solid var(--yl-line-2);
  border-left: 3px solid var(--yl-blue);
  border-radius: var(--r-md, 10px);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  box-shadow: 0 10px 26px -20px rgba(0,0,0,0.9);
}
.dashboard-page .kpi-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dashboard-page .kpi-card.completed { border-left-color: var(--yl-good); }
.dashboard-page .kpi-card.avg       { border-left-color: var(--yl-blue); }
.dashboard-page .kpi-card.util      { border-left-color: var(--yl-blue); }
.dashboard-page .kpi-card.waiting   { border-left-color: var(--yl-warn); }
.dashboard-page .kpi-card.delayed   { border-left-color: var(--yl-red); }

.dashboard-page .kpi-ico {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  font: 800 0.66rem var(--mono);
  flex-shrink: 0;
  background: var(--yl-surface-2);
  color: var(--yl-ink-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--yl-line-2);
}
.dashboard-page .kpi-card.completed .kpi-ico { background: rgba(43,182,115,0.18); color: var(--yl-good); }
.dashboard-page .kpi-card.avg .kpi-ico       { background: var(--yl-blue-glow); color: var(--yl-blue); }
.dashboard-page .kpi-card.util .kpi-ico      { background: var(--yl-blue-glow); color: var(--yl-blue); }
.dashboard-page .kpi-card.waiting .kpi-ico   { background: rgba(240,160,32,0.18); color: var(--yl-warn); }
.dashboard-page .kpi-card.delayed .kpi-ico   { background: rgba(230,0,18,0.18); color: var(--yl-red); }

.dashboard-page .kpi-meta { min-width: 0; flex: 1; }
.dashboard-page .kpi-label {
  font-size: 0.62rem;
  color: var(--yl-ink-3);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dashboard-page .kpi-value {
  font: 800 1.9rem var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1.05;
  margin-top: 2px;
}
.dashboard-page .kpi-value .unit { font-size: 0.8rem; color: var(--yl-ink-3); margin-left: 3px; font-weight: 700; }

/* Sparkline: inline SVG trend at the right of each KPI card. */
.dashboard-page .kpi-spark {
  flex-shrink: 0;
  width: 60px;
  height: 32px;
  display: block;
  opacity: 0.85;
}
.dashboard-page .kpi-spark polyline { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dashboard-page .kpi-card.completed .kpi-spark polyline { stroke: var(--yl-good); }
.dashboard-page .kpi-card.avg .kpi-spark polyline       { stroke: var(--yl-blue); }
.dashboard-page .kpi-card.util .kpi-spark polyline      { stroke: var(--yl-blue); }
.dashboard-page .kpi-card.waiting .kpi-spark polyline   { stroke: var(--yl-warn); }
.dashboard-page .kpi-card.delayed .kpi-spark polyline   { stroke: var(--yl-red); }

/* ---- Queue (side rail, single column, compact rows) ---- */
.dashboard-page .queue-panel { border-top: 3px solid var(--yl-warn); }
.dashboard-page .queue-body { padding: 8px; overflow-y: auto; }
.dashboard-page .queue-list { display: flex; flex-direction: column; gap: 6px; }
.dashboard-page .queue-empty { color: var(--yl-ink-3); font-size: 0.72rem; text-align: center; padding: 20px 0; }
.dashboard-page .q-row {
  background: var(--yl-surface);
  border: 1px solid var(--yl-line);
  border-radius: var(--r-sm);
  min-height: 50px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.dashboard-page .q-row.q-ready { border-left: 3px solid var(--yl-good); }
.dashboard-page .q-row:active { border-color: var(--yl-line-2); background: var(--yl-surface-2); }
.dashboard-page .q-num {
  width: 24px; height: 24px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--yl-surface-2);
  border: 1px solid var(--yl-line-2);
  color: var(--yl-ink-2);
  border-radius: var(--r-sm);
  font: 800 0.68rem var(--mono);
}
.dashboard-page .q-info { min-width: 0; flex: 1; }
.dashboard-page .q-id { color: #fff; font-size: 0.82rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-page .q-time { color: var(--yl-ink-3); font-weight: 600; font-family: var(--mono); font-size: 0.72rem; }
.dashboard-page .q-meta { color: var(--yl-ink-3); font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dashboard-page .q-right { flex-shrink: 0; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; width: 56px; }
.dashboard-page .rd-bar { background: var(--yl-surface-2); width: 100%; height: 4px; border-radius: 2px; overflow: hidden; }
.dashboard-page .rd-fill { background: var(--yl-good); height: 100%; }
.dashboard-page .rd-fill.warn { background: var(--yl-warn); }
.dashboard-page .rd-text { color: var(--yl-good); font: 800 0.58rem var(--mono); letter-spacing: 0.06em; }
.dashboard-page .rd-text.warn { color: var(--yl-warn); }

/* ---- Buttons on dark ---- */
.dashboard-page .btn-primary { background: var(--yl-blue); color: #fff; border-color: var(--yl-blue); }
.dashboard-page .btn-primary:hover { background: var(--yl-blue-dim); border-color: var(--yl-blue-dim); }
.dashboard-page .btn-go { background: var(--yl-good); color: #06281A; border-color: var(--yl-good); }
.dashboard-page .btn-go:hover { background: #239962; border-color: #239962; }
.dashboard-page .btn-danger { background: var(--yl-red); color: #fff; border-color: var(--yl-red); }
.dashboard-page .btn-warn { background: var(--yl-warn); color: #2A1A02; border-color: var(--yl-warn); }
.dashboard-page .btn-ghost { background: var(--yl-surface); color: var(--yl-ink-2); border-color: var(--yl-line-2); }
.dashboard-page .btn-ghost:hover { background: var(--yl-surface-2); color: var(--yl-ink); }
.dashboard-page .linkish { color: var(--yl-blue); }

/* ---- Empty state (dark) ---- */
.dashboard-page .empty {
  background: var(--yl-surface);
  border: 1px dashed var(--yl-line-2);
  color: var(--yl-ink-2);
}
.dashboard-page .empty h3 { color: var(--yl-ink); }
.dashboard-page .empty p { color: var(--yl-ink-2); }

/* ---- Responsive ---- */
@media (max-width: 1280px) {
  .dashboard-page .ops-context-right > div:nth-child(2) { display: none; }
  .dashboard-page .queue-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1280px) {
  .dashboard-page .ops-ticker { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .dashboard-page .system-state { display: none; }
  .dashboard-page .ops-context-right { display: none; }
  .dashboard-page .ops-ticker { display: none; }
  .dashboard-page .control-board {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  .dashboard-page .side-rail { grid-template-rows: auto auto; }
  .dashboard-page .bays-grid { grid-template-columns: 1fr; }
  .dashboard-page .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-height: 900px) and (orientation: landscape) {
  .dashboard-page .ops-header { min-height: 50px; padding: 6px 18px; }
  .dashboard-page .brand-sub { display: none; }
  .dashboard-page .clock-time { font-size: 1.06rem; }
  .dashboard-page main { padding: 10px 16px 12px; gap: 8px; }
  .dashboard-page .ops-context { min-height: 38px; padding-bottom: 8px; }
  .dashboard-page .ops-context h1 { font-size: 1.14rem; }
  .dashboard-page .tick { padding: 3px 11px; }
  .dashboard-page .tick strong { font-size: 1.08rem; }
  .dashboard-page .control-board { gap: 9px; }
  .dashboard-page .side-rail { gap: 9px; }
  .dashboard-page .panel-head { min-height: 32px; padding: 6px 12px; }
  .dashboard-page .current-body { padding: 9px; }
  .dashboard-page .bays-grid { gap: 9px; }
  .dashboard-page .bay-topbar { padding: 8px 13px; }
  .dashboard-page .bay-split { padding: 10px 13px; gap: 10px; }
  .dashboard-page .truck-plate { font-size: 2rem; }
  .dashboard-page .bp-name { font-size: 0.94rem; }
  .dashboard-page .bay-gauge, .dashboard-page .gauge-ring { width: 120px; height: 120px; }
  .dashboard-page .timer { font-size: 1.16rem; }
  .dashboard-page .bay-complete { min-height: 48px; margin: 0 13px 13px; }
  .dashboard-page .dslot-img { width: 84px; height: 84px; }
  .dashboard-page .dslot-tap { min-height: 46px; font-size: 0.78rem; }
  .dashboard-page .kpi-row { margin-top: 9px; }
  .dashboard-page .kpi-card { padding: 9px 13px; min-height: 64px; }
  .dashboard-page .kpi-value { font-size: 1.6rem; }
  .dashboard-page .kpi-spark { width: 54px; height: 28px; }
  .dashboard-page .q-row { min-height: 46px; }
}

/* =====================================================
   Smartboard (touch) tuning
   65" 4K touch: no mouse, no hover, on-screen keyboard.
   Scoped to .dashboard-page. Fires on touch-capable devices.
   ===================================================== */
@media (hover: none), (pointer: coarse) {
  .dashboard-page .btn:hover,
  .dashboard-page .btn:disabled:hover { background: inherit; }
  .dashboard-page .btn-primary:hover { background: var(--yl-blue); border-color: var(--yl-blue); }
  .dashboard-page .btn-go:hover { background: var(--yl-good); border-color: var(--yl-good); }
  .dashboard-page .btn-danger:hover { background: var(--yl-red); border-color: var(--yl-red); }
  .dashboard-page .btn-warn:hover { background: var(--yl-warn); border-color: var(--yl-warn); }
  .dashboard-page .btn-ghost:hover { background: var(--yl-surface); color: var(--yl-ink-2); border-color: var(--yl-line-2); }
  .dashboard-page .q-row:hover { border-color: var(--yl-line); background: var(--yl-surface); }

  .dashboard-page .btn:active { filter: brightness(0.9); }
  .dashboard-page .btn-ghost:active { background: var(--yl-surface-2); }
  .dashboard-page .q-row:active { border-color: var(--yl-line-2); background: var(--yl-surface-2); }
  .dashboard-page .nav-link:active { background: var(--yl-surface); }
  .dashboard-page .linkish:active { color: var(--yl-blue); }

  /* Fingertip targets — 48px minimum. */
  .dashboard-page .btn { min-height: 48px; padding: 11px 18px; }
  .dashboard-page .btn-sm { min-height: 44px; padding: 8px 14px; }
  .dashboard-page .btn-lg { min-height: 52px; padding: 13px 20px; }
  .dashboard-page .q-right .btn { min-width: 80px; }
  .dashboard-page .dslot-tap { min-height: 52px; }
  .dashboard-page .modal-foot .btn { min-height: 50px; min-width: 120px; }
}

/* =====================================================
   Admin Quick Entry modal (linear touch flow)
   Select Bay -> Select Truck -> auto-populate -> START LOADING.
   Big targets, single column, no left/right hunt.
   ===================================================== */
.quick-entry-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 8, 12, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity 0.18s; padding: var(--s-5);
}
.quick-entry-overlay.on { opacity: 1; pointer-events: auto; }
.quick-entry {
  background: var(--surface);
  border: 1px solid #CFCFCF;
  border-top: 3px solid var(--brand);
  border-radius: var(--r-sm);
  max-width: 460px; width: 100%;
  box-shadow: var(--sh-3);
  transform: translateY(12px); transition: transform 0.18s;
  overflow: hidden;
}
.quick-entry-overlay.on .quick-entry { transform: translateY(0); }
.quick-entry-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--line);
  font-size: 0.96rem; font-weight: 650; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center;
}
.quick-entry-body { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.quick-entry .qe-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-3);
}
.quick-entry .qe-step .qe-num {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--inset); color: var(--ink-2);
  font-family: var(--mono); font-size: 0.62rem;
}
.quick-entry .qe-select,
.quick-entry .qe-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid #BFBFBF;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.quick-entry .qe-select:focus,
.quick-entry .qe-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(230, 0, 18, 0.08);
}
.quick-entry .qe-autofill {
  font-size: 0.78rem; color: var(--ink-2);
  background: var(--soft); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px;
  display: none;
}
.quick-entry .qe-autofill.on { display: block; }
.quick-entry .qe-autofill .qe-af-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 3px 0; font-size: 0.76rem;
}
.quick-entry .qe-autofill .qe-af-label { color: var(--ink-3); font-weight: 600; }
.quick-entry .qe-autofill .qe-af-val { color: var(--ink); font-weight: 700; font-family: var(--mono); }
.quick-entry .qe-start {
  min-height: 60px;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  margin-top: var(--s-2);
}
.quick-entry .qe-cancel {
  min-height: 48px;
}

/* =====================================================
   Planner Workbench / Operations Review
   Same Atlas shell as the dashboard, optimised for
   keyboard work, CSV planning and supervisor review.
   These are desk pages that get printed, so they stay
   fully light - no dark well.
   ===================================================== */
.workbench-page {
  background: var(--page);
}
.workbench-page .ops-header {
  min-height: 62px;
  padding: 11px 28px;
}
.workbench-page .brand-mark {
  width: 52px; height: 34px; display: grid; place-items: center; padding: 0;
  background: var(--brand); color: #fff; border-radius: 0;
  font-family: var(--mono); font-weight: 800; font-size: 0.74rem;
}
.workbench-page .brand-stack { display: flex; flex-direction: column; gap: 1px; }
.workbench-page .brand-name { font-size: 0.95rem; font-weight: 650; letter-spacing: 0.3px; }
.workbench-page .brand-sub { color: #A8A8A8; font-size: 0.66rem; font-weight: 500; letter-spacing: 0.2px; }
.workbench-page .system-state {
  height: 30px; display: flex; align-items: center; gap: 7px; padding: 0 11px;
  border: 1px solid #4A4A4A; border-radius: var(--r-sm); color: #C0C0C0;
  font: 650 0.6rem var(--mono); letter-spacing: 0.4px;
}
.workbench-page .system-state span { width: 6px; height: 6px; border-radius: 50%; background: #3FA463; }
.workbench-page .clock-time { font-size: 1.22rem; }
.workbench-page main { max-width: 1920px; padding: 22px 28px 32px; }

.workbench-context {
  display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s-4);
  padding: 2px 0 16px;
  border-bottom: 1px solid var(--line-strong);
}
.workbench-eyebrow {
  color: var(--brand);
  font-size: 0.63rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.14em;
}
.workbench-context h1 {
  margin-top: 5px; color: var(--ink);
  font-size: 1.6rem; font-weight: 650; letter-spacing: -0.035em; line-height: 1.05;
}
.workbench-context p { margin-top: 5px; color: #626262; font-size: 0.82rem; font-weight: 500; }
.workbench-legend { display: flex; gap: 14px; padding-bottom: 4px; color: var(--ink-2); font-size: 0.72rem; font-weight: 600; }
.workbench-legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.ready-dot { background: var(--st-good); } .pick-dot { background: var(--st-warn); }

.workbench-page .admin-grid { grid-template-columns: 380px minmax(0,1fr); gap: 16px; align-items: start; }
.workbench-page .workbench-sidebar { min-width: 0; }
.workbench-page .card,
.workbench-page .rpt-card {
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  box-shadow: none;
}
.workbench-page .card { margin-bottom: 12px; }
.workbench-page .card h3,
.workbench-page .rpt-card h3 {
  color: #5C5C5C; font-size: 0.66rem;
  letter-spacing: 0.1em; background: var(--inset); margin: -20px -20px 16px;
  padding: 11px 16px; border-bottom: 1px solid var(--line-strong);
}
.workbench-page .rpt-card h3 { margin: -20px -20px 16px; }
.workbench-page .import-card { border-top: 3px solid var(--brand); }
.workbench-page .job-editor-card { border-top: 3px solid var(--st-warn); }
.workbench-page .settings-card { border-top: 3px solid var(--st-info); }
.workbench-page .danger-card { border-top: 3px solid var(--st-crit); }
.workbench-page .card-note { padding: 10px 12px; background: var(--soft); border-left: 3px solid var(--brand); color: var(--ink-2); }
.workbench-page .fg > label { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.62rem; color: #5C5C5C; }
.workbench-page .prep-checks { padding: 10px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--r-sm); }
.workbench-page .form-actions { padding-top: 12px; border-top: 1px solid var(--line); }
.workbench-page .workbench-table-card { min-height: 620px; }
.workbench-page .workbench-table-card > div { max-height: calc(100vh - 270px); overflow: auto !important; }
.workbench-page .tbl { border: none; }
.workbench-page .tbl th { position: sticky; top: 0; z-index: 1; background: var(--ops-ink); color: #E4E4E4; border-bottom-color: var(--ops-ink); }
.workbench-page .tbl td { vertical-align: middle; }
.workbench-page .tbl .btn { min-height: 28px; padding: 4px 8px; font-size: 0.64rem; }
.workbench-page .panel-count { font-family: var(--mono); border-radius: var(--r-sm); }

/* ===== Tab-based admin workbench (ease of use) ===== */
.workbench-page .workbench-legend { gap: 0; }
.admin-tabs {
  display: flex; align-items: flex-end; gap: 4px;
  border-bottom: 2px solid var(--line);
  margin: 4px 0 18px;
}
.admin-tabs #btn-quick-entry { margin-left: auto; margin-bottom: 6px; }
.admin-tab {
  appearance: none; background: transparent; border: none; cursor: pointer;
  padding: 11px 20px; font: 700 0.9rem var(--sans, inherit);
  color: #6B6B6B; letter-spacing: 0.01em;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--ink, #1a1a1a); }
.admin-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.admin-panel { display: none; }
.admin-panel.active { display: block; }

/* --- Jobs tab --- */
.jobs-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.jobs-toolbar-left { display: flex; align-items: center; gap: 10px; }
.jt-title { font: 700 1.05rem var(--sans, inherit); color: var(--ink, #1a1a1a); }
.jobs-toolbar-right { display: flex; align-items: center; gap: 16px; }
.legend-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; color: #6B6B6B; }
.legend-inline .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

/* Collapsible job editor drawer */
.job-drawer {
  display: none;
  background: #fff; border: 1px solid var(--line);
  border-top: 3px solid var(--brand); border-radius: var(--r-md, 10px);
  padding: 18px 20px; margin-bottom: 16px;
  box-shadow: 0 12px 30px -22px rgba(0,0,0,0.5);
}
.job-drawer.open { display: block; animation: drawerIn 0.18s ease; }
@keyframes drawerIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.job-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.job-drawer-head h3 { margin: 0; font-size: 1rem; }
.job-drawer .form-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px;
}
.job-drawer .fg-wide { grid-column: 1 / -1; }
.job-drawer .form-actions { margin-top: 16px; padding-top: 14px; }

/* Full-width jobs table (no more cramped sidebar) */
.workbench-page .workbench-table-card { min-height: 0; }
.workbench-page .table-scroll { max-height: calc(100vh - 300px); overflow: auto; }

/* --- Import tab: 3-step flow --- */
.import-flow {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  align-items: start; max-width: 1200px;
}
.import-card.step { position: relative; padding-top: 22px; }
.step-badge {
  position: absolute; top: -14px; left: 18px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font: 800 0.85rem var(--mono);
  box-shadow: 0 4px 10px -3px rgba(0,0,0,0.4);
}
.step-badge.alt { background: #8A8A8A; font-size: 0.62rem; width: auto; padding: 0 10px; border-radius: 15px; }
.import-card.primary-step { border-top: 3px solid var(--brand); }
.lookup-badge { font-weight: 700; }

/* --- Settings tab --- */
.settings-flow {
  display: grid; grid-template-columns: repeat(2, minmax(0, 420px)); gap: 16px;
  align-items: start;
}
.danger-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

@media (max-width: 900px) {
  .import-flow, .settings-flow { grid-template-columns: 1fr; }
  .job-drawer .form-grid { grid-template-columns: 1fr 1fr; }
}

.reports-page .report-context { padding-bottom: 14px; }
.reports-page .report-filter-bar {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  border-left: 3px solid var(--brand); border-radius: var(--r-sm);
}
.reports-page .report-filter-bar label { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.63rem; }
.reports-page .kpi-row { margin-bottom: 4px !important; }
.reports-page .kpi-ico { font-family: var(--mono); }
.reports-page .rpt-card { overflow: hidden; }
.reports-page .rpt-card h3 { margin: -20px -20px 16px; }

@media (max-width: 1100px) {
  .workbench-page .system-state { display: none; }
  .workbench-page .admin-grid { grid-template-columns: 340px minmax(0,1fr); }
}
@media (max-width: 900px) {
  .workbench-page .admin-grid { grid-template-columns: 1fr; }
  .workbench-legend { display: none; }
  .workbench-page .workbench-table-card > div { max-height: none; }
}
