/* 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;
}

* { 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(--ink);
  color: #fff;
  padding: 0 24px;
  border-bottom: var(--tally) solid var(--signal);
}
header nav {
  display: flex; gap: 2px; align-items: stretch;
  max-width: 1280px; margin: 0 auto;
}
header a {
  color: #A9B2AE; 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: #fff; background: rgba(255,255,255,.05); }
header a.brand {
  color: #fff; 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: #fff; border-bottom-color: var(--signal); }
/* 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 {
  color: #A9B2AE; 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 {
  color: #fff; background: rgba(255,255,255,.05); text-decoration: none;
}

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: #FAFBFA; }
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: #FBFCFB;
  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: #fff; 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]:hover { background: var(--signal); border-color: var(--signal); }
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: 10.5px;
  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; }
.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: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; vertical-align: 1px;
}
.badge-new     { background: var(--go);   color: #fff; }
.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: #fff; }

/* ------------------------------------------------------- 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: 10.5px;
  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;
}
.flash-ok  { background: var(--go-w);   border-color: var(--go);   color: #1E4A2E; }
.flash-err { background: var(--live-w); border-color: var(--live); color: #7A1714; }

.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: #fff; 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: #7B888E; }
.ad-midroll td { background: #F6F9FA; 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: #fff; font-weight: 600;
}
.pagination .page-step.disabled,
.pagination .page-step.disabled:hover {
  color: #A7AFAA; background: #F7F8F7; border-color: var(--rule-soft); cursor: default;
}
.pagination .page-gap { color: #A7AFAA; padding: 0 2px; font-family: var(--mono); }

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

.two-col { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.two-col aside {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); padding: 14px;
}
.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(--ink); }
.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 rgba(0,0,0,.45);
}
.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: 10.5px; 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; }
  table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
