/* Departures — publishing terminal
 *
 * Built like point-of-sale software, because that's the job: a person scanning
 * a dense board of live states and hitting one confident button. POS is light,
 * not dark — it's read for hours under hard light — and it never makes you hunt
 * for the number you came for.
 *
 * Palette   AJ Tech Studio's own, sampled from the mark: ink #082932 (the AJ),
 *           green #0E8A72 (Tech Studio), gold #D7A22E (the spark), grey #838383.
 *           They map onto the roles without being forced: ink is the button you
 *           press, green is sent, gold is in-flight. Red is the one addition —
 *           the brand has no failure colour, and errors need one.
 * Type      Barlow Semi Condensed for labels, counts and headers — condensed
 *           industrial faces are the vernacular of shelf labels and terminals,
 *           and they buy horizontal room in a matrix. System sans for prose.
 * Signature The queue matrix: one row per video, one column per destination,
 *           a status chip in every cell. The data model, made visible.
 */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@400;500;600;700&display=swap');

:root {
  --chassis: #EEF2F3;
  --surface: #FFFFFF;
  --sunk:    #F5F8F8;
  --ink:     #082932;
  --ink-2:   #566A70;
  --ink-3:   #838383;
  --rule:    #D2DBDD;
  --rule-2:  #E6EDEE;

  --action:  #082932;
  --action-d:#0E4450;
  --live:    #0E8A72;
  --wait:    #A87516;
  --fail:    #C0392B;
  --off:     #7A8590;

  --live-bg: #E3F3EF;
  --wait-bg: #FAF0DA;
  --fail-bg: #FBE7E4;
  --off-bg:  #ECF0F1;

  --cond: 'Barlow Semi Condensed', 'Arial Narrow', system-ui, sans-serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 6px;
  --shadow: 0 1px 2px rgba(8,41,50,.07), 0 1px 1px rgba(8,41,50,.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--chassis);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--action); }
h1, h2, h3 { margin: 0; font-family: var(--cond); font-weight: 600; }

/* ── chrome ─────────────────────────────────────────────────── */
.top {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 20;
}
.top-in {
  max-width: 1440px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 24px; min-height: 56px;
}
.logo { display: flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; }
.logo img { height: 26px; width: auto; display: block; }
.logo .sep { width: 1px; height: 20px; background: var(--rule); }
.logo .app {
  font-family: var(--cond); font-weight: 500; font-size: 13px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
}
/* No logo file? Fall back to the name rather than an empty bar. */
.logo .fallback {
  font-family: var(--cond); font-weight: 700; font-size: 18px;
  letter-spacing: .04em; color: var(--ink);
}
.logo .fallback em { font-style: normal; color: var(--live); }

.tabs { display: flex; gap: 2px; margin-right: auto; overflow-x: auto; }
.tab {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: var(--r); text-decoration: none;
  color: var(--ink-2); white-space: nowrap; display: flex; align-items: center; gap: 7px;
}
.tab:hover { background: var(--sunk); color: var(--ink); }
.tab[aria-current] { background: var(--ink); color: #fff; font-weight: 600; }
.tab b {
  font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 3px;
  background: var(--rule-2); color: var(--ink-2);
}
.tab[aria-current] b { background: rgba(255,255,255,.2); color: #fff; }

/* ── shell ──────────────────────────────────────────────────── */
.wrap { max-width: 1440px; margin: 0 auto; padding: 20px; }

.head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.head h1 { font-size: 21px; font-weight: 600; letter-spacing: 0; }
.path {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px;
  color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--r); padding: 3px 8px;
}
.head .spacer { margin-left: auto; }

/* ── buttons ────────────────────────────────────────────────── */
.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 500; letter-spacing: 0;
  padding: 8px 14px; border-radius: var(--r); border: 1px solid var(--action);
  background: var(--action); color: #fff; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 7px;
  line-height: 1; white-space: nowrap; box-shadow: var(--shadow);
}
.btn:hover { background: var(--action-d); border-color: var(--action-d); }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn.sec:hover { background: var(--sunk); border-color: var(--ink-3); }
.btn.danger { background: var(--surface); color: var(--fail); border-color: var(--fail); }
.btn.danger:hover { background: var(--fail); color: #fff; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* ── destination cards ──────────────────────────────────────── */
.decks {
  display: grid; gap: 12px; margin-bottom: 24px;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
}
.deck {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.deck-h {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; border-bottom: 1px solid var(--rule-2);
}
.led { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--off); }
.led.live  { background: var(--live);  box-shadow: 0 0 0 3px var(--live-bg); }
.led.wait  { background: var(--wait);  box-shadow: 0 0 0 3px var(--wait-bg); }
.led.fail  { background: var(--fail);  box-shadow: 0 0 0 3px var(--fail-bg); }
.deck-h .nm {
  font-family: var(--sans); font-weight: 600; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.plat {
  margin-left: auto; font-family: var(--cond); font-size: 10px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
  border: 1px solid var(--rule); border-radius: 3px; padding: 2px 6px;
}
.via {
  font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--live); background: #E3F3EF; border-radius: 3px; padding: 2px 5px;
  font-family: var(--cond);
}

/* the counts are what you came for — POS shows them big */
.nums { display: grid; grid-template-columns: repeat(3, 1fr); }
.num { padding: 12px 14px; border-right: 1px solid var(--rule-2); }
.num:last-child { border-right: 0; }
.num i {
  display: block; font-style: normal; font-family: var(--cond);
  font-size: 11px; font-weight: 500; letter-spacing: .04em;
  color: var(--ink-3); margin-bottom: 2px;
}
.num b {
  font-family: var(--cond); font-size: 20px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.num.q b { color: var(--wait); }
.num.f b { color: var(--fail); }
.num.z b { color: var(--ink-3); }

.deck-m {
  padding: 10px 14px; border-top: 1px solid var(--rule-2);
  font-size: 12px; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.deck-m .clock { font-family: var(--cond); font-weight: 600; color: var(--ink); }
.deck-a { padding: 10px 14px; border-top: 1px solid var(--rule-2); display: flex; gap: 7px; }
.deck-a form { flex: 1; display: flex; }
.armed {
  font-family: var(--cond); font-size: 10px; font-weight: 700; letter-spacing: .08em;
  color: #fff; background: var(--wait); border-radius: 3px; padding: 2px 6px;
}

/* ── the matrix — signature element ─────────────────────────── */
.panel {
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
}
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.panel-h {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--rule);
  background: var(--sunk);
}
.panel-h h2 { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.panel-h .spacer { margin-left: auto; }

.grid { width: 100%; border-collapse: collapse; }
.grid th {
  font-family: var(--cond); font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); text-align: left;
  padding: 8px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.grid td {
  padding: 10px 12px; border-bottom: 1px solid var(--rule-2); vertical-align: middle;
}
.grid tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: var(--sunk); }
.grid .seq {
  font-family: var(--cond); font-weight: 600; font-size: 14px;
  font-variant-numeric: tabular-nums; color: var(--ink-3); width: 46px;
}
.grid .ttl { font-weight: 500; max-width: 300px; }
.grid .ttl small {
  display: block; color: var(--ink-3); font-weight: 400; font-size: 11px;
  font-family: ui-monospace, monospace; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.grid .spec {
  font-family: var(--cond); font-size: 12px; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.grid .cell { text-align: center; width: 96px; }
.grid .act { text-align: right; white-space: nowrap; }

/* status chip — the atom of the whole board */
.chip {
  font-family: var(--cond); font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 8px; border-radius: 3px;
  display: inline-block; white-space: nowrap;
}
.chip.live { background: var(--live-bg); color: var(--live); }
.chip.wait { background: var(--wait-bg); color: var(--wait); }
.chip.fail { background: var(--fail-bg); color: var(--fail); }
.chip.off  { background: var(--off-bg);  color: var(--off); }
a.chip { text-decoration: none; }
a.chip:hover { filter: brightness(.94); }

.empty { padding: 44px 20px; text-align: center; color: var(--ink-2); }
.empty h3 { font-size: 17px; margin-bottom: 6px; color: var(--ink); }
.empty code {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--sunk); border: 1px solid var(--rule); border-radius: 3px; padding: 2px 6px;
}

/* ── forms ──────────────────────────────────────────────────── */
.form { padding: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f { display: block; margin-bottom: 14px; }
.f > span {
  display: block; font-size: 12.5px; font-weight: 500;
  letter-spacing: 0; color: var(--ink-2); margin-bottom: 5px;
}
.f > span em { font-style: normal; text-transform: none; letter-spacing: 0; color: var(--ink-3); font-weight: 400; }
.f input, .f select, .f textarea {
  width: 100%; padding: 9px 11px; font: inherit; font-size: 14px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--rule); border-radius: var(--r);
}
.f input:focus, .f select:focus, .f textarea:focus {
  outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(8,41,50,.13);
}
.f input:disabled { background: var(--sunk); color: var(--ink-3); }
.f textarea { resize: vertical; min-height: 84px; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.check {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: var(--r); padding: 9px 13px;
  background: var(--surface); font-size: 13px;
}
.check:has(input:checked) { border-color: var(--live); background: #EFF8F6; }
.check input { width: auto; margin: 0; accent-color: var(--action); }
.acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }

/* ── notices ────────────────────────────────────────────────── */
.note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 14px; border-radius: var(--r); margin-bottom: 14px; font-size: 13px;
  border: 1px solid var(--rule); background: var(--surface); box-shadow: var(--shadow);
}
.note.ok   { border-left: 3px solid var(--live); }
.note.warn { border-left: 3px solid var(--wait); }
.note.bad  { border-left: 3px solid var(--fail); }
.hint {
  font-size: 12px; color: #0B5F4F; background: #EFF8F6;
  border: 1px solid #CFE7E1; border-radius: var(--r); padding: 8px 11px; margin: -8px 0 14px;
}
.err { color: var(--fail); font-size: 12px; margin: 4px 0 0; }

/* ── activity ───────────────────────────────────────────────── */
.log { list-style: none; margin: 0; padding: 0; }
.log li {
  display: flex; gap: 10px; padding: 8px 16px;
  border-bottom: 1px solid var(--rule-2); font-size: 12.5px; color: var(--ink-2);
}
.log li:last-child { border-bottom: 0; }
.log time {
  font-family: var(--cond); font-variant-numeric: tabular-nums;
  color: var(--ink-3); flex: none; width: 74px;
}
.log .src {
  font-family: var(--cond); font-weight: 600; color: var(--ink); flex: none; width: 58px;
}
.log .error .msg { color: var(--fail); }
.log .warn  .msg { color: var(--wait); }

.cols { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 20px; align-items: start; }

/* ── narrower ───────────────────────────────────────────────
 * The matrix is the one thing that genuinely needs width: a column per
 * destination. It scrolls sideways rather than collapsing, because a
 * stacked matrix stops being a matrix. Everything else gives way first.
 */
@media (max-width: 1080px) {
  .cols { grid-template-columns: 1fr; }
  .decks { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
}

@media (max-width: 760px) {
  .wrap { padding: 14px 12px 32px; }
  .top-in { min-height: 52px; padding: 0 12px; gap: 12px; flex-wrap: wrap; }
  .logo img { height: 22px; }
  .logo .sep, .logo .app { display: none; }   /* the mark alone is enough on a phone */
  .tabs { order: 3; width: 100%; margin: 0 -12px; padding: 0 12px 8px; }
  .head { gap: 10px; margin-bottom: 12px; }
  .head h1 { font-size: 19px; }
  .head .spacer { display: none; }
  .head .path { order: 3; width: 100%; }
  .decks { grid-template-columns: 1fr; gap: 10px; }
  .row2 { grid-template-columns: 1fr; gap: 0; }
  .slots { grid-template-columns: 1fr 1fr; }
  .form { padding: 14px; }
  .checks { flex-direction: column; }
  .check { width: 100%; }
  .btn { padding: 10px 14px; }   /* thumbs, not cursors */
  .btn.sm { padding: 8px 12px; }
}

@media (max-width: 560px) {
  /* Trim the matrix to what a thumb can act on: which video, and where it stands. */
  .grid .spec { display: none; }
  .grid .ttl { max-width: 150px; }
  .grid .ttl small { display: none; }
  .grid th, .grid td { padding: 9px 8px; }
  .grid .cell { width: auto; min-width: 74px; }
  .slots { grid-template-columns: 1fr; }
  .log time { width: 62px; }
  .log .src { display: none; }
}

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

/* ── publish slots ──────────────────────────────────────────── */
.slots { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.slot { display: flex; align-items: center; gap: 8px; }
.slot > span {
  font-family: var(--cond); font-size: 11px; font-weight: 700;
  color: var(--ink-3); background: var(--sunk); border: 1px solid var(--rule);
  border-radius: 3px; width: 22px; height: 22px; flex: none;
  display: grid; place-items: center;
}
.slot select { flex: 1; }
.slot[hidden] { display: none; }

/* ── sign in ────────────────────────────────────────────────── */
.login { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.signin { width: 100%; max-width: 380px; }
.signin-h { padding: 18px 16px; border-bottom: 1px solid var(--rule-2); background: var(--sunk); }
.signin-h .logo { pointer-events: none; }
.signin-sub { color: var(--ink-2); font-size: 13px; margin: 0 0 16px; }

/* ── brand roll-up ──────────────────────────────────────────
 * The whole brand at a glance, above the per-account cards: how many
 * accounts, how many are actually connected, and what's in flight.
 */
.rollup {
  display: flex; flex-wrap: wrap; gap: 0;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--r); box-shadow: var(--shadow);
  margin-bottom: 20px; overflow: hidden;
}
.ru {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 20px; border-right: 1px solid var(--rule-2);
}
.ru:last-child { border-right: 0; }
.ru b {
  font-family: var(--cond); font-size: 22px; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.ru b.ok    { color: var(--live); }
.ru b.wait  { color: var(--wait); }
.ru b.fail  { color: var(--fail); }
.ru b.muted { color: var(--ink-3); }
.ru i {
  font-style: normal; font-family: var(--cond); font-size: 11px;
  letter-spacing: .04em; color: var(--ink-3);
}
@media (max-width: 560px) {
  .ru { padding: 10px 14px; flex: 1; }
  .ru b { font-size: 18px; }
}

/* time under a Scheduled chip in the matrix */
.cell .when {
  display: block; margin-top: 3px; font-family: var(--cond);
  font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}

/* ── content calendar rows ──────────────────────────────────── */
.daterow { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.daterow-n {
  font-family: var(--cond); font-size: 11px; font-weight: 700; color: var(--ink-3);
  background: var(--sunk); border: 1px solid var(--rule); border-radius: 3px;
  width: 24px; height: 24px; flex: none; display: grid; place-items: center;
}
.daterow input[type="datetime-local"] { flex: 1; max-width: 320px; }
.daterow-x { flex: none; color: var(--ink-3); }
.daterow-x:hover { color: var(--fail); border-color: var(--fail); }

/* ── date+time slots (settings) ─────────────────────────────── */
.slots-col { display: flex; flex-direction: column; gap: 8px; }
.slots-col .slot { display: flex; align-items: center; gap: 8px; }
.slots-col .slot > span {
  font-family: var(--cond); font-size: 11px; font-weight: 700; color: var(--ink-3);
  background: var(--sunk); border: 1px solid var(--rule); border-radius: 3px;
  width: 24px; height: 24px; flex: none; display: grid; place-items: center;
}
.slots-col .slot input[type="datetime-local"] { flex: 1; max-width: 320px; }
.slots-col .slot[hidden] { display: none; }
