/* ─────────────────────────────────────────────────────────────────────────
   Glitcho admin — pulled directly from the app's Theme.swift tokens.

   Color/sizing/font ramps match Sources/GlitchoCore/Theme/Theme.swift:
     bgBase  #0A0B0F   bgPanel  #14161C   accent  #9146FF   accentGlow #B57BFF
     live    #EF4444   green    #22C55E   yellow  #F5C842   text       #F5F5F7
     hairline white@8% radius   md 12 / lg 16 / window 22
     fonts   13 body / 15 headline / 17 title3 / 22 title2 / 28 title / 40 lg

   GlassPanel approximation: regularMaterial → backdrop-filter blur(40px)
   saturate(180%) on rgba(20,22,28,0.62) with hairline + heavy shadow.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  color-scheme: dark;

  --bg-base:           #0A0B0F;
  --bg-panel:          #14161C;
  --bg-panel-soft:     rgba(20, 22, 28, 0.62);
  --bg-elev:           rgba(255, 255, 255, 0.04);
  --bg-elev-hover:     rgba(255, 255, 255, 0.07);
  --hairline:          rgba(255, 255, 255, 0.08);
  --hairline-strong:   rgba(255, 255, 255, 0.16);

  --text-primary:    #F5F5F7;
  --text-secondary:  #A1A1AA;
  --text-tertiary:   #71717A;

  --accent:       #9146FF;
  --accent-glow:  #B57BFF;
  --accent-soft:  rgba(145, 70, 255, 0.16);
  --accent-line:  rgba(145, 70, 255, 0.32);

  --live:        #EF4444;
  --live-soft:   rgba(239, 68, 68, 0.16);
  --green:       #22C55E;
  --green-soft:  rgba(34, 197, 94, 0.16);
  --yellow:      #F5C842;
  --yellow-soft: rgba(245, 200, 66, 0.14);

  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-window: 22px;
  --r-pill: 999px;

  --shadow-glass: 0 24px 60px -20px rgba(0, 0, 0, 0.55),
                  0 0 0 0.5px rgba(255, 255, 255, 0.04) inset;
  --shadow-card:  0 8px 24px -10px rgba(0, 0, 0, 0.5),
                  0 0 0 0.5px rgba(255, 255, 255, 0.04) inset;

  --side-w: 240px;
  --side-w-collapsed: 64px;

  --font-sans:    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
  --font-display: -apple-system-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Default constrains every inline icon — without this, a naked
   <svg><use/></svg> with no inline width inflates to its parent's
   width, which is what made the sidebar icons fill the screen. */
svg { width: 1em; height: 1em; flex-shrink: 0; fill: none; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.46;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background:
    radial-gradient(1100px 700px at -10% -10%, rgba(145, 70, 255, 0.10), transparent 60%),
    radial-gradient(900px 600px at 110% 100%, rgba(145, 70, 255, 0.05), transparent 60%),
    var(--bg-base);
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.012em;
  margin: 0;
  color: var(--text-primary);
}
h1 { font-size: 32px; line-height: 1.06; font-weight: 800; }
h2 { font-size: 17px; line-height: 1.2; font-weight: 700; }
h3 { font-size: 15px; line-height: 1.3; font-weight: 600; }

p { margin: 0; }
code, pre { font-family: var(--font-mono); }

.muted     { color: var(--text-secondary); }
.tertiary  { color: var(--text-tertiary); }
.mono      { font-family: var(--font-mono); }
.tnum      { font-variant-numeric: tabular-nums; }
.right     { text-align: right; }

/* ─── Sidebar ────────────────────────────────────────────────────────── */

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  border-right: 0.5px solid var(--hairline);
  background:
    linear-gradient(180deg, rgba(145, 70, 255, 0.05) 0%, transparent 24%),
    rgba(15, 16, 22, 0.72);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 14px;
}
.brand .brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: linear-gradient(180deg, #A865FF 0%, #6D28D9 100%);
  display: grid; place-items: center;
  box-shadow:
    0 6px 14px -6px rgba(145, 70, 255, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.brand .brand-mark svg { width: 16px; height: 16px; color: white; }
.brand .brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.2px;
  color: var(--text-primary);
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13px;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar nav a:hover { background: var(--bg-elev-hover); color: var(--text-primary); }
.sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--accent-glow);
  box-shadow: inset 0 0 0 0.5px var(--accent-line);
}
.sidebar nav a.active svg { color: var(--accent-glow); }
.sidebar nav a svg { width: 15px; height: 15px; color: var(--text-tertiary); }

.sidebar-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  border-top: 0.5px solid var(--hairline);
}
.lang-row { display: flex; gap: 3px; padding: 4px 2px; }
.lang-row a {
  flex: 1;
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 0;
  border-radius: 6px;
  color: var(--text-tertiary);
  letter-spacing: 0.4px;
}
.lang-row a:hover { background: var(--bg-elev-hover); color: var(--text-primary); }
.lang-row a.active { color: var(--accent-glow); background: var(--accent-soft); }

.sidebar-actions form { margin: 0; }
.sidebar-actions form button {
  width: 100%;
  background: transparent;
  border: 0.5px solid var(--hairline);
  color: var(--text-secondary);
  padding: 7px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-actions form button:hover {
  background: var(--bg-elev-hover);
  color: var(--text-primary);
  border-color: var(--hairline-strong);
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 0.5px solid var(--hairline);
  background: var(--bg-elev);
  color: var(--text-primary);
  margin-bottom: 6px;
  transition: background 120ms ease;
}
.user-pill:hover { background: var(--bg-elev-hover); color: var(--text-primary); }
.user-pill.active { background: var(--accent-soft); border-color: var(--accent-line); }
.user-avatar {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-glow) 100%);
  color: white;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
}
.user-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.user-meta .user-name {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-meta .user-role {
  font-size: 10.5px;
  color: var(--text-tertiary);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar .footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--text-tertiary);
  padding: 4px 0 0;
  letter-spacing: 0.3px;
}

/* ─── Main column ────────────────────────────────────────────────────── */

main { min-width: 0; padding: 0; }

.topbar {
  padding: 36px 36px 14px;
  display: flex; align-items: baseline; gap: 16px;
}
.topbar h1 { flex: 1; }
.content { padding: 4px 36px 64px; max-width: 1280px; }

@media (max-width: 880px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; padding: 10px; }
  .sidebar nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .sidebar nav a { white-space: nowrap; }
  .sidebar-actions { display: none; }
  .topbar { padding: 20px 18px 10px; }
  .content { padding: 4px 18px 48px; }
}

/* ─── Glass panel & section ───────────────────────────────────────────── */

.glass, .section {
  position: relative;
  background: var(--bg-panel-soft);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 16px; font-weight: 700; }
.section-head .right { color: var(--text-tertiary); font-size: 12px; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

/* ─── Stat cards ──────────────────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  position: relative;
  padding: 16px 18px 14px;
  border-radius: var(--r-lg);
  border: 0.5px solid var(--hairline);
  background: var(--bg-panel-soft);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  display: flex; flex-direction: column; gap: 6px;
  min-height: 104px;
  overflow: hidden;
}
.stat-card::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(140% 80% at 100% 0%, rgba(145, 70, 255, 0.07), transparent 60%);
  pointer-events: none;
}
.stat-card .stat-label {
  position: relative;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  text-transform: uppercase;
}
.stat-card .stat-value {
  position: relative;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.stat-card .stat-sub {
  position: relative;
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: auto;
}
.stat-card.accent .stat-value { color: var(--accent-glow); }
.stat-card .stat-bar {
  width: 100%; height: 3px;
  background: var(--bg-elev);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.stat-card .stat-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-glow) 100%);
  border-radius: 2px;
}

/* ─── Pills / badges ──────────────────────────────────────────────────── */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  border-radius: var(--r-pill);
  background: var(--bg-elev);
  color: var(--text-secondary);
  border: 0.5px solid var(--hairline);
  white-space: nowrap;
  text-transform: capitalize;
}
.pill svg { width: 10px; height: 10px; }
.pill-accent  { background: var(--accent-soft); color: var(--accent-glow); border-color: var(--accent-line); }
.pill-success { background: var(--green-soft);  color: var(--green);  border-color: rgba(34, 197, 94, 0.3); }
.pill-warn    { background: var(--yellow-soft); color: var(--yellow); border-color: rgba(245, 200, 66, 0.3); }
.pill-danger  { background: var(--live-soft);   color: var(--live);   border-color: rgba(239, 68, 68, 0.3); }

.live-dot {
  width: 7px; height: 7px;
  background: var(--live);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  animation: live-pulse 1.6s ease-out infinite;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70%  { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ─── Buttons ────────────────────────────────────────────────────────── */

.btn, button:not(.switch button):not(.chip button):not(.copy-btn) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  border-radius: 8px;
  border: 0.5px solid var(--hairline);
  background: var(--bg-elev);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease, border-color 120ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover, button:not(.switch button):not(.chip button):not(.copy-btn):hover {
  background: var(--bg-elev-hover);
  border-color: var(--hairline-strong);
  color: var(--text-primary);
}
.btn:active, button:not(.switch button):not(.chip button):not(.copy-btn):active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn svg, button svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(180deg, #A865FF 0%, #7C3AED 100%);
  border-color: rgba(145, 70, 255, 0.6);
  color: white;
  box-shadow: 0 4px 12px -4px rgba(145, 70, 255, 0.45);
}
.btn-primary:hover { filter: brightness(1.1); color: white; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elev); color: var(--text-primary); }

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.32);
  color: var(--live);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); color: var(--live); }

.btn-sm { padding: 5px 10px; font-size: 11.5px; }
.btn-sm svg { width: 12px; height: 12px; }
.btn-lg { padding: 10px 18px; font-size: 13.5px; }
button.danger {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.32) !important;
  color: var(--live) !important;
}
button.danger:hover { background: rgba(239, 68, 68, 0.2) !important; }
a.button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px;
  font-weight: 600; font-size: 12.5px; border-radius: 8px;
  border: 0.5px solid var(--hairline); background: var(--bg-elev);
  color: var(--text-primary); text-decoration: none; }
a.button:hover { background: var(--bg-elev-hover); border-color: var(--hairline-strong); color: var(--text-primary); }

/* ─── Tables ─────────────────────────────────────────────────────────── */

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left;
  font-weight: 600;
  font-size: 10.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 10px 12px 8px;
  border-bottom: 0.5px solid var(--hairline);
}
tbody td {
  padding: 11px 12px;
  border-bottom: 0.5px solid var(--hairline);
  color: var(--text-primary);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--bg-elev); }

/* ─── Form rows ──────────────────────────────────────────────────────── */

.form-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0;
  border-bottom: 0.5px solid var(--hairline);
  gap: 14px;
}
.form-row:last-child { border-bottom: 0; padding-bottom: 0; }
.form-row:first-child { padding-top: 0; }
.form-row .label { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.form-row .label strong { font-weight: 600; font-size: 13px; color: var(--text-primary); }
.form-row .label span { color: var(--text-tertiary); font-size: 11.5px; }

input[type="text"], input[type="password"], input[type="number"], input[type="email"], textarea, select {
  background: rgba(0, 0, 0, 0.32);
  border: 0.5px solid var(--hairline);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea { min-height: 86px; resize: vertical; }

label.field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--text-secondary);
  margin-bottom: 10px;
}
label.field > span { font-weight: 600; color: var(--text-secondary); font-size: 11.5px; }

/* ─── Toggle switch ──────────────────────────────────────────────────── */

.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0;
  background: var(--bg-elev);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-pill);
  transition: background 160ms ease;
  cursor: pointer;
}
.switch .track::before {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  transition: transform 160ms ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::before { transform: translateX(17px); }

/* ─── Chips ──────────────────────────────────────────────────────────── */

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px 4px 10px;
  background: var(--bg-elev);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-pill);
  font-size: 11.5px;
  color: var(--text-primary);
}
.chip button {
  background: none; border: 0; color: var(--text-tertiary); cursor: pointer;
  padding: 0; width: 14px; height: 14px; display: grid; place-items: center;
}
.chip button:hover { color: var(--live); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

/* ─── Empty state ────────────────────────────────────────────────────── */

.empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 36px 20px;
  color: var(--text-secondary);
  text-align: center;
}
.empty .empty-ring {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 0.5px solid var(--accent-line);
  display: grid; place-items: center;
  color: var(--accent-glow);
}
.empty .empty-ring svg { width: 20px; height: 20px; }
.empty h3 { color: var(--text-primary); margin: 4px 0 0; }
.empty p { font-size: 12.5px; max-width: 380px; }

/* ─── Storage bars ───────────────────────────────────────────────────── */

.storage-bars { display: flex; flex-direction: column; gap: 9px; }
.storage-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr 96px 56px;
  gap: 14px;
  align-items: center;
  font-size: 12.5px;
}
.storage-row .ch { color: var(--text-primary); font-weight: 600; }
.storage-row .bar {
  height: 7px;
  background: var(--bg-elev);
  border-radius: 4px;
  overflow: hidden;
}
.storage-row .bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-glow) 100%);
  border-radius: 4px;
}
.storage-row .bytes { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); text-align: right; }
.storage-row .count { color: var(--text-tertiary); font-size: 11.5px; text-align: right; }

/* ─── Pair hero ──────────────────────────────────────────────────────── */

.pair-hero {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 28px;
  align-items: center;
  padding: 6px;
}
.qr-frame {
  background: white;
  padding: 14px;
  border-radius: var(--r-lg);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  aspect-ratio: 1;
  display: grid; place-items: center;
}
.qr-frame img, .qr-frame svg { width: 100%; height: 100%; }
.code-digits {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 44px;
  letter-spacing: 8px;
  line-height: 1;
  color: var(--text-primary);
  margin: 12px 0 4px;
  font-variant-numeric: tabular-nums;
}
.code-help { color: var(--text-secondary); font-size: 12.5px; max-width: 320px; }

@media (max-width: 720px) { .pair-hero { grid-template-columns: 1fr; } }

/* ─── Recording cards (grid) ─────────────────────────────────────────── */

.rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.rec-card {
  background: var(--bg-panel-soft);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.rec-card:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.55); }
.rec-card .thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #2a1a4a 0%, #4a1f6c 100%);
  display: grid; place-items: center;
}
.rec-card .thumb svg { width: 36px; height: 36px; color: rgba(255, 255, 255, 0.36); }
.rec-card .thumb .rec-badge {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 7px;
  background: var(--live);
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  border-radius: 4px;
}
.rec-card .meta { padding: 11px 14px 13px; }
.rec-card .meta .ch { font-weight: 600; font-size: 13.5px; }
.rec-card .meta .ti { font-size: 12px; color: var(--text-secondary); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-card .meta .row { display: flex; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--text-tertiary); align-items: center; flex-wrap: wrap; }

/* ─── State badges (for recordings/jobs) ─────────────────────────────── */

span.state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: var(--r-pill);
  background: var(--bg-elev);
  color: var(--text-secondary);
  border: 0.5px solid var(--hairline);
  text-transform: capitalize;
}
span.state.running   { background: var(--live-soft);   color: var(--live);   border-color: rgba(239, 68, 68, 0.3); }
span.state.running::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--live);
  animation: live-pulse 1.6s ease-out infinite;
}
span.state.pending   { background: var(--yellow-soft); color: var(--yellow); border-color: rgba(245, 200, 66, 0.3); }
span.state.completed { background: var(--green-soft);  color: var(--green);  border-color: rgba(34, 197, 94, 0.3); }
span.state.failed    { background: var(--live-soft);   color: var(--live);   border-color: rgba(239, 68, 68, 0.3); }

/* ─── Banner (status messages) ───────────────────────────────────────── */

.banner {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  margin-bottom: 12px;
  border: 0.5px solid var(--hairline);
}
.banner.success { background: var(--green-soft); color: var(--green); border-color: rgba(34, 197, 94, 0.3); }
.banner.error   { background: var(--live-soft);  color: var(--live);  border-color: rgba(239, 68, 68, 0.3); }
.banner.info    { background: var(--accent-soft); color: var(--accent-glow); border-color: var(--accent-line); }

/* ─── Logs / terminal ────────────────────────────────────────────────── */

.log-stream {
  background: #06070A;
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 14px 16px;
  max-height: 70vh;
  overflow-y: auto;
  color: var(--text-secondary);
  white-space: pre-wrap;
  line-height: 1.7;
}
.log-line { padding: 1px 0; }
.log-line.info  { color: var(--text-secondary); }
.log-line.warn  { color: var(--yellow); }
.log-line.error { color: var(--live); }

/* ─── Plain list (dashboard recent recordings, etc.) ─────────────────── */

.plain-list {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column;
  gap: 0;
}
.plain-list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 0.5px solid var(--hairline);
  font-size: 12.5px;
}
.plain-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.plain-list li:first-child { padding-top: 0; }
.plain-list li strong { font-weight: 600; color: var(--text-primary); }
.plain-list li span { color: var(--text-secondary); font-size: 11.5px; }

/* ─── Misc bits ──────────────────────────────────────────────────────── */

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  border: 0.5px solid var(--hairline-strong);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.32);
  color: var(--text-primary);
}
.copy-row {
  display: flex; align-items: center; gap: 8px;
  background: rgba(0, 0, 0, 0.32);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  word-break: break-all;
}
.copy-row .copy-btn { margin-left: auto; flex-shrink: 0; }
.divider-hair { height: 0.5px; background: var(--hairline); margin: 14px 0; }

/* ─── Toolbar (filter rows) ──────────────────────────────────────────── */

.toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 12px;
}
.toolbar input, .toolbar select {
  width: auto;
  min-width: 120px;
}

/* ─── Login ──────────────────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center;
  padding: 20px;
  grid-column: 1 / -1;
}
.login-card {
  background: var(--bg-panel-soft);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-window);
  padding: 32px;
  width: min(420px, 100%);
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
}
.login-card .brand { justify-content: center; padding: 0 0 18px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* htmx indicators */
.htmx-indicator { opacity: 0; transition: opacity 200ms ease; }
.htmx-request .htmx-indicator { opacity: 1; }

/* ─── Legacy aliases (defensive, in case any partial is still HTML-old) ─ */

.panel {
  background: var(--bg-panel-soft);
  border: 0.5px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-glass);
  backdrop-filter: blur(28px) saturate(160%);
}
.panel.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head h2 { font-size: 16px; font-weight: 700; }
.panel-head a, .panel-head .button { font-size: 12px; color: var(--accent-glow); }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid label.span-2, .form-grid .span-2 { grid-column: span 2; }
.form-grid .actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.span-2, .form-grid .span-2 { grid-column: auto; }
}

.actions-inline { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ─── Status block (used by older twitch-status partial) ─────────────── */

.status {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 0;
}
.status strong { color: var(--text-primary); font-weight: 600; }
.status span { color: var(--text-secondary); font-size: 12px; }

/* ─── Force-clamp icons that have no explicit width (defense-in-depth) ─ */

.sidebar nav a svg,
.brand .brand-mark svg,
.btn svg,
button svg,
.pill svg,
.empty .empty-ring svg,
.rec-card .thumb svg,
.copy-btn svg {
  /* sizes are set above per-component, but force-clamping here means a
     missing class never falls back to the parent's full width. */
  max-width: 32px;
  max-height: 32px;
}
