/* ══════════════════════════════════════════════════════════════════════
   TODAY · Daily Labor Snapshot — page-specific styles
   Layered on top of styles.css and ratios.css
   ══════════════════════════════════════════════════════════════════════ */

/* ----- LAYOUT FIX -----
   Global styles.css uses `html, body { height: 100% }` and `body { display: flex }`,
   which locks .main to viewport height. With .main as a flex column, every section
   inside (KPI row, panels, tables) competes for that fixed height and gets crushed
   by flex-shrink. We let the page expand naturally and prevent shrinking of children
   so Chrome/Edge render every card and panel at its real content height.
*/
html, body { height: auto; min-height: 100%; }

/* ----- Page header summary stat: danger color ----- */
.summary-value.danger { color: #b91c1c; }

/* ----- Top alert banner ----- */
.today-alert {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: var(--space-5, 20px);
}
.today-alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
  display: grid;
  place-items: center;
}
.today-alert-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.today-alert-body strong {
  color: #7f1d1d;
  font-size: 14px;
  font-weight: 700;
}
.today-alert-body span {
  color: #991b1b;
  font-size: 13px;
}
.today-alert-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn-secondary-on-alert {
  background: white;
}



/* AI bubble is draggable on this page — hint with grab cursor */
#aiBubble { cursor: grab; }
#aiBubble:active { cursor: grabbing; }

/* ----- $/Hours unit toggle ----- */
.unit-btn {
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary, #64748b);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.unit-btn:hover { color: var(--text-primary, #0f172a); }
.unit-btn.active {
  background: white;
  color: var(--text-primary, #0f172a);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* AI bubble + panel styles now come from the shared ai-bubble.css (linked in
   <head>) — removed from here to de-duplicate. ai-bubble.css is a superset:
   it also styles .ai-chip / .ai-stub that ai-bubble.js creates. */

/* ----- Today's shifts timeline ----- */
.shift-timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.timeline-shift {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 14px;
}
.timeline-shift-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.timeline-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary, #0f172a);
}
.timeline-time {
  font-size: 11px;
  color: var(--text-tertiary, #64748b);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.timeline-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 10px 0;
  border-top: 1px solid var(--slate-200);
  border-bottom: 1px solid var(--slate-200);
  margin-bottom: 10px;
}
.timeline-stats > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ts-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
}
.ts-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
}
.timeline-bar {
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  background: var(--slate-200);
  margin-bottom: 6px;
}
.tb-seg { display: block; height: 100%; }
.timeline-foot {
  font-size: 11px;
  color: var(--text-tertiary, #64748b);
}

/* ----- Today by Facility table ----- */
.today-table { display: flex; flex-direction: column; }
/* Facility, Census, Staffed, Callouts, Open, Agency hrs, OT hrs, Labor cost, PPD, Status/Driver, View Detail */
.today-table { min-width: 980px; }
.today-table-head, .today-row {
  display: grid;
  grid-template-columns: 1.9fr 0.75fr 0.6fr 0.6fr 0.5fr 0.7fr 0.65fr 0.95fr 0.65fr 1.25fr 0.85fr;
  gap: 12px;
  align-items: center;
  padding: 11px 4px;
}
/* per-row View Detail link (last column) */
.today-row-action { display: flex; justify-content: flex-start; }
.tf-detail-link {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600; text-decoration: none;
  color: var(--accent-600, #1d4ed8);
  padding: 4px 10px; border-radius: 7px;
  border: 1px solid var(--border-subtle, #e2e8f0); background: #fff;
  white-space: nowrap; transition: background 0.12s, border-color 0.12s;
}
.tf-detail-link:hover { background: var(--accent-50, #eff6ff); border-color: var(--accent-500, #2563eb); }
.today-row-status { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.today-row-driver { font-size: 11px; color: #64748b; line-height: 1.2; }
.today-table-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary, #64748b);
  font-weight: 600;
  border-bottom: 1px solid var(--slate-200);
}
.today-row {
  border-bottom: 1px solid var(--slate-100);
}
.today-row:hover { background: var(--slate-50); }
.today-row:last-child { border-bottom: none; }
/* Status colors moved off inline styles into modifier classes (td-/today- scope). */
.today-table .unit-dot.is-critical { background: #ef4444; }
.today-table .unit-dot.is-watch    { background: #f59e0b; }
.today-table .unit-dot.is-good     { background: #22c55e; }
.today-table .unit-cap { color: #94a3b8; font-weight: 500; }
.today-table .unit-num.is-warn { color: #b45309; }
.today-table .unit-num.is-good { color: #15803d; }

/* ----- Agency cards grid ----- */
.agency-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 8px;
}
.agency-card {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  padding: 14px;
}
.agency-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--slate-200);
}
.agency-shifts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.agency-shift {
  font-size: 12px;
  color: var(--text-secondary, #475569);
  padding: 6px 10px;
  background: white;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

/* Agency · by-shift summary row (Day / Evening / Night) — moved off inline styles. */
.agency-byshift { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 14px; }
.agency-byshift-cell {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; background: var(--slate-50); border: 1px solid var(--slate-200); border-radius: 8px;
}
.agency-byshift-cell.is-heavy { background: #ffffff; border-color: #fecaca; }
.abs-shift { display: flex; align-items: center; gap: 8px; }
.abs-dot { width: 8px; height: 8px; border-radius: 3px; flex-shrink: 0; }
.abs-dot.is-day { background: #22c55e; }
.abs-dot.is-eve { background: #f59e0b; }
.abs-dot.is-night { background: #a855f7; }
.abs-name { font-size: 13px; font-weight: 600; color: #0f172a; }
.abs-tag { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.abs-count { font-size: 12px; color: #64748b; font-variant-numeric: tabular-nums; }
.abs-count strong { color: #0f172a; }
.abs-count.is-heavy, .abs-count.is-heavy strong { color: #b91c1c; }
@media (max-width: 760px) { .agency-byshift { grid-template-columns: 1fr; } }

@media (max-width: 1100px) {
  .shift-timeline { grid-template-columns: 1fr; }
  .agency-grid    { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .today-alert {
    grid-template-columns: 1fr;
  }
  .today-alert-actions { width: 100%; justify-content: flex-end; }
  .today-table-head, .today-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  /* stacked single-column table fits the viewport (no pointless inner scroll) */
  .today-table { min-width: 0; }
  .timeline-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════════════
   HERO — the focal point you land on. Two bands:
   (1) Problems (state-aware: LOUD red when gaps, CALM green when clear)
   (2) Money (the 3 dollar signals, large)
   Everything below the hero is SECONDARY detail and visually recedes.
   ══════════════════════════════════════════════════════════════════════ */
.today-hero {
  margin: 0 32px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ----- (1) Problems band — leads, but compact (not a slab) ----- */
.hero-problems {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  align-items: center;
  border: 1px solid;
  border-radius: 12px;
  padding: 12px 16px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.hero-problems-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.hero-problems-icon svg { width: 19px; height: 19px; }
.hero-problems-icon .icon-alert,
.hero-problems-icon .icon-ok { display: none; }
.hero-problems.is-critical .icon-alert,
.hero-problems.is-watch    .icon-alert { display: block; }
.hero-problems.is-clear    .icon-ok    { display: block; }

.hero-problems-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
/* Context eyebrow — ties the alert to the active filter selection. Static
   (today.js doesn't touch it), so it survives Today / Yesterday / This Week. */
.hero-problems-scope {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  opacity: 0.7;
  margin-bottom: 2px;
}
.hero-problems-headline {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.hero-problems-detail { font-size: 12.5px; line-height: 1.45; }
.hero-problems-stats { display: flex; gap: 16px; margin-top: 7px; flex-wrap: wrap; }
.hp-stat { display: flex; align-items: baseline; gap: 5px; }
.hp-stat-val { font-size: 14px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.hp-stat-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; opacity: 0.7;
}
.hero-problems-action { flex-shrink: 0; }

/* CRITICAL — LOUD. The red is earned by real gaps. */
.hero-problems.is-critical {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border-color: #fecaca;
  border-left: 4px solid #ef4444;
  box-shadow: none;
}
.hero-problems.is-critical .hero-problems-icon { background: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.hero-problems.is-critical .hero-problems-headline { color: #7f1d1d; }
.hero-problems.is-critical .hero-problems-detail { color: #991b1b; }
.hero-problems.is-critical .hp-stat-val { color: #b91c1c; }

/* WATCH — amber. Something to keep an eye on, not on fire. */
.hero-problems.is-watch {
  background: linear-gradient(135deg, #fffbeb 0%, #fff7ed 100%);
  border-color: #fde68a;
  border-left: 4px solid #f59e0b;
  box-shadow: none;
}
.hero-problems.is-watch .hero-problems-icon { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.hero-problems.is-watch .hero-problems-headline { color: #78350f; }
.hero-problems.is-watch .hero-problems-detail { color: #92400e; }
.hero-problems.is-watch .hp-stat-val { color: #b45309; }

/* CLEAR — CALM, low-key. Silence means safe. */
.hero-problems.is-clear {
  background: #f5fdf8;
  border-color: #bbf7d0;
  border-left: 4px solid #22c55e;
  box-shadow: none;
  padding: 10px 16px;
}
.hero-problems.is-clear .hero-problems-icon { background: rgba(34, 197, 94, 0.14); color: #15803d; }
.hero-problems.is-clear .hero-problems-headline { color: #14532d; font-size: 14px; font-weight: 600; }
.hero-problems.is-clear .hero-problems-detail { color: #166534; }
.hero-problems.is-clear .hp-stat-val { color: #15803d; }

/* ----- (2) Money band — 3 large dollar cards ----- */
.hero-money {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.money-card {
  background: #ffffff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.money-label {
  font-size: 11px; font-weight: 600; color: var(--text-tertiary, #64748b);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 7px;
}
.money-value-row { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; margin-bottom: 5px; }
.money-value {
  font-size: 25px; font-weight: 800; color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1;
}
.money-delta { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 5px; }
.money-compare { font-size: 12px; color: var(--text-tertiary, #64748b); margin-bottom: 12px; }
.money-meter { height: 5px; background: #f1f5f9; border-radius: 3px; overflow: hidden; }
.money-meter > div { height: 100%; border-radius: 3px; }

/* ----- Secondary efficiency strip (HPPD / PPD) — light, supporting ----- */
.today-secondary {
  margin: 10px 32px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 30px;
  padding: 12px 20px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 12px;
}
.sec-metric { display: inline-flex; align-items: baseline; gap: 8px; }
.sec-metric-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-tertiary, #64748b);
}
.sec-metric-value {
  font-size: 18px; font-weight: 800; color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
}
.sec-metric-delta { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.sec-metric-compare { font-size: 11px; color: var(--text-muted, #94a3b8); }

/* ══════════════════════════════════════════════════════════════════════
   DETAIL — everything below the hero. Recedes: muted group labels, the
   panels read as "scroll here for the why," not competing headlines.
   ══════════════════════════════════════════════════════════════════════ */
.detail-start {
  margin: 26px 32px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.detail-start-text {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}
.detail-start::after { content: ""; flex: 1; height: 1px; background: var(--slate-200); }

.detail-group-label {
  margin: 22px 32px 8px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.detail-group-label .dg-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--text-secondary, #475569);
  text-transform: uppercase;
}
.detail-group-label .dg-hint {
  font-size: 12px; font-weight: 500; color: var(--text-muted, #94a3b8);
}

@media (max-width: 900px) {
  .hero-money { grid-template-columns: 1fr; }
  .hero-problems { grid-template-columns: 54px 1fr; }
  .hero-problems-action { grid-column: 1 / -1; }
}

/* ── Mobile — keep the daily detail page from scrolling horizontally ─────── */
@media (max-width: 760px) {
  /* OT projection (Approaching OT + OT Projecting) is a fixed inline 2-col
     grid; stack it so the right panel doesn't push past the viewport. */
  .today-risk-grid { grid-template-columns: 1fr !important; }
}

/* ── Shared detail-card chrome ───────────────────────────────────────────
   Page-scoped classes that replace the repeated inline card styles on the
   Shift Breakdown, Hours Composition and OT Projection panels. Values are
   identical to the inline styles they replace — no visual change, just
   de-duplicated markup. */
.td-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
.td-card-title { font-size: 14px; font-weight: 700; color: #0f172a; letter-spacing: -0.01em; }
.td-card-sub   { font-size: 12px; color: #64748b; margin-top: 2px; }
.td-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; font-weight: 600; }
/* Padded body for panels whose content isn't a self-padded list/table. */
.td-panel-body { padding: 14px 18px 18px; }

/* ── Daily KPI cards — operations-priority grid (replaces the former inline
   money cards + secondary HPPD/PPD strip). today.js drives each card's
   <id>Label / Value / Delta / Compare / Meter. ── */
.today-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin: 0 32px 18px;
}
.td-kpi {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  padding: 13px 15px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.td-kpi-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-tertiary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.3;
  margin-bottom: 7px;
  min-height: 2.6em;
}
.td-kpi-value-row { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; margin-bottom: 5px; }
.td-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.td-kpi-delta {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.td-kpi-delta.is-over { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.td-kpi-delta.is-warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.td-kpi-delta.is-ok   { background: rgba(34, 197, 94, 0.12); color: #15803d; }
.td-kpi-compare {
  font-size: 11.5px;
  color: var(--text-tertiary, #64748b);
  line-height: 1.35;
  margin-bottom: 11px;
  flex: 1;
}
.td-kpi-meter { height: 5px; background: #f1f5f9; border-radius: 3px; overflow: hidden; margin-top: auto; }
.td-kpi-meter-fill { display: block; height: 100%; border-radius: 3px; }
.td-kpi-meter-fill.is-warn   { background: #f59e0b; }
.td-kpi-meter-fill.is-danger { background: #ef4444; }
.td-kpi-meter-fill.is-ok     { background: #22c55e; }
@media (max-width: 1280px) { .today-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .today-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-left: 20px;
    margin-right: 20px;
  }
}
@media (max-width: 360px) { .today-kpi-grid { grid-template-columns: 1fr; } }

/* Shift breakdown cards — red accent on elevated values + tabular foot. */
.ts-val.is-bad { color: #b91c1c; }
.timeline-foot { font-variant-numeric: tabular-nums; }
.timeline-foot strong { color: var(--text-primary, #0f172a); font-weight: 700; }

/* ══════════════════════════════════════════════════════════════════════
   COMPACT DAILY STATUS STRIP — replaces the former 6-card KPI grid. One thin
   read-only strip of labor signals; today.js drives <id>Label/Value/Delta.
   ══════════════════════════════════════════════════════════════════════ */
.today-status-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 0 32px 18px;
  background: #ffffff;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}
.tss-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 16px;
  border-right: 1px solid var(--slate-100, #f1f5f9);
}
.tss-item:last-child { border-right: none; }
.tss-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-tertiary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.3;
}
.tss-value-row { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.tss-value {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.tss-delta {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tss-delta.is-over { background: rgba(239, 68, 68, 0.12); color: #b91c1c; }
.tss-delta.is-warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.tss-delta.is-ok   { background: rgba(34, 197, 94, 0.12); color: #15803d; }
@media (max-width: 1200px) {
  .today-status-strip { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .today-status-strip {
    grid-template-columns: repeat(2, 1fr);
    margin-left: 20px;
    margin-right: 20px;
  }
}
@media (max-width: 360px) { .today-status-strip { grid-template-columns: 1fr; } }

/* ── Thin data-variance framing for the lead banner (was a louder alert).
   Keeps today.js state classes (is-critical/is-watch/is-clear) but reads as a
   data signal, not an action prompt. ── */
.today-hero .hero-problems { padding-top: 10px; padding-bottom: 10px; }
.hero-problems-scope { letter-spacing: 0.06em; }

/* ══════════════════════════════════════════════════════════════════════
   DAILY ANALYSIS PREVIEW — four compact summary cards + callouts mini strip.
   Each card teases an analysis whose full drilldown lives on today-detail.html.
   ══════════════════════════════════════════════════════════════════════ */
.daily-preview-cta, .callouts-cta { font-size: 12px; padding: 6px 14px; text-decoration: none; white-space: nowrap; flex-shrink: 0; }
.daily-preview-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.preview-card {
  background: #fff; border: 1px solid var(--slate-200, #e2e8f0); border-radius: 12px;
  padding: 13px 14px; display: flex; flex-direction: column; gap: 10px;
}
.preview-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.preview-card-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #0f172a; }
.preview-card-link { font-size: 11px; font-weight: 600; color: var(--accent-600, #2563eb); text-decoration: none; white-space: nowrap; }
.preview-card-link:hover { text-decoration: underline; }

.pc-shift-rows { display: flex; flex-direction: column; gap: 6px; }
.pc-shift-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.pc-shift-name { font-size: 12px; font-weight: 600; color: #0f172a; }
.pc-shift-nums { font-size: 11.5px; color: #64748b; font-variant-numeric: tabular-nums; text-align: right; }
.pc-shift-row .status-pill { font-size: 9px; padding: 1px 6px; }

.pc-hours { display: flex; flex-direction: column; gap: 8px; }
.pc-hours-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pc-hours-cap { font-size: 11px; color: #64748b; }
.pc-hours-var { font-size: 13px; font-weight: 800; color: #b91c1c; font-variant-numeric: tabular-nums; }
.pc-hours-bar { display: flex; height: 14px; border-radius: 5px; overflow: hidden; border: 1px solid var(--slate-200, #e2e8f0); }
.pc-hours-legend { display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: 10.5px; color: #64748b; }
.pc-hours-legend span { display: inline-flex; align-items: center; gap: 4px; }
.pc-hours-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.pc-legend-reg { background: #2563eb; } .pc-legend-ot { background: #f59e0b; }
.pc-legend-agency { background: #a855f7; } .pc-legend-pto { background: #14b8a6; }

.pc-stat-row { display: flex; gap: 10px; }
.pc-stat { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.pc-stat-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #94a3b8; white-space: nowrap; }
.pc-stat-val { font-size: 14px; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; }
.pc-stat-val.is-bad { color: #b91c1c; } .pc-stat-val.is-good { color: #15803d; }
.pc-foot { font-size: 11px; color: #64748b; font-variant-numeric: tabular-nums; margin-top: auto; }
.pc-foot strong { color: #0f172a; }

.callouts-mini { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.cm-stat { display: flex; flex-direction: column; gap: 1px; }
.cm-val { font-size: 18px; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; }
.cm-val.is-bad { color: #dc2626; }
.cm-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; }
.cm-note { font-size: 11.5px; color: #64748b; flex: 1; min-width: 220px; }

@media (max-width: 1280px) { .daily-preview-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .daily-preview-grid { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════════════════
   DAILY SNAPSHOT REBUILD — sticky filters, dual HPPD/PPD card, exception
   2-up grid, compact agency summary. Status cards reuse .today-kpi-grid/.td-kpi;
   driver cards reuse .daily-preview-grid/.preview-card/.pc-*.
   ══════════════════════════════════════════════════════════════════════ */

/* Dual HPPD / PPD status card — two mini metrics inside one .td-kpi shell. */
.td-kpi-pair { display: flex; gap: 18px; align-items: flex-start; }
.tk-pair { display: flex; flex-direction: column; gap: 3px; }
.tk-pair-label { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary, #94a3b8); }
.tk-pair-value { font-size: 18px; font-weight: 800; color: var(--text-primary, #0f172a); font-variant-numeric: tabular-nums; line-height: 1; }
.tk-pair-delta { font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--warning-700, #b45309); }

/* Exception summaries — 2-up (Callouts | Agency Summary). */
.exception-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; margin: 0 var(--space-8, 32px) 20px; }
.exception-grid > .panel { margin: 0; }

/* Compact agency summary list (exception panel). */
.agency-summary-list { display: flex; flex-direction: column; }
.agency-summary-row {
  display: grid; grid-template-columns: 1.4fr 0.7fr 0.7fr 0.9fr 1.2fr; gap: 10px; align-items: center;
  padding: 9px 4px; border-bottom: 1px solid var(--slate-100, #f1f5f9); font-size: 12.5px;
}
.agency-summary-row:last-child { border-bottom: none; }
.agency-summary-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary, #64748b); font-weight: 600; }
.agency-summary-row .as-name { font-weight: 600; color: var(--text-primary, #0f172a); }
.agency-summary-row .as-num { font-variant-numeric: tabular-nums; color: var(--text-secondary, #475569); }
.agency-summary-row .as-fac { color: var(--text-tertiary, #64748b); }

@media (max-width: 900px) { .exception-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .agency-summary-row { grid-template-columns: 1fr 1fr; row-gap: 2px; }
  .agency-summary-row .as-fac { grid-column: 1 / -1; }
}

/* ══════════════════════════════════════════════════════════════════════
   TODAY SNAPSHOT (rebuild) — page-specific styles for today.html.
   Prefixes: ts- (today-snapshot components), reuses td-/today-/.panel chrome.
   Clean compact Cloud UI; tabular numerals on every $/hr/%/PPD value; red is
   reserved for genuinely critical signals (status pills + critical open gaps).
   ══════════════════════════════════════════════════════════════════════ */

/* ----- Watchlist panel placement + header count ----- */
.ts-panel { margin: 0 var(--space-8, 32px) 22px; }
.ts-watch-count {
  font-size: 12px; font-weight: 600; color: var(--text-tertiary, #64748b);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* The table scrolls horizontally inside its own panel on narrow viewports —
   the only element allowed to scroll sideways on mobile. */
.ts-watch-scroll { overflow-x: auto; }
.ts-watch { min-width: 940px; }

.ts-watch-head, .ts-watch-row {
  display: grid;
  grid-template-columns: 1.7fr 0.95fr 1.5fr 1fr 0.55fr 0.8fr 0.7fr 0.6fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 11px var(--space-5, 20px);
}
.ts-watch-head {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary, #64748b); font-weight: 600;
  border-bottom: 1px solid var(--slate-200, #e2e8f0);
}
.ts-watch-row { border-bottom: 1px solid var(--slate-100, #f1f5f9); }
.ts-watch-row:last-child { border-bottom: none; }
.ts-watch-row:hover { background: var(--slate-50, #f8fafc); }
.ts-num { text-align: right; font-variant-numeric: tabular-nums; }
.ts-watch-detail-h { text-align: left; }

.ts-fac { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ts-fac-name { font-size: 13px; font-weight: 700; color: var(--text-primary, #0f172a); }
.ts-fac-sub { font-size: 11px; color: var(--text-tertiary, #64748b); font-variant-numeric: tabular-nums; }
.ts-driver-cell { font-size: 12px; color: var(--text-secondary, #475569); line-height: 1.3; }
.ts-var { font-weight: 700; }
.ts-var.is-good { color: #15803d; }
.ts-var.is-warn { color: #b45309; }
.ts-var.is-over { color: #b91c1c; }
.ts-watch-action { display: flex; justify-content: flex-start; }
.ts-watch-empty { padding: 22px var(--space-5, 20px); color: var(--text-tertiary, #64748b); font-size: 13px; }

/* ----- Driver Cockpit — four compact summary cards ----- */
.ts-cockpit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;          /* equal-height driver cards across rows */
  gap: 12px;
  margin: 0 var(--space-8, 32px) 24px;
}
.ts-driver-card {
  background: #fff;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  padding: 14px 15px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ts-driver-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ts-driver-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--text-secondary, #475569);
}
.ts-driver-chip {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
.ts-driver-chip.is-warn { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.ts-driver-chip.is-ok { background: rgba(34, 197, 94, 0.13); color: #15803d; }
.ts-driver-chip.is-neutral { background: var(--slate-100, #f1f5f9); color: var(--text-tertiary, #64748b); font-variant-numeric: tabular-nums; }
.ts-driver-value {
  font-size: 21px; font-weight: 800; color: var(--text-primary, #0f172a);
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1;
}
.ts-driver-meta { font-size: 11.5px; color: var(--text-tertiary, #64748b); font-variant-numeric: tabular-nums; line-height: 1.35; margin-top: auto; }

/* Hours-mix mini bar + legend */
.ts-mix-bar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  border: 1px solid var(--slate-200, #e2e8f0); background: var(--slate-100, #f1f5f9);
}
.ts-mix-bar i { display: block; height: 100%; }
.ts-mix-reg { background: #2563eb; }
.ts-mix-ot { background: #f59e0b; }
.ts-mix-agency { background: #a855f7; }
.ts-mix-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; color: var(--text-tertiary, #64748b); font-variant-numeric: tabular-nums; }
.ts-mix-legend span { display: inline-flex; align-items: center; gap: 4px; }
.ts-mix-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* ----- Exceptions Snapshot — two compact cards ----- */
.ts-exc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0 var(--space-8, 32px) 24px;
}
.ts-exc-card {
  background: #fff;
  border: 1px solid var(--slate-200, #e2e8f0);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  padding: 15px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ts-exc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ts-exc-title { font-size: 13px; font-weight: 700; color: var(--text-primary, #0f172a); letter-spacing: -0.01em; }
.ts-exc-count { font-size: 20px; font-weight: 800; color: var(--text-primary, #0f172a); font-variant-numeric: tabular-nums; line-height: 1; }
.ts-exc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ts-exc-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "main tag" "sub tag";
  align-items: center;
  column-gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--slate-100, #f1f5f9);
}
.ts-exc-row:last-child { border-bottom: none; }
.ts-exc-main { grid-area: main; display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.ts-exc-name { font-size: 12.5px; font-weight: 700; color: var(--text-primary, #0f172a); }
.ts-exc-role { font-size: 11px; color: var(--text-tertiary, #64748b); }
.ts-exc-sub { grid-area: sub; font-size: 11px; color: var(--text-tertiary, #64748b); margin-top: 1px; }
.ts-exc-tag {
  grid-area: tag; justify-self: end; white-space: nowrap;
  font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.ts-tag-amber { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.ts-tag-calm { background: rgba(34, 197, 94, 0.13); color: #15803d; }
.ts-exc-none { font-size: 12px; color: var(--text-tertiary, #94a3b8); font-style: italic; padding: 8px 0; }
.ts-exc-link {
  font-size: 12px; font-weight: 600; color: var(--accent-600, #2563eb);
  text-decoration: none; margin-top: auto;
}
.ts-exc-link:hover { text-decoration: underline; }

/* HPPD/PPD dual card — neutral caption under PPD (overrides amber pair-delta) */
.tk-pair-sub { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary, #94a3b8); }

/* ----- CTA row ----- */
.ts-cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px var(--space-8, 32px) 36px; }
.ts-cta { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }

/* ----- Responsive ----- */
@media (max-width: 1280px) { .ts-cockpit-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .ts-exc-grid { grid-template-columns: 1fr; } }
@media (max-width: 620px)  { .ts-cockpit-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .ts-panel { margin-left: var(--space-5, 20px); margin-right: var(--space-5, 20px); }
  .ts-cockpit-grid, .ts-exc-grid, .ts-cta-row { margin-left: var(--space-5, 20px); margin-right: var(--space-5, 20px); }
  /* Four header chips wrap instead of overflowing the viewport. */
  .today-header .portfolio-summary { flex-wrap: wrap; gap: 10px 18px; }
  .today-header .summary-divider { display: none; }
}

/* ══════════════════════════════════════════════════════════════════════
   TODAY DETAIL (today-detail.html) — the source-level investigation grid.
   Prefix: td-. One heavy expandable tree grid + a sticky inspector. Dense but
   readable; tabular numerals on every $/hr value; nesting depth is read off
   the row tint (facility strongest → source row muted).
   ══════════════════════════════════════════════════════════════════════ */

/* Topbar action buttons (page supplies its own — no shared injector here) */
.td-topbtn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

/* Detail-search sizing inside the canonical FilterBar. */
.td-search-group { flex: 1 1 220px; }
.td-search {
  height: 34px; padding: 0 12px; font: inherit; font-size: 13px; width: 100%;
  background: #fff; border: 1px solid var(--slate-200, #e2e8f0); border-radius: 999px;
  color: var(--text-primary, #0f172a); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.12s, box-shadow 0.18s;
}
.td-search:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14); }

/* Sticky toolbar */
.td-toolbar {
  position: relative; top: auto; z-index: 7;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin: 0 0 16px; padding: 11px var(--space-8, 32px);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: saturate(1.4) blur(6px); backdrop-filter: saturate(1.4) blur(6px);
  border-top: 1px solid var(--border-subtle, #e2e8f0);
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
}
.td-btn {
  appearance: none; display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border-default, #cbd5e1); background: #fff; color: var(--text-secondary, #475569);
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.td-btn:hover { background: var(--slate-50, #f8fafc); border-color: var(--accent-300, #93c5fd); }
.td-btn-primary { background: var(--accent-600, #2563eb); border-color: var(--accent-600, #2563eb); color: #fff; }
.td-btn-primary:hover { background: var(--accent-700, #1d4ed8); border-color: var(--accent-700, #1d4ed8); }
.td-tool-sep { width: 1px; height: 24px; background: var(--slate-200, #e2e8f0); }
.td-tool-field { display: inline-flex; align-items: center; gap: 8px; }
.td-tool-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary, #94a3b8); }
.td-tool-spacer { flex: 1 1 auto; }
.td-toolbar .filter-segmented { flex-shrink: 0; }
.td-scope-control {
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px;
  min-width: 172px; min-height: 30px; padding: 5px 10px;
  border: 1px solid var(--slate-200, #e2e8f0); border-radius: 999px;
  background: var(--slate-50, #f8fafc); color: var(--text-secondary, #475569);
  font-size: 12px; white-space: nowrap;
}
.td-scope-clear {
  margin-left: auto; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--accent-600, #1d4ed8); font: inherit; font-weight: 700;
}
.td-toggle {
  appearance: none; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--border-default, #cbd5e1); background: #fff; color: var(--text-secondary, #475569);
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 999px;
}
.td-toggle-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--slate-300, #cbd5e1); transition: background 0.12s; }
.td-toggle.is-on { border-color: var(--accent-300, #93c5fd); background: var(--accent-50, #eff6ff); color: var(--accent-700, #1d4ed8); }
.td-toggle.is-on .td-toggle-dot { background: var(--accent-500, #2563eb); }

/* Layout: grid + inspector */
.td-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 16px;
  margin: 0 var(--space-8, 32px) 32px; align-items: start;
}
.td-grid-card { background: #fff; border: 1px solid var(--border-subtle, #e2e8f0); border-radius: var(--radius-lg, 14px); overflow: hidden; min-width: 0; }
.td-gridwrap { overflow: auto; max-height: calc(100vh - 210px); -webkit-overflow-scrolling: touch; }

/* The grid itself */
.td-grid { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 1180px; font-variant-numeric: tabular-nums; }
.td-grid thead th {
  position: sticky; top: 0; z-index: 3; background: var(--slate-50, #f8fafc);
  color: var(--text-secondary, #475569); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; padding: 9px 12px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--border-subtle, #e2e8f0);
}
.td-grid thead th.td-c-name { text-align: left; }
.td-grid thead th.td-c-driver, .td-grid thead th.td-c-status { text-align: left; }
.td-grid thead th.td-corner { position: sticky; left: 0; z-index: 5; }

.td-grid tbody td, .td-grid tbody th.td-c-name {
  padding: 8px 12px; text-align: right; font-size: 12.5px; color: var(--text-secondary, #475569);
  border-bottom: 1px solid var(--slate-100, #f1f5f9); white-space: nowrap; background: #fff;
}
.td-grid.is-compact tbody td, .td-grid.is-compact tbody th.td-c-name { padding: 4px 12px; font-size: 11.5px; }
.td-c-name { text-align: left !important; position: sticky; left: 0; z-index: 2; min-width: 260px; }
.td-c-status, .td-c-driver { text-align: left !important; }
.td-c-driver { color: var(--text-tertiary, #64748b); }
.td-strong { font-weight: 700; color: var(--text-primary, #0f172a); }
.td-dim { color: var(--slate-300, #cbd5e1); }
.td-over { color: #b91c1c; font-weight: 700; }
.td-under { color: #15803d; font-weight: 700; }

.td-name-inner { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; }
.td-name-text { display: inline-flex; flex-direction: column; gap: 1px; min-width: 0; }
.td-name-main { color: var(--text-primary, #0f172a); }
.td-name-sub { font-size: 10.5px; font-weight: 500; color: var(--slate-500, #64748b); }
.td-chev-wrap { display: inline-flex; flex-shrink: 0; color: var(--text-tertiary, #94a3b8); transition: transform 0.12s ease; }
.td-chev-wrap.is-open { transform: rotate(90deg); }
.td-chev-spacer { width: 11px; flex-shrink: 0; display: inline-block; }

/* Row-level nesting tints (facility strongest → source row muted) */
.td-row-facility > * { background: #eef2f7 !important; }
.td-row-facility .td-name-main { font-weight: 800; }
.td-row-department > * { background: #f8fafc !important; }
.td-row-department .td-name-main { font-weight: 700; }
.td-row-position .td-name-main { font-weight: 600; color: #334155; }
.td-row-employee .td-name-main { font-weight: 500; color: #475569; }
.td-row-shift > * { font-size: 11.5px; color: #64748b; }
.td-row-shift .td-name-main { font-weight: 400; color: #64748b; }
.td-grid.is-compact .td-row-shift > * { font-size: 11px; }
.td-row.is-expandable { cursor: pointer; }
.td-grid tbody tr.td-row.is-expandable:hover > * { background: #eff6ff !important; }
.td-grid tbody tr.td-row.is-selected > * { background: #e0e7ff !important; }
.td-row-empty td { padding: 22px 16px; text-align: center; color: var(--text-tertiary, #94a3b8); font-size: 13px; }

/* Inspector */
.td-insp {
  position: sticky; top: calc(var(--topbar-h, 64px) + 70px); align-self: start;
  background: #fff; border: 1px solid var(--border-subtle, #e2e8f0); border-radius: 14px;
  padding: 16px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  max-height: calc(100vh - 150px); overflow: auto;
}
.td-insp-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 28px 12px; color: var(--text-tertiary, #94a3b8); font-size: 13px; }
.td-insp-empty-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--slate-50, #f8fafc); color: var(--slate-300, #cbd5e1); }
.td-insp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--slate-100, #f1f5f9); }
.td-insp-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #fff; background: var(--accent-600, #2563eb); padding: 2px 8px; border-radius: 999px; }
.td-insp-name { font-size: 16px; font-weight: 800; color: var(--text-primary, #0f172a); flex: 1 1 100%; letter-spacing: -0.01em; }
.td-insp-section { margin-top: 14px; }
.td-insp-h { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary, #94a3b8); margin-bottom: 8px; }
.td-insp-kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 5px 0; font-size: 12.5px; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--slate-100, #f1f5f9); }
.td-insp-kv:last-child { border-bottom: none; }
.td-insp-k { color: var(--text-secondary, #475569); font-weight: 600; }
.td-insp-v { color: var(--text-primary, #0f172a); }
.td-insp-bar-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.td-insp-bar-k { font-size: 11.5px; color: var(--text-secondary, #475569); font-variant-numeric: tabular-nums; }
.td-insp-bar-k strong { color: var(--text-primary, #0f172a); }
.td-insp-bar { display: block; height: 8px; border-radius: 4px; overflow: hidden; background: var(--slate-100, #f1f5f9); }
.td-insp-bar i { display: block; height: 100%; }
.td-insp-bar-overlay { margin-bottom: 2px; }
.td-insp-why { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary, #475569); margin: 0; background: var(--slate-50, #f8fafc); border: 1px solid var(--slate-100, #f1f5f9); border-radius: 8px; padding: 10px 12px; }
.td-insp-src { margin-top: 14px; font-size: 10.5px; color: var(--text-muted, #94a3b8); font-variant-numeric: tabular-nums; }

/* Responsive */
@media (max-width: 1180px) {
  .td-layout { grid-template-columns: 1fr; }
  .td-insp { position: static; max-height: none; top: auto; }
}
@media (max-width: 760px) {
  .td-toolbar { padding-left: var(--space-5, 20px); padding-right: var(--space-5, 20px); }
  .td-layout { margin-left: var(--space-5, 20px); margin-right: var(--space-5, 20px); }
  .today-header .portfolio-summary { flex-wrap: wrap; }
}

/* ══════════════════════════════════════════════════════════════════════
   DAILY BRIEF (today.html) — two lenses, dual watchlist, debrief package.
   Prefix: brief- / bw- (brief watchlist) / db- (debrief package).
   Calm + premium: yesterday reads cool/settled, today reads forward. Red is
   reserved for genuinely critical items (critical gaps, critical status pill).
   ══════════════════════════════════════════════════════════════════════ */

/* Two lenses side by side */
.brief-lenses { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 0 var(--space-8, 32px) 22px; }
.brief-lens { background: #fff; border: 1px solid var(--slate-200, #e2e8f0); border-radius: 14px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); }
.brief-lens.is-yesterday { border-top: 3px solid #94a3b8; }
.brief-lens.is-today { border-top: 3px solid #2563eb; }
.brief-lens.is-active { box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16), 0 1px 3px rgba(15, 23, 42, 0.04); }
.brief-lens.is-yesterday.is-active { box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.22), 0 1px 3px rgba(15, 23, 42, 0.04); }

.brief-lens-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--slate-100, #f1f5f9); margin-bottom: 12px; }
.brief-lens-eyebrow { display: block; font-size: 13px; font-weight: 800; color: var(--text-primary, #0f172a); letter-spacing: -0.01em; }
.brief-lens-date { display: block; font-size: 11px; color: var(--text-muted, #94a3b8); margin-top: 2px; }
.brief-lens-total { text-align: right; flex-shrink: 0; }
.brief-lens-amt { display: block; font-size: 20px; font-weight: 800; color: var(--text-primary, #0f172a); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.brief-lens-pill { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.brief-lens-pill.is-over { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.brief-lens-pill.is-good { background: rgba(34, 197, 94, 0.13); color: #15803d; }

.brief-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; }
.brief-kpi { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px solid #f6f8fb; min-width: 0; }
.brief-kpi-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted, #94a3b8); }
.brief-kpi-val { font-size: 13.5px; font-weight: 700; color: var(--text-primary, #0f172a); font-variant-numeric: tabular-nums; line-height: 1.3; }
.brief-kpi-val.is-warn { color: #b45309; }
.brief-kpi-val.is-good { color: #15803d; }
.brief-kpi-val.is-crit { color: #b91c1c; }

.brief-notes { margin-top: 14px; background: var(--slate-50, #f8fafc); border: 1px solid #eef2f7; border-radius: 10px; padding: 12px 14px; }
.brief-notes-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-secondary, #64748b); margin-bottom: 8px; }
.brief-note { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-secondary, #475569); line-height: 1.45; padding: 3px 0; }
.brief-note-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--slate-300, #cbd5e1); margin-top: 6px; flex-shrink: 0; }

/* Dual facility watchlist (10 columns) */
#briefWatch { min-width: 1120px; }
.bw-head, .bw-row { display: grid; grid-template-columns: 1.5fr 1.25fr 1.1fr 0.9fr 1.1fr 0.9fr 0.7fr 0.6fr 0.55fr 0.95fr; gap: 12px; align-items: center; padding: 10px var(--space-5, 20px); }
.bw-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary, #64748b); font-weight: 600; border-bottom: 1px solid var(--slate-200, #e2e8f0); }
.bw-row { border-bottom: 1px solid var(--slate-100, #f1f5f9); }
.bw-row:last-child { border-bottom: none; }
.bw-row:hover { background: var(--slate-50, #f8fafc); }
.bw-driver { font-size: 11.5px; color: var(--text-secondary, #475569); }
.bw-pill { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bw-pill.is-over { background: rgba(245, 158, 11, 0.15); color: #b45309; }
.bw-pill.is-good { background: rgba(34, 197, 94, 0.13); color: #15803d; }

/* Debrief package */
.brief-debrief .db-body { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; padding: 16px var(--space-5, 20px) 18px; }
.db-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted, #94a3b8); margin-bottom: 10px; }
.db-recipient { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid #f6f8fb; font-size: 12.5px; }
.db-recipient-field { font-size: 10px; font-weight: 700; color: var(--text-secondary, #64748b); background: var(--slate-100, #f1f5f9); border-radius: 5px; padding: 1px 6px; min-width: 26px; text-align: center; }
.db-recipient-role { color: var(--text-primary, #0f172a); font-weight: 600; }
.db-recipient-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--text-tertiary, #64748b); background: #eef2f7; border-radius: 5px; padding: 1px 6px; }
.db-check { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; color: var(--text-secondary, #334155); cursor: pointer; }
.db-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.db-btn { width: 100%; justify-content: flex-start; }
.db-note { font-size: 11.5px; color: #15803d; min-height: 16px; }

/* Debrief email preview modal */
.db-modal { position: fixed; inset: 0; z-index: 1400; display: flex; align-items: center; justify-content: center; padding: 24px; }
.db-modal[hidden] { display: none !important; }
.db-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); }
.db-modal-panel { position: relative; width: min(680px, 100%); max-height: 85vh; display: flex; flex-direction: column; background: #fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); overflow: hidden; }
.db-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--slate-200, #e2e8f0); }
.db-modal-head strong { font-size: 14px; color: var(--text-primary, #0f172a); }
.db-modal-sub { display: block; font-size: 11px; color: var(--text-tertiary, #64748b); margin-top: 2px; }
.db-modal-close { appearance: none; border: 0; background: transparent; cursor: pointer; color: var(--text-tertiary, #64748b); padding: 5px; border-radius: 6px; line-height: 0; }
.db-modal-close:hover { background: var(--slate-100, #f1f5f9); color: var(--text-primary, #0f172a); }
.db-modal-body { margin: 0; padding: 16px 18px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; color: var(--text-secondary, #334155); white-space: pre-wrap; background: var(--slate-50, #f8fafc); flex: 1; }
.db-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--slate-200, #e2e8f0); }
.db-modal-foot .td-btn { text-decoration: none; }

/* Responsive */
@media (max-width: 1100px) {
  .brief-lenses { grid-template-columns: 1fr; }
  .brief-debrief .db-body { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .brief-lenses { margin-left: var(--space-5, 20px); margin-right: var(--space-5, 20px); }
  .brief-kpis { grid-template-columns: 1fr; }
}

/* Print / Save PDF — keep the briefing, drop the chrome */
@media print {
  .brief-debrief, .ts-cta-row, .db-modal,
  .ai-bubble, .ai-panel, .detail-group-label { display: none !important; }
  .brief-lenses { grid-template-columns: 1fr 1fr; }
  .ts-watch-scroll { overflow: visible; }
  #briefWatch { min-width: 0; }
  body { background: #fff; }
}
