:root {
  --ink-950: #080c12;
  --ink-900: #0d131c;
  --ink-850: #121a25;
  --ink-800: #172231;
  --ink-700: #273548;
  --line: #2f3d50;
  --text: #edf2f7;
  --muted: #94a3b8;
  --dim: #68778b;
  --signal: #d9a441;
  --signal-hot: #f0c266;
  --meter: #6fc2d0;
  --meter-hot: #efb35a;
  --good: #5cb889;
  --warn: #d9a441;
  --bad: #db6a69;
  --radius: 8px;
  --display: "Bahnschrift SemiCondensed", "Arial Narrow", "Segoe UI", sans-serif;
  --body: "Segoe UI", Tahoma, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ink-950);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: var(--body);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--ink-950);
  background-size: 100% 32px;
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

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

.eyebrow,
.section-label {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px clamp(18px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.96);
  backdrop-filter: blur(12px);
}

.brand-lockup,
.topbar-actions,
.on-air-indicator,
.channel-heading,
.meter-heading-row,
.panel-heading {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 14px;
}

.brand-lockup h1 {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: 1.55rem;
  font-stretch: condensed;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.topbar-actions {
  gap: 22px;
}

.on-air-indicator {
  gap: 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.tally,
.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
  box-shadow: 0 0 0 4px rgba(104, 119, 139, 0.12);
}

.tally--live,
.status-dot--good {
  background: var(--good);
  box-shadow: 0 0 0 4px rgba(92, 184, 137, 0.12);
}

.tally--off,
.status-dot--bad {
  background: var(--bad);
  box-shadow: 0 0 0 4px rgba(219, 106, 105, 0.12);
}

.status-dot--warn {
  background: var(--warn);
  box-shadow: 0 0 0 4px rgba(217, 164, 65, 0.12);
}

.text-button {
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.text-button:hover {
  color: var(--text);
  border-color: var(--signal);
}

.dashboard {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 42px);
}

.error-strip {
  margin-bottom: 16px;
  padding: 10px 14px;
  border-left: 3px solid var(--warn);
  color: #f0d9a7;
  background: rgba(217, 164, 65, 0.09);
  font-size: 0.88rem;
}

.broadcast-deck {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.75fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-900);
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.track-channel,
.meter-bank,
.listen-console {
  min-width: 0;
  padding: clamp(20px, 3vw, 38px);
}

.track-channel--current {
  min-height: 248px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.track-channel--next {
  border-bottom: 1px solid var(--line);
  background: var(--ink-850);
}

.channel-heading,
.meter-heading-row,
.panel-heading {
  justify-content: space-between;
  gap: 16px;
}

.mode-badge,
.validation-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.67rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.validation-badge--valid {
  color: #a8dfc4;
  border-color: rgba(92, 184, 137, 0.42);
  background: rgba(92, 184, 137, 0.08);
}

.validation-badge--invalid {
  color: #f1aeac;
  border-color: rgba(219, 106, 105, 0.42);
}

.current-title,
.next-title,
.panel h2 {
  font-family: var(--display);
  font-weight: 650;
  line-height: 1.03;
}

.current-title {
  max-width: 1000px;
  margin: 28px 0 10px;
  font-size: clamp(2.3rem, 5vw, 5.2rem);
  letter-spacing: -0.025em;
}

.next-title {
  margin: 30px 0 8px;
  font-size: clamp(1.65rem, 2.7vw, 2.65rem);
}

.track-artist {
  min-height: 1.4em;
  margin: 0;
  color: var(--signal-hot);
  font-size: 1rem;
}

.track-facts,
.track-filename {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.track-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 24px;
}

.track-filename {
  margin-top: 25px;
  overflow-wrap: anywhere;
}

.meter-bank {
  grid-column: 1 / -1;
  border-bottom: 1px solid var(--line);
  background: #0a1018;
}

.meter-state,
.player-state,
.panel-count,
.last-refresh,
.scheduler-history {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.editor-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 60px;
}

.editor-panel + .editor-panel {
  margin-top: 18px;
}

.back-link {
  color: var(--meter);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-decoration: none;
}

.back-link:hover {
  color: #b9edf4;
}

.editor-form {
  padding: 24px;
}

.upload-form {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 16px;
}

.file-drop {
  display: grid;
  min-width: min(100%, 420px);
  gap: 9px;
  padding: 18px;
  border: 1px dashed #48647d;
  border-radius: 4px;
  background: #0b1520;
}

.file-drop span,
.editor-form label > span,
.weekday-picker legend {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-note,
.editor-footnote,
.editor-form small {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.55;
}

.editor-footnote {
  margin: 0;
  padding: 18px 24px;
  border-top: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid label {
  display: grid;
  gap: 8px;
}

.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 43px;
  padding: 9px 11px;
  border: 1px solid #354b61;
  border-radius: 3px;
  color: #e5edf5;
  background: #0b1520;
  font: inherit;
}

.form-grid input:focus,
.form-grid select:focus,
.file-drop:focus-within {
  border-color: var(--meter);
  outline: 2px solid rgba(111, 194, 208, 0.18);
  outline-offset: 1px;
}

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0;
  padding: 0;
  border: 0;
}

.weekday-picker legend {
  width: 100%;
  margin-bottom: 8px;
}

.weekday-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid #354b61;
  border-radius: 3px;
  background: #0b1520;
}

.event-editor-list {
  display: grid;
  gap: 12px;
  padding: 20px 24px 24px;
}

.event-editor {
  border: 1px solid var(--line);
  border-left: 3px solid var(--signal);
  background: var(--ink-850);
}

.event-editor summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  cursor: pointer;
}

.event-editor summary span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

.remove-event-form {
  padding: 0 24px 24px;
}

.danger-button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #7f4547;
  border-radius: 4px;
  color: #ffd6d4;
  background: #351d22;
  font-weight: 700;
  cursor: pointer;
}

.danger-button:hover:not(:disabled) {
  border-color: var(--bad);
  background: #4a252b;
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.form-alert--success {
  border-left-color: var(--good);
  color: #bce9d5;
  background: rgba(89, 191, 146, 0.08);
}

.scale {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 25px 64px 7px 45px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.scale span:last-child {
  text-align: right;
}

.meter-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.meter-label,
.meter-value {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.meter-track {
  position: relative;
  height: 15px;
  border: 1px solid #263446;
  background:
    repeating-linear-gradient(90deg, transparent 0 15px, rgba(8, 12, 18, 0.9) 15px 18px),
    #111b27;
  overflow: hidden;
}

.meter-fill {
  width: 0;
  height: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, #3a8795 0 72%, var(--meter) 72% 88%, var(--meter-hot) 88% 100%);
  transition: width 110ms linear;
}

.peak-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: #f8d58f;
  opacity: 0;
  transition: left 110ms linear, opacity 160ms ease;
}

.listen-console {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 20px;
  padding-top: 20px;
  padding-bottom: 20px;
  background: var(--ink-850);
}

.listen-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  border: 1px solid #b98934;
  border-radius: 4px;
  color: #171106;
  background: var(--signal);
  font-weight: 750;
  cursor: pointer;
}

.listen-button {
  min-width: 158px;
  padding: 10px 18px;
}

.listen-button:hover,
.primary-button:hover {
  background: var(--signal-hot);
}

.listen-button__icon {
  width: 1.2em;
  line-height: 1;
  text-align: center;
}

.listen-button__icon::before {
  content: "\1F50A";
}

.listen-button[aria-pressed="true"] .listen-button__icon::before {
  content: "\1F507";
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.volume-control input {
  width: clamp(100px, 16vw, 190px);
  accent-color: var(--signal);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.schedule-panel {
  margin-top: 18px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid #436078;
  border-radius: 4px;
  color: #d8e7f3;
  background: #142232;
  font-size: 0.76rem;
  font-weight: 700;
  text-decoration: none;
}

.secondary-button:hover {
  border-color: var(--meter);
  background: #193044;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-900);
  overflow: hidden;
}

.panel-heading {
  min-height: 88px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

.panel h2 {
  margin: 4px 0 0;
  font-size: 1.65rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid rgba(47, 61, 80, 0.72);
  text-align: left;
}

th {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #d7e0ea;
  font-size: 0.84rem;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr.is-current {
  background: rgba(217, 164, 65, 0.08);
}

tbody tr.is-next {
  background: rgba(111, 194, 208, 0.055);
}

.track-title-cell strong,
.track-title-cell small {
  display: block;
}

.track-title-cell small {
  max-width: 390px;
  margin-top: 4px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.67rem;
  overflow-wrap: anywhere;
}

.row-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.67rem;
  text-transform: uppercase;
}

.row-status--current {
  color: var(--signal-hot);
}

.row-status--next {
  color: var(--meter);
}

.empty-cell {
  padding: 30px 18px;
  color: var(--muted);
  text-align: center;
}

.program-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 9px 24px;
}

.program-facts div {
  min-width: 0;
  padding: 15px 8px 15px 0;
  border-bottom: 1px solid rgba(47, 61, 80, 0.72);
}

.program-facts dt {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.program-facts dd {
  margin: 7px 0 0;
  color: #d7e0ea;
  font-size: 0.83rem;
  overflow-wrap: anywhere;
}

.schedule-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 10px;
  padding: 20px 24px 12px;
}

.schedule-event {
  padding: 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--signal);
  background: var(--ink-850);
}

.schedule-event__top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.schedule-event strong {
  font-family: var(--display);
  font-size: 1.05rem;
}

.schedule-event span,
.schedule-event small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.69rem;
}

.schedule-event small {
  display: block;
  margin-top: 10px;
  line-height: 1.5;
}

.scheduler-history {
  margin: 0;
  padding: 8px 24px 22px;
  line-height: 1.5;
}

.system-panel {
  margin-top: 18px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.status-item {
  display: flex;
  min-width: 0;
  gap: 13px;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.status-item:last-child {
  border-right: 0;
}

.status-item span:not(.status-dot):not(.format-glyph),
.status-item strong,
.status-item small {
  display: block;
}

.status-item span:not(.status-dot):not(.format-glyph) {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.63rem;
  text-transform: uppercase;
}

.status-item strong {
  margin-top: 5px;
  font-size: 0.84rem;
}

.status-item small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.67rem;
  line-height: 1.4;
}

.format-glyph {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 28px;
  height: 19px;
  border: 1px solid var(--meter);
  color: var(--meter);
  font-family: var(--mono);
  font-size: 0.62rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 3vw, 48px) 30px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.station-mark {
  position: relative;
  width: 56px;
  height: 56px;
}

.station-mark--small {
  width: 38px;
  height: 38px;
}

.station-mark__ring,
.station-mark__core {
  position: absolute;
  border-radius: 50%;
}

.station-mark__ring {
  inset: 0;
  border: 2px solid var(--signal);
  border-right-color: transparent;
  transform: rotate(-35deg);
}

.station-mark__core {
  inset: 36%;
  background: var(--signal);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(430px, 100%);
}

.login-panel {
  padding: clamp(28px, 7vw, 48px);
  border: 1px solid var(--line);
  border-top: 3px solid var(--signal);
  border-radius: var(--radius);
  background: var(--ink-900);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.42);
}

.login-panel .station-mark {
  margin-bottom: 30px;
}

.login-panel h1 {
  margin: 8px 0 12px;
  font-family: var(--display);
  font-size: clamp(2.4rem, 8vw, 3.8rem);
  line-height: 0.98;
}

.login-copy {
  margin: 0 0 27px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 9px;
}

.login-form label {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.login-form input:not([type="hidden"]) {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  background: var(--ink-950);
}

.login-form input:focus {
  border-color: var(--signal);
}

.primary-button {
  width: 100%;
  margin-top: 18px;
}

.button-link {
  padding: 10px 18px;
  text-decoration: none;
}

.form-alert {
  margin-bottom: 16px;
  padding: 10px 12px;
  border-left: 3px solid var(--bad);
  color: #f1aeac;
  background: rgba(219, 106, 105, 0.08);
  font-size: 0.82rem;
}

.login-footnote {
  margin: 18px 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.65rem;
  line-height: 1.5;
  text-align: center;
}

.error-panel h1 {
  color: var(--signal);
}

@media (max-width: 1120px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .status-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .status-item:nth-child(3) {
    border-right: 0;
  }

  .status-item:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
  }

  .on-air-indicator {
    display: none;
  }

  .broadcast-deck {
    grid-template-columns: 1fr;
  }

  .track-channel--current {
    min-height: 220px;
    border-right: 0;
  }

  .meter-bank,
  .listen-console {
    grid-column: 1;
  }

  .listen-console {
    flex-wrap: wrap;
  }

  .current-title {
    font-size: clamp(2.15rem, 12vw, 3.6rem);
  }

  .scale {
    margin-left: 40px;
    margin-right: 48px;
  }

  .status-grid {
    grid-template-columns: 1fr 1fr;
  }

  .status-item,
  .status-item:nth-child(3) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .status-item:nth-child(even) {
    border-right: 0;
  }

  .status-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .footer {
    flex-direction: column;
    gap: 7px;
  }

  .panel-actions {
    align-items: flex-end;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .dashboard {
    padding: 12px;
  }

  .topbar {
    padding: 13px 15px;
  }

  .brand-lockup .eyebrow,
  .station-mark--small {
    display: none;
  }

  .brand-lockup h1 {
    font-size: 1.2rem;
  }

  .track-channel,
  .meter-bank,
  .listen-console,
  .panel-heading {
    padding: 19px;
  }

  .meter-row {
    grid-template-columns: 20px minmax(0, 1fr) 46px;
    gap: 8px;
  }

  .scale {
    margin-right: 44px;
    margin-left: 29px;
  }

  .scale span:nth-child(even) {
    display: none;
  }

  .program-facts,
  .status-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .event-editor summary {
    flex-direction: column;
  }

  .status-item,
  .status-item:nth-child(3),
  .status-item:nth-child(even) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .status-item:last-child {
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
