/* RadioVoiceTrax — two skins from one stylesheet.
   .console  operator side: dense, dark, information-rich.
   .portal   station side: bright, roomy, four things you can do.        */

:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-2: #1d242e;
  --line: #2a323e;
  --ink: #e6ebf2;
  --ink-2: #97a3b4;
  --ink-3: #64707f;
  --accent: #4f9cf9;
  --accent-2: #2f7fe0;
  --human: #4ec9a5;
  --ai: #c08bf0;
  --warn: #f0b04e;
  --bad: #f2686b;
  --ok: #4ec9a5;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- layout */
header.top {
  display: flex; align-items: center; gap: 22px; padding: 0 22px; height: 54px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 700; font-size: 17px; letter-spacing: -0.3px; color: var(--ink); }
.brand span { color: var(--accent); }
.brand small {
  display: block; font-size: 10px; font-weight: 500; color: var(--ink-3);
  letter-spacing: 0.06em; text-transform: uppercase; margin-top: -3px;
}
nav.top-nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav.top-nav a {
  padding: 6px 12px; border-radius: 7px; color: var(--ink-2); font-weight: 500;
  font-size: 13px;
}
nav.top-nav a:hover { background: var(--panel-2); color: var(--ink); text-decoration: none; }
nav.top-nav a.on { background: var(--accent); color: #fff; }

main { max-width: 1280px; margin: 0 auto; padding: 26px 22px 90px; }
main.wide { max-width: 1600px; }

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.4px; }
h2 { font-size: 16px; margin: 30px 0 12px; letter-spacing: -0.2px; }
h3 { font-size: 13px; margin: 0 0 10px; color: var(--ink-2); font-weight: 600;
     text-transform: uppercase; letter-spacing: 0.06em; }
.sub { color: var(--ink-3); margin: 0 0 22px; font-size: 13px; }

/* ---------------------------------------------------------------- panels */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
}
.panel.tight { padding: 13px 15px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.g-side { grid-template-columns: 1fr 340px; align-items: start; }
@media (max-width: 900px) {
  .g2, .g3, .g4, .g-side { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- stats */
.stat { background: var(--panel); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 15px 17px; }
.stat .n { font-size: 26px; font-weight: 700; letter-spacing: -0.7px; }
.stat .l { font-size: 11px; color: var(--ink-3); text-transform: uppercase;
           letter-spacing: 0.07em; margin-top: 2px; }
.stat .hint { font-size: 11px; color: var(--ink-3); margin-top: 5px; }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase;
     letter-spacing: 0.07em; color: var(--ink-3); font-weight: 600;
     padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid rgba(42,50,62,.55); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(79,156,249,.045); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- pills */
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px;
  font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.pill.human   { background: rgba(78,201,165,.16); color: var(--human); }
.pill.hybrid  { background: rgba(79,156,249,.16); color: var(--accent); }
.pill.ai      { background: rgba(192,139,240,.16); color: var(--ai); }
.pill.pending { background: rgba(240,176,78,.16); color: var(--warn); }
.pill.approved, .pill.ok, .pill.delivered { background: rgba(78,201,165,.16); color: var(--ok); }
.pill.rejected, .pill.failed { background: rgba(242,104,107,.16); color: var(--bad); }
.pill.draft, .pill.dryrun, .pill.open { background: rgba(151,163,180,.14); color: var(--ink-2); }
.pill.muted { background: var(--panel-2); color: var(--ink-3); }

/* ---------------------------------------------------------------- forms */
label { display: block; font-size: 11px; text-transform: uppercase;
        letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 4px;
        font-weight: 600; }
input[type=text], input[type=email], input[type=number], input[type=password],
input[type=date], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); border-radius: 7px; padding: 8px 10px; font-size: 13px;
  font-family: inherit;
}
textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,156,249,.13);
}
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 130px; }
.row > .shrink { flex: 0 0 auto; min-width: 0; }
.help { font-size: 11px; color: var(--ink-3); margin-top: 4px; }

button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: 7px;
  padding: 8px 15px; font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; white-space: nowrap; display: inline-block;
}
button:hover, .btn:hover { background: var(--accent-2); text-decoration: none; }
button.ghost, .btn.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--ink-2);
}
button.ghost:hover, .btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
button.good { background: var(--ok); color: #06231b; }
button.bad  { background: transparent; border: 1px solid rgba(242,104,107,.4); color: var(--bad); }
button.bad:hover { background: rgba(242,104,107,.12); }
button.sm, .btn.sm { padding: 5px 10px; font-size: 12px; }

/* ---------------------------------------------------------------- audio */
audio { width: 100%; height: 34px; filter: invert(.92) hue-rotate(180deg); }
.portal audio { filter: none; }

/* ------------------------------------------------------- segment ribbon */
.ribbon { display: flex; height: 8px; border-radius: 4px; overflow: hidden;
          background: var(--panel-2); margin: 7px 0; }
.ribbon i { display: block; height: 100%; }
.ribbon i.human { background: var(--human); }
.ribbon i.tts   { background: var(--ai); }
.ribbon i.var   { background: var(--accent); }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--ink-3); }
.legend b { display: inline-block; width: 8px; height: 8px; border-radius: 2px;
            margin-right: 5px; vertical-align: middle; }

.script {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: 11px 13px; margin: 8px 0; word-break: break-word;
}
.script .h { background: rgba(78,201,165,.18); border-bottom: 2px solid var(--human);
             border-radius: 2px; padding: 1px 0; }
.script .t { background: rgba(192,139,240,.16); border-bottom: 2px solid var(--ai);
             border-radius: 2px; padding: 1px 0; }
.script .v { background: rgba(79,156,249,.18); border-bottom: 2px solid var(--accent);
             border-radius: 2px; padding: 1px 0; }

.mono { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 3px; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

.empty { text-align: center; padding: 44px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink-2); margin-bottom: 6px; }

details.adv { margin-top: 10px; }
details.adv summary { cursor: pointer; font-size: 12px; color: var(--ink-3);
                      user-select: none; }
details.adv summary:hover { color: var(--ink-2); }
details.adv > div { margin-top: 12px; }

.banner { padding: 11px 15px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.banner.info { background: rgba(79,156,249,.1); border: 1px solid rgba(79,156,249,.3); }
.banner.warn { background: rgba(240,176,78,.1); border: 1px solid rgba(240,176,78,.32);
               color: #f4c67c; }
.banner.bad  { background: rgba(242,104,107,.1); border: 1px solid rgba(242,104,107,.32); }

/* ================================================================ PORTAL */
body.portal {
  background: #f6f8fb; color: #101720;
}
body.portal header.top { background: #fff; border-bottom: 1px solid #e2e8f0; height: 62px; }
body.portal .brand { color: #101720; }
body.portal .brand small { color: #8595a8; }
body.portal main { max-width: 940px; padding-top: 30px; }
body.portal .panel { background: #fff; border: 1px solid #e2e8f0;
                     box-shadow: 0 1px 2px rgba(16,23,32,.04); }
body.portal h1 { font-size: 27px; }
body.portal .sub { color: #64748b; font-size: 14px; }
body.portal h3 { color: #64748b; }
body.portal label { color: #64748b; }
body.portal input, body.portal select, body.portal textarea {
  background: #fff; border-color: #cbd5e1; color: #101720;
}
body.portal .script { background: #f8fafc; border-color: #e2e8f0; color: #1e293b; }
body.portal td { border-bottom-color: #eef2f7; }
body.portal th { color: #94a3b8; border-bottom-color: #e2e8f0; }
body.portal .dim, body.portal .help { color: #94a3b8; }
body.portal .ribbon { background: #eef2f7; }
body.portal .stat { background: #fff; border-color: #e2e8f0; }
body.portal button.ghost { border-color: #cbd5e1; color: #475569; }
body.portal button.ghost:hover { background: #f1f5f9; color: #0f172a; }
body.portal .empty { color: #94a3b8; }

/* One big card per link — the station's whole job is on this card. */
.link-card { border: 1px solid #e2e8f0; border-radius: 12px; background: #fff;
             padding: 16px 18px; margin-bottom: 12px; }
.link-card.done { background: #f8fdfb; border-color: #bfe8db; }
.link-card .when { font-size: 12px; font-weight: 700; color: #64748b;
                   letter-spacing: .05em; text-transform: uppercase; }
.link-card .ctx { font-size: 13px; color: #475569; margin: 3px 0 9px; }
.link-card .ctx b { color: #0f172a; font-weight: 600; }
.link-card .acts { display: flex; gap: 8px; margin-top: 12px; align-items: center;
                   flex-wrap: wrap; }
body.portal button, body.portal .btn { background: #2563eb; }
body.portal button:hover, body.portal .btn:hover { background: #1d4ed8; }
body.portal button.good { background: #10b981; color: #fff; }
body.portal button.good:hover { background: #059669; }
/* Ghost must win over the generic portal button rule: "Try another" should
   read as the quieter option next to "Sounds good". */
body.portal button.ghost, body.portal .btn.ghost {
  background: transparent; border: 1px solid #cbd5e1; color: #475569;
}
body.portal button.ghost:hover, body.portal .btn.ghost:hover {
  background: #f1f5f9; color: #0f172a;
}
/* The station reads scripts, they don't debug them — proportional, larger. */
body.portal .link-card .script {
  font-family: var(--sans); font-size: 15px; line-height: 1.6; color: #0f172a;
  padding: 13px 15px;
}

.hour-head { display: flex; align-items: baseline; gap: 12px; margin: 26px 0 12px; }
.hour-head h2 { margin: 0; font-size: 19px; }

.dropzone {
  border: 2px dashed #cbd5e1; border-radius: 12px; padding: 30px; text-align: center;
  background: #fbfdff; cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.over { border-color: #2563eb; background: #eff6ff; }
.dropzone .big { font-size: 15px; font-weight: 600; color: #1e293b; }
.dropzone .small { color: #64748b; margin-top: 4px; }

.day-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.day-tabs a { padding: 5px 11px; border-radius: 20px; font-size: 12.5px;
              background: #fff; border: 1px solid #e2e8f0; color: #475569; }
.day-tabs a.on { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ================================================================ SIGN IN */
body.login main { max-width: 460px; padding-top: 60px; }
body.login h1 { text-align: center; margin-bottom: 22px; }
.signin .panel { padding: 22px; }
.banner.ok-banner { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
body.portal .banner.bad { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
body.portal .banner.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
body.portal .banner.info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
body.login details.adv summary { text-align: center; color: #94a3b8; }

/* Enrolment codes and API keys: shown once, meant to be copied. */
.reveal {
  font-family: var(--mono); font-size: 13px; letter-spacing: .02em;
  background: var(--bg); border: 1px dashed var(--accent); border-radius: 8px;
  padding: 13px 15px; margin: 10px 0; word-break: break-all; user-select: all;
}
body.portal .reveal { background: #f8fafc; border-color: #2563eb; }
.once { font-size: 11px; color: var(--warn); text-transform: uppercase;
        letter-spacing: .07em; font-weight: 600; }
