/* Rundown / NRCS board */
.rd-page { display:flex; flex-direction:column; height:100%; min-height:0; background:var(--bg-0); }

/* ── Masthead: identity → clocks → state, one calm row ─────────────────────── */
.rd-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 20px; border-bottom:1px solid var(--border); background:var(--bg-1); gap:20px; flex-wrap:wrap;
}
.rd-head-left, .rd-head-right { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.rd-head .rd-pip { height:26px; }
.rd-viewtabs { display:flex; align-items:center; gap:4px; }
.rd-title { font-size:var(--fs-lg); font-weight:700; white-space:nowrap; }
.rd-title-sub { color:var(--text-3); font-weight:400; font-size:var(--fs-sm); margin-left:6px; }
.rd-select, .rd-input {
  background:var(--bg-2); border:1px solid var(--border); color:var(--text-2);
  font-size:var(--fs-sm); padding:6px 10px; border-radius:var(--r-md);
}
.rd-select:focus, .rd-input:focus { outline:none; border-color:var(--info); }
.rd-input.grow { flex:1; min-width:140px; }

.rd-clock-block { text-align:right; }
.rd-clock-label { font-size:var(--fs-2xs); color:var(--text-3); text-transform:uppercase; letter-spacing:0.1em; }
.rd-clock-time { font-family:var(--font-mono); font-size:var(--fs-xl); font-weight:700; font-variant-numeric:tabular-nums; }
.rd-clock-time.over { color:var(--danger); }
.rd-clock-time.under { color:var(--success); }
.rd-pip {
  display:inline-flex; align-items:center; gap:7px; padding:5px 12px; border-radius:999px;
  background:var(--bg-2); border:1px solid var(--border); font-size:var(--fs-xs); font-weight:600;
  color:var(--text-3); text-transform:uppercase; letter-spacing:0.05em;
}
.rd-pip.live { background:var(--live-soft); border-color:var(--live); color:var(--live); }
.rd-dot { width:7px; height:7px; border-radius:50%; background:var(--live); box-shadow:0 0 0 3px var(--live-soft); }
.rd-error {
  margin:10px 20px 0; padding:10px 12px; border-radius:var(--r-md);
  background:var(--danger-soft); color:var(--danger); border:1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  font-size:var(--fs-sm);
}

.rd-layout { display:grid; grid-template-columns:1fr 280px; flex:1; min-height:0; }
.rd-main { overflow-y:auto; padding:16px 20px; }
.rd-side { border-left:1px solid var(--border); background:var(--bg-1); padding:16px; overflow-y:auto; }

/* ── Toolbar: build (quiet, left) / transport (loud, right) ────────────────── */
.rd-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.rd-toolbar .btn, .rd-toolbar .rd-input, .rd-toolbar .rd-select { height:32px; }
.rd-toolbar .btn.ghost { background:transparent; border-color:transparent; color:var(--text-3); }
.rd-toolbar .btn.ghost:hover { color:var(--text-1); background:var(--bg-2); }
.rd-spacer { flex:1; }

/* ── Segments ──────────────────────────────────────────────────────────────── */
.rd-segment { margin-bottom:20px; }
.rd-seg-head {
  display:flex; align-items:center; justify-content:space-between;
  padding:6px 4px; border-bottom:1px solid var(--border-strong); margin-bottom:6px;
}
.rd-seg-name { font-size:var(--fs-sm); font-weight:700; text-transform:uppercase; letter-spacing:0.08em; color:var(--text-2); }
.rd-seg-dur { font-family:var(--font-mono); font-size:var(--fs-xs); color:var(--text-3); }

/* ── Item rows: strict grid — kind | cue | hit | body | dur | actions ──────── */
.rd-item {
  display:grid;
  grid-template-columns:26px 54px 64px minmax(0,1fr) auto 64px;
  align-items:center; gap:10px;
  padding:8px 12px; border-radius:var(--r-md);
  border:1px solid var(--border); background:var(--bg-2); margin-bottom:4px; cursor:default;
  position:relative;
}
.rd-item:hover { background:var(--bg-3); }
.rd-item.on-air {
  border-color:var(--live); background:var(--live-soft);
  box-shadow:0 0 0 1px var(--live-soft), 0 4px 20px rgba(255,59,48,0.15);
}
.rd-item.played { opacity:0.4; }
.rd-kind {
  width:26px; height:26px; border-radius:var(--r-sm); display:flex; align-items:center; justify-content:center;
  font-size:var(--fs-xs); font-weight:700; flex-shrink:0; line-height:1;
}
.rd-kind.story { background:var(--info-soft); color:var(--info); }
.rd-kind.clip { background:var(--purple-soft); color:var(--purple); }
.rd-kind.live { background:var(--danger-soft); color:var(--danger); }
.rd-kind.graphic { background:var(--warning-soft); color:var(--warning); }
.rd-kind.delay { background:var(--warning-soft); color:var(--warning); }

.rd-cue {
  font-family:var(--font-mono); font-size:var(--fs-xs); font-weight:700; color:var(--info);
  text-align:center; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.rd-cue.empty { color:var(--text-4); }

.rd-hit { font-family:var(--font-mono); font-size:var(--fs-xs); color:var(--text-3); text-align:right; font-variant-numeric:tabular-nums; }
.rd-hit-expected { font-size:var(--fs-2xs); }
.rd-hit-expected.behind { color:var(--danger); }
.rd-hit-expected.ahead { color:var(--success); }

.rd-item-main { min-width:0; }
.rd-item-title { font-size:var(--fs-md); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.rd-item-badges { display:flex; align-items:center; gap:6px; margin-top:2px; min-height:14px; }
.rd-badge {
  font-size:var(--fs-2xs); text-transform:uppercase; letter-spacing:0.05em; font-weight:600;
  padding:1px 6px; border-radius:var(--r-sm);
  background:var(--bg-4); color:var(--text-4);
}
.rd-badge.standby { background:var(--warning-soft); color:var(--warning); }
.rd-badge.auto { background:var(--info-soft); color:var(--info); }
.rd-badge.script { background:transparent; color:var(--text-4); padding-left:0; }
/* PLY-002 (#376): take committed to the DB, transport never confirmed. Must
   read as an alarm, not a status — the row otherwise looks normally on-air. */
.rd-badge.dispatch-failed { background:var(--danger-soft); color:var(--danger); font-weight:600; }

.rd-item-dur { font-family:var(--font-mono); font-size:var(--fs-sm); color:var(--text-2); min-width:48px; text-align:right; font-variant-numeric:tabular-nums; }
.rd-added { color:var(--warning); font-size:var(--fs-xs); }

/* Status chip lives in the actions column; hover swaps it for the buttons.
   Fixed min-width + height so the row doesn't shift when they swap. */
.rd-item-end { display:flex; justify-content:flex-end; align-items:center; min-width:64px; min-height:24px; }
.rd-status {
  display:inline-flex; align-items:center; line-height:1;
  font-size:var(--fs-2xs); text-transform:uppercase; letter-spacing:0.05em;
  padding:3px 8px; border-radius:999px; font-weight:600; background:var(--bg-4); color:var(--text-4);
}
.rd-status.ready { background:var(--success-soft); color:var(--success); }
.rd-status.on_air { background:var(--live); color:#fff; }
.rd-status.played, .rd-status.skipped, .rd-status.skip { background:var(--bg-4); color:var(--text-4); }
.rd-actions { display:none; gap:4px; align-items:center; }
.rd-item:hover .rd-actions { display:flex; }
.rd-item:hover .rd-status { display:none; }
/* Fixed square hover buttons so glyphs (⤼ ⚙ ↩) center and don't wobble the row */
.rd-actions .btn {
  width:24px; height:24px; min-height:24px; padding:0; line-height:1;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:var(--fs-sm);
}

/* Delay rows: schedule furniture, not content — quieter than real items */
.rd-item.rd-delay {
  border-style:dashed; border-color:color-mix(in srgb, var(--warning) 45%, var(--border));
  background:transparent; opacity:0.9;
}
.rd-item.rd-delay .rd-item-title { font-size:var(--fs-sm); font-weight:500; color:var(--warning); }
.rd-item.skip-flag { opacity:0.4; }
.rd-item.skip-flag .rd-item-title { text-decoration:line-through; }
.rd-item.standby { border-color:var(--warning); box-shadow:0 0 0 1px var(--warning-soft); }

/* ── Add row: one quiet line, only under an open rundown ───────────────────── */
.rd-add-panel {
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
  margin-top:16px; padding:10px 12px; border:1px dashed var(--border); border-radius:var(--r-md);
}
.rd-empty { color:var(--text-3); padding:40px 0; text-align:center; }

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.rd-side-title { font-size:var(--fs-2xs); text-transform:uppercase; letter-spacing:0.1em; color:var(--text-3); margin-bottom:10px; }
.rd-next-block { padding:12px; border-radius:var(--r-md); background:var(--bg-2); border:1px solid var(--border); }
.rd-next-title { font-size:var(--fs-md); font-weight:600; }
.rd-next-meta { font-size:var(--fs-xs); color:var(--text-3); margin-top:4px; }
.rd-stat {
  display:flex; justify-content:space-between; padding:6px 0; font-size:var(--fs-sm);
  border-bottom:1px solid var(--border); color:var(--text-2);
}
.btn.danger { color:var(--live); border-color:color-mix(in srgb, var(--live) 40%, var(--border)); }

@media (max-width: 900px) {
  .rd-layout { grid-template-columns: 1fr; }
  .rd-side { border-left:none; border-top:1px solid var(--border); }
  .rd-item { grid-template-columns:26px minmax(0,1fr) auto 64px; }
  .rd-cue, .rd-hit { display:none; }
}

/* ── World clock (iNews-style masthead) ────────────────────────────────────── */
.rd-worldclock { display:flex; gap:14px; align-items:center; }
.rd-wc-zone { text-align:center; }
.rd-wc-label { font-size:var(--fs-2xs); text-transform:uppercase; letter-spacing:0.1em; color:var(--text-3); }
.rd-wc-time { font-family:var(--font-mono); font-size:var(--fs-lg); font-weight:600; color:var(--text-1); font-variant-numeric:tabular-nums; }
@media (max-width: 1250px) { .rd-worldclock .rd-wc-zone:nth-child(n+3) { display:none; } }

/* ── Timing engine (ontime-inspired) ───────────────────────────────────────── */
.rd-offset-badge {
  font-family:var(--font-mono); font-size:var(--fs-lg); font-weight:700;
  padding:2px 10px; border-radius:var(--r-sm); font-variant-numeric:tabular-nums;
  background:var(--bg-4); color:var(--text-2);
}
.rd-offset-badge.behind { background:var(--danger-soft); color:var(--danger); }
.rd-offset-badge.ahead { background:var(--success-soft); color:var(--success); }

/* On-air strip: the ONE loud element on the page — timer + trim + TAKE */
.rd-onair-strip {
  display:flex; align-items:center; gap:18px; flex-wrap:wrap;
  padding:12px 16px; margin-bottom:14px; border-radius:var(--r-md);
  border:1px solid var(--live); background:var(--live-soft);
}
.rd-onair-timer { flex:1; min-width:200px; }
.rd-onair-timer-label { font-size:var(--fs-xs); text-transform:uppercase; letter-spacing:0.08em; color:var(--text-3); }
.rd-onair-timer-time {
  font-family:var(--font-mono); font-size:44px; font-weight:700; line-height:1.1;
  font-variant-numeric:tabular-nums; color:var(--text-1);
}
.rd-onair-timer.warning .rd-onair-timer-time { color:var(--warning); }
.rd-onair-timer.danger .rd-onair-timer-time { color:var(--danger); }
.rd-onair-timer.overtime .rd-onair-timer-time { color:var(--danger); font-weight:700; }
@keyframes rd-blink { 50% { opacity:0.55; } }
.rd-onair-added { font-size:var(--fs-xs); color:var(--warning); }
.rd-addtime { display:flex; gap:6px; }
.btn.rd-take {
  font-size:var(--fs-md); font-weight:800; letter-spacing:0.08em; text-transform:uppercase;
  padding:14px 28px; border-radius:var(--r-md);
  background:var(--live); border-color:var(--live); color:#fff;
}
.btn.rd-take:hover { filter:brightness(1.12); }

/* ── Inline item editor ────────────────────────────────────────────────────── */
.rd-item-editor {
  display:flex; flex-wrap:wrap; gap:10px; align-items:end; padding:10px 12px; margin:-2px 0 8px;
  border:1px dashed var(--border); border-radius:var(--r-md); background:var(--bg-2);
}
.rd-item-editor label { display:flex; flex-direction:column; gap:3px; font-size:var(--fs-xs); color:var(--text-3); }
.rd-input.xs { width:76px; }

/* ── Session report ────────────────────────────────────────────────────────── */
.rd-report-table { width:100%; border-collapse:collapse; font-size:var(--fs-sm); }
.rd-report-table th { text-align:left; font-size:var(--fs-2xs); text-transform:uppercase; letter-spacing:0.08em; color:var(--text-3); padding:6px 8px; border-bottom:1px solid var(--border); }
.rd-report-table td { padding:6px 8px; border-bottom:1px solid var(--border); color:var(--text-2); }
.rd-report-table tr.skipped td { opacity:0.45; text-decoration:line-through; }
.rd-report-table .over { color:var(--danger); }
.rd-report-table .under { color:var(--success); }
.rd-clock-time.over, .mono.over { color:var(--danger); }
.rd-clock-time.under, .mono.under { color:var(--success); }

/* ── Manage view: all rundowns table ───────────────────────────────────────── */
.rd-manage-table { width:100%; border-collapse:collapse; font-size:var(--fs-sm); }
.rd-manage-table th {
  text-align:left; font-size:var(--fs-2xs); text-transform:uppercase; letter-spacing:0.08em;
  color:var(--text-3); padding:6px 8px; border-bottom:1px solid var(--border);
}
.rd-manage-table td { padding:6px 8px; border-bottom:1px solid var(--border); color:var(--text-2); vertical-align:middle; }
.rd-manage-actions { display:flex; gap:4px; align-items:center; justify-content:flex-end; }
.rd-manage-count { font-size:var(--fs-xs); color:var(--text-3); }
.rd-manage-empty { text-align:center; color:var(--text-3); padding:24px 0; }
