/* Schedule Portal — "transmission log"
 *
 * The design language comes from the room this tool is used in: continuity
 * sheets, playout logs, timecode, tally lights. Three consequences run through
 * everything below.
 *
 *   Monospace is the primary voice, titles included. Schedulers read columns of
 *   times, durations and asset ids all day; proportional digits do not align and
 *   a log that does not align is harder to scan. Prose sans is kept for the
 *   human-language layer only — descriptions, help text.
 *
 *   Amber is the accent, because in a gallery amber is the tally: it means this
 *   one is live. Red is held back for genuine alerts — an expired licence, a
 *   clash — so it keeps its force.
 *
 *   The tally edge is the signature: a 3px left rule that marks state on
 *   anything that has one. It is already half-present in the asset table, where
 *   each row carries its source CSV's colour; everything else now follows that
 *   same grammar rather than inventing a second one.
 */

:root {
  --ink:      #15181C;   /* chrome, primary text */
  --ink-soft: #2C3238;
  --paper:    #EEF0EE;   /* page — cool grey-green card stock */
  --surface:  #FFFFFF;
  --rule:     #D4D9D5;
  --rule-soft:#E6EAE7;
  --muted:    #5A625D;
  --signal:   #A25507;   /* tally amber — active, primary action */
  --signal-w: #FBF3E7;   /* amber wash */
  --live:     #A3201B;   /* on air / alert — used sparingly on purpose */
  --live-w:   #FBEDEC;
  --go:       #2F6B44;   /* confirmed */
  --go-w:     #EAF3ED;
  --slate:    #4A5A63;   /* recessive: planning marks, not content */
  --slate-w:  #EFF3F4;

  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono",
          "Roboto Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;

  --r: 2px;              /* machined, not pillowy */
  --tally: 3px;

  /* chrome = the ink-dark header bar; separate tokens so dark mode can keep
     the bar distinct from the page instead of dissolving into it. */
  --chrome:            #15181C;
  --chrome-fg:         #A9B2AE;
  --chrome-fg-strong:  #FFFFFF;
  --chrome-hover:      rgba(255,255,255,.05);

  --surface-2:  #FBFCFB;   /* kv row headers, quiet panels */
  --row-hover:  #FAFBFA;
  --slate-w-soft: #F6F9FA; /* mid-roll rows */
  --slate-soft: #7B888E;
  --disabled-fg:#A7AFAA;
  --disabled-bg:#F7F8F7;
  --go-deep:    #1E4A2E;   /* flash text on washes */
  --live-deep:  #7A1714;
  --on-accent:  #FFFFFF;   /* text on solid go/slate badges */
  --shadow:     rgba(21,24,28,.28);
  --glow:       none;      /* dark mode lights the tallies */

  color-scheme: light;
}

/* After dark: the same control room with the house lights off. The page goes
   near-black with the green cast of the card stock kept; the tally lamps —
   amber, red, green — are the light sources now, so the lit ones carry a
   faint glow. One grammar, two times of day. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink:      #E4E7E2;
    --ink-soft: #C3C9C2;
    --paper:    #131614;
    --surface:  #1A1E1B;
    --rule:     #2E332F;
    --rule-soft:#242923;
    --muted:    #8B948D;
    --signal:   #E89230;
    --signal-w: #2A2015;
    --live:     #E25A50;
    --live-w:   #2C1815;
    --go:       #58A874;
    --go-w:     #152219;
    --slate:    #8FA2AC;
    --slate-w:  #1C2225;
    --chrome:            #0D0F0E;
    --chrome-fg:         #8B948D;
    --chrome-fg-strong:  #F2F4F1;
    --chrome-hover:      rgba(255,255,255,.06);
    --surface-2:  #1F231F;
    --row-hover:  #1E221F;
    --slate-w-soft: #181D20;
    --slate-soft: #6E7E87;
    --disabled-fg:#565E58;
    --disabled-bg:#171A18;
    --go-deep:    #9FD3B2;
    --live-deep:  #F0A29C;
    --on-accent:  #10130F;
    --shadow:     rgba(0,0,0,.55);
    --glow:       0 0 10px rgba(232,146,48,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink:      #E4E7E2;
  --ink-soft: #C3C9C2;
  --paper:    #131614;
  --surface:  #1A1E1B;
  --rule:     #2E332F;
  --rule-soft:#242923;
  --muted:    #8B948D;
  --signal:   #E89230;
  --signal-w: #2A2015;
  --live:     #E25A50;
  --live-w:   #2C1815;
  --go:       #58A874;
  --go-w:     #152219;
  --slate:    #8FA2AC;
  --slate-w:  #1C2225;
  --chrome:            #0D0F0E;
  --chrome-fg:         #8B948D;
  --chrome-fg-strong:  #F2F4F1;
  --chrome-hover:      rgba(255,255,255,.06);
  --surface-2:  #1F231F;
  --row-hover:  #1E221F;
  --slate-w-soft: #181D20;
  --slate-soft: #6E7E87;
  --disabled-fg:#565E58;
  --disabled-bg:#171A18;
  --go-deep:    #9FD3B2;
  --live-deep:  #F0A29C;
  --on-accent:  #10130F;
  --shadow:     rgba(0,0,0,.55);
  --glow:       0 0 10px rgba(232,146,48,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  font-family: var(--sans);
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ chrome */

header {
  background: var(--chrome);
  color: var(--chrome-fg-strong);
  padding: 0 24px;
  border-bottom: var(--tally) solid var(--signal);
  box-shadow: var(--glow);
}
header nav {
  display: flex; gap: 2px; align-items: stretch;
  max-width: 1280px; margin: 0 auto;
}
header a {
  color: var(--chrome-fg); text-decoration: none;
  font-family: var(--mono); font-size: 12px;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 14px 12px; display: flex; align-items: center;
  border-bottom: var(--tally) solid transparent; margin-bottom: calc(var(--tally) * -1);
}
header a:hover { color: var(--chrome-fg-strong); background: var(--chrome-hover); }
header a.brand {
  color: var(--chrome-fg-strong); font-weight: 700; letter-spacing: .1em;
  margin-right: auto; padding-left: 0;
}
header a.brand:hover { background: none; }
/* The tally: the section you are in is lit. */
header a[aria-current="page"], header a.active {
  color: var(--chrome-fg-strong); border-bottom-color: var(--signal);
}
/* The lit tally warms up rather than snapping on. */
header a { transition: color .15s ease, background-color .15s ease, border-bottom-color .25s ease; }
/* Lock is a submit button styled as a nav item, so it needs the nav's rules
   rather than the amber-underline treatment button.link gets on white. */
header form.inline { display: flex; align-items: stretch; }
header button.nav-lock, header button.theme-toggle {
  color: var(--chrome-fg); text-decoration: none;
  font-family: var(--mono); font-size: 12px;
  letter-spacing: .06em; text-transform: uppercase;
  padding: 14px 12px; background: none; border: none; cursor: pointer;
}
header button.nav-lock:hover, header button.theme-toggle:hover {
  color: var(--chrome-fg-strong); background: var(--chrome-hover); text-decoration: none;
}
header button.theme-toggle { font-size: 14px; padding: 14px 10px; }

main { max-width: 1280px; margin: 28px auto 64px; padding: 0 24px; }

/* --------------------------------------------------------------- typography */

h1, h2, h3 {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}
h1 { margin: 0 0 20px; font-size: 26px; }
h2 { margin: 40px 0 12px; font-size: 16px; text-transform: uppercase;
     letter-spacing: .08em; color: var(--ink-soft); }
/* Section rule under standalone h2s only — .inline-h sits inside a <summary>,
   where a horizontal rule would cut the disclosure header in half. */
h2:not(.inline-h)::after {
  content: ""; display: block; height: 1px; background: var(--rule);
  margin-top: 8px;
}
h3 { font-size: 14px; margin: 20px 0 8px; }
a { color: var(--signal); }
a:hover { color: var(--ink); }
p { margin: 8px 0; }

code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--slate-w); color: var(--ink);
  padding: 1px 5px; border-radius: var(--r);
}
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ tables */
/* The log. Data columns are mono so times and ids line up down the page. */

table {
  width: 100%; border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
}
th, td {
  padding: 9px 12px; text-align: left;
  border-bottom: 1px solid var(--rule-soft); vertical-align: top;
}
th {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--row-hover); }
td, th { transition: background-color .12s ease; }
td.nowrap, .kv th { font-variant-numeric: tabular-nums; }
/* Times, ids and durations read as data, not prose. */
td code, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.kv th {
  text-align: left; width: 180px; background: var(--surface-2);
  text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--muted);
}

/* ------------------------------------------------------------------- cards */

.cards { display: flex; gap: 12px; flex-wrap: wrap; }
.card {
  background: var(--surface); border: 1px solid var(--rule);
  border-left: var(--tally) solid var(--ink);
  border-radius: var(--r); padding: 16px 18px; min-width: 180px; flex: 1;
}
.card h2 {
  margin: 0; font-size: 11px; letter-spacing: .09em; color: var(--muted);
}
.card h2::after { display: none; }
.card .big {
  font-family: var(--mono); font-size: 38px; font-weight: 600;
  margin: 6px 0 0; line-height: 1; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.card p { margin: 2px 0; font-size: 12.5px; color: var(--muted); }
.card p a { font-family: var(--mono); font-size: 12px; text-decoration: none; }
.card p a:hover { text-decoration: underline; }
.card summary { cursor: pointer; list-style: none; }
.card summary::-webkit-details-marker { display: none; }
.inline-h { display: inline-block; margin: 0; font-size: 15px; }

/* ------------------------------------------------------------------- forms */

input, select, button, textarea { font-family: var(--sans); font-size: 13.5px; }
input, select, textarea {
  padding: 7px 10px; border: 1px solid var(--rule);
  border-radius: var(--r); background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--signal); outline-offset: -1px; border-color: var(--signal);
}
textarea { width: 100%; }
input[type=date], input[type=time], input[type=number] {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
}

button[type=submit] {
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  padding: 8px 16px; border-radius: var(--r); cursor: pointer;
  font-family: var(--mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: .07em;
}
button[type=submit] { transition: background-color .15s ease, border-color .15s ease, transform .05s ease; }
button[type=submit]:hover { background: var(--signal); border-color: var(--signal); }
button[type=submit]:active { transform: translateY(1px); }
button[type=submit]:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

form.inline, button.link { display: inline; }
button.link {
  background: none; border: none; color: var(--signal); text-decoration: underline;
  cursor: pointer; padding: 0; font-size: inherit; font-family: inherit;
}
button.link:hover { color: var(--ink); }
button.link.danger { color: var(--live); }

.filters {
  display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 10px 12px;
}
.filters select, .filters input { padding: 6px 9px; }
.filters button[type=submit] { padding: 7px 14px; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
             gap: 12px; margin-top: 12px; align-items: end; }
.grid-form label, .inline-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.inline-form {
  display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
  background: var(--surface); padding: 14px; border: 1px solid var(--rule);
  border-left: var(--tally) solid var(--rule);
  border-radius: var(--r); margin: 12px 0;
}
.inline-form .checkbox { flex-direction: row; align-items: center; }
/* Grid forms lay labels out as a column (caption above control); a checkbox
   wants the opposite, with its own hint allowed to wrap underneath. */
.grid-form .checkbox {
  flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 6px;
  text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--ink);
}
.grid-form .checkbox .hint { flex-basis: 100%; }
.add-entry select { min-width: 360px; }
.inline-checkbox {
  display: inline-flex; align-items: center; gap: 5px; margin-right: 10px;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}

/* ------------------------------------------------------------------ badges */
/* Small, square-ish, mono. Licence state is the one thing a scheduler must
   never misread, so those three carry colour; everything else stays quiet. */

.badge {
  display: inline-block; padding: 2px 6px; border-radius: var(--r);
  background: var(--slate-w); color: var(--ink-soft);
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; vertical-align: 1px;
}
.badge-new     { background: var(--go);   color: var(--on-accent); }
.badge-edited  { background: transparent; color: var(--muted);
                 box-shadow: inset 0 0 0 1px var(--rule); }
.badge-active  { background: var(--go-w);     color: var(--go); }
.badge-future  { background: var(--signal-w); color: var(--signal); }
.badge-expired { background: var(--live-w);   color: var(--live); }
.badge-ad      { background: var(--slate);    color: var(--on-accent); }

/* ------------------------------------------------------- source provenance */

.source-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 5px; vertical-align: baseline;
}
.source-legend { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.source-legend .muted {
  font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em;
}
.source-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface); color: var(--ink-soft); text-decoration: none;
  font-family: var(--mono); font-size: 11px;
}
.source-chip:hover { border-color: var(--muted); color: var(--ink); }
.source-chip.active {
  border-color: var(--signal); background: var(--signal-w);
  color: var(--signal); font-weight: 600;
}

/* ----------------------------------------------------------------- notices */
/* All four use the tally edge, so severity reads from colour alone. */

.flashes { list-style: none; padding: 0; margin: 0 0 20px; }
.flash {
  padding: 10px 14px; border-radius: var(--r); margin-bottom: 6px;
  border-left: var(--tally) solid; font-size: 13px;
  animation: flash-in .28s ease both;
}
.flash-ok  { background: var(--go-w);   border-color: var(--go);   color: var(--go-deep); }
.flash-err { background: var(--live-w); border-color: var(--live); color: var(--live-deep); }
.flash.dismissing { animation: flash-out .3s ease both; }
@keyframes flash-in  { from { opacity: 0; transform: translateY(-6px); } }
@keyframes flash-out { to   { opacity: 0; transform: translateY(-4px); } }

.reserved-banner, .warn-banner, .ad-summary {
  padding: 11px 14px; margin: 12px 0; font-size: 12.5px;
  border-radius: var(--r); border-left: var(--tally) solid;
}
.reserved-banner { background: var(--signal-w); border-color: var(--signal); }
.reserved-banner .badge { margin-left: 6px; background: var(--surface); color: var(--signal); }
.warn-banner { background: var(--signal-w); border-color: var(--signal); }
.warn-banner ul { margin: 8px 0 0; padding-left: 20px; }
.warn-banner p { margin: 6px 0; }
.ad-summary { background: var(--slate-w); border-color: var(--slate); }
.ad-summary form { display: inline; margin-left: 10px; }

/* --------------------------------------------------------------- ad breaks */
/* Planning marks, not content: they recede so the running order stays legible. */

.ad-row td { background: var(--slate-w); color: var(--slate); }
.ad-row .muted { color: var(--slate-soft); }
.ad-midroll td { background: var(--slate-w-soft); font-size: 12.5px; }

/* -------------------------------------------------------------- pagination */

.pagination { display: flex; gap: 4px; align-items: center; justify-content: center;
              margin: 20px 0; flex-wrap: wrap; }
.pagination .page-num, .pagination .page-step {
  display: inline-block; min-width: 32px; text-align: center;
  padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--surface); color: var(--ink-soft); text-decoration: none;
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
}
.pagination .page-num:hover, .pagination .page-step:hover {
  border-color: var(--signal); color: var(--signal);
}
.pagination .page-num.current {
  background: var(--ink); border-color: var(--ink); color: var(--paper); font-weight: 600;
}
.pagination .page-step.disabled,
.pagination .page-step.disabled:hover {
  color: var(--disabled-fg); background: var(--disabled-bg);
  border-color: var(--rule-soft); cursor: default;
}
.pagination .page-gap { color: var(--disabled-fg); padding: 0 2px; font-family: var(--mono); }

/* ----------------------------------------------------------- two-column ed */

.two-col { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
/* Without this the editor column's min-content (wide forms, the lane) can
   push the whole grid past the viewport instead of wrapping/scrolling. */
.two-col > section { min-width: 0; }
.two-col aside {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 14px;
  position: sticky; top: 16px; align-self: start;
  max-height: calc(100vh - 32px); overflow-y: auto;
}
.date-list { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow-y: auto; }
.date-list a {
  display: block; padding: 6px 9px; border-radius: var(--r);
  color: var(--ink-soft); text-decoration: none;
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
  border-left: var(--tally) solid transparent;
}
.date-list a:hover { background: var(--paper); color: var(--ink); }
.date-list a.active {
  background: var(--signal-w); border-left-color: var(--signal);
  color: var(--signal); font-weight: 600;
}

/* ------------------------------------------------------------- access gate */
/* The one full-bleed screen. Ink field, single lit card — a slate before air. */

body.gate { background: var(--chrome); }
.gate-main {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px; max-width: none; margin: 0;
}
.gate-card {
  background: var(--surface); border-radius: var(--r); padding: 32px;
  width: 100%; max-width: 380px;
  border-top: var(--tally) solid var(--signal);
  box-shadow: 0 24px 60px var(--shadow);
}
.gate-title { margin: 0; font-family: var(--mono); font-size: 19px; letter-spacing: -.01em; }
.gate-sub { margin: 6px 0 22px; color: var(--muted); font-size: 13px; }
.gate-label {
  display: block; font-family: var(--mono); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .09em; color: var(--muted);
  margin-bottom: 6px;
}
.gate-input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--rule);
  border-radius: var(--r); letter-spacing: .28em; text-transform: uppercase;
  font-family: var(--mono); font-size: 15px;
}
.gate-input:focus { outline: 2px solid var(--signal); outline-offset: -1px; border-color: var(--signal); }
button.gate-submit { width: 100%; margin-top: 18px; padding: 12px; font-size: 12px; }

/* -------------------------------------------------------------- foundation */

:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
  .add-entry select { min-width: 0; width: 100%; }
}
@media (max-width: 640px) {
  main { padding: 0 14px; margin-top: 18px; }
  header { padding: 0 14px; }
  header nav { flex-wrap: wrap; }
  header a { padding: 10px 8px; font-size: 11px; }
  h1 { font-size: 21px; }
}
/* Tables scroll inside a wrapper (added by portal.js) so the table keeps its
   semantics for assistive tech; the wrapper is focusable for keyboard scroll. */
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --- a11y utilities (bug-sweep additions; design pass extends these) --- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--paper); padding: 6px 12px;
  font-family: var(--mono); font-size: 12px;
}
.skip-link:focus { left: 0; }
input.time-late { width: 5.5em; font-family: var(--mono); }

/* --- validator issues panel --- */
.issues-panel {
  border: 1px solid var(--rule); border-left: var(--tally) solid var(--live);
  background: var(--live-w); padding: 10px 14px; margin: 14px 0;
}
.issues-title { margin: 0 0 6px; }
.issues-list { list-style: none; margin: 0; padding: 0; }
.issue { font-size: 13px; padding: 3px 0; }
.issue-code {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; margin-right: 6px; color: var(--live);
}
.issue-warn .issue-code { color: var(--slate); }
.issues-clear { font-family: var(--mono); font-size: 12px; color: var(--go); }

/* --- timeline lane --- */
.lane-wrap {
  overflow-x: auto; border: 1px solid var(--rule); background: var(--surface);
  margin: 10px 0 18px; position: relative;
}
.lane { position: relative; height: 92px; }
.lane-tick {
  position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--rule-soft);
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  padding-left: 3px; pointer-events: none;
}
.lane-reserved {
  position: absolute; top: 18px; height: 44px;
  background: repeating-linear-gradient(45deg, var(--slate-w), var(--slate-w) 6px,
              transparent 6px, transparent 12px);
  border: 1px dashed var(--slate); color: var(--slate);
  font-family: var(--mono); font-size: 10.5px; padding: 2px 4px;
  overflow: hidden; white-space: nowrap;
}
.lane-entry {
  position: absolute; top: 18px; height: 44px; box-sizing: border-box;
  background: var(--signal-w); border: 1px solid var(--signal);
  border-left: var(--tally) solid var(--signal);
  border-radius: var(--r); cursor: grab; overflow: hidden;
  padding: 3px 5px; user-select: none; touch-action: none;
}
.lane-entry:focus { outline: 2px solid var(--signal); outline-offset: 1px; }
.lane-entry { transition: box-shadow .15s ease, background-color .15s ease; }
.lane-entry.dragging { cursor: grabbing; z-index: 5; box-shadow: 0 4px 14px var(--shadow); }
.lane-entry.conflict { background: var(--live-w); border-color: var(--live); }
.lane-entry.saving { opacity: 0.5; pointer-events: none; }
.lane-entry-time { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.lane-entry-title {
  display: block; font-size: 11.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.lane-break {
  position: absolute; top: 66px; height: 12px;
  background: var(--slate-w); border: 1px solid var(--slate);
}
.lane-break.pinned { border-width: 2px; }
.lane-issue {
  position: absolute; top: 2px; width: 14px; height: 14px; line-height: 14px;
  text-align: center; font-family: var(--mono); font-size: 11px; font-weight: 700;
  border-radius: 50%; color: #fff; background: var(--live); z-index: 4;
}
.lane-issue.warn { background: var(--slate); }

/* --- promo line-ups & kind badge --- */
.badge-kind { background: var(--slate-w); color: var(--slate); border: 1px solid var(--slate); }
.lineup summary {
  cursor: pointer; font-family: var(--mono); font-size: 11px; color: var(--slate);
}
.lineup-list { margin: 4px 0 4px 0; padding-left: 22px; font-size: 12px; }
.lineup-list li { padding: 1px 0; }

/* --- confirm dialog (replaces window.confirm; see portal.js) --- */
dialog.confirm-dialog {
  border: 1px solid var(--rule); border-top: var(--tally) solid var(--live);
  border-radius: var(--r); background: var(--surface); color: var(--ink);
  padding: 20px 22px; max-width: 420px; box-shadow: 0 18px 50px var(--shadow);
}
dialog.confirm-dialog::backdrop { background: rgba(0,0,0,.45); }
dialog.confirm-dialog[open] { animation: flash-in .18s ease both; }
.confirm-msg { margin: 0 0 16px; font-size: 13.5px; line-height: 1.55; }
.confirm-row { display: flex; gap: 8px; justify-content: flex-end; }
.confirm-row button {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase;
  letter-spacing: .07em; padding: 8px 14px; border-radius: var(--r); cursor: pointer;
}
.confirm-row .confirm-cancel {
  background: var(--surface); color: var(--ink-soft); border: 1px solid var(--rule);
}
.confirm-row .confirm-go {
  background: var(--live); color: #fff; border: 1px solid var(--live);
}
.confirm-row .confirm-go:hover { filter: brightness(1.1); }

/* --- disclosure motion --- */
details.lineup > ol, details.card > * { animation: none; }
details[open] > .lineup-list,
details[open] > .grid-form { animation: flash-in .2s ease both; }

/* Issue markers on the lane pulse once when the page loads — a glance-catcher,
   not a siren. */
.lane-issue { animation: issue-pop .4s ease both; }
@keyframes issue-pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.15); } }

/* ===================================================== task-shaped UI ===== */
/* Phase 1 of the UX revamp: the page tells you what it is for, what to do
   next, and what is wrong — before it shows you a table. */

.lede {
  margin: -8px 0 16px; max-width: 68ch;
  font-size: 13.5px; color: var(--muted);
}
.hint {
  display: block; font-size: 12px; color: var(--muted);
  font-family: var(--sans);
}

/* --- section tabs (Library: Assets | Imports) --- */
.tabs {
  display: flex; gap: 2px; margin: 0 0 20px;
  border-bottom: 1px solid var(--rule);
}
.tab {
  font-family: var(--mono); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .07em; text-decoration: none; color: var(--muted);
  padding: 8px 14px; border: 1px solid transparent; border-bottom: none;
  border-radius: var(--r) var(--r) 0 0; margin-bottom: -1px;
  transition: color .15s ease, background-color .15s ease;
}
.tab:hover { color: var(--ink); background: var(--surface); }
.tab.active {
  color: var(--ink); background: var(--surface);
  border-color: var(--rule); border-top: var(--tally) solid var(--signal);
  padding-top: calc(8px - var(--tally) + 1px);
}

/* --- empty states: never a bare "nothing here" --- */
.empty-state {
  background: var(--surface); border: 1px dashed var(--rule);
  border-radius: var(--r); padding: 28px 24px; text-align: center;
  margin: 16px 0;
}
.empty-title {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  color: var(--ink); margin: 0 0 6px;
}
.empty-state .hint { max-width: 52ch; margin: 0 auto 14px; }

/* --- primary call to action --- */
.btn-primary {
  display: inline-block; background: var(--signal); color: var(--on-accent);
  border: 1px solid var(--signal); border-radius: var(--r);
  padding: 9px 18px; text-decoration: none;
  font-family: var(--mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: .07em;
  transition: filter .15s ease, transform .05s ease;
}
.btn-primary:hover { filter: brightness(1.08); color: var(--on-accent); }
.btn-primary:active { transform: translateY(1px); }

/* --- home --- */
.home-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.home-head h2 { flex: 1; }
.home-head h2::after { display: none; }

.work-card {
  text-decoration: none; color: inherit; display: block;
  border-left-color: var(--signal);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.work-card:hover {
  transform: translateY(-2px); box-shadow: 0 6px 18px var(--shadow);
  color: inherit;
}
.work-card.has-errors { border-left-color: var(--live); }
.work-name {
  font-family: var(--mono); font-size: 16px; font-weight: 600;
  color: var(--ink); margin: 4px 0 2px; letter-spacing: -.01em;
}
a.card { text-decoration: none; color: inherit; }
a.card:hover { color: inherit; border-color: var(--signal); }

.chip {
  display: inline-block; margin: 8px 0 0; padding: 2px 8px;
  border-radius: var(--r); font-family: var(--mono); font-size: 11px;
  font-weight: 600; letter-spacing: .05em;
}
.chip-ok   { background: var(--go-w);     color: var(--go); }
.chip-warn { background: var(--slate-w);  color: var(--slate); }
.chip-err  { background: var(--live-w);   color: var(--live); }

/* --- attention list --- */
.attention { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.attn-row {
  display: grid; grid-template-columns: 90px 1fr auto; gap: 12px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--rule);
  border-left: var(--tally) solid var(--slate);
  border-radius: var(--r); padding: 10px 14px;
  text-decoration: none; color: var(--ink); font-size: 13px;
  transition: border-color .12s ease, background-color .12s ease;
}
.attn-row:hover { border-color: var(--signal); color: var(--ink); }
.attn-row.attn-err  { border-left-color: var(--live); }
.attn-row.attn-warn { border-left-color: var(--signal); }
.attn-tag {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.attn-row .hint { text-align: right; }

/* --- getting-started checklist --- */
.checklist { margin-bottom: 24px; border-left-color: var(--signal); }
.checklist-list { list-style: none; margin: 10px 0 0; padding: 0; }
.checklist-list li {
  display: grid; grid-template-columns: 26px 1fr; gap: 4px 10px;
  align-items: baseline; padding: 6px 0;
}
.checklist-list li .hint { grid-column: 2; }
.check-mark {
  grid-row: span 2; width: 22px; height: 22px; line-height: 21px; text-align: center;
  border-radius: 50%; font-family: var(--mono); font-size: 11px; font-weight: 700;
  border: 1px solid var(--rule); color: var(--muted);
}
.checklist-list li.done .check-mark {
  background: var(--go); border-color: var(--go); color: var(--on-accent);
}
.checklist-list li.done > a { color: var(--muted); }

@media (max-width: 640px) {
  .attn-row { grid-template-columns: 1fr; gap: 2px; }
  .attn-row .hint { text-align: left; }
  .home-head { flex-direction: column; align-items: stretch; gap: 8px; }
}

/* ================================================ schedule workspace ===== */
/* Phase 2: the day editor stops being a stack of forms and becomes a place to
   work — a spine that says which day you are on, the running order, and the
   library within reach. */

.crumb { margin: 0 0 4px; font-family: var(--mono); font-size: 12px; }

/* --- the day bar --- */
.day-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--rule);
  border-left: var(--tally) solid var(--signal);
  border-radius: var(--r); padding: 8px 12px; margin: 0 0 16px;
  box-shadow: 0 1px 0 var(--rule-soft);
}
.day-step {
  font-family: var(--mono); font-size: 16px; line-height: 1;
  text-decoration: none; color: var(--ink-soft);
  border: 1px solid var(--rule); border-radius: var(--r);
  padding: 6px 11px; transition: border-color .12s ease, color .12s ease;
}
.day-step:hover { border-color: var(--signal); color: var(--signal); }
.day-now { display: flex; flex-direction: column; min-width: 190px; }
.day-date {
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  letter-spacing: -.01em; color: var(--ink);
}
.day-weekday {
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.day-bar .chip { margin: 0; text-decoration: none; }
a.chip:hover { filter: brightness(1.06); }
.day-bar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.day-today {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; text-decoration: none; color: var(--signal);
}
.day-bar input[type=date] { padding: 5px 8px; }

.kbd-help > summary {
  cursor: help; list-style: none; width: 22px; height: 22px; line-height: 20px;
  text-align: center; border: 1px solid var(--rule); border-radius: 50%;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.kbd-help > summary::-webkit-details-marker { display: none; }
.kbd-help[open] > summary { border-color: var(--signal); color: var(--signal); }
.kbd-list {
  position: absolute; right: 12px; z-index: 30; margin-top: 6px;
  display: grid; grid-template-columns: auto 1fr; gap: 3px 12px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 12px 14px; box-shadow: 0 10px 30px var(--shadow);
  font-size: 12px; min-width: 280px;
}
.kbd-list dt { font-family: var(--mono); font-size: 11px; color: var(--signal); }
.kbd-list dd { margin: 0; color: var(--muted); }

/* --- two-column workspace --- */
.workspace { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.workspace > .work-main { min-width: 0; }

/* --- collapsible setup --- */
.setup {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); margin: 0 0 12px; padding: 0 14px;
}
.setup > summary {
  cursor: pointer; padding: 11px 0; display: flex; align-items: baseline;
  gap: 10px; flex-wrap: wrap;
}
.setup[open] > summary { border-bottom: 1px solid var(--rule-soft); }
.setup-title {
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--ink);
}
.setup > summary .hint { display: inline; }
.setup .inline-form { border: none; border-left: none; padding: 12px 0; margin: 0; background: none; }
.setup .inline-form + .inline-form { border-top: 1px dashed var(--rule-soft); }

.run-title { display: flex; align-items: baseline; gap: 10px; }
.run-title .hint { display: inline; font-family: var(--mono); }

/* --- library picker panel --- */
.picker {
  position: sticky; top: 64px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 12px;
  max-height: calc(100vh - 84px); display: flex; flex-direction: column;
}
.picker-title { margin: 0 0 8px; font-size: 13px; }
.picker-filter { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.picker-filter input[type=search] { grid-column: 1 / -1; }
.picker-count { margin: 8px 0 4px; }
.picker-list {
  list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1;
  border-top: 1px solid var(--rule-soft);
}
.picker-item {
  padding: 9px 2px; border-bottom: 1px solid var(--rule-soft);
  transition: background-color .12s ease;
}
.picker-item:hover { background: var(--row-hover); }
.picker-item.armed {
  background: var(--signal-w);
  box-shadow: inset var(--tally) 0 0 0 var(--signal);
}
.picker-name { display: block; font-size: 13px; line-height: 1.35; }
.picker-meta .hint { margin-top: 1px; }
.picker-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.badge-weight { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--rule); }
.picker-add { display: flex; gap: 4px; align-items: center; margin-top: 6px; }
.picker-time { width: 6.5em; padding: 5px 7px; }
.picker-aim, .picker-go {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; border-radius: var(--r); cursor: pointer;
  padding: 6px 10px; border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink-soft); transition: border-color .12s ease, color .12s ease;
}
.picker-aim:hover, .picker-go:hover { border-color: var(--signal); color: var(--signal); }
.picker-go { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.picker-go:hover { background: var(--signal); border-color: var(--signal); color: var(--on-accent); }
.picker-item.armed .picker-aim { border-color: var(--signal); color: var(--signal); background: var(--signal-w); }
.picker-days { margin-top: 10px; border-top: 1px solid var(--rule-soft); padding-top: 8px; }
.picker-days > summary {
  cursor: pointer; font-family: var(--mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.picker .empty-state { padding: 18px 12px; }

/* Lane in placement mode: empty stretches invite a click. */
.lane.placing { cursor: crosshair; }
.lane.placing .lane-entry { cursor: crosshair; }
.lane-ghost {
  position: absolute; top: 18px; height: 44px; pointer-events: none;
  border: 1px dashed var(--signal); background: var(--signal-w);
  opacity: .75; border-radius: var(--r); z-index: 3;
}

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .picker { position: static; max-height: none; }
  .picker-list { max-height: 420px; }
}
@media (max-width: 640px) {
  .day-bar { gap: 8px; }
  .day-now { min-width: 0; }
  .day-bar-end { width: 100%; margin-left: 0; }
}

/* --- export card & row menus (phase 3) --- */
.export-card {
  margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule-soft);
}
.export-links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.export-links a:not(.btn-primary) { font-family: var(--mono); font-size: 11.5px; }
.export-card .warn-banner { margin: 6px 0; padding: 8px 10px; }

.row-menu { display: inline-block; position: relative; margin-right: 10px; }
.row-menu > summary {
  cursor: pointer; list-style: none; color: var(--signal);
  text-decoration: underline; font-size: inherit;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-body {
  position: absolute; z-index: 25; right: 0; margin-top: 4px;
  display: flex; flex-direction: column; gap: 2px; min-width: 170px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 8px 10px; box-shadow: 0 10px 30px var(--shadow);
}
.row-menu-body a { font-family: var(--mono); font-size: 11.5px; text-decoration: none; }
.row-menu-body a:hover { text-decoration: underline; }

/* --- undo offer (phase 4) --- */
.flash-undo {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.flash-undo button.link {
  font-family: var(--mono); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--go-deep);
}

/* --- EPG generator run report --- */
.run-report {
  background: var(--surface-2); border: 1px solid var(--rule-soft);
  border-radius: var(--r); padding: 12px 14px; margin: 8px 0 0;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55;
  color: var(--ink-soft); overflow-x: auto; white-space: pre-wrap;
  max-height: 420px; overflow-y: auto;
}
input[type=file] { font-family: var(--mono); font-size: 12px; padding: 6px 0; }

/* --- import page --- */
.import-card { margin-top: 20px; }
/* Fields in the import forms carry multi-line hints, so align their tops
   rather than their baselines — otherwise short fields sink to the bottom of
   a tall row. */
.import-card .grid-form { align-items: start; }
.kind-split { margin-top: 6px; font-family: var(--mono); font-size: 11.5px; }
.kind-split a { text-decoration: none; }
.kind-split a:hover { text-decoration: underline; }
