/* Runplan tab (.rp-*) — event editor, between Schedule and Catering.
   Runs and pit stops share ONE column grid so a pit's swap fields sit under
   the column they change. Layout mirrors the approved mockup
   (tools/harness/event_runplan_mockup.html). */

#cal-ev-runplan { min-height: 100%; }
.rp-loading { padding: 40px; text-align: center; color: #5a6678; font-size: 13px; }

.rp-wrap { display: grid; grid-template-columns: 225px minmax(0, 1fr); gap: 18px; align-items: start; }

.rp-lab {
  display: flex; align-items: center; gap: 6px; margin: 0 0 8px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase; color: #7a8a9b;
}
.rp-lab .material-symbols-outlined { font-size: 15px; color: #5a6678; }

/* ── Session rail ── */
.rp-rail { position: sticky; top: 0; }
.rp-day-lab {
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase; color: var(--accent);
  padding: 6px 0;
}
.rp-ses {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: #0f1318; border: 1px solid #1a1f28; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 6px; cursor: pointer; color: inherit;
  transition: border-color .15s, background .15s;
}
.rp-ses:hover { border-color: #2a3040; }
.rp-ses.active { border-color: rgba(var(--accent-rgb), .55); background: rgba(var(--accent-rgb), .06); }
.rp-ses-b { flex: 1; min-width: 0; display: block; }
.rp-ses-n { display: block; font-size: 13px; font-weight: 600; color: #dce3ed; }
.rp-ses.active .rp-ses-n { color: var(--accent); }
.rp-ses-t { display: block; font-size: 11px; color: #5a6678; margin-top: 1px; font-variant-numeric: tabular-nums; }
.rp-ses-c {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10.5px; font-weight: 700;
  letter-spacing: .4px; text-transform: uppercase;
  padding: 2px 7px; border-radius: 10px; background: #1f2530; color: #9aa7b8; white-space: nowrap;
}
.rp-ses-c.none { background: none; color: #3a4555; }
.rp-hint { font-size: 11.5px; color: #5a6678; line-height: 1.45; margin: 10px 0 0; }
.rp-hint b { color: #7a8a9b; font-weight: 600; }

/* ── Plan bar ── */
.rp-planbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.rp-plan-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; padding: 7px 13px; border-radius: 20px;
  border: 1px solid #2a3040; background: rgba(255,255,255,.02); color: #9aa7b8;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.rp-plan-chip:hover { border-color: #7a8a9b; }
.rp-plan-chip.active { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), .08); }
.rp-plan-chip .material-symbols-outlined { font-size: 14px; }
.rp-plan-chip .rp-dry { color: #e0a64b; }
.rp-plan-chip .rp-wet { color: #5aa7e8; }
.rp-plan-chip.ghost { border-style: dashed; background: none; color: #7a8a9b; }
.rp-plan-chip.ghost:hover { border-color: var(--accent); color: var(--accent); }
.rp-planbar-right { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.rp-carsel { width: auto; padding: 6px 26px 6px 10px; font-size: 12px; }
.rp-cartag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; color: #7a8a9b;
  border: 1px solid #1a1f28; border-radius: 20px; padding: 4px 10px;
}
.rp-cartag .material-symbols-outlined { font-size: 14px; }
.rp-iconbtn {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  background: none; border: 1px solid #1a1f28; border-radius: 8px; color: #5a6678; cursor: pointer;
}
.rp-iconbtn:hover { border-color: #7a8a9b; color: #9aa7b8; }
.rp-iconbtn .material-symbols-outlined { font-size: 16px; }
.rp-saved {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; color: #4ac8a4;
  opacity: 0; transition: opacity .2s;
}
.rp-saved.show { opacity: 1; }

/* ── Mileage chain ── */
.rp-carry {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #0f1318; border: 1px solid #1a1f28; border-left: 3px solid #818cf8;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 14px;
}
.rp-carry > .material-symbols-outlined { font-size: 17px; color: #818cf8; }
.rp-carry-lab { font-size: 12.5px; color: #9aa7b8; }
.rp-carry-note { font-size: 11.5px; color: #5a6678; }
.rp-chain-it { display: inline-flex; align-items: center; gap: 6px; }
.rp-chain-it > span:first-child {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10.5px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase; color: #5a6678; white-space: nowrap;
}
.rp-chain-it select { width: auto; min-width: 90px; max-width: 150px; padding: 6px 22px 6px 9px; font-size: 12px; }
.rp-chain-none { font-size: 12px; color: #3a4555; }
.rp-chain-sep { color: #3a4555; }
.rp-chain-ran {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: #22c55e; background: rgba(34, 197, 94, .08);
  border: 1px solid rgba(34, 197, 94, .25); border-radius: 6px; padding: 4px 8px;
  white-space: nowrap;
}
.rp-chain-ran .material-symbols-outlined { font-size: 14px; }

/* ── Stint timeline ── */
.rp-tlwrap:not(:empty) { margin-bottom: 12px; }
.rp-tl-bar {
  position: relative; display: flex; align-items: stretch; gap: 2px;
  height: 34px; background: #0f1318; border: 1px solid #1a1f28; border-radius: 8px;
  padding: 4px; overflow: hidden;
}
.rp-tl-seg {
  border-radius: 4px; overflow: hidden; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.rp-tl-seg.run { min-width: 8px; }
.rp-tl-seg.run i {
  font-style: normal; font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; font-size: 12.5px; letter-spacing: .4px; color: #0b0e12; overflow: hidden;
}
.rp-tl-seg.run small { font-size: 10px; color: rgba(11, 14, 18, .72); font-variant-numeric: tabular-nums; }
.rp-tl-seg.pit { min-width: 4px; background: repeating-linear-gradient(45deg, #2a3040 0 4px, #1a1f28 4px 8px); }
.rp-tl-seg.run[data-c="0"] { background: #5b8def; }
.rp-tl-seg.run[data-c="1"] { background: #e0a63c; }
.rp-tl-seg.run[data-c="2"] { background: #58b98a; }
.rp-tl-seg.run[data-c="3"] { background: #c76fd6; }
.rp-tl-seg.run[data-c="4"] { background: #e0705a; }
.rp-tl-seg.run[data-c="5"] { background: #4fb8c9; }
.rp-tl-seg.run[data-c="6"] { background: #a3b34c; }
.rp-tl-seg.run[data-c="7"] { background: #d66f9c; }
.rp-tl-seg.run[data-c="x"] { background: #3a4555; }
.rp-tl-seg.run[data-c="x"] i { color: #9aa7b8; }
.rp-tl-flag {
  position: absolute; top: 0; bottom: 0; width: 0;
  border-left: 2px dashed #e05a5a; transform: translateX(-2px);
}
.rp-tl-meta { display: flex; justify-content: flex-end; margin-top: 4px; }
.rp-tl-note { font-size: 11px; color: #5a6678; }
.rp-tl-note.red { color: #e05a5a; }

/* ── Doc: rows + right rail ── */
.rp-doc { display: grid; grid-template-columns: minmax(0, 1fr) 262px; gap: 18px; align-items: start; }
/* Desktop sheet layout: the table takes the FULL width (the 262px aside is what
   forced the old rows into a sideways scroller); baseline + sets go below. */
.rp-doc-sheet { grid-template-columns: minmax(0, 1fr); }
.rp-sets-strip { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; align-items: start; margin-top: 12px; }
.rp-sets-strip .rp-base { grid-column: 1 / -1; }
.rp-sets-strip > .rp-lab { grid-column: 1 / -1; margin: 4px 0 0; }
.rp-sets-strip .rp-hint { grid-column: 1 / -1; margin: 2px 0 0; }
.rp-scroll { overflow-x: auto; }
.rp-rows { min-width: 1010px; display: flex; flex-direction: column; gap: 6px; }
.rp-norows { padding: 18px; text-align: center; color: #5a6678; font-size: 12.5px;
  border: 1px dashed #2a3040; border-radius: 8px; }

.rp-grid {
  display: grid; align-items: center; gap: 7px;
  grid-template-columns: 24px 32px 1.05fr 54px 62px 1.1fr 1.2fr 1.2fr 1.25fr 86px 92px 20px;
}
.rp-cols { padding: 0 10px; }
.rp-cols span {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: .7px; text-transform: uppercase; color: #5a6678;
}
.rp-cols .r { text-align: right; }

.rp-run, .rp-pit { background: #0f1318; border: 1px solid #1a1f28; border-radius: 8px; padding: 8px 10px; }
.rp-run:hover { border-color: #2a3040; }
.rp-in { padding: 7px 9px; font-size: 12.5px; }
select.rp-in { padding-right: 22px; }
.rp-num { text-align: right; font-variant-numeric: tabular-nums; }
.rp-move { display: flex; flex-direction: column; }
.rp-move button {
  background: none; border: none; cursor: pointer; color: #2a3040; padding: 0; height: 13px;
  display: flex; align-items: center; justify-content: center;
}
.rp-run:hover .rp-move button, .rp-pit:hover .rp-move button { color: #5a6678; }
.rp-move button:hover { color: var(--accent); }
.rp-move .material-symbols-outlined { font-size: 15px; }
/* Row drag-reorder: the whole row is the handle (controls disarm it in JS). */
.rp-run[draggable="true"], .rp-pit[draggable="true"] { cursor: grab; }
.rp-grid.dragging { opacity: .45; }
.rp-grid.over { outline: 2px dashed var(--accent, #9bcc1a); outline-offset: 2px; }
.rp-runno {
  font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 800;
  letter-spacing: .5px; color: #9aa7b8; text-align: center;
}
.rp-fuel { position: relative; display: block; }
.rp-fuel .rp-in { padding-right: 20px; width: 100%; }
/* top is a fixed 15px (the input's own centre), not 50% — the suggestion chip
 * below the input grows the container and 50% would drift off the input. */
.rp-fuel::after {
  content: 'L'; position: absolute; right: 8px; top: 15px; transform: translateY(-50%);
  font-size: 11px; color: #5a6678; pointer-events: none;
}
.rp-fuel.plus::before {
  content: '+'; position: absolute; left: -4px; top: 15px; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: #e0a64b;
}
.rp-fuel-sug {
  display: block; width: 100%; margin-top: 3px; padding: 1px 3px;
  background: rgba(224, 166, 75, .08); border: 1px solid rgba(224, 166, 75, .35);
  border-radius: 5px; color: #e0a64b; font-size: 10px; font-weight: 600;
  white-space: nowrap; overflow: hidden; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .15s;
}
.rp-fuel-sug:hover { background: rgba(224, 166, 75, .2); }
.rp-fuel-sug.off { display: none; }
.rp-fuel-sug.met {
  color: #22c55e; border-color: rgba(34, 197, 94, .3);
  background: rgba(34, 197, 94, .06); cursor: default;
}
.rp-brk { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rp-brk .rp-sub { font-size: 11.5px; padding: 5px 20px 5px 8px; }
.rp-notes { display: flex; gap: 5px; min-width: 0; }
.rp-notes .rp-in { flex: 1; min-width: 0; }
.rp-notes-x {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 26px; border: 1px solid #1f2530; border-radius: 6px; background: none;
  color: #5a6678; cursor: pointer; transition: transform .15s, color .15s;
}
.rp-notes-x .material-symbols-outlined { font-size: 16px; }
.rp-run.exp .rp-notes-x { transform: rotate(180deg); color: var(--accent); border-color: var(--accent); }
.rp-note-full { display: none; grid-column: 1 / -1; margin-top: 6px; }
.rp-run.exp .rp-note-full { display: block; }
.rp-note-full textarea { min-height: 110px; line-height: 1.5; resize: vertical; }

.rp-derived { text-align: right; line-height: 1.3; min-width: 0; }
.rp-derived b {
  display: block; font-size: 12.5px; font-weight: 700; color: #dce3ed;
  font-variant-numeric: tabular-nums;
}
.rp-derived small {
  display: block; font-size: 10px; color: #5a6678;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rp-derived .warn, .rp-set-nums .warn { color: #e0a64b; font-weight: 600; }
.rp-derived .red, .rp-set-nums .red, .rp-tot .red { color: #ef4444; font-weight: 600; }
.rp-derived .ok { color: #4ac8a4; }
.rp-x {
  background: none; border: none; cursor: pointer; color: #3a4555; padding: 2px;
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
}
.rp-x:hover { color: #ef4444; }
.rp-x .material-symbols-outlined { font-size: 15px; }

/* pit rows: amber spine; swap fields sit under the columns they change */
.rp-pit {
  background: rgba(224, 166, 75, .05);
  border-color: rgba(224, 166, 75, .22); border-left: 3px solid #e0a64b;
  padding-left: 8px;   /* 8 + 3px spine = run row's 10 + 1px border — grids align */
}
.rp-pit-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 800;
  letter-spacing: .8px; text-transform: uppercase; color: #e0a64b;
}
.rp-pit-tag .material-symbols-outlined { font-size: 14px; }
.rp-pit-out {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: #7a8a9b;
  border: 1px dashed #2a3040; border-radius: 12px; padding: 5px 9px;
  white-space: nowrap; overflow: hidden; min-width: 0;
}
.rp-pit-out b { color: #dce3ed; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.rp-pit-out small { font-size: 9px; font-weight: 700; letter-spacing: .5px; color: #5a6678; text-transform: uppercase; }
.rp-pit-skip { text-align: center; color: #3a4555; }
.rp-dur .rp-in { text-align: right; font-variant-numeric: tabular-nums; }

.rp-adds { display: flex; gap: 8px; margin-top: 2px; }
.rp-add {
  flex: 1; background: transparent; border: 1px dashed #2a3040; border-radius: 6px;
  padding: 7px 10px; font-family: 'Barlow Condensed', sans-serif; font-size: 11px;
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #7a8a9b;
  cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.rp-add .material-symbols-outlined { font-size: 15px; }
.rp-add:hover { border-color: var(--accent); color: var(--accent); }
.rp-add.pit:hover { border-color: #e0a64b; color: #e0a64b; }

/* ── Totals ── */
.rp-totals {
  display: flex; align-items: stretch; flex-wrap: wrap;
  background: #141820; border: 1px solid #1a1f28; border-radius: 10px;
  margin-top: 14px; padding: 10px 4px;
}
.rp-tot {
  flex: 1 1 90px; padding: 2px 14px; border-right: 1px solid #1a1f28;
  display: flex; flex-direction: column; gap: 1px; min-width: 86px;
}
.rp-tot:last-child { border-right: none; }
.rp-tot small {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: .7px; text-transform: uppercase; color: #5a6678;
}
.rp-tot b {
  font-family: 'Barlow Condensed', sans-serif; font-size: 19px; font-weight: 800;
  color: #dce3ed; font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.rp-tot b em { font-style: normal; font-size: 12px; color: #7a8a9b; font-weight: 700; margin-left: 2px; }
.rp-seat { flex: 2 1 200px; }
.rp-seat-row { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 8px; margin-top: 3px; }
.rp-seat-row > span { font-size: 11.5px; color: #9aa7b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-seat-row i { height: 5px; border-radius: 3px; background: #1f2530; position: relative; overflow: hidden; display: block; }
.rp-seat-row i::after {
  content: ''; position: absolute; inset: 0; width: var(--w, 0%);
  background: var(--accent); border-radius: 3px;
}
.rp-seat-row small { font-size: 10.5px; color: #5a6678; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Sets in play + baseline ── */
.rp-sets { position: sticky; top: 0; display: flex; flex-direction: column; gap: 8px; }
.rp-base {
  background: #0f1318; border: 1px solid #1a1f28; border-top: 2px solid var(--accent);
  border-radius: 10px; padding: 10px 12px;
}
.rp-base-h { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.rp-base-h .material-symbols-outlined { font-size: 16px; color: var(--accent); }
.rp-base-h b { font-size: 12.5px; color: #dce3ed; }
.rp-base-h span { font-size: 10.5px; color: #5a6678; }
.rp-base-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 9px; }
.rp-base-grid label small {
  display: block; font-family: 'Barlow Condensed', sans-serif; font-size: 10px;
  font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #5a6678; margin-bottom: 3px;
}
.rp-base-note { font-size: 10.5px; color: #5a6678; line-height: 1.45; margin: 8px 0 0; }
.rp-set { background: #0f1318; border: 1px solid #1a1f28; border-radius: 8px; padding: 9px 11px; }
.rp-set-head { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.rp-set-head .material-symbols-outlined { font-size: 15px; color: #5a6678; align-self: center; }
.rp-set-name { font-size: 12.5px; font-weight: 700; color: #dce3ed; }
.rp-set-sub { font-size: 11px; color: #5a6678; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-set-carried {
  margin-left: auto; font-family: 'Barlow Condensed', sans-serif; font-size: 10px;
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #818cf8;
  border: 1px solid rgba(129, 140, 248, .35); border-radius: 10px; padding: 1px 7px; white-space: nowrap;
}
.rp-set-carried.packed { color: #4ac8a4; border-color: rgba(74, 200, 164, .35); }
.rp-bar { height: 6px; border-radius: 3px; background: #1f2530; margin: 8px 0 6px; display: flex; overflow: hidden; }
.rp-bar i { display: block; height: 100%; }
.rp-bar .carried {
  background: repeating-linear-gradient(-55deg, rgba(255,255,255,.16) 0 3px, transparent 3px 6px),
    rgba(129, 140, 248, .55);
}
.rp-bar .planned { background: var(--accent); }
.rp-bar .planned.warn { background: #e0a64b; }
.rp-bar .planned.red { background: #ef4444; }
.rp-set-nums { font-size: 11px; color: #7a8a9b; font-variant-numeric: tabular-nums; }
.rp-set-nums b { color: #dce3ed; font-weight: 600; }

/* ── The run sheet (desktop >600px) ──
   The team's own Excel run-plan shape: an outing row per run, a thin amber pit
   row between, the right side derived (clocks / fuel / tyre SOR→EOR). Cells
   are flat — chrome only on hover/focus — so the table reads like the printed
   sheet it becomes. .col-eng marks what the Driver-sheet preview hides. */
.rp-sheetwrap { border: 1px solid #2a3040; border-radius: 10px; overflow: hidden; background: #0f1318; }
.rp-shtitle {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 12px; background: #141820; border-bottom: 2px solid #2a3040;
}
.rp-shtitle b {
  font-family: 'Barlow Condensed', sans-serif; font-size: 15px; font-weight: 800;
  letter-spacing: .7px; text-transform: uppercase; color: #dce3ed;
}
.rp-shtitle > span { font-size: 11.5px; color: #5a6678; font-variant-numeric: tabular-nums; }
.rp-shview {
  margin-left: auto; background: none; border: 1px solid #2a3040; border-radius: 14px;
  padding: 4px 11px; font-family: 'Barlow Condensed', sans-serif; font-size: 11px;
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #7a8a9b;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.rp-shview:hover { border-color: var(--accent); color: var(--accent); }
.rp-shscroll { overflow-x: auto; }
.rp-tbl { width: 100%; min-width: 1040px; border-collapse: collapse; table-layout: fixed; }
.rp-tbl th {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; color: #5a6678; text-align: center;
  background: #141820; border: 1px solid #1a1f28; border-top: none; padding: 6px 5px;
}
.rp-tbl th.w-out  { width: 44px; }
.rp-tbl th.w-laps { width: 48px; }
.rp-tbl th.w-drv  { width: 76px; }
.rp-tbl th.w-km   { width: 88px; }
.rp-tbl th.w-brk  { width: 118px; }
.rp-tbl th.w-pit  { width: 52px; }
.rp-tbl th.w-clk  { width: 60px; }
.rp-tbl th.w-rem  { width: 60px; }
.rp-tbl th.w-fuel { width: 50px; }
.rp-tbl th.w-x    { width: 30px; }
.rp-tbl td { border: 1px solid #1a1f28; padding: 0; vertical-align: middle; text-align: center; }
.rp-tbl td.rp-cc { padding: 3px 4px; }
.rp-tbl tr.rp-run > td { border-top: 2px solid #2a3040; }
.rp-tbl tbody tr:first-child > td { border-top: none; }
.rp-tbl tr.rp-pit { background: rgba(224, 166, 75, .05); }
.rp-tbl tr.rp-pit > td:first-child { box-shadow: inset 3px 0 0 #e0a64b; }
.rp-tbl .rp-mut { color: #3a4555; font-size: 12px; }
/* tinted derived columns — the Excel sheet's reading: green time, amber fuel */
.rp-tbl td.rp-ct { background: rgba(34, 197, 94, .06); }
.rp-tbl td.rp-cf { background: rgba(224, 120, 75, .07); }
/* drag/reorder */
.rp-tbl tr[draggable="true"] { cursor: grab; }
.rp-tbl tr.rp-tr.dragging > td { opacity: .45; }
.rp-tbl tr.rp-tr.over > td { border-top: 2px dashed var(--accent, #9bcc1a); }
.rp-td-out { position: relative; }
.rp-tbl .rp-outno { font-size: 14px; }
.rp-tbl .rp-move {
  position: absolute; left: 1px; top: 50%; transform: translateY(-50%);
  flex-direction: column; opacity: 0; transition: opacity .12s;
}
.rp-tr:hover .rp-move { opacity: 1; }
.rp-tbl .rp-move button { color: #5a6678; }
.rp-tbl .rp-pit-tag { justify-content: center; }
/* flat cell fields: the CELL is the control — chrome on hover/focus only */
.rp-tbl .rp-sin, .rp-tbl select.rp-in {
  width: 100%; background: none; border: 1px solid transparent; border-radius: 6px;
  padding: 6px 6px; font-size: 12.5px; color: inherit; min-height: 30px;
}
.rp-tbl .rp-sin:hover, .rp-tbl select.rp-in:hover { border-color: #2a3040; }
.rp-tbl .rp-sin:focus, .rp-tbl select.rp-in:focus {
  border-color: var(--accent); background: #0b0e12; outline: none;
}
.rp-tbl select.rp-in { padding-right: 18px; text-align: left; }
.rp-tbl textarea.rp-ta {
  display: block; min-height: 60px; text-align: left; resize: vertical;
  line-height: 1.4; font-size: 12px; padding: 5px 7px;
}
.rp-tbl tr.rp-pit textarea.rp-ta-pit { min-height: 30px; height: 32px; }
/* driver cell: colour chip + the real select overlaid at opacity 0 */
.rp-drv { position: relative; display: flex; align-items: center; justify-content: center; min-height: 34px; }
.rp-drv-chip {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800; font-size: 12.5px;
  letter-spacing: .8px; color: #0b0e12; border-radius: 6px; padding: 6px 9px; min-width: 46px;
}
.rp-drv-chip[data-c="0"] { background: #5b8def; }
.rp-drv-chip[data-c="1"] { background: #e0a63c; }
.rp-drv-chip[data-c="2"] { background: #58b98a; }
.rp-drv-chip[data-c="3"] { background: #c76fd6; }
.rp-drv-chip[data-c="4"] { background: #e0705a; }
.rp-drv-chip[data-c="5"] { background: #4fb8c9; }
.rp-drv-chip[data-c="6"] { background: #a3b34c; }
.rp-drv-chip[data-c="7"] { background: #d66f9c; }
.rp-drv-chip[data-c="x"] { background: #1f2530; color: #7a8a9b; }
.rp-drv select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.rp-drv:focus-within { outline: 2px solid rgba(155, 204, 26, .5); outline-offset: -2px; border-radius: 6px; }
/* derived cells */
.rp-clk { font-size: 12px; font-variant-numeric: tabular-nums; color: #dce3ed; white-space: nowrap; }
.rp-clk .red { color: #ef4444; font-weight: 700; }
.rp-clk .ok { color: #4ac8a4; font-weight: 600; }
.rp-tbl .rp-sor { display: block; text-align: center; line-height: 1.25; padding: 2px 3px; }
.rp-tbl .rp-sor b { font-size: 12px; font-weight: 700; color: #dce3ed; font-variant-numeric: tabular-nums; }
.rp-tbl .rp-sor small { display: block; font-size: 9.5px; color: #5a6678; font-variant-numeric: tabular-nums; }
.rp-tbl .rp-pit-out { border: none; padding: 0 4px; font-size: 11px; justify-content: center; }
.rp-tbl .rp-fuel-sh .rp-in, .rp-tbl .rp-fuel-sh .rp-sin { padding-right: 16px; }
/* fixed 16px = the input's own centre — the sug chip below grows the wrapper,
   and 50% would drift off the input (the original .rp-fuel::after lesson) */
.rp-tbl .rp-fuel::after { top: 16px; right: 5px; }
.rp-tbl .rp-fuel.plus::before { left: 0; top: 16px; }
.rp-tbl .rp-fuel-sug { margin-top: 2px; }
.rp-tbl .rp-x { margin: 0 auto; }
.rp-sheetwrap .rp-adds { padding: 8px; margin: 0; background: #141820; border-top: 1px solid #1a1f28; }
.rp-sheetwrap .rp-norows { border: none; }
/* brakes chips */
.rp-brkcell { display: flex; flex-direction: column; gap: 2px; padding: 0; }
.rp-brkchip {
  display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0;
  background: none; border: 1px solid transparent; border-radius: 6px;
  padding: 3px 4px; cursor: pointer; text-align: left; color: inherit; font-size: 11px;
}
.rp-brkchip:hover { border-color: #2a3040; }
.rp-brkchip.openhere { border-color: var(--accent); }
.rp-brk-ax {
  flex: 0 0 auto; font-family: 'Barlow Condensed', sans-serif; font-size: 9px;
  font-weight: 800; letter-spacing: .5px; color: #5a6678;
  border: 1px solid #2a3040; border-radius: 4px; padding: 0 3px;
}
.rp-brk-v { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-brk-kit { color: var(--accent); font-weight: 600; }
.rp-brk-none { color: #3a4555; }
.rp-brkchip > .material-symbols-outlined { flex: 0 0 auto; font-size: 13px; color: #3a4555; }
/* Driver-sheet preview: engineering columns gone, fields flattened to print */
.rp-sheetwrap.dv .col-eng { display: none; }
.rp-sheetwrap.dv .rp-adds { display: none; }
/* The handout preview must be READ-only, not merely un-clickable: pointer-events
   alone left every field in the tab order and fully keyboard-editable, so
   proof-reading with Tab/arrow keys silently rewrote the plan through
   onInput -> applyField -> scheduleSave (audit RP-07). `inert` on .rp-shscroll
   is what actually locks it; these rules are the flattened print look. */
.rp-sheetwrap.dv .rp-sin, .rp-sheetwrap.dv select.rp-in, .rp-sheetwrap.dv .rp-drv select {
  pointer-events: none; border-color: transparent !important; resize: none;
}
.rp-sheetwrap.dv .rp-fuel::after, .rp-sheetwrap.dv .rp-fuel-sug { display: none; }
.rp-sheetwrap.dv .rp-fuel.plus::before { display: none; }
.rp-sheetwrap.dv select.rp-in { appearance: none; }
.rp-sheetwrap.dv .rp-move { display: none; }
.rp-sheetwrap.dv tr[draggable="true"] { cursor: default; }

/* ── The brakes popover (hangs off <body>, above the event modal) ── */
#rp-brkpop {
  position: fixed; z-index: 3500; width: 292px;
  background: #141820; border: 1px solid #2a3040; border-radius: 12px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .45); padding: 12px; text-align: left;
  color: #dce3ed; font-size: 13px;
}
#rp-brkpop h4 {
  margin: 0 0 8px; display: flex; align-items: center; gap: 7px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 13px; font-weight: 800;
  letter-spacing: .7px; text-transform: uppercase; color: #dce3ed;
}
#rp-brkpop h4 .material-symbols-outlined { font-size: 16px; color: var(--accent); }
#rp-brkpop h4 small {
  margin-left: auto; font-family: 'Barlow', sans-serif; font-size: 11px;
  font-weight: 500; letter-spacing: 0; text-transform: none; color: #5a6678;
}
.rp-bp-ax + .rp-bp-ax { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #2a3040; }
.rp-bp-axh {
  font-family: 'Barlow Condensed', sans-serif; font-size: 10.5px; font-weight: 800;
  letter-spacing: .8px; text-transform: uppercase; color: #7a8a9b; margin-bottom: 6px;
}
.rp-bp-segs { display: flex; gap: 4px; margin-bottom: 8px; }
.rp-bp-seg {
  flex: 1; background: #0f1318; border: 1px solid #2a3040; border-radius: 6px;
  padding: 6px 4px; font-family: 'Barlow Condensed', sans-serif; font-size: 10.5px;
  font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: #7a8a9b;
  cursor: pointer; white-space: nowrap;
}
.rp-bp-seg.on { border-color: var(--accent); color: var(--accent); background: rgba(var(--accent-rgb), .08); }
.rp-bp-seg:disabled { opacity: .4; cursor: default; }
.rp-bp-body { display: flex; flex-direction: column; gap: 6px; }
.rp-bp-body .rp-in { width: 100%; font-size: 12px; }
.rp-bp-note { font-size: 11px; color: #5a6678; margin: 2px 0 0; line-height: 1.4; }
.rp-bp-done {
  margin-top: 12px; width: 100%; background: rgba(var(--accent-rgb), .12);
  border: 1px solid var(--accent); border-radius: 8px; padding: 7px;
  font-family: 'Barlow Condensed', sans-serif; font-size: 12px; font-weight: 800;
  letter-spacing: .6px; text-transform: uppercase; color: var(--accent); cursor: pointer;
}

/* ── Empty states ── */
.rp-empty {
  border: 1px dashed #2a3040; border-radius: 12px; padding: 40px 24px; margin: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.rp-empty.in-main { margin: 0; }
.rp-empty .material-symbols-outlined { font-size: 30px; color: #3a4555; }
.rp-empty h3 {
  margin: 4px 0 0; font-family: 'Barlow Condensed', sans-serif; font-size: 17px;
  font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #9aa7b8;
}
.rp-empty p { margin: 0; font-size: 12.5px; color: #5a6678; max-width: 400px; line-height: 1.5; }
.rp-empty-acts { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.rp-empty-acts .btn-save { display: inline-flex; align-items: center; gap: 6px; }
.rp-empty-acts .btn-save .material-symbols-outlined { font-size: 16px; }
.rp-empty-acts .or {
  font-size: 11px; color: #3a4555; text-transform: uppercase; letter-spacing: .6px;
}
.rp-empty-acts select { width: 220px; }

/* ── Narrow: rail on top, rows collapse to labelled cards ── */
@media (max-width: 1150px) {
  .rp-doc { grid-template-columns: 1fr; }
  .rp-sets { position: static; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
  .rp-base { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .rp-wrap { grid-template-columns: 1fr; }
  .rp-rail { position: static; }
  .rp-scroll { overflow-x: visible; }
  .rp-rows { min-width: 0; }
  .rp-cols { display: none; }
  .rp-grid { grid-template-columns: 1fr 1fr; row-gap: 8px; }
  .rp-grid > * { grid-column: span 1; min-width: 0; }
  .rp-move { display: none; }
  .rp-runno { text-align: left; }
  .rp-notes, .rp-note-full, .rp-brk { grid-column: 1 / -1; }
  .rp-derived { text-align: left; }
  .rp-in { font-size: 16px; }   /* iOS: <16px zooms the page */
}

/* ── ≤600px: collapsible cards (phoneRowsHTML) — a shape, not a squeeze ──
   Every run/pit is ONE summary line (the oversight view); tapping it animates
   the editor open DOWNWARD beneath the head (grid-rows 0fr→1fr), so the
   tapped row never moves. The toggle is a class flip on the live DOM — a
   re-render would reset the scroll (the "screen jumps" bug). */
@media (max-width: 600px) {
  /* the session rail becomes a horizontal chip strip above the plan */
  .rp-rail { display: flex; align-items: stretch; gap: 6px; overflow-x: auto;
    padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
  .rp-rail .rp-lab { display: none; }
  .rp-day-lab { flex: 0 0 auto; align-self: center; margin: 0; white-space: nowrap; }
  .rp-ses { flex: 0 0 auto; width: auto; min-width: 132px; }
  .rp-rail .rp-hint { flex: 0 0 auto; align-self: center; margin: 0; max-width: 220px;
    font-size: 10.5px; }

  /* collapsible wrapper: the card chrome moves here, the grid inside goes bare */
  .rp-cw { background: #0f1318; border: 1px solid #1a1f28; border-radius: 10px;
    transition: border-color .28s ease; }
  .rp-cw.pit { background: rgba(224, 166, 75, .05);
    border-color: rgba(224, 166, 75, .22); border-left: 3px solid #e0a64b; }
  .rp-cw.open { border-color: rgba(var(--accent-rgb, 155, 204, 26), .45); }
  .rp-cw.pit.open { border-color: rgba(224, 166, 75, .5); }
  .rp-cw .rp-grid { background: none; border: none; border-radius: 0; padding: 0; }
  .rp-cc { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    background: none; border: none; cursor: pointer; color: inherit; font: inherit;
    padding: 9px 8px 9px 11px; min-height: 54px; }
  .rp-cc .rp-runno { flex: 0 0 30px; text-align: left; }
  .rp-cc .rp-pit-tag { flex: 0 0 30px; }
  .rp-cc-b { flex: 1; min-width: 0; }
  .rp-cc-t { display: block; font-size: 13.5px; font-weight: 600; color: #dce3ed;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rp-cc-s { display: block; font-size: 11.5px; color: #5a6678; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-variant-numeric: tabular-nums; }
  .rp-cc-s .red { color: #ef4444; } .rp-cc-s .warn { color: #e0a64b; }
  .rp-cc-note { flex: 0 0 auto; color: #5a6678; display: flex; }
  .rp-cc-note .material-symbols-outlined { font-size: 16px; }
  .rp-cc-go { flex: 0 0 auto; width: 34px; height: 34px; display: flex; align-items: center;
    justify-content: center; color: #3a4555; transition: transform .28s ease; }
  .rp-cw.open .rp-cc-go { transform: rotate(180deg); color: var(--accent); }
  .rp-cb { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
  .rp-cw.open .rp-cb { grid-template-rows: 1fr; }
  .rp-cbi { overflow: hidden; min-height: 0; }   /* padding a level deeper or 0fr can't reach 0 */
  .rp-cbi > .rp-grid { padding: 2px 10px 10px; }

  /* the editor card: labelled field rows */
  .rp-ph { display: flex; flex-direction: column; gap: 7px; }
  .rp-ph-f { display: grid; grid-template-columns: 84px minmax(0, 1fr);
    align-items: center; gap: 8px; }
  .rp-ph-f.wide { grid-template-columns: 84px minmax(0, 1fr); }
  .rp-ph-lab {
    font-family: 'Barlow Condensed', sans-serif; font-size: 10px; font-weight: 700;
    letter-spacing: .7px; text-transform: uppercase; color: #5a6678;
  }
  .rp-ph .rp-fuel .rp-in { width: 100%; }
  .rp-ph-der { display: flex; gap: 16px; padding-top: 7px; border-top: 1px dashed #2a3040; }
  .rp-ph-der .rp-derived { flex: 1 1 0; text-align: left; }
  .rp-ph-ctlrow { display: flex; gap: 8px; padding-top: 8px; border-top: 1px dashed #2a3040; }
  .rp-ph-ctlrow button {
    flex: 1; min-height: 40px; display: flex; align-items: center; justify-content: center;
    gap: 5px; background: none; border: 1px solid #2a3040; border-radius: 8px;
    color: #9aa7b8; cursor: pointer;
    font-family: 'Barlow Condensed', sans-serif; font-size: 11px; font-weight: 700;
    letter-spacing: .6px; text-transform: uppercase;
  }
  .rp-ph-ctlrow button .material-symbols-outlined { font-size: 16px; }
  .rp-ph-ctlrow .del { color: #ef4444; border-color: rgba(239, 68, 68, .35); }
  .rp-adds .rp-add { min-height: 44px; }

  /* the two rails become one readout line each, opening a sheet */
  .rp-line { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    background: #0f1318; border: 1px solid #1a1f28; border-radius: 9px;
    padding: 9px 11px; min-height: 46px; margin-bottom: 8px; cursor: pointer;
    color: inherit; font: inherit; }
  .rp-line.chain { border-left: 3px solid #818cf8; }
  .rp-line.sets { border-left: 3px solid var(--accent); }
  .rp-line > .material-symbols-outlined { font-size: 17px; color: #7a8a9b; flex: 0 0 auto; }
  .rp-line.chain > .material-symbols-outlined:first-child { color: #818cf8; }
  .rp-line-b { flex: 1; min-width: 0; }
  .rp-line-t { display: block; font-size: 12.5px; color: #9aa7b8; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis; }
  .rp-line-t b { color: #dce3ed; font-weight: 600; }
  .rp-line-t .warn { color: #e0a64b; } .rp-line-t .red { color: #ef4444; }
  .rp-line-s { display: block; font-size: 11px; color: #5a6678; margin-top: 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .rp-line-go { color: #3a4555; }

  .rp-scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 260;
    opacity: 0; pointer-events: none; transition: opacity .2s; }
  .rp-scrim.open { opacity: 1; pointer-events: auto; }
  .rp-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 261; max-height: 80%;
    display: flex; flex-direction: column; background: #141820;
    border-top: 1px solid #2a3040; border-radius: 16px 16px 0 0;
    transform: translateY(102%); transition: transform .24s cubic-bezier(.32, .72, 0, 1); }
  .rp-sheet.open { transform: translateY(0); }
  .rp-sheet-grip { width: 34px; height: 4px; border-radius: 2px; background: #2a3040;
    margin: 7px auto 0; flex: 0 0 auto; }
  .rp-sheet-h { flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-bottom: 1px solid #1f2530; }
  .rp-sheet-h b { flex: 1; font-family: 'Barlow Condensed', sans-serif; font-size: 16px;
    font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: #dce3ed; }
  .rp-sheet-x { width: 38px; height: 38px; display: flex; align-items: center;
    justify-content: center; background: none; border: none; border-radius: 8px;
    color: #7a8a9b; cursor: pointer; }
  .rp-sheet-b { flex: 1; min-height: 0; overflow-y: auto;
    padding: 12px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .rp-sheet[data-sheet="chain"] .rp-sheet-sets { display: none; }
  .rp-sheet[data-sheet="sets"] .rp-sheet-chain { display: none; }
  /* the chain strip relaxes inside the sheet: one row per session */
  .rp-sheet .rp-carry { flex-direction: column; align-items: stretch; border-left-width: 1px;
    background: none; border: none; padding: 0; margin: 0; gap: 8px; }
  .rp-sheet .rp-carry > .material-symbols-outlined { display: none; }
  .rp-sheet .rp-chain-it { display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid #1f2530; }
  .rp-sheet .rp-chain-it select { min-height: 40px; font-size: 16px; }
  .rp-sheet .rp-chain-sep { display: none; }
  .rp-sheet .rp-base-grid .rp-in, .rp-sheet .rp-base-grid input { font-size: 16px; min-height: 40px; }

  @media (prefers-reduced-motion: reduce) {
    .rp-cw, .rp-cb, .rp-cc-go, .rp-scrim, .rp-sheet { transition: none; }
  }
}

/* ── Light mode ── */
body.light-mode .rp-ses { background: #f8f9fc; border-color: #e8ecf2; }
body.light-mode .rp-ses-n { color: #1a2030; }
body.light-mode .rp-ses.active { background: rgba(155, 204, 26, .10); }
body.light-mode .rp-ses.active .rp-ses-n { color: #5b7a00; }
body.light-mode .rp-ses-c { background: #e8ecf2; color: #4a5568; }
body.light-mode .rp-ses-c.none { background: none; color: #b0bcd0; }
body.light-mode .rp-day-lab { color: #5b7a00; }
body.light-mode .rp-plan-chip { border-color: #dde2ec; background: #f7f9fc; color: #6b7a8d; }
body.light-mode .rp-plan-chip.active { border-color: #9bcc1a; color: #5b7a00; background: rgba(155, 204, 26, .10); }
body.light-mode .rp-cartag { border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .rp-iconbtn { border-color: #dde2ec; color: #8899aa; }
body.light-mode .rp-carry { background: #f8f9fc; border-color: #e8ecf2; border-left-color: #6366f1; }
body.light-mode .rp-carry-lab { color: #4a5568; }
body.light-mode .rp-run, body.light-mode .rp-set, body.light-mode .rp-base { background: #f8f9fc; border-color: #e8ecf2; }
body.light-mode .rp-base { border-top-color: #9bcc1a; }
body.light-mode .rp-pit { background: rgba(185, 122, 16, .06); border-color: rgba(185, 122, 16, .25); border-left-color: #b97a10; }
body.light-mode .rp-pit-tag { color: #b97a10; }
body.light-mode .rp-cols span, body.light-mode .rp-tot small { color: #8899aa; }
body.light-mode .rp-runno { color: #4a5568; }
body.light-mode .rp-derived b, body.light-mode .rp-tot b, body.light-mode .rp-set-name,
body.light-mode .rp-set-nums b, body.light-mode .rp-base-h b { color: #1a2030; }
body.light-mode .rp-totals { background: #ffffff; border-color: #e8ecf2; }
body.light-mode .rp-tot { border-right-color: #e8ecf2; }
body.light-mode .rp-bar, body.light-mode .rp-seat-row i { background: #e8ecf2; }
body.light-mode .rp-derived .warn, body.light-mode .rp-set-nums .warn { color: #b97a10; }
body.light-mode .rp-derived .ok { color: #199a76; }
body.light-mode .rp-add, body.light-mode .rp-norows { border-color: #dde2ec; color: #8899aa; }
body.light-mode .rp-empty { border-color: #dde2ec; }
body.light-mode .rp-empty h3 { color: #4a5568; }
body.light-mode .rp-notes-x { border-color: #dde2ec; color: #8899aa; }
body.light-mode .rp-pit-out { border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .rp-pit-out b { color: #1a2030; }
body.light-mode .rp-saved { color: #199a76; }
body.light-mode .rp-tl-bar { background: #f8f9fc; border-color: #e8ecf2; }
body.light-mode .rp-tl-seg.pit { background: repeating-linear-gradient(45deg, #d5dae4 0 4px, #eceff5 4px 8px); }
body.light-mode .rp-tl-note { color: #8899aa; }
body.light-mode .rp-chain-ran { color: #199a76; border-color: rgba(25, 154, 118, .3); background: rgba(25, 154, 118, .07); }
body.light-mode .rp-fuel-sug { color: #b97a10; border-color: rgba(185, 122, 16, .35); background: rgba(185, 122, 16, .06); }
body.light-mode .rp-fuel-sug.met { color: #199a76; border-color: rgba(25, 154, 118, .3); background: rgba(25, 154, 118, .06); }
body.light-mode .rp-ph-lab { color: #8899aa; }
body.light-mode .rp-ph-der { border-top-color: #e8ecf2; }
body.light-mode .rp-cw { background: #f8f9fc; border-color: #e8ecf2; }
body.light-mode .rp-cw.pit { background: rgba(185, 122, 16, .06);
  border-color: rgba(185, 122, 16, .25); border-left-color: #b97a10; }
body.light-mode .rp-cc-t { color: #1a2030; }
body.light-mode .rp-cc-s, body.light-mode .rp-cc-note { color: #8899aa; }
body.light-mode .rp-cc-s .warn { color: #b97a10; }
body.light-mode .rp-cc-go { color: #b0bcd0; }
body.light-mode .rp-ph-ctlrow { border-top-color: #e8ecf2; }
body.light-mode .rp-ph-ctlrow button { border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .rp-ph-ctlrow .del { color: #b91c1c; border-color: rgba(185, 28, 28, .3); }
body.light-mode .rp-line { background: #f8f9fc; border-color: #e8ecf2; }
body.light-mode .rp-line.chain { border-left-color: #6366f1; }
body.light-mode .rp-line-t { color: #4a5568; }
body.light-mode .rp-line-t b { color: #1a2030; }
body.light-mode .rp-line-t .warn { color: #b97a10; }
body.light-mode .rp-line-s { color: #8899aa; }
body.light-mode .rp-scrim { background: rgba(20, 26, 36, .42); }
body.light-mode .rp-sheet { background: #ffffff; border-top-color: #dde2ec; }
body.light-mode .rp-sheet-grip { background: #dde2ec; }
body.light-mode .rp-sheet-h { border-bottom-color: #e8ecf2; }
body.light-mode .rp-sheet-h b { color: #1a2030; }
body.light-mode .rp-sheet .rp-chain-it { border-bottom-color: #e8ecf2; }

/* ── Light mode: the run sheet + brakes popover ── */
body.light-mode .rp-sheetwrap { background: #f8f9fc; border-color: #d5dae4; }
body.light-mode .rp-shtitle { background: #eef1f6; border-bottom-color: #d5dae4; }
body.light-mode .rp-shtitle b { color: #1a2030; }
body.light-mode .rp-shview { border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .rp-tbl th { background: #eef1f6; border-color: #e8ecf2; color: #8899aa; }
body.light-mode .rp-tbl td { border-color: #e8ecf2; }
body.light-mode .rp-tbl tr.rp-run > td { border-top-color: #d5dae4; }
body.light-mode .rp-tbl tr.rp-pit { background: rgba(185, 122, 16, .06); }
body.light-mode .rp-tbl tr.rp-pit > td:first-child { box-shadow: inset 3px 0 0 #b97a10; }
body.light-mode .rp-tbl .rp-mut, body.light-mode .rp-brk-none,
body.light-mode .rp-brkchip > .material-symbols-outlined { color: #b0bcd0; }
body.light-mode .rp-tbl td.rp-ct { background: rgba(25, 154, 118, .07); }
body.light-mode .rp-tbl td.rp-cf { background: rgba(200, 110, 40, .07); }
body.light-mode .rp-tbl .rp-sin:hover, body.light-mode .rp-tbl select.rp-in:hover,
body.light-mode .rp-brkchip:hover { border-color: #d5dae4; }
body.light-mode .rp-tbl .rp-sin:focus, body.light-mode .rp-tbl select.rp-in:focus { background: #ffffff; }
body.light-mode .rp-clk, body.light-mode .rp-tbl .rp-sor b { color: #1a2030; }
body.light-mode .rp-clk .red { color: #b91c1c; }
body.light-mode .rp-clk .ok { color: #199a76; }
body.light-mode .rp-drv-chip[data-c="x"] { background: #e8ecf2; color: #6b7a8d; }
body.light-mode .rp-brk-ax { border-color: #dde2ec; color: #8899aa; }
body.light-mode .rp-sheetwrap .rp-adds { background: #eef1f6; border-top-color: #e8ecf2; }
body.light-mode #rp-brkpop {
  background: #ffffff; border-color: #dde2ec; color: #1a2030;
  box-shadow: 0 14px 34px rgba(20, 26, 36, .18);
}
body.light-mode #rp-brkpop h4 { color: #1a2030; }
body.light-mode .rp-bp-ax + .rp-bp-ax { border-top-color: #e8ecf2; }
body.light-mode .rp-bp-seg { background: #f8f9fc; border-color: #dde2ec; color: #6b7a8d; }
body.light-mode .rp-bp-seg.on { border-color: #9bcc1a; color: #5b7a00; background: rgba(155, 204, 26, .1); }

/* ── Things the sheet used to leave blank without saying why ──────────────── */
/* A session typed 22:00 → 02:00 has no length, so the clocks, the margin at
 * the flag and the session-end marker all render "—". The banner names the
 * +1d control that fixes it (audit RP-14). */
.rp-warn {
  display: flex; align-items: flex-start; gap: 9px;
  background: rgba(185, 122, 16, .08); border: 1px solid rgba(185, 122, 16, .3);
  border-left: 3px solid #b97a10; border-radius: 8px;
  padding: 8px 12px; margin-bottom: 12px;
  font-size: 12px; line-height: 1.5; color: #e0c48a;
}
.rp-warn > .material-symbols-outlined { font-size: 17px; color: #d99a20; flex: 0 0 auto; }
/* A baseline of exactly 0 is "not set" — it used to switch the simulation off
 * in silence (audit RP-09). */
.rp-base-warn {
  display: flex; align-items: flex-start; gap: 6px;
  margin: 8px 0 0; font-size: 10.5px; line-height: 1.45; color: #d99a20;
}
.rp-base-warn > .material-symbols-outlined { font-size: 13px; flex: 0 0 auto; }
.rp-base-warn b { color: #e8b552; }
/* The chain named a plan that has since been deleted — the carry falls back to
 * that session's first plan, and says so rather than showing a plan it is not
 * using (audit RP-05). */
.rp-chain-it.stale select { border-color: rgba(185, 122, 16, .55); }
.rp-chain-stale {
  font-size: 10.5px; color: #d99a20; white-space: nowrap;
}

body.light-mode .rp-warn { background: rgba(185, 122, 16, .07); color: #7a5205; }
body.light-mode .rp-warn > .material-symbols-outlined { color: #b97a10; }
body.light-mode .rp-base-warn, body.light-mode .rp-chain-stale { color: #8a5f08; }
body.light-mode .rp-base-warn b { color: #6b4a05; }
