/* Run sheet — the broadcast running order.
   Dark chassis because the use scene is a pre-dawn desk and the screen is the light source.
   Tally colour never carries meaning alone: every state ships colour, a text label, and a
   fixed column position. */

@font-face {
  font-family: "Barlow Condensed";
  src: url("/static/fonts/barlow-condensed-500.woff2") format("woff2");
  font-weight: 500; font-display: swap; font-style: normal;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/static/fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600; font-display: swap; font-style: normal;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("/static/fonts/barlow-condensed-700.woff2") format("woff2");
  font-weight: 700; font-display: swap; font-style: normal;
}

:root {
  --chassis-900: #0c0f13;
  --chassis-800: #12161c;
  --chassis-700: #181d25;
  --chassis-600: #212832;
  --rule:        #2b333f;

  --ink:         #eef2f7;
  --ink-dim:     #9fb0c4;   /* tinted from the chassis hue, never neutral grey */
  --ink-faint:   #6d7f95;

  --on-air:      #ff3b30;   /* reserved. Nothing else on this surface uses it. */
  --on-air-ink:  #ffd9d6;
  --next:        #34c759;
  --next-ink:    #cdf3d7;
  --hold:        #ffab2e;
  --hold-ink:    #ffe6c2;
  --flag:        #7d8ef5;
  --flag-ink:    #dfe3fd;

  --display: "Barlow Condensed", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --lift: 0 1px 2px rgb(0 0 0 / .5), 0 6px 18px -6px rgb(0 0 0 / .55);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

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

::selection { background: var(--flag); color: #0b0d10; }
:where(input, select, textarea) { caret-color: var(--next); }

:focus-visible {
  outline: 2px solid var(--next);
  outline-offset: 2px;
  border-radius: 2px;
}

* { scrollbar-width: thin; scrollbar-color: var(--chassis-600) var(--chassis-900); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--chassis-900); }
::-webkit-scrollbar-thumb {
  background: var(--chassis-600);
  border: 3px solid var(--chassis-900);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: #33404f; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ---------------------------------------------------------------- chassis */

.chassis {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 20px;
  height: 52px;
  background: var(--chassis-800);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
}

.ident { display: flex; align-items: center; gap: 9px; }

.ident-mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--on-air);
  box-shadow: 0 0 0 3px rgb(255 59 48 / .16);
}

.ident-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.chassis nav { display: flex; gap: 4px; margin-right: auto; }

.chassis nav a,
.sign-out {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  padding: 5px 11px;
  border-radius: 3px;
  transition: color .12s, background .12s;
}
.chassis nav a:hover, .sign-out:hover { color: var(--ink); background: var(--chassis-600); }
.chassis nav a[aria-current="page"] { color: var(--ink); background: var(--chassis-600); }

main { max-width: 1180px; margin: 0 auto; padding: 32px 20px 96px; }

/* ---------------------------------------------------------------- heads */

.sheet-head { margin-bottom: 36px; }

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 2.9rem);
  letter-spacing: -.005em;
  text-transform: uppercase;
  margin: 0 0 4px;
  line-height: 1.02;
  text-wrap: balance;
}

.dateline {
  margin: 0;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

.block { margin-top: 44px; }

.block-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}

.block-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.24rem;
  letter-spacing: .02em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink);
}

.count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- tally */

.tally {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 2px;
  white-space: nowrap;
  animation: take .16s cubic-bezier(.2, 0, 0, 1);
}

@keyframes take { from { opacity: 0; transform: translateX(-3px); } }

@media (prefers-reduced-motion: reduce) {
  .tally { animation: none; }
  * { transition-duration: .001ms !important; }
}

.tally-on-air  { background: var(--on-air); color: #2b0400; }
.tally-next    { background: var(--next);   color: #04240e; }
.tally-hold    { background: var(--hold);   color: #2e1a00; }
.tally-cleared { background: var(--chassis-600); color: var(--ink-dim); }
.tally-flag    { background: var(--flag);   color: #0b0f2e; }

/* ---------------------------------------------------------------- table */

.rundown {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rundown thead th {
  font-family: var(--display);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--rule);
}

.rundown tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--chassis-700);
  vertical-align: top;
}

.rundown tbody tr { transition: background .1s; }
.rundown tbody tr:hover { background: var(--chassis-800); }

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }

.col-state { width: 108px; }
.col-who, .col-acct { width: 148px; color: var(--ink-dim); }
.col-from { width: 210px; color: var(--ink-dim); overflow-wrap: anywhere; }
.col-due { width: 150px; color: var(--ink-dim); }
.col-act { width: 168px; }

.item-title { display: block; color: var(--ink); overflow-wrap: anywhere; }

.consequence {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-faint);
}
.consequence.err { color: var(--hold-ink); }

.acct {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-dim);
}

/* Overdue is a count, stated plainly. Never softened, never colour alone. */
.overdue {
  display: block;
  margin-top: 3px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--on-air-ink);
}

/* ---------------------------------------------------------------- messages */

.empty, .notice, .error {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 3px;
  font-size: 14px;
}
.empty  { background: var(--chassis-800); color: var(--ink-faint); }
.notice { background: var(--chassis-800); color: var(--ink-dim); border: 1px solid var(--rule); }
.error  { background: #2a1210; color: var(--on-air-ink); border: 1px solid #5b1f1a; }

.notice a, .error a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* ---------------------------------------------------------------- filters */

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }

.chip {
  font-family: var(--display);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  background: var(--chassis-800);
  border: 1px solid var(--rule);
  padding: 5px 11px;
  border-radius: 3px;
  transition: color .12s, background .12s, border-color .12s;
}
.chip:hover { color: var(--ink); border-color: #3a4553; }
.chip-on { background: var(--ink); color: var(--chassis-900); border-color: var(--ink); }

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

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field.actions { justify-content: end; }

label {
  font-family: var(--display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

input, select {
  font-family: var(--body);
  font-size: 14px;
  color: var(--ink);
  background: var(--chassis-900);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 8px 10px;
  width: 100%;
  transition: border-color .12s;
}
input::placeholder { color: var(--ink-faint); }
input:hover, select:hover { border-color: #3a4553; }
input:focus, select:focus { border-color: var(--next); }

.hint { margin: 0; font-size: 13px; color: var(--ink-faint); max-width: 68ch; }

button {
  font-family: var(--display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--chassis-900);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: var(--lift);
  transition: background .12s, color .12s, border-color .12s;
}
button:hover { background: #fff; }
button:disabled { background: var(--chassis-600); border-color: var(--rule); color: var(--ink-faint); cursor: not-allowed; box-shadow: none; }

button.ghost {
  background: transparent;
  color: var(--ink-dim);
  border-color: var(--rule);
  box-shadow: none;
  padding: 5px 10px;
  font-size: 12.5px;
}
button.ghost:hover { color: var(--ink); border-color: #3a4553; background: var(--chassis-700); }

.inline { display: inline-block; margin: 0 4px 4px 0; }
.inline select { width: auto; padding: 5px 8px; font-size: 12.5px; }

/* ---------------------------------------------------------------- gate */

.gate {
  max-width: 380px;
  margin: 14vh auto 0;
  background: var(--chassis-800);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 30px;
  box-shadow: var(--lift);
}
.gate h1 { font-size: 2rem; margin-bottom: 6px; }
.gate-sub { margin: 0 0 22px; color: var(--ink-dim); font-size: 14px; }
.gate .field { margin-bottom: 18px; }
.gate button { width: 100%; }

/* ---------------------------------------------------------------- narrow */

@media (max-width: 760px) {
  main { padding: 22px 14px 72px; }
  .chassis { gap: 12px; padding: 0 14px; }
  .chassis nav a, .sign-out { padding: 5px 7px; font-size: 14px; }

  /* The rundown becomes stacked records. Every cell keeps its label. */
  .rundown thead { display: none; }
  .rundown, .rundown tbody, .rundown tr, .rundown td { display: block; width: 100%; }
  .rundown tbody tr {
    border: 1px solid var(--rule);
    border-radius: 3px;
    margin-bottom: 10px;
    padding: 4px 0;
    background: var(--chassis-800);
  }
  .rundown tbody td { border-bottom: 0; padding: 6px 12px; }
  .rundown tbody td:empty { display: none; }
}
