/* ══ SCHEDULE PLANNER — full-page time grid with one lane per car ══
   Opened from the event modal's Schedule tab (js/pages/schedule-planner.js).
   All classes are .sp-* ; the page mounts as a fixed overlay left of the nav. */

/* "Open planner" button in the event modal's Schedule tab (sits in the
   focus-toggle row, outside #sp-page). */
.cal-ev-planner-btn {
  margin-left: 10px; background: rgba(212,245,66,.07); border: 1px solid rgba(212,245,66,.4);
  color: var(--accent, #d4f542); font-size: 12px; font-weight: 600;
  padding: 5px 14px; border-radius: 8px; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px;
}
.cal-ev-planner-btn:hover { background: rgba(212,245,66,.14); }
body.light-mode .cal-ev-planner-btn { background: #f4fadf; border-color: #c6dd66; color: #6f8f0e; }

#sp-page {
  --sp-bg:#090b0e; --sp-panel:#101318; --sp-panel2:#141a22; --sp-raised:#1a212c;
  --sp-line:#1f2530; --sp-line2:#2c3542; --sp-ink:#dce3ed; --sp-mut:#8b95a7; --sp-faint:#5a6678;
  --sp-prac:#58a6ff; --sp-qual:#a78bfa; --sp-race:#f25c5c; --sp-warm:#3ecfa3; --sp-oth:#8b95a7;
  --sp-warn:#fbbf24;
  --sp-headh:46px;
  position: fixed; top: 0; right: 0; bottom: 0; left: var(--nav-w, 64px);
  z-index: 150; background: var(--sp-bg); color: var(--sp-ink);
  display: none; flex-direction: column; font-size: 14px;
}
#sp-page.open { display: flex; }
@media (max-width: 900px) { #sp-page { left: 0; } }

#sp-page .material-symbols-outlined { font-size: 16px; }
#sp-page button { font-family: inherit; }
#sp-page input, #sp-page select, #sp-page textarea { font-family: inherit; }

/* ── Header ── */
.sp-top { border-bottom: 1px solid var(--sp-line); background: var(--sp-panel); flex-shrink: 0; }
.sp-row1 { display: flex; align-items: center; gap: 12px; padding: 10px 16px 8px; }
.sp-back { display: flex; align-items: center; gap: 4px; background: none; border: none;
  color: var(--sp-mut); cursor: pointer; font-size: 12.5px; padding: 4px 6px; border-radius: 6px; }
.sp-back:hover { color: var(--sp-ink); background: var(--sp-raised); }
.sp-ttl { min-width: 0; }
.sp-ttl .sp-eyebrow { font-size: 10px; letter-spacing: 1.6px; color: var(--accent, #d4f542);
  font-weight: 600; text-transform: uppercase; }
.sp-ttl h1 { margin: 1px 0 0; font-size: 17px; font-weight: 600; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-ttl h1 .sp-sub { color: var(--sp-mut); font-weight: 400; }
.sp-spacer { flex: 1; }
.sp-editors-note { font-size: 11.5px; color: var(--sp-warn); background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.3); border-radius: 14px; padding: 3px 12px;
  display: flex; align-items: center; gap: 6px; }
.sp-toolbtn { background: var(--sp-panel2); border: 1px solid var(--sp-line); color: var(--sp-mut);
  font-size: 12.5px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; }
.sp-toolbtn:hover { color: var(--sp-ink); border-color: var(--sp-line2); }
.sp-confbadge { background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.4); color: var(--sp-warn); }
.sp-confbadge:hover { color: var(--sp-warn); border-color: var(--sp-warn); }
.sp-confbadge.sp-zero { background: var(--sp-panel2); border-color: var(--sp-line); color: var(--sp-faint); }
.sp-save { background: var(--accent, #d4f542); border: none; color: #000; font-weight: 600;
  font-size: 13px; padding: 7px 18px; border-radius: 8px; cursor: pointer; }
.sp-save:hover { filter: brightness(1.06); }
.sp-save:disabled { background: var(--sp-raised); color: var(--sp-faint); cursor: default; filter: none; }

.sp-row2 { display: flex; align-items: flex-end; gap: 14px; padding: 2px 16px 0; }
.sp-daytabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.sp-daytabs::-webkit-scrollbar { display: none; }
.sp-daytab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--sp-mut);
  cursor: pointer; padding: 6px 14px 8px; text-align: left; border-radius: 6px 6px 0 0; flex-shrink: 0; }
.sp-daytab:hover { background: var(--sp-panel2); color: var(--sp-ink); }
.sp-daytab.on { color: var(--sp-ink); border-bottom-color: var(--accent, #d4f542); }
.sp-daytab .sp-dl { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.sp-daytab .sp-dd { font-size: 10.5px; color: var(--sp-faint); margin-top: 1px; }
.sp-daytab.sp-pad .sp-dl { color: var(--sp-mut); font-weight: 500; }
.sp-daytab .sp-cnt { font-size: 10px; background: var(--sp-raised); color: var(--sp-mut);
  border-radius: 8px; padding: 0 6px; line-height: 15px; }
.sp-daytab .sp-warndot { width: 6px; height: 6px; border-radius: 50%; background: var(--sp-warn); }
.sp-layerchips { display: flex; gap: 4px; padding-bottom: 8px; }
.sp-lchip { background: var(--sp-panel2); border: 1px solid var(--sp-line); color: var(--sp-mut);
  font-size: 11.5px; padding: 3px 10px; border-radius: 20px; cursor: pointer; }
.sp-lchip.on { border-color: rgba(212,245,66,.5); color: var(--accent, #d4f542); background: rgba(212,245,66,.07); }

/* ── Conflict strip ── */
.sp-constrip { background: #1c1712; border-bottom: 1px solid rgba(251,191,36,.25); padding: 6px 16px;
  display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; flex-shrink: 0;
  max-height: 118px; overflow-y: auto; }
.sp-constrip .sp-wic { color: var(--sp-warn); margin-top: 1px; flex-shrink: 0; }
.sp-constrip ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.sp-constrip li { display: flex; gap: 8px; align-items: center; color: #d9c99a; }
.sp-constrip .sp-jump { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.sp-constrip .sp-jump:hover { color: var(--sp-warn); }
.sp-constrip .sp-ign { background: none; border: 1px solid #4a3d20; color: #a08c58; font-size: 10.5px;
  border-radius: 5px; padding: 1px 7px; cursor: pointer; flex-shrink: 0; }
.sp-constrip .sp-ign:hover { color: var(--sp-warn); border-color: var(--sp-warn); }
.sp-constrip .sp-daytag { font-size: 10px; background: #2b2113; color: var(--sp-warn);
  border-radius: 4px; padding: 1px 5px; letter-spacing: .5px; flex-shrink: 0; }

/* ── Main ── */
.sp-main { flex: 1; min-height: 0; display: flex; }
.sp-planner { flex: 1; min-width: 0; overflow: auto; position: relative; }

/* ── Time grid ── */
.sp-grid { display: flex; min-width: max-content; padding-right: 12px; }
.sp-timecol { width: 52px; flex-shrink: 0; position: sticky; left: 0; z-index: 8; background: var(--sp-bg); }
.sp-corner { height: var(--sp-headh); position: sticky; top: 0; background: var(--sp-bg); z-index: 9;
  border-bottom: 1px solid var(--sp-line); }
.sp-hourlbl { height: 52px; position: relative; }
.sp-hourlbl span { position: absolute; top: -7px; right: 8px; font-size: 10.5px; color: var(--sp-faint);
  font-variant-numeric: tabular-nums; }
.sp-lane { flex: 1 1 200px; min-width: 185px; border-right: 1px solid var(--sp-line);
  display: flex; flex-direction: column; }
@media (max-width: 900px) { .sp-lane { min-width: 150px; } }
.sp-lane-head { height: var(--sp-headh); position: sticky; top: 0; z-index: 7; background: var(--sp-panel);
  border-bottom: 1px solid var(--sp-line); display: flex; align-items: center; gap: 8px; padding: 0 8px 0 10px; }
.sp-lane-head .sp-bar { width: 3px; height: 22px; border-radius: 2px; flex-shrink: 0; }
.sp-lane-head .sp-ln { min-width: 0; flex: 1; cursor: pointer; }
.sp-lane-head .sp-ln b { font-size: 13px; font-weight: 600; display: block; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.sp-lane-head .sp-ln i { font-style: normal; font-size: 10px; color: var(--sp-faint); letter-spacing: .4px;
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-lane-head .sp-hbtn { background: none; border: none; color: var(--sp-faint); cursor: pointer;
  padding: 4px; border-radius: 6px; flex-shrink: 0; display: flex; }
.sp-lane-head .sp-hbtn:hover { color: var(--sp-ink); background: var(--sp-raised); }
.sp-lane-head .sp-hbtn.sp-soloed { color: var(--accent, #d4f542); }
.sp-lane-body { position: relative;
  background:
    repeating-linear-gradient(to bottom, var(--sp-line) 0 1px, transparent 1px 52px),
    repeating-linear-gradient(to bottom, transparent 0 26px, rgba(44,53,66,.35) 26px 27px, transparent 27px 52px);
}
.sp-lane.sp-shared .sp-lane-body { background-color: rgba(212,245,66,.015); }
.sp-lane.sp-drop .sp-lane-body { background-color: rgba(212,245,66,.05); }

.sp-lane.sp-min { flex: 0 0 34px; min-width: 34px; cursor: pointer; }
.sp-lane.sp-min .sp-lane-head { padding: 0; justify-content: center; }
.sp-lane.sp-min .sp-lane-head .sp-ln, .sp-lane.sp-min .sp-lane-head .sp-hbtn { display: none; }
.sp-lane.sp-min .sp-lane-body > * { display: none; }
.sp-lane.sp-min .sp-lane-body { background: var(--sp-panel); }
.sp-minlabel { display: none; }
.sp-lane.sp-min .sp-minlabel { display: flex; position: sticky; top: calc(var(--sp-headh) + 10px);
  writing-mode: vertical-rl; margin: 14px auto 0; font-size: 10.5px; color: var(--sp-faint);
  letter-spacing: 1px; gap: 6px; align-items: center; }
.sp-minlabel .sp-mc { background: var(--sp-raised); border-radius: 8px; color: var(--sp-mut);
  font-size: 9.5px; padding: 5px 1px; writing-mode: horizontal-tb; }

.sp-nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--sp-race);
  z-index: 3; pointer-events: none; }
.sp-nowline::before { content: ""; position: absolute; left: -3px; top: -3.5px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--sp-race); }

/* ── Blocks ── */
.sp-blk { position: absolute; border-radius: 7px; padding: 4px 7px 4px 9px; cursor: grab;
  user-select: none; -webkit-user-select: none; overflow: hidden; display: flex; flex-direction: column;
  gap: 1px; z-index: 2; background: var(--sp-raised); border: 1px solid var(--sp-line2); }
.sp-blk::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--sp-edge, #8b95a7); }
.sp-blk:hover { border-color: #3a4657; z-index: 4; }
.sp-blk.sp-sel { box-shadow: 0 0 0 2px var(--accent, #d4f542); z-index: 5; }
.sp-blk.sp-dim { opacity: .16; pointer-events: none; }
.sp-blk .sp-bt { font-size: 9.5px; color: var(--sp-mut); font-variant-numeric: tabular-nums;
  letter-spacing: .3px; white-space: nowrap; }
.sp-blk .sp-bn { font-size: 12px; font-weight: 600; line-height: 1.15; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.sp-blk .sp-bm { display: flex; align-items: center; gap: 5px; margin-top: auto; padding-top: 2px;
  min-height: 0; flex-wrap: wrap; row-gap: 2px; }
.sp-blk.sp-tight { flex-direction: row; align-items: center; gap: 6px; padding-top: 2px; padding-bottom: 2px; }
.sp-blk.sp-tight .sp-bm { display: none; }
.sp-blk.sp-tight .sp-bt { order: 2; }
.sp-blk .sp-locdot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.sp-blk .sp-locnm { font-size: 10px; color: var(--sp-mut); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 90px; }
.sp-blk .sp-avs { display: flex; }
.sp-blk .sp-av { width: 15px; height: 15px; border-radius: 50%; font-size: 7.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; color: #000; margin-left: -4px;
  border: 1.5px solid var(--sp-raised); }
.sp-blk .sp-av:first-child { margin-left: 0; }
.sp-blk .sp-multi { font-size: 9px; color: var(--sp-mut); display: flex; align-items: center;
  gap: 2px; margin-left: auto; }
.sp-blk .sp-rz { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; cursor: ns-resize; }
.sp-blk.sp-session { background: color-mix(in srgb, var(--sp-tc) 14%, var(--sp-panel2));
  border-color: color-mix(in srgb, var(--sp-tc) 40%, var(--sp-line2)); }
.sp-blk.sp-session::before { background: var(--sp-tc); }
.sp-blk.sp-session .sp-bn { color: color-mix(in srgb, var(--sp-tc) 60%, var(--sp-ink)); }
.sp-blk .sp-typetag { font-size: 8.5px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--sp-tc); font-weight: 700; }
.sp-blk.sp-conflict { border-style: dashed; border-color: rgba(251,191,36,.65); }
.sp-blk.sp-conflict.sp-tight { padding-right: 18px; }
.sp-blk .sp-warnbdg { position: absolute; top: 3px; right: 4px; color: var(--sp-warn); }
.sp-blk.sp-dragging { opacity: .75; cursor: grabbing; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
#sp-page.sp-readonly .sp-blk { cursor: pointer; }
.sp-drawblk { position: absolute; left: 2%; width: 96%; background: rgba(212,245,66,.08);
  border: 1px dashed rgba(212,245,66,.55); border-radius: 7px; z-index: 6; pointer-events: none;
  font-size: 10px; color: var(--accent, #d4f542); padding: 3px 8px; font-variant-numeric: tabular-nums; }

/* ── Lane / add menu ── */
.sp-menu { position: fixed; z-index: 210; background: var(--sp-panel2); border: 1px solid var(--sp-line2);
  border-radius: 9px; min-width: 190px; padding: 4px; box-shadow: 0 12px 32px rgba(0,0,0,.5); }
.sp-menu .sp-mi { padding: 7px 10px; border-radius: 6px; font-size: 12.5px; color: var(--sp-ink);
  cursor: pointer; display: flex; gap: 8px; align-items: center; }
.sp-menu .sp-mi:hover { background: var(--sp-raised); }
.sp-menu .sp-mi.sp-msub { color: var(--sp-mut); font-size: 11px; cursor: default; padding-bottom: 2px; }
.sp-menu .sp-mi.sp-msub:hover { background: none; }
.sp-menu hr { border: none; border-top: 1px solid var(--sp-line); margin: 4px 2px; }
.sp-menu .sp-mdot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }

/* ── Inspector ── */
.sp-inspector { width: 0; flex-shrink: 0; overflow: hidden; border-left: 1px solid var(--sp-line);
  background: var(--sp-panel); transition: width .18s ease; display: flex; flex-direction: column; }
.sp-inspector.open { width: 342px; }
@media (max-width: 900px) { .sp-inspector.open { width: 300px; } }
.sp-insc { width: 342px; display: flex; flex-direction: column; min-height: 0; height: 100%; }
@media (max-width: 900px) { .sp-insc { width: 300px; } }
.sp-ins-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px;
  border-bottom: 1px solid var(--sp-line); flex-shrink: 0; }
.sp-kindpill { display: flex; background: var(--sp-panel2); border: 1px solid var(--sp-line);
  border-radius: 7px; padding: 2px; gap: 2px; }
.sp-kindpill button { background: none; border: none; color: var(--sp-mut); font-size: 11.5px;
  padding: 3px 10px; border-radius: 5px; cursor: pointer; }
.sp-kindpill button.on { background: var(--sp-raised); color: var(--sp-ink); }
.sp-ins-head .sp-x { margin-left: auto; background: none; border: none; color: var(--sp-faint);
  cursor: pointer; padding: 4px; border-radius: 6px; display: flex; }
.sp-ins-head .sp-x:hover { color: var(--sp-ink); background: var(--sp-raised); }
.sp-ins-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.sp-ins-body::-webkit-scrollbar { width: 8px; }
.sp-ins-body::-webkit-scrollbar-thumb { background: var(--sp-line2); border-radius: 4px; }
.sp-fgrp { display: flex; flex-direction: column; gap: 5px; flex-shrink: 0; }
.sp-flbl { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sp-faint);
  font-weight: 600; }
.sp-fin { background: var(--sp-panel2); border: 1px solid var(--sp-line); border-radius: 7px;
  color: var(--sp-ink); font-size: 13px; padding: 7px 10px; width: 100%; }
.sp-fin:focus { outline: none; border-color: rgba(212,245,66,.5); }
.sp-fin:disabled { opacity: .55; }
.sp-frow { display: flex; gap: 8px; }
.sp-frow .sp-fgrp { flex: 1; }
#sp-page input[type="time"].sp-fin { font-variant-numeric: tabular-nums; }
.sp-chiprow { display: flex; flex-wrap: wrap; gap: 5px; }
.sp-chip { background: var(--sp-panel2); border: 1px solid var(--sp-line); color: var(--sp-mut);
  font-size: 11.5px; padding: 4px 10px; border-radius: 16px; cursor: pointer;
  display: flex; align-items: center; gap: 6px; }
.sp-chip:hover { border-color: var(--sp-line2); color: var(--sp-ink); }
.sp-chip.on { border-color: rgba(212,245,66,.55); color: var(--accent, #d4f542);
  background: rgba(212,245,66,.07); }
.sp-chip .sp-cdot { width: 7px; height: 7px; border-radius: 50%; }
.sp-chip.sp-carchip.on { color: var(--sp-ink); border-color: var(--sp-cc);
  background: color-mix(in srgb, var(--sp-cc) 14%, var(--sp-panel2)); }
.sp-memchips { display: flex; flex-wrap: wrap; gap: 5px; }
.sp-memchip { display: flex; align-items: center; gap: 6px; background: var(--sp-panel2);
  border: 1px solid var(--sp-line); border-radius: 16px; padding: 3px 8px 3px 4px; font-size: 11.5px; }
.sp-memchip .sp-av { width: 18px; height: 18px; border-radius: 50%; font-size: 8.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; color: #000; }
.sp-memchip .sp-rm { background: none; border: none; color: var(--sp-faint); cursor: pointer;
  font-size: 12px; padding: 0 2px; line-height: 1; }
.sp-memchip .sp-rm:hover { color: var(--sp-race); }
.sp-rolebtns { display: flex; flex-wrap: wrap; gap: 5px; }
.sp-rolebtn { background: none; border: 1px solid var(--sp-rc); color: var(--sp-rc); font-size: 10.5px;
  letter-spacing: .4px; padding: 2px 9px; border-radius: 12px; cursor: pointer; }
.sp-rolebtn.on { background: var(--sp-rc); color: #000; font-weight: 600; }
.sp-memsearch-wrap { position: relative; }
.sp-memresults { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: var(--sp-panel2);
  border: 1px solid var(--sp-line2); border-radius: 8px; margin-top: 3px; overflow: hidden; display: none;
  max-height: 200px; overflow-y: auto; }
.sp-memresults.open { display: block; }
.sp-memresults .sp-mr { display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  cursor: pointer; font-size: 12.5px; }
.sp-memresults .sp-mr:hover { background: var(--sp-raised); }
.sp-memresults .sp-mr .sp-av { width: 18px; height: 18px; border-radius: 50%; font-size: 8.5px;
  font-weight: 700; display: flex; align-items: center; justify-content: center; color: #000; }
.sp-memresults .sp-mr i { font-style: normal; margin-left: auto; font-size: 10px; color: var(--sp-faint); }
.sp-ins-foot { border-top: 1px solid var(--sp-line); padding: 10px 14px; display: flex; gap: 8px;
  flex-shrink: 0; }
.sp-ins-foot button { flex: 1; font-size: 12.5px; padding: 7px 0; border-radius: 7px; cursor: pointer; }
.sp-dup { background: var(--sp-panel2); border: 1px solid var(--sp-line); color: var(--sp-mut); }
.sp-dup:hover { color: var(--sp-ink); border-color: var(--sp-line2); }
.sp-del { background: rgba(242,92,92,.08); border: 1px solid rgba(242,92,92,.35); color: var(--sp-race); }
.sp-del:hover { background: rgba(242,92,92,.16); }
.sp-notime { font-size: 11.5px; color: var(--sp-warn); background: rgba(251,191,36,.07);
  border: 1px solid rgba(251,191,36,.25); border-radius: 7px; padding: 7px 10px; }

/* ── Tray + legend ── */
.sp-tray { border-top: 1px solid var(--sp-line); background: var(--sp-panel); padding: 7px 16px;
  display: flex; align-items: center; gap: 10px; flex-shrink: 0; min-height: 40px; flex-wrap: wrap; }
.sp-tray .sp-tlbl { font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--sp-faint); font-weight: 600; flex-shrink: 0; }
.sp-traychip { background: var(--sp-panel2); border: 1px dashed var(--sp-line2); color: var(--sp-mut);
  font-size: 12px; padding: 4px 12px; border-radius: 16px; cursor: pointer;
  display: flex; gap: 6px; align-items: center; }
.sp-traychip:hover { color: var(--sp-ink); border-color: var(--sp-faint); }
.sp-traychip.sp-sel { border-color: var(--accent, #d4f542); color: var(--accent, #d4f542);
  border-style: solid; }
.sp-tray .sp-tempty { font-size: 11.5px; color: var(--sp-faint); font-style: italic; }
.sp-tray .sp-addun { margin-left: auto; background: none; border: none; color: var(--sp-faint);
  font-size: 11.5px; cursor: pointer; padding: 3px 8px; border-radius: 6px; flex-shrink: 0; }
.sp-tray .sp-addun:hover { color: var(--accent, #d4f542); background: var(--sp-panel2); }

.sp-legend { border-top: 1px solid var(--sp-line); background: var(--sp-panel); padding: 5px 16px;
  display: flex; align-items: center; gap: 16px; font-size: 10.5px; color: var(--sp-faint);
  flex-shrink: 0; flex-wrap: wrap; }
.sp-lg { display: flex; align-items: center; gap: 5px; }
.sp-lg .sp-d { width: 8px; height: 8px; border-radius: 2px; }
.sp-legend .sp-hint { margin-left: auto; }
.sp-legend .sp-hint b { color: var(--sp-mut); font-weight: 600; }

/* ── Unsaved-changes dialog (three-way: Save / Discard / Keep editing) ── */
.sp-dlg-backdrop { position: absolute; inset: 0; z-index: 40; display: flex;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(4,6,9,.66); }
.sp-dlg { background: var(--sp-panel2); border: 1px solid var(--sp-line2); border-radius: 14px;
  width: 100%; max-width: 420px; padding: 22px 24px 18px; box-shadow: 0 18px 48px rgba(0,0,0,.55); }
.sp-dlg-title { font-size: 16px; font-weight: 700; color: var(--sp-ink); }
.sp-dlg-msg { font-size: 13px; color: var(--sp-mut); margin-top: 6px; line-height: 1.5; }
.sp-dlg-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.sp-dlg-btn { font-size: 12.5px; font-weight: 600; padding: 8px 16px; border-radius: 8px;
  cursor: pointer; font-family: inherit; border: 1px solid var(--sp-line2); }
.sp-dlg-cancel { background: none; color: var(--sp-mut); }
.sp-dlg-cancel:hover { color: var(--sp-ink); border-color: var(--sp-faint); }
.sp-dlg-discard { background: none; border-color: rgba(242,92,92,.4); color: var(--sp-race); }
.sp-dlg-discard:hover { background: rgba(242,92,92,.12); }
.sp-dlg-save { background: var(--accent, #d4f542); border-color: var(--accent, #d4f542); color: #000; }
.sp-dlg-save:hover { filter: brightness(1.06); }
.sp-dlg-save:focus-visible { outline: 2px solid var(--sp-ink); outline-offset: 2px; }
body.light-mode #sp-page .sp-dlg-save { color: #1a2208; }

/* ── Light mode — token-level overrides; components read the tokens ── */
body.light-mode #sp-page {
  --sp-bg:#f5f7fb; --sp-panel:#ffffff; --sp-panel2:#f1f3f8; --sp-raised:#e8ecf4;
  --sp-line:#dde2ec; --sp-line2:#c9d1e0; --sp-ink:#2a3342; --sp-mut:#6b7688; --sp-faint:#93a0b4;
}
body.light-mode #sp-page .sp-lane-body {
  background:
    repeating-linear-gradient(to bottom, var(--sp-line) 0 1px, transparent 1px 52px),
    repeating-linear-gradient(to bottom, transparent 0 26px, rgba(201,209,224,.45) 26px 27px, transparent 27px 52px);
}
body.light-mode #sp-page .sp-constrip { background: #fdf6e0; border-bottom-color: #ecd990; }
body.light-mode #sp-page .sp-constrip li { color: #8a6d1f; }
body.light-mode #sp-page .sp-constrip .sp-daytag { background: #f3e6bb; color: #8a6d1f; }
body.light-mode #sp-page .sp-blk .sp-av { border-color: var(--sp-raised); }
body.light-mode #sp-page .sp-save { color: #1a2208; }

@media (prefers-reduced-motion: reduce) {
  #sp-page * { transition: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════════
   PHONE (≤600px)

   The planner already had the right bones for this: one day at a time via
   .sp-daytabs, a flex row of lanes with min-width, and a sticky time column.
   So the phone version is mostly a matter of committing to them — lanes get a
   fixed width and snap, the inspector stops being a side rail and becomes a
   bottom sheet, and the chrome collapses to one row.

   The one behaviour change is in the JS: drag-to-create can't work on touch
   (the same gesture scrolls the grid), so a TAP on empty lane space creates a
   30-minute block instead. See laneDown/drawUp.
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .sp-row1 { padding: 8px 10px 6px; gap: 8px; }
  .sp-row1 .sp-back span:not(.material-symbols-outlined) { display: none; }  /* arrow only */
  .sp-eyebrow { display: none; }
  #sp-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sp-editors-note { display: none; }
  .sp-save { padding: 9px 14px; }
  .sp-row2 { padding: 0 10px; }
  .sp-layerchips { display: none; }      /* → the inspector's own kind switch */
  .sp-legend { display: none; }          /* colour is learned from the blocks */

  /* Lanes: fixed 150px, snapped, so a swipe lands on a car rather than between two */
  .sp-planner { scroll-snap-type: x proximity; }
  .sp-lane { flex: 0 0 150px; min-width: 150px; scroll-snap-align: start; }
  .sp-timecol { width: 42px; }
  .sp-hourlbl span { font-size: 9.5px; right: 5px; }

  /* Blocks own their gesture — without this a drag scrolls the grid instead of
     moving the block. Empty lane space deliberately does NOT, so the time axis
     still scrolls. */
  .sp-blk, .sp-rz { touch-action: none; }
  .sp-blk { padding: 3px 5px 3px 8px; }
  .sp-blk .sp-bn { font-size: 11.5px; }

  /* The inspector becomes a bottom sheet: a 320px side rail at 390px would
     leave 70px of planner. */
  .sp-main { flex-direction: column; }
  /* Both selectors: the base pair is width:0 / .open{width:342px}, and .open
     (0,2,0) would otherwise keep winning the width here. */
  .sp-inspector, .sp-inspector.open {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; max-height: 62dvh; z-index: 60;
    border-left: none; border-top: 1px solid var(--sp-line);
    border-radius: 16px 16px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.5);
    overflow-y: auto;
  }
  .sp-inspector:not(.open) { display: none; }
  .sp-tray { max-height: 34dvh; }
}
