:root {
  color-scheme: dark;
  --paper: #10101a;
  --panel: #171723;
  --border: #2c2b3c;
  --muted: #a5a3bb;
  --text: #f4f1fb;
  --lavender: #d5c6ff;
  --violet: #ab8fff;
  --gold: #ebcb96;
  --good: #7ee4ba;
  --bad: #ffaaa6;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  background: var(--paper);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: var(--lavender); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--lavender); outline-offset: 4px; }
h1, h2, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.85rem, 4vw, 3.8rem); font-weight: 650; letter-spacing: -.055em; line-height: 1.09; }
h2 { font-size: 1.03rem; font-weight: 650; letter-spacing: -.01em; }
p { line-height: 1.55; }
.muted, dt { color: var(--muted); font-size: .86rem; }
.brand { color: var(--text); display: inline-flex; align-items: center; gap: .72rem; white-space: nowrap; }
.brand img { border-radius: 10px; }
.brand strong { font-size: 1.17rem; letter-spacing: -.04em; font-weight: 700; }
.brand span { color: var(--gold); }
.brand small { font-size: .58rem; letter-spacing: .21em; color: var(--muted); display: block; margin-top: .13rem; }
.brand:hover { text-decoration: none; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .65rem; padding: .6rem .9rem; min-height: 40px; border-radius: 8px; font-size: .87rem; font-weight: 600; border: 1px solid transparent; color: var(--text); background: none; }
.button:hover { text-decoration: none; }
.quiet { border-color: var(--border); }
.quiet:hover { background: #232235; }
.primary { background: var(--lavender); color: #21153d; }
.primary:hover { background: #e6ddff; }
.pill { display: inline-flex; align-items: center; gap: .45rem; width: max-content; max-width: 100%; border: 1px solid var(--border); border-radius: 2rem; padding: .34rem .65rem; font-size: .73rem; font-weight: 650; color: var(--muted); background: #1c1b29; }
.pill::before { content: ""; width: .43rem; height: .43rem; background: currentColor; border-radius: 50%; flex: 0 0 auto; }
.pill[data-state="live"] { color: var(--good); background: #172b28; border-color: #2e4d46; }
.pill[data-state="standby"] { color: var(--gold); background: #2a2422; border-color: #524238; }
.pill[data-state="offline"], .pill[data-state="unavailable"] { color: var(--bad); background: #322126; border-color: #563541; }
.public-page { background: radial-gradient(ellipse at 50% -30%, #26223d, var(--paper) 58%); }
.public-header, .public-footer { padding: 1.05rem clamp(1rem, 6vw, 6rem); display: flex; align-items: center; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--border); }
.public-content { max-width: 1120px; padding: clamp(2.2rem, 5vw, 4.5rem) 1.2rem 2.2rem; margin: 0 auto; }
.public-intro { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; }
.public-intro p { color: var(--muted); margin-top: .6rem; }
.public-bottom { display: flex; gap: 1.2rem; justify-content: space-between; align-items: center; padding-top: 1.3rem; }
.public-links { display: flex; gap: 1.15rem; flex-wrap: wrap; font-size: .87rem; }
.now-playing { display: grid; gap: .35rem; }
.now-playing span { color: var(--gold); font-size: .73rem; }
.public-footer { color: var(--muted); font-size: .82rem; border-top: 1px solid var(--border); border-bottom: 0; }
.screen { aspect-ratio: 16 / 9; position: relative; overflow: hidden; isolation: isolate; background: #100e1a; border: 1px solid #353047; border-radius: 11px; }
.screen-art { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 48%, #4b3472 0%, #2b224a 38%, #171425 70%); overflow: hidden; }
.screen-art::before { content: ""; width: 112%; aspect-ratio: 1; position: absolute; top: 48%; left: 50%; border-radius: 50%; transform: translate(-50%,-50%) scaleY(.64) rotate(-15deg); background: repeating-radial-gradient(circle, transparent 0 2.8%, #dfc0ff3d 2.9% 3.05%, transparent 3.15% 5.7%), radial-gradient(circle, #9d72d138, transparent 62%); box-shadow: inset 0 0 12rem #151223; }
.screen-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(124deg, #1c183c2c, #14101a10 51%, #130e16a8); }
.screen video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; visibility: hidden; }
.screen.loaded video { visibility: visible; background: #0b0910; }
.screen-overlay { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: .6rem; padding: 1rem; text-align: center; pointer-events: none; }
.screen-overlay .button { pointer-events: auto; }
.player-message { font-size: .82rem; color: #eee7ff; text-shadow: 0 2px 6px #130b24; }
.screen.loaded .screen-overlay { display: none; }
.app-shell { display: grid; grid-template-columns: 217px minmax(0, 1fr); min-height: 100vh; }
.sidebar { padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: 2.5rem; background: #12121d; border-right: 1px solid var(--border); }
.sidebar .brand { margin-inline: .28rem; }
.sidebar nav { display: grid; gap: .35rem; }
.nav-button { display: flex; align-items: center; gap: .72rem; border: 1px solid transparent; color: var(--muted); background: none; padding: .67rem .75rem; border-radius: 8px; text-align: left; font-size: .86rem; white-space: nowrap; }
.nav-button span { width: 1.15rem; color: var(--violet); font-size: 1rem; }
.nav-button:hover { background: #1d1b2b; color: var(--text); }
.nav-button.selected { background: #28233b; color: var(--lavender); border-color: #423652; font-weight: 600; }
.sidebar-end { display: flex; flex-direction: column; gap: .5rem; margin-top: auto; }
.dashboard-main { width: 100%; max-width: 1500px; margin: 0 auto; padding: clamp(1.15rem, 3vw, 2.7rem); }
.dash-header { display: flex; gap: .65rem; justify-content: space-between; align-items: end; padding-bottom: 1.35rem; border-bottom: 1px solid var(--border); margin-bottom: 1.35rem; }
.dash-header h1 { font-size: clamp(1.9rem, 4vw, 3rem); }
.section-label { color: var(--gold); margin-bottom: .25rem; font-size: .73rem; letter-spacing: .08em; }
.card { padding: clamp(.85rem, 2vw, 1.25rem); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.card-heading { display: flex; gap: .5rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-heading a { font-size: .84rem; }
.meters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: .8rem; }
.meter { display: grid; align-content: start; gap: .4rem; }
.meter span, .meter small { color: var(--muted); }
.meter span { font-size: .79rem; }
.meter small { font-size: .72rem; }
.meter strong { font-size: clamp(1.17rem, 2.1vw, 1.72rem); font-weight: 650; letter-spacing: -.045em; overflow-wrap: anywhere; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; gap: .8rem; }
.telemetry-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; padding-top: 1rem; }
.telemetry-strip dt { font-size: .71rem; }
.telemetry-strip dd { font-size: .87rem; margin-top: .25rem; overflow-wrap: anywhere; }
.resources { min-height: 100%; }
.resource { display: grid; grid-template-columns: 1fr auto; gap: .55rem; margin: 1.15rem 0; }
.resource label, .resource strong { font-size: .81rem; }
.resource progress { grid-column: 1 / -1; width: 100%; height: .47rem; border: 0; border-radius: 7px; appearance: none; color: var(--violet); background: #2e2b40; }
.resource progress::-webkit-progress-bar { background: #2e2b40; border-radius: 7px; }
.resource progress::-webkit-progress-value { background: var(--violet); border-radius: 7px; }
.resource progress::-moz-progress-bar { background: var(--violet); border-radius: 7px; }
.subline { font-size: .75rem; color: var(--muted); margin-top: .8rem; }
.health-list div { padding: .65rem 0; display: flex; justify-content: space-between; gap: .5rem; border-bottom: 1px solid var(--border); }
.health-list dd { font-size: .85rem; font-variant-numeric: tabular-nums; }
canvas { display: block; width: 100%; height: 153px; }
.alert { background: #302720; border: 1px solid #614d3a; padding: .75rem .95rem; border-radius: 8px; color: var(--gold); margin-bottom: .85rem; font-size: .87rem; }
.dash-footer { padding-top: 1.1rem; color: var(--muted); font-size: .75rem; }
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 1.3rem; background: radial-gradient(ellipse at 45% 28%, #302449, #151323 55%, var(--paper)); }
.login-card { width: min(100%, 410px); padding: 2rem; border: 1px solid var(--border); border-radius: 16px; background: #171624; }
.login-card h1 { font-size: 1.85rem; margin: 1.2rem 0; }
.login-card button { width: 100%; }
.login-card label { margin-bottom: .9rem; }
.login-card .feedback { margin-bottom: .7rem; }
form { min-width: 0; }
label { display: grid; gap: .4rem; color: var(--muted); font-size: .84rem; }
label + label, form > p { margin-top: .9rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.form-grid label + label, .form-grid > p { margin-top: 0; }
.full { grid-column: 1 / -1; }
input, textarea, select { color: var(--text); background: #10101a; border: 1px solid var(--border); border-radius: 7px; padding: .55rem .65rem; min-width: 0; width: 100%; }
textarea { min-height: 84px; resize: vertical; }
.form-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .7rem; }
.feedback { color: var(--good); font-size: .83rem; overflow-wrap: anywhere; }
.feedback.error { color: var(--bad); }
.logo-preview { border-radius: 12px; object-fit: contain; margin-bottom: .7rem; background: #10101a; }
.spacing { margin-top: .8rem; }
.link-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .45rem; margin-bottom: .65rem; }
.link-row input { font-size: .73rem; }
.link-row .button { min-height: 34px; padding: .4rem .55rem; }
.programme-list { max-height: 480px; overflow: auto; }
.programme-row { border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: .65rem; padding: .6rem 0; }
.programme-row p { font-size: .79rem; overflow-wrap: anywhere; }
.programme-row .button { min-height: 32px; padding: .35rem; }
.big-number { font-size: 2rem; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; margin-top: .65rem; font-size: .84rem; }
caption { text-align: left; color: var(--muted); padding-bottom: .45rem; }
td, th { padding: .55rem .65rem; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--lavender); white-space: nowrap; }
.filter { display: flex; align-items: center; }
.filter select { min-width: 110px; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: .85rem 1.1rem; gap: .8rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar nav { display: flex; overflow: auto; }
  .sidebar-end { flex-direction: row; flex-wrap: wrap; }
  .sidebar-end .button { min-height: 34px; padding: .35rem .6rem; }
}
@media (max-width: 660px) {
  .sidebar nav { flex-wrap: wrap; overflow: visible; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .meters, .telemetry-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .public-intro, .public-bottom { align-items: flex-start; flex-direction: column; }
  .public-header .button { padding-inline: .5rem; }
  .programme-row { align-items: start; flex-direction: column; }
}
@media (max-width: 360px) {
  .dash-header { align-items: start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
}
