@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono.woff2') format('woff2');
  font-weight: 400 600;
  font-display: swap;
}

:root {
  color-scheme: dark;
  /* deck: smoked cassette shell */
  --ground: oklch(0.165 0.009 60);
  --ground-deep: oklch(0.135 0.008 60);
  --panel: oklch(0.2 0.011 62);
  --panel-raised: oklch(0.235 0.012 64);
  --line: oklch(0.31 0.013 65);
  --line-soft: oklch(0.26 0.012 64);
  --ink: oklch(0.95 0.012 85);
  --ink-2: oklch(0.79 0.016 78);
  --ink-3: oklch(0.66 0.016 72);
  --tape: oklch(0.29 0.035 48);
  --tape-edge: oklch(0.36 0.04 50);

  /* J-card insert stock (the rail) */
  --card: oklch(0.9 0.035 88);
  --card-2: oklch(0.85 0.04 86);
  --card-line: oklch(0.76 0.04 80);
  --card-ink: oklch(0.22 0.02 60);
  --card-ink-2: oklch(0.42 0.025 62);

  /* one colour, one meaning */
  --rec: oklch(0.64 0.215 28);
  --rec-ink: oklch(0.99 0.01 30);
  --rec-soft: oklch(0.64 0.215 28 / 0.14);
  --amber: oklch(0.82 0.15 78);
  --amber-soft: oklch(0.82 0.15 78 / 0.12);
  --err: oklch(0.74 0.1 12);
  --err-soft: oklch(0.74 0.1 12 / 0.12);
  --focus: oklch(0.86 0.13 92);

  /* insert bands */
  --band-0: oklch(0.72 0.17 48);
  --band-1: oklch(0.86 0.15 96);
  --band-2: oklch(0.73 0.11 190);
  --band-3: oklch(0.64 0.15 262);
  --band-4: oklch(0.74 0.14 2);
  --band-5: oklch(0.77 0.15 140);

  --font: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --rail: 236px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  font-stretch: 100%;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
::selection { background: oklch(0.86 0.15 96 / 0.35); color: var(--ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid var(--ground); }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- type ---------- */
.display {
  font-stretch: 68%;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 0.95;
}
h1.display { font-size: clamp(30px, 3.4vw, 40px); margin: 0; }
h2.section {
  margin: 0;
  font-size: 13px;
  font-stretch: 72%;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  font-stretch: 85%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  background: var(--card);
  color: var(--card-ink);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--card-line);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--card-line);
  text-decoration: none;
}
.brand-word {
  font-size: 26px; font-weight: 850; font-stretch: 62%;
  text-transform: uppercase; letter-spacing: 0.01em; line-height: 1;
}
.brand-word b { color: var(--band-0); font-weight: inherit; }
.brand svg { width: 34px; height: 22px; }
.nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 600; font-size: 14.5px;
  color: var(--card-ink-2);
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--card-2); color: var(--card-ink); }
.nav a[aria-current='page'] { background: var(--card-ink); color: var(--card); }
.nav .count {
  margin-left: auto; font-family: var(--mono); font-size: 11.5px;
  display: inline-flex; align-items: center; gap: 5px;
}
.nav .count .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--rec); }
.nav .badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--amber); color: var(--card-ink); font-weight: 700; }
.nav a[aria-current='page'] .badge { background: var(--amber); color: var(--card-ink); }
table.t.users { min-width: 0; }
table.t.users .acts { gap: 6px; flex-wrap: nowrap; }
@media (max-width: 1280px) {
  table.t.users th:nth-child(5), table.t.users td:nth-child(5) { display: none; }
}
@media (max-width: 1100px) {
  table.t.users th:nth-child(3), table.t.users td:nth-child(3) { display: none; }
}
.rail-foot { margin-top: auto; border-top: 1px solid var(--card-line); }
.meter { padding: 14px 20px 6px; }
.meter h3 { margin: 0 0 8px; font-size: 11.5px; font-weight: 700; font-stretch: 80%; letter-spacing: 0.08em; text-transform: uppercase; color: var(--card-ink-2); }
.meter dl { margin: 0; display: grid; grid-template-columns: 1fr auto; row-gap: 5px; font-size: 13px; }
.meter dt { color: var(--card-ink-2); }
.meter dd { margin: 0; font-family: var(--mono); font-size: 12px; text-align: right; }
.bar { grid-column: 1 / -1; height: 3px; background: var(--card-line); border-radius: 2px; overflow: hidden; margin-bottom: 4px; }
.bar i { display: block; height: 100%; background: var(--card-ink); transform-origin: left; transform: scaleX(0); transition: transform 0.6s var(--ease); }
.who { display: flex; align-items: center; gap: 8px; padding: 12px 14px 14px 20px; font-size: 13px; }
.who span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--card-ink-2); }
.who button { background: none; border: 0; padding: 6px; border-radius: 6px; cursor: pointer; color: var(--card-ink-2); display: grid; }
.who button:hover { background: var(--card-2); color: var(--card-ink); }

.main { min-width: 0; padding: 32px clamp(16px, 3.4vw, 48px) 64px; }
.page { max-width: 1240px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .grow { flex: 1; min-width: 200px; }
.onair { display: flex; align-items: center; gap: 12px; align-self: center; }
.page-head p { margin: 8px 0 0; color: var(--ink-3); max-width: 72ch; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-raised);
  font-weight: 600; font-size: 14px; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: oklch(0.27 0.013 64); border-color: oklch(0.38 0.014 66); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn.primary:hover { background: oklch(0.88 0.014 85); }
.btn.go { background: var(--ink); color: var(--ground); border-color: var(--ink); }
.btn.go:hover { background: oklch(0.88 0.014 85); }
.btn.go .rec-dot { background: var(--rec); }
.btn.del { background: var(--err); color: var(--ground); border-color: var(--err); }
.btn.del:hover { background: oklch(0.69 0.1 12); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-raised); color: var(--ink); }
.btn.danger { color: var(--err); }
.btn.danger:hover { background: var(--err-soft); border-color: oklch(0.55 0.08 12); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 34px; padding: 0; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; }
.btn.is-busy { pointer-events: none; opacity: 0.7; }

.field { display: block; margin-bottom: 16px; }
.input, .select {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--ground-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--ink-3); }
.input:hover, .select:hover { border-color: oklch(0.38 0.014 66); }
.input:focus, .select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.86 0.13 92 / 0.18); }
.input.mono { font-size: 13px; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b9b0a2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.with-btn { display: flex; gap: 8px; }
.with-btn .input { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.seg { display: inline-flex; padding: 3px; background: var(--ground-deep); border: 1px solid var(--line); border-radius: 8px; gap: 2px; width: 100%; }
.seg button {
  flex: 1; height: 32px; border: 0; background: none; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-size: 13.5px; color: var(--ink-3);
}
.seg button[aria-pressed='true'] { background: var(--panel-raised); color: var(--ink); box-shadow: 0 1px 2px oklch(0 0 0 / 0.35); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; font-stretch: 85%; letter-spacing: 0.05em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--ink-3); white-space: nowrap;
}
.chip .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.live { background: var(--rec); border-color: var(--rec); color: var(--rec-ink); }
.chip.live .d { animation: blink 1.6s steps(2, jump-none) infinite; }
.chip.starting, .chip.retrying { color: var(--amber); border-color: oklch(0.82 0.15 78 / 0.45); background: var(--amber-soft); }
.chip.error { color: var(--err); border-color: oklch(0.6 0.09 12 / 0.6); }
@keyframes blink { 50% { opacity: 0.25; } }

.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 4px; font-family: var(--mono); font-size: 11px; background: var(--panel-raised); color: var(--ink-2); border: 1px solid var(--line-soft); }
.tag.busy { color: var(--amber); border-color: oklch(0.82 0.15 78 / 0.4); background: var(--amber-soft); }
.tag.err { color: var(--err); border-color: oklch(0.6 0.09 12 / 0.5); }
.tag.ok { color: oklch(0.82 0.12 150); border-color: oklch(0.5 0.08 150 / 0.5); background: oklch(0.5 0.08 150 / 0.1); }

.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); min-height: 56px; }
.panel-head h2 { flex: 1; }
.panel-body { padding: 16px; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13.5px; }
.notice svg { margin-top: 2px; }
.notice.warn { background: var(--amber-soft); color: oklch(0.9 0.08 85); border: 1px solid oklch(0.82 0.15 78 / 0.28); }
.notice.err { background: var(--err-soft); color: oklch(0.9 0.04 15); border: 1px solid oklch(0.74 0.1 12 / 0.35); }

/* ---------- deck strip (streams summary) ---------- */
.strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.strip > div { padding: 12px 16px 14px 0; }
.strip > div + div { padding-left: 16px; border-left: 1px solid var(--line-soft); }
.strip dt { font-size: 12px; font-weight: 600; font-stretch: 85%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.strip dd { margin: 4px 0 0; font-family: var(--mono); font-size: 17px; color: var(--ink); }
.strip dd small { font-size: 12px; color: var(--ink-3); }
.strip dd .on { color: var(--rec); }

/* ---------- stream rows ---------- */
.rows { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.rows-head, .row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1.6fr) 130px 110px 110px 132px;
  align-items: center; gap: 16px; padding: 0 16px;
}
.rows-head { height: 38px; font-size: 11.5px; font-weight: 600; font-stretch: 85%; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); border-bottom: 1px solid var(--line-soft); background: var(--ground-deep); }
.row { min-height: 78px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background 0.15s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel-raised); }
.row-name { min-width: 0; }
.row-name a { display: block; font-weight: 700; font-size: 15.5px; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-name a:hover { text-decoration: underline; }
.row-sub { display: flex; gap: 10px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.row-sub span { overflow: hidden; text-overflow: ellipsis; }
.row .num { font-family: var(--mono); font-size: 13px; }
.row .c-state .c-uptime { display: none; font-family: var(--mono); }
.row .act { display: flex; justify-content: flex-end; }
.row .act .btn { width: 112px; }
.row.is-live .num { color: var(--ink); }

/* ---------- cassette (signature) ---------- */
.cass { display: block; }
.cass .hub { transform-box: fill-box; transform-origin: center; }
.cass.spinning .hub { animation: spin 2.4s linear infinite; }
.cass.spinning .hub.r { animation-duration: 2.4s; }
@keyframes spin { to { transform: rotate(-360deg); } }
.cass .tape { transition: r 1s var(--ease); }
.mini { width: 68px; height: 44px; }

/* ---------- detail ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); text-decoration: none; font-size: 13.5px; margin-bottom: 14px; }
.back:hover { color: var(--ink); }
.title-edit {
  background: none; border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; margin-left: -7px;
  width: min(100%, 640px);
}
.title-edit:hover { border-color: var(--line); }
.title-edit:focus { outline: none; border-color: var(--focus); background: var(--ground-deep); }

.deck {
  display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 0;
  margin-bottom: 20px; overflow: hidden;
}
.deck-visual { padding: 22px; background: var(--ground-deep); border-right: 1px solid var(--line-soft); display: grid; place-items: center; }
.deck-visual svg { width: 100%; max-width: 380px; height: auto; filter: drop-shadow(0 10px 24px oklch(0 0 0 / 0.45)); }
.deck-info { display: flex; flex-direction: column; min-width: 0; }
.tele { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line-soft); }
.tele > div { padding: 14px 18px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.tele > div:nth-child(3n) { border-right: 0; }
.tele > div:nth-last-child(-n+3) { border-bottom: 0; }
.tele dt { font-size: 12px; font-weight: 600; font-stretch: 85%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.tele dd { margin: 3px 0 0; font-family: var(--mono); font-size: 18px; }
.now { padding: 14px 18px 18px; flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.now-title { font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-track { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.now-track i { display: block; height: 100%; background: var(--band, var(--ink)); transform-origin: left; transform: scaleX(0); transition: transform 1s linear; }
.now-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

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

/* tracklist: side A */
.tracks { list-style: none; margin: 0; padding: 0; }
.track {
  display: grid; grid-template-columns: 22px 26px minmax(0, 1fr) auto 30px 30px;
  align-items: center; gap: 10px; padding: 8px 12px 8px 8px;
  border-bottom: 1px solid var(--line-soft); background: var(--panel);
}
.track:last-child { border-bottom: 0; }
.track .grip { cursor: grab; color: var(--ink-3); display: grid; place-items: center; height: 28px; border-radius: 4px; }
.track .grip:hover { color: var(--ink); background: var(--panel-raised); }
.track .n { font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-align: right; }
.track .t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.track .dur { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
.track .meta { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.track .mute.is-muted { color: var(--err); }
.track .mute[disabled] { opacity: 0.35; }
.warn-tag { color: var(--amber); }
.track.playing { background: color-mix(in oklch, var(--band, var(--ink)) 12%, var(--panel)); }
.track.playing .n { color: var(--band, var(--ink)); }
.track.dragging { opacity: 0.4; }
.track.drop-before { box-shadow: inset 0 2px 0 var(--focus); }
.tracks-foot { display: flex; justify-content: space-between; padding: 10px 16px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--line-soft); }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }

.log {
  margin: 0; height: 260px; overflow: auto; padding: 12px 16px;
  background: var(--ground-deep); border-radius: 0 0 var(--radius) var(--radius);
  font: 12px/1.65 var(--mono); color: var(--ink-2); white-space: pre-wrap; word-break: break-all;
}
.log .ts { color: var(--ink-3); margin-right: 8px; }
.log .bad { color: oklch(0.82 0.11 40); }
.log .good { color: oklch(0.85 0.1 150); }

/* ---------- drawer (file picker) ---------- */
.scrim { position: fixed; inset: 0; background: oklch(0.1 0.01 60 / 0.6); backdrop-filter: blur(2px); z-index: 40; animation: fade 0.2s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  background: var(--panel); border-left: 1px solid var(--line);
  z-index: 41; display: flex; flex-direction: column;
  animation: slide 0.35s var(--ease);
  box-shadow: -20px 0 50px oklch(0 0 0 / 0.4);
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line-soft); }
.drawer-head h2 { flex: 1; font-size: 20px; }
.drawer-body { flex: 1; overflow: auto; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-soft); }
.pick { display: grid; grid-template-columns: 20px 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.pick:hover { background: var(--panel-raised); }
.pick input { width: 16px; height: 16px; accent-color: var(--ink); }
.pick .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick .k { color: var(--ink-3); display: grid; place-items: center; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }

/* ---------- library ---------- */
.drop {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px; margin-bottom: 20px;
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: var(--panel); cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop:hover, .drop.over { border-color: var(--card-line); background: var(--panel-raised); }
.drop .ic { width: 48px; height: 48px; border-radius: 10px; background: var(--card); color: var(--card-ink); display: grid; place-items: center; flex: none; }
.drop .ic svg { width: 22px; height: 22px; }
.drop strong { display: block; font-size: 15.5px; color: var(--ink); }
.drop span { color: var(--ink-3); font-size: 13px; }
.uploads { display: grid; gap: 8px; margin: -8px 0 20px; }
.up { display: grid; grid-template-columns: minmax(0, 1fr) 160px 60px; gap: 14px; align-items: center; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); font-size: 13px; }
.up .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up .p { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.up .p i { display: block; height: 100%; background: var(--ink); transform-origin: left; transition: transform 0.2s; }
.up.failed { border-color: oklch(0.6 0.09 12 / 0.6); }
.up.failed .p i { background: var(--err); }
.up .s { font-family: var(--mono); font-size: 12px; text-align: right; color: var(--ink-3); }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid transparent; background: none; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-3); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed='true'] { background: var(--panel-raised); border-color: var(--line); color: var(--ink); }
.tabs .n { font-family: var(--mono); font-size: 11.5px; margin-left: 6px; color: var(--ink-3); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel); }
table.t { width: 100%; border-collapse: collapse; min-width: 760px; }
table.t th { text-align: left; height: 38px; padding: 0 14px; font-size: 11.5px; font-weight: 600; font-stretch: 85%; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); background: var(--ground-deep); border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.t td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr:hover td { background: var(--panel-raised); }
table.t .name { display: flex; align-items: center; gap: 10px; max-width: 380px; }
table.t .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
table.t .kind { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; background: var(--panel-raised); color: var(--ink-2); flex: none; }
table.t td.r, table.t th.r { text-align: right; }
table.t .acts { display: flex; gap: 2px; justify-content: flex-end; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(360px, 480px); }
.auth-art { background: var(--card); color: var(--card-ink); display: flex; flex-direction: column; justify-content: space-between; padding: 40px clamp(24px, 5vw, 64px); overflow: hidden; }
.auth-art .brand { padding: 0; border: 0; }
.auth-art h1 { font-size: clamp(44px, 6vw, 84px); margin: 0 0 18px; }
.auth-art p { max-width: 46ch; color: var(--card-ink-2); font-size: 16px; margin: 0; }
.auth-art svg.cass { width: min(100%, 520px); margin: 28px 0; filter: drop-shadow(0 18px 30px oklch(0.3 0.04 60 / 0.35)); }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 40px clamp(24px, 4vw, 56px); }
.auth-form h2 { font-size: 30px; margin: 0 0 6px; }
.auth-form > p { color: var(--ink-3); margin: 0 0 28px; }
.auth-form .btn { width: 100%; margin-top: 6px; }
.auth-switch { margin-top: 18px; font-size: 13.5px; color: var(--ink-3); }
.auth-switch button { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.form-err { margin-bottom: 14px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 60; width: min(440px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: var(--ink); color: var(--ground); font-weight: 500; font-size: 13.5px; box-shadow: 0 10px 30px oklch(0 0 0 / 0.45); animation: rise 0.35s var(--ease); }
.toast.err { background: var(--err); color: var(--ground); }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

.loading { padding: 80px 0; text-align: center; color: var(--ink-3); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cols { grid-template-columns: 1fr; }
  .rows-head, .row { grid-template-columns: 68px minmax(0, 1fr) 120px 100px 120px; }
  .rows-head .c-bitrate, .row .c-bitrate { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .rail { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--card-line); }
  .brand { border-bottom: 0; padding: 12px 16px; }
  .brand-word { font-size: 22px; }
  .nav { flex-direction: row; padding: 8px; margin-left: auto; }
  .nav a { padding: 8px 10px; }
  .nav a .lbl, .nav .count { display: none; }
  .rail-foot { display: none; }
  .main { padding: 20px 16px 48px; }
  .deck { grid-template-columns: 1fr; }
  .deck-visual { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strip > div:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--line-soft); }
  .strip > div:nth-child(4) { border-top: 1px solid var(--line-soft); }
  .rows-head { display: none; }
  .row { grid-template-columns: 60px minmax(0, 1fr) auto; grid-template-areas: 'c n a' 'c s a'; row-gap: 4px; padding: 12px; }
  .row .mini { grid-area: c; width: 60px; height: 40px; }
  .row .row-name { grid-area: n; }
  .row .c-state { grid-area: s; display: flex; gap: 10px; align-items: center; }
  .row .c-state .c-uptime { display: inline; color: var(--ink-2); font-size: 12.5px; }
  .row .num.c-uptime, .row .c-bitrate, .row-sub span:first-child { display: none; }
  .row.ro .row-sub span:first-child { display: inline; }
  .row .act { grid-area: a; }
  .row .act .btn { width: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 24px 16px; }
  .auth-art svg.cass { display: none; }
  .auth-art h1 { font-size: 40px; margin-top: 24px; }
  .grid-2 { grid-template-columns: 1fr; }
  .up { grid-template-columns: minmax(0, 1fr) 80px 50px; }
  table.t { min-width: 0; }
  table.t th:nth-child(2), table.t td:nth-child(2),
  table.t th:nth-child(4), table.t td:nth-child(4),
  table.t th:nth-child(5), table.t td:nth-child(5),
  table.t th:nth-child(6), table.t td:nth-child(6) { display: none; }
  table.t th, table.t td { padding-left: 10px; padding-right: 10px; }
  table.t.users thead { display: none; }
  table.t.users tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--line-soft); }
  table.t.users tr:last-child { border-bottom: 0; }
  table.t.users td { display: none; padding: 0; border: 0; background: none !important; }
  table.t.users td:nth-child(1) { display: block; grid-column: 1 / -1; }
  table.t.users td:nth-child(2), table.t.users td:nth-child(6) { display: block; }
  .nav .count#nav-pending { display: inline-flex; margin-left: -4px; }
}
@media (max-width: 520px) {
  .tele { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tele > div { border-right: 1px solid var(--line-soft) !important; border-bottom: 1px solid var(--line-soft) !important; }
  .tele > div:nth-child(2n) { border-right: 0 !important; }
  .tele > div:nth-last-child(-n+2) { border-bottom: 0 !important; }
  .drop { flex-direction: column; text-align: center; }
  .track { grid-template-columns: 22px 24px minmax(0, 1fr) auto 30px; }
  .track .codec { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- playlists (video + audio) ---------- */
.list { border-bottom: 1px solid var(--line-soft); }
.list-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--ground-deep); border-bottom: 1px solid var(--line-soft); }
.list-title { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.list-title b { font-weight: 700; }
.list-title.video svg { color: var(--band-0); }
.list-title.audio svg { color: var(--band-2); }
.list-total { margin-left: auto; font-size: 12.5px; color: var(--ink-2); }
.seg.seg-sm { width: auto; padding: 2px; }
.seg.seg-sm button { height: 28px; padding: 0 10px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; flex: none; }
.seg.seg-sm button svg { width: 14px; height: 14px; }
.seg.seg-sm button[aria-pressed='true'] { color: var(--band, var(--ink)); }
.list-empty { margin: 0; padding: 14px 16px 4px; font-size: 13px; color: var(--ink-3); max-width: 62ch; }
.list-drop { display: flex; align-items: center; gap: 10px; padding: 10px 16px 12px; border-radius: 0; transition: background 0.15s; }
.list-drop.over { background: var(--panel-raised); box-shadow: inset 0 0 0 1.5px var(--card-line); }
.list-drop-main { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 12px; border: 1.5px dashed var(--line); border-radius: var(--radius-sm); color: var(--ink-3); font-size: 13px; cursor: pointer; text-align: center; transition: border-color 0.15s, color 0.15s; }
.list-drop-main:hover { border-color: var(--card-line); color: var(--ink); }
.list-drop-main u { text-underline-offset: 3px; }
.uploads.inline { margin: 0; padding: 0 16px; gap: 6px; }
.uploads.inline:not(:empty) { padding-top: 10px; }
.mixer { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.mixer label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 10px; }
.mixer .label { grid-column: 1 / -1; }
.mixer output { font-size: 12.5px; color: var(--ink-2); min-width: 44px; text-align: right; }
input[type='range'] { width: 100%; accent-color: var(--band, var(--ink)); }
.storage { display: grid; grid-template-columns: auto minmax(80px, 1fr) auto; align-items: center; gap: 14px; padding: 12px 16px; }
.storage .mono { font-size: 12px; color: var(--ink-2); }
.storage-bar { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.storage-bar i { display: block; height: 100%; background: var(--ink-2); transform-origin: left; transition: transform 0.6s var(--ease); }
.storage.full .storage-bar i { background: var(--amber); }
.notice.info { background: var(--panel); color: var(--ink-2); border: 1px solid var(--line); }

/* now playing, two lanes */
.now { gap: 12px; }
.now-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.now-ic { color: var(--ink-3); display: grid; }
.now-main { min-width: 0; display: grid; gap: 6px; }
.now-row .now-title { font-size: 14.5px; }
.now-row .now-meta { font-family: var(--mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* YouTube advice */
.advice { margin-bottom: 20px; border: 1px solid oklch(0.82 0.15 78 / 0.28); background: var(--amber-soft); border-radius: var(--radius-sm); color: oklch(0.9 0.08 85); font-size: 13.5px; }
.advice summary { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; font-weight: 600; list-style: none; }
.advice summary::-webkit-details-marker { display: none; }
.advice summary::after { content: '+'; margin-left: auto; font-family: var(--mono); }
.advice[open] summary::after { content: '–'; }
.advice ul { margin: 0; padding: 0 16px 12px 40px; display: grid; gap: 6px; max-width: 90ch; }

/* extra destinations */
.dest { display: grid; gap: 8px; padding: 12px; margin-bottom: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--ground-deep); }
.dest-top { display: flex; gap: 8px; align-items: center; }
.dest-top .input { flex: 1; min-width: 0; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span:first-of-type { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 0.2s; }
.switch span:first-of-type::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink); transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--band, var(--band-2)); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--ground); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.swatch { width: 30px; height: 30px; border-radius: 7px; cursor: pointer; border: 2px solid transparent; outline-offset: 2px; }
.swatch[aria-checked='true'] { border-color: var(--ink); }

@media (max-width: 860px) {
  .mixer { grid-template-columns: 1fr; }
  .list-total { margin-left: 0; width: 100%; order: 3; }
  .list-drop { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .track { grid-template-columns: 22px minmax(0, 1fr) 30px 30px; }
  .track .n, .track .meta { display: none; }
  .storage { grid-template-columns: 1fr auto; }
  .storage .label { display: none; }
}

.drawer.modal { top: 50%; bottom: auto; left: 50%; right: auto; transform: translate(-50%, -50%); height: auto; width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; animation: fade 0.2s; }

.others-head { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 12px; }
.others-head .muted { font-size: 12.5px; }
.row.ro { cursor: default; }
.row.ro:hover { background: transparent; }
.ro-name { display: block; font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.ro .row-sub svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
