/* StreamForge panel — light (default) and dark themes */
:root {
  --bg: #ffffff;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef0f5;
  --border: #e5e8f0;
  --border-2: #d5dae6;
  --text: #16192b;
  --text-2: #4a5169;
  --muted: #7c859c;
  --accent: #6d5cf6;
  --accent-2: #5b4be0;
  --accent-glow: rgba(109, 92, 246, 0.28);
  --grad: linear-gradient(135deg, #8b7cf6 0%, #6d5cf6 55%, #5b4be0 100%);
  --ok: #16a34a;
  --ok-bg: rgba(22, 163, 74, 0.12);
  --ok-fg: #15803d;
  --warn: #d97706;
  --warn-bg: rgba(217, 119, 6, 0.13);
  --warn-fg: #b45309;
  --err: #e11d48;
  --err-bg: rgba(225, 29, 72, 0.11);
  --err-fg: #be123c;
  --info: #0284c7;
  --info-bg: rgba(2, 132, 199, 0.11);
  --info-fg: #0369a1;
  --hover: rgba(22, 25, 43, 0.04);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 28px rgba(22, 25, 43, 0.10);
  --shadow-sm: 0 1px 2px rgba(22, 25, 43, 0.06);
  --sidebar-w: 248px;
  --sidebar-bg: linear-gradient(180deg, #151a33 0%, #0f1329 100%);
  --sidebar-text: #aab2cf;
  --sidebar-border: rgba(255, 255, 255, 0.07);
  --font: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --chart-grid: rgba(22, 25, 43, 0.07);
  --scroll: #c9cfdd;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a0d14;
  --bg-2: #0f1320;
  --surface: #131826;
  --surface-2: #181e2e;
  --surface-3: #1f2637;
  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.13);
  --text: #e8ebf3;
  --text-2: #aab2c5;
  --muted: #7c859c;
  --accent: #8b7cf6;
  --accent-2: #6366f1;
  --accent-glow: rgba(139, 124, 246, 0.35);
  --ok: #22c55e; --ok-bg: rgba(34, 197, 94, 0.12); --ok-fg: #4ade80;
  --warn: #f59e0b; --warn-bg: rgba(245, 158, 11, 0.14); --warn-fg: #fbbf24;
  --err: #f43f5e; --err-bg: rgba(244, 63, 94, 0.13); --err-fg: #fb7185;
  --info: #38bdf8; --info-bg: rgba(56, 189, 248, 0.12); --info-fg: #7dd3fc;
  --hover: rgba(255, 255, 255, 0.05);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-sm: none;
  --sidebar-bg: linear-gradient(180deg, #0e1220 0%, #0b0e17 100%);
  --chart-grid: rgba(255, 255, 255, 0.06);
  --scroll: #2a3245;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
::selection { background: rgba(109, 92, 246, 0.25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

.boot { height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); display: flex; flex-direction: column; padding: 18px 14px; color: var(--sidebar-text); }
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 20px; }
.brand .logo { width: 38px; height: 38px; display: grid; place-items: center; flex: none; filter: drop-shadow(0 6px 14px var(--accent-glow)); }
.brand .logo svg { width: 38px; height: 38px; }
.brand .name { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: #fff; line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .name small { display: block; font-weight: 500; font-size: 11px; color: var(--sidebar-text); letter-spacing: 0.04em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(170, 178, 207, 0.6); padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--sidebar-text); font-weight: 500; transition: background 0.15s, color 0.15s; }
.nav a svg { width: 18px; height: 18px; opacity: 0.85; }
.nav a:hover { background: rgba(255, 255, 255, 0.05); color: #fff; text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(139, 124, 246, 0.22), rgba(139, 124, 246, 0.06)); color: #fff; box-shadow: inset 3px 0 0 #8b7cf6; }
.sidebar .spacer { flex: 1; }
/* locked by the licence: the sidebar keeps only the brand and the sign-out; the top bar keeps only its title */
.layout.locked .nav, .layout.locked .upd-box, .layout.locked #topstats, .layout.locked #topalerts { display: none !important; }
.sidebar-foot { border-top: 1px solid var(--sidebar-border); padding-top: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--grad); display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; flex: none; }
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; font-size: 13px; color: #fff; }
.sidebar-foot .who span { font-size: 11.5px; color: var(--sidebar-text); }
.sidebar .btn.ghost { color: var(--sidebar-text); }
.sidebar .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.main { min-width: 0; display: flex; flex-direction: column; }

/* ---------- topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar h1 .crumb { color: var(--muted); font-weight: 500; }
.topbar h1 .crumb a { color: var(--muted); }
.topbar .stats { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border-2); font-size: 12px; color: var(--text-2); white-space: nowrap; box-shadow: var(--shadow-sm); }
.pill b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.pill svg { width: 13px; height: 13px; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pill.warn { border-color: rgba(217, 119, 6, 0.4); color: var(--warn-fg); }
.pill.err { border-color: rgba(225, 29, 72, 0.4); color: var(--err-fg); }
.pill.accent { border-color: rgba(109, 92, 246, 0.4); color: var(--accent); }

.content { padding: 24px 28px 48px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 12px; font-size: 14px; font-weight: 700; letter-spacing: 0.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h3 .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.card h3 .right { margin-left: auto; }
.card.sub { background: var(--surface-2); box-shadow: none; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
.stat::after { content: ''; position: absolute; inset: auto -30% -60% auto; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, var(--accent-glow), transparent 70%); opacity: 0.35; pointer-events: none; }
.stat .label { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.stat .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.stat.ok::after { background: radial-gradient(circle, rgba(22, 163, 74, 0.35), transparent 70%); }
.stat.warn::after { background: radial-gradient(circle, rgba(217, 119, 6, 0.35), transparent 70%); }
.stat.info::after { background: radial-gradient(circle, rgba(2, 132, 199, 0.35), transparent 70%); }
.stat.err::after { background: radial-gradient(circle, rgba(225, 29, 72, 0.35), transparent 70%); }

.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: var(--grad); transition: width 0.5s; }
.meter.ok > i { background: var(--ok); }
.meter.warn > i { background: var(--warn); }
.meter.err > i { background: var(--err); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; transition: all 0.15s; white-space: nowrap; box-shadow: var(--shadow-sm); }
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px var(--accent-glow); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: var(--err-bg); border-color: rgba(225, 29, 72, 0.3); color: var(--err-fg); }
.btn.danger:hover { background: rgba(225, 29, 72, 0.2); }
.btn.ok { background: var(--ok-bg); border-color: rgba(22, 163, 74, 0.3); color: var(--ok-fg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn.icon.sm { padding: 5px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(22, 25, 43, 0.14); }
.seg button.primary.active { background: var(--accent); color: #fff; }

/* Flussonic-style "Except / Only" toggle */
.xo { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--muted); user-select: none; cursor: pointer; }
.xo .tr { width: 34px; height: 18px; border-radius: 18px; background: var(--surface-3); border: 1px solid var(--border-2); position: relative; transition: background 0.2s; }
.xo .tr::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.2s; }
.xo.on .tr { background: var(--ok); border-color: transparent; }
.xo.on .tr::after { transform: translateX(16px); }
.xo.on .only { color: var(--ok-fg); }
.xo:not(.on) .except { color: var(--err-fg); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field label .hint { font-weight: 400; color: var(--muted); }
.field .help { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--bg-2); color: var(--text); outline: none; transition: border 0.15s, box-shadow 0.15s; }
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(109, 92, 246, 0.18); }
.input.mono { font-family: var(--mono); font-size: 12.5px; }
.input.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237c859c' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
textarea.input { min-height: 80px; resize: vertical; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; }
.checks { display: flex; gap: 14px; flex-wrap: wrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.radios { display: flex; gap: 16px; flex-wrap: wrap; }
.radios label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 500; color: var(--text-2); }
.radios input { accent-color: var(--accent); width: 16px; height: 16px; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.radio-card { border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 12px; cursor: pointer; background: var(--bg-2); transition: all 0.15s; }
.radio-card b { display: block; font-size: 13px; }
.radio-card span { font-size: 11.5px; color: var(--muted); }
.radio-card.active { border-color: var(--accent); background: rgba(109, 92, 246, 0.08); box-shadow: 0 0 0 3px rgba(109, 92, 246, 0.14); }
.switch { position: relative; width: 40px; height: 22px; border-radius: 22px; background: var(--surface-3); border: 1px solid var(--border-2); cursor: pointer; transition: background 0.2s; flex: none; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); transition: transform 0.2s; }
.switch.on { background: var(--accent-2); border-color: transparent; }
.switch.on::after { transform: translateX(18px); }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.form-actions .right { margin-left: auto; }
.section-title { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
.section-title:first-child { margin-top: 0; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--hover); }
td .mono { font-family: var(--mono); font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.compact th, table.compact td { padding: 7px 10px; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: 0.4; margin-bottom: 10px; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.online { background: var(--ok-bg); color: var(--ok-fg); }
.badge.online::before { box-shadow: 0 0 6px currentColor; }
.badge.waiting { background: var(--warn-bg); color: var(--warn-fg); }
.badge.error { background: var(--err-bg); color: var(--err-fg); }
.badge.disabled { background: var(--surface-3); color: var(--muted); }
.badge.plain::before { display: none; }
.badge.accent { background: rgba(109, 92, 246, 0.14); color: var(--accent); }
.badge.info { background: var(--info-bg); color: var(--info-fg); }
.tag { display: inline-block; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 600; font-family: var(--mono); }

/* ---------- streams toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search .input { padding-left: 34px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.chip b { color: var(--text); }
.chip.active { border-color: var(--accent); color: var(--accent); background: rgba(109, 92, 246, 0.1); }
.chip.ok.active { border-color: var(--ok); color: var(--ok-fg); background: var(--ok-bg); }
.chip.warn.active { border-color: var(--warn); color: var(--warn-fg); background: var(--warn-bg); }
.chip.err.active { border-color: var(--err); color: var(--err-fg); background: var(--err-bg); }

/* ---------- stream grid ---------- */
.stream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.scard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; cursor: pointer; box-shadow: var(--shadow-sm); }
.scard:hover { transform: translateY(-2px); border-color: var(--border-2); box-shadow: var(--shadow); }
.scard .thumb { position: relative; aspect-ratio: 16/9; background: #05070c; }
.scard .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scard .thumb .st { position: absolute; top: 10px; left: 10px; }
.scard .thumb .br { position: absolute; bottom: 8px; right: 8px; display: flex; gap: 5px; }
.scard .thumb .play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.3); display: grid; place-items: center; opacity: 0; transition: opacity 0.15s; color: #fff; }
.scard .thumb .play svg { width: 18px; height: 18px; margin-left: 2px; }
.scard:hover .thumb .play { opacity: 1; }
.scard .body { padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.scard .body .t { flex: 1; min-width: 0; }
.scard .body .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.scard .body .t span { font-size: 11.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb .bt { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px; font-family: var(--mono); display: inline-flex; align-items: center; gap: 4px; }
.thumb .bt svg { width: 12px; height: 12px; }
.chlogo { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; background: var(--surface-3); flex: none; padding: 3px; }
.chlogo.lg { width: 56px; height: 56px; border-radius: 12px; padding: 5px; }
.chlogo.thumb-logo { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; background: rgba(0,0,0,0.5); backdrop-filter: blur(6px); }

/* stream list */
.slist .name .name-in { display: flex; gap: 10px; align-items: flex-start; }
.slist .name a { font-weight: 700; color: var(--text); }
.slist .name small { display: block; color: var(--muted); font-size: 11.5px; }
.slist .input-url { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slist .kv { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.slist .kv b { color: var(--text); font-weight: 600; }
.row-actions { display: flex; gap: 5px; justify-content: flex-end; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 16px; color: var(--text-2); font-weight: 600; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; background: transparent; cursor: pointer; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs a.active, .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- overview ---------- */
.ov-desc { display: grid; grid-template-columns: auto 1.2fr 1fr 1.4fr 1fr; gap: 14px; align-items: end; }
@media (max-width: 1100px) { .ov-desc { grid-template-columns: 1fr 1fr; } }
.ov-desc .field { margin-bottom: 0; }
.logo-pick { display: flex; align-items: center; gap: 10px; }
.logo-pick .chlogo { cursor: pointer; border: 1px dashed var(--border-2); }
.ov-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.ov-top .right { margin-left: auto; }
.player-host { background: #000; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.player-host .offline { aspect-ratio: 16/9; display: grid; place-items: center; color: var(--muted); font-weight: 600; background: #05070c url('/static/img/no-preview.svg') center/cover; }
.proto-tabs { display: flex; gap: 4px; margin-top: 10px; }
.proto-tabs button { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); font-weight: 700; font-size: 12px; cursor: pointer; color: var(--text-2); }
.proto-tabs button.active { background: var(--accent); border-color: transparent; color: #fff; }
.ov-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.ov-status .right { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.mi { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 800px) { .mi { grid-template-columns: 1fr; } }
.mi .box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.mi .box h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.mi .box h4 .hint { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.track-line { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--text-2); padding: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-line b { color: var(--accent); font-weight: 700; min-width: 22px; }
.track-line .pid { color: var(--muted); margin-left: auto; }

/* ---------- player ---------- */
.player { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16/9; position: relative; border: 1px solid var(--border); }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: rgba(0, 0, 0, 0.5); font-weight: 600; pointer-events: none; }

/* ---------- key/value ---------- */
.kvlist { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kvlist dt { color: var(--muted); font-weight: 500; }
.kvlist dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.kvlist dd.mono { font-family: var(--mono); font-size: 12px; }

/* ---------- url / list rows ---------- */
.url-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.url-row:last-child { border-bottom: 0; }
.url-row .proto { min-width: 78px; justify-content: center; }
.url-row code { flex: 1; font-family: var(--mono); font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; padding: 0; min-width: 120px; }
.url-row .input { flex: 1; min-width: 160px; }
.url-row.off code { color: var(--muted); text-decoration: line-through; }
.src-row { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--bg-2); }
.src-row .top { display: flex; align-items: center; gap: 8px; }
.src-row .top .input { flex: 1; }
.src-row .opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.src-row .opts .field { margin-bottom: 0; }
.src-status { min-width: 84px; font-size: 12px; font-weight: 600; text-align: center; }
.src-status.online { color: var(--ok-fg); } .src-status.error { color: var(--err-fg); } .src-status.connecting { color: var(--warn-fg); } .src-status.idle { color: var(--muted); }
.code-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: 12px; color: var(--text-2); white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; }
.log { background: #0b0e17; color: #aab2c5; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-family: var(--mono); font-size: 11.5px; line-height: 1.6; max-height: 360px; overflow: auto; }
.log .t { color: #7c859c; margin-right: 8px; }
.log .e { color: #fb7185; }
.log .ok { color: #4ade80; }

/* ---------- chart ---------- */
.chart { width: 100%; height: 190px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------- alert ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-size: 13px; margin-bottom: 16px; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert.warn { background: var(--warn-bg); border-color: rgba(217, 119, 6, 0.35); color: var(--warn-fg); }
.alert.err { background: var(--err-bg); border-color: rgba(225, 29, 72, 0.35); color: var(--err-fg); }
.alert.info { background: var(--info-bg); border-color: rgba(2, 132, 199, 0.3); color: var(--info-fg); }
.alert.ok { background: var(--ok-bg); border-color: rgba(22, 163, 74, 0.3); color: var(--ok-fg); }
.alert code { background: rgba(0,0,0,0.06); }

/* ---------- toasts / modal ---------- */
#toasts { position: fixed; right: 20px; top: 72px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-2); box-shadow: 0 10px 30px rgba(22, 25, 43, 0.22); font-weight: 600; font-size: 14px; min-width: 260px; animation: pop 0.2s ease-out; display: flex; gap: 8px; align-items: center; }
.toast.ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok-fg); } .toast.err { border-color: var(--err); background: var(--err-bg); color: var(--err-fg); } .toast.warn { border-color: var(--warn); background: var(--warn-bg); color: var(--warn-fg); }
.toast svg { width: 16px; height: 16px; flex: none; }
.toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--err); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 13, 25, 0.55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 90; animation: fade 0.15s; padding: 20px; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 16px; box-shadow: var(--shadow); animation: pop 0.2s; max-height: 90vh; overflow: auto; }
.modal.wide { max-width: 800px; }
.modal-head { padding: 18px 22px 0; display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 0 22px 20px; display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% -10%, rgba(109, 92, 246, 0.18), transparent 60%), radial-gradient(900px 500px at 100% 100%, rgba(99, 102, 241, 0.14), transparent 60%), var(--bg); padding: 20px; }
.login { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 20px; padding: 34px 32px; box-shadow: var(--shadow); }
.login .brand { padding: 0 0 22px; justify-content: center; }
.login .brand .name { color: var(--text); }
.login .brand .name small { color: var(--muted); }
.login h2 { margin: 0 0 4px; font-size: 20px; text-align: center; }
.login p { margin: 0 0 22px; color: var(--muted); text-align: center; font-size: 13px; }
.login .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.login .ver { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 16px; }

/* ---------- gpu ---------- */
.gpu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.gpu-card .title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.gpu-card .title .ico { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #76b900, #3f8f00); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 11px; }
.gpu-card .title b { font-size: 15px; display: block; }
.gpu-card .title span { font-size: 12px; color: var(--muted); }
.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.gauge { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.gauge .l { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.gauge .v { font-size: 20px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; }
.gauge .v small { font-size: 12px; color: var(--muted); font-weight: 500; }

.mini { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
kbd { font-family: var(--mono); background: var(--surface-3); padding: 1px 6px; border-radius: 5px; font-size: 11px; border: 1px solid var(--border-2); }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; width: var(--sidebar-w); transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .topbar { padding: 12px 16px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar .stats { display: none; }
}
.topbar .menu-btn { display: none; }

/* ---------- chart tooltip ---------- */
.chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 12px; min-width: 150px; }
.chart-tip .when { color: var(--muted); font-size: 11px; margin-bottom: 4px; white-space: nowrap; }
.chart-tip .row { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.chart-tip .row i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.chart-tip .row b { margin-left: auto; font-variant-numeric: tabular-nums; padding-left: 12px; }
.chart-cursor { position: absolute; width: 0; border-left: 1px dashed var(--muted); pointer-events: none; z-index: 4; }
.chart-box { position: relative; }
.pulse-section { margin-bottom: 26px; }
.pulse-section h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.pulse-section .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.pulse-pair { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .pulse-pair { grid-template-columns: 1fr; } }
.pulse-pair .card h3 { font-size: 13px; }
.disk-row { display: grid; grid-template-columns: 140px 1fr 170px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.disk-row:last-child { border-bottom: 0; }
.disk-row .meter { margin: 0; height: 8px; }
.disk-row .name b { display: block; }
.disk-row .name span { color: var(--muted); font-size: 11.5px; }
.disk-row .num { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-2); }

/* ---------- streams: chips with icons, pager, compact list ---------- */
.chip svg { width: 14px; height: 14px; }
.chip.ok { color: var(--ok-fg); } .chip.warn { color: var(--warn-fg); } .chip.err { color: var(--err-fg); } .chip.off { color: var(--muted); }
.chip.ok svg { color: var(--ok); } .chip.warn svg { color: var(--warn); } .chip.err svg { color: var(--err); }
.chip b { font-weight: 600; }
.chip.active { box-shadow: 0 0 0 3px rgba(109, 92, 246, 0.12); }
.chip.ok.active { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14); } .chip.warn.active { box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14); } .chip.err.active { box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.14); }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 4px; }
.tabs .tab-plus { display: inline-grid; place-items: center; width: 34px; height: 34px; margin: 2px 6px 4px 0; border-radius: 9px; background: var(--grad); color: #fff; border: 0; padding: 0; box-shadow: 0 4px 12px var(--accent-glow); }
.tabs .tab-plus svg { width: 16px; height: 16px; }
.dot-st { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; border: 2px solid var(--muted); }
.dot-st::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.dot-st.online { border-color: var(--ok); } .dot-st.online::after { background: var(--ok); }
.dot-st.waiting { border-color: var(--warn); } .dot-st.waiting::after { background: var(--warn); }
.dot-st.error { border-color: var(--err); } .dot-st.error::after { background: var(--err); }
.compact-list td { padding: 6px 10px; font-size: 12.5px; }
.compact-list .mini svg { width: 12px; height: 12px; vertical-align: -2px; color: var(--muted); }
.compact-list .badge { font-size: 11px; padding: 2px 7px; }

/* ---------- streams: chips with icons, pager, compact list ---------- */
.chip svg { width: 14px; height: 14px; }
.chip.ok { color: var(--ok-fg); } .chip.warn { color: var(--warn-fg); } .chip.err { color: var(--err-fg); } .chip.off { color: var(--muted); }
.chip b { font-weight: 600; }
.chip.active { box-shadow: 0 0 0 3px rgba(109, 92, 246, 0.12); }
.chip.ok.active { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14); } .chip.warn.active { box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.14); } .chip.err.active { box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.14); }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 4px; }
.tabs .tab-plus { display: inline-grid; place-items: center; width: 34px; height: 34px; margin: 2px 6px 4px 0; border-radius: 9px; background: var(--grad); color: #fff; border: 0; padding: 0; box-shadow: 0 4px 12px var(--accent-glow); }
.tabs .tab-plus svg { width: 16px; height: 16px; }
.dot-st { width: 16px; height: 16px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; border: 2px solid var(--muted); }
.dot-st::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.dot-st.online { border-color: var(--ok); } .dot-st.online::after { background: var(--ok); }
.dot-st.waiting { border-color: var(--warn); } .dot-st.waiting::after { background: var(--warn); }
.dot-st.error { border-color: var(--err); } .dot-st.error::after { background: var(--err); }
.compact-list td { padding: 6px 10px; font-size: 12.5px; }
.compact-list .mini svg { width: 12px; height: 12px; vertical-align: -2px; color: var(--muted); }
.compact-list .badge { font-size: 11px; padding: 2px 7px; }

/* ---------- inline create bar ---------- */
.create-bar { margin-bottom: 16px; border-color: rgba(109, 92, 246, 0.35); box-shadow: 0 0 0 3px rgba(109, 92, 246, 0.08); }
.create-grid { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 14px; }
.create-grid .field { margin-bottom: 8px; }
@media (max-width: 1000px) { .create-grid { grid-template-columns: 1fr; } }
.pub-urls .url-row code { color: var(--text); }

/* ---------- transcoder ---------- */
.track-card { margin-top: 12px; }
.track-card + .track-card { margin-top: 12px; }
details.adv { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-top: 4px; background: var(--surface-2); }
details.adv summary { cursor: pointer; font-weight: 600; color: var(--text-2); }

/* ---------- auto-hiding sidebar: icon rail, expands on hover ---------- */
:root { --rail-w: 64px; }
@media (min-width: 961px) {
  .layout { grid-template-columns: var(--rail-w) 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; height: 100vh; width: var(--rail-w); overflow: hidden; transition: width 0.18s ease, box-shadow 0.18s; z-index: 60; padding: 14px 10px; }
  .sidebar:hover, .sidebar.pinned { width: var(--sidebar-w); box-shadow: var(--shadow); padding: 18px 14px; }
  .sidebar .lbl, .sidebar .brand .name, .sidebar .sidebar-foot .who, .sidebar .sidebar-foot .btn { opacity: 0; transition: opacity 0.12s; white-space: nowrap; }
  .sidebar:hover .lbl, .sidebar:hover .brand .name, .sidebar:hover .sidebar-foot .who, .sidebar:hover .sidebar-foot .btn,
  .sidebar.pinned .lbl, .sidebar.pinned .brand .name, .sidebar.pinned .sidebar-foot .who, .sidebar.pinned .sidebar-foot .btn { opacity: 1; }
  .sidebar .nav a { white-space: nowrap; padding: 10px 13px; }
  .sidebar .nav-section { height: 30px; padding: 10px 12px 4px; }
  .sidebar .brand { padding: 6px 4px 16px; }
  .sidebar .sidebar-foot { min-height: 46px; }
  .sidebar .sidebar-foot .btn { position: relative; }
}

/* ---------- config: listeners ---------- */
.cfg-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .cfg-grid { grid-template-columns: 1fr; } }
.lst-section { padding: 10px 0 12px; border-bottom: 1px solid var(--border); }
.lst-section:last-child { border-bottom: 0; }
.lst-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); }
.lst-head { display: grid; gap: 10px; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 0 4px; }
.lst-row { display: grid; gap: 10px; align-items: center; padding: 4px 0; }
@media (min-width: 961px) {
  .layout { display: block; }
  .main { margin-left: var(--rail-w); }
}

/* ---------- premium polish: clear selected states, Flussonic-style tabs, zebra tables ---------- */
body { font-size: 14.5px; color: #10131f; }
[data-theme="dark"] body { color: var(--text); }
.card h3 { font-size: 15px; }
th { font-size: 12px; letter-spacing: 0.04em; color: #5b6478; background: #f3f5fa; }
[data-theme="dark"] th { background: var(--surface-2); color: var(--text-2); }
tbody tr:nth-child(even) td { background: rgba(22, 25, 43, 0.02); }
[data-theme="dark"] tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
tbody tr:hover td { background: rgba(109, 92, 246, 0.06); }
td { font-size: 13.5px; }
.slist .kv { font-size: 12.5px; }
.slist .input-url { font-size: 12px; }
/* selected chips / segments are filled, not outlined */
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active b, .chip.active svg { color: #fff; }
.chip.ok.active { background: var(--ok); border-color: var(--ok); color: #fff; }
.chip.warn.active { background: var(--warn); border-color: var(--warn); color: #fff; }
.chip.err.active { background: var(--err); border-color: var(--err); color: #fff; }
.chip.off.active { background: #64748b; border-color: #64748b; color: #fff; }
.seg button.active { background: var(--accent); color: #fff; box-shadow: none; }
.seg button.active svg { color: #fff; }
/* Flussonic-style boxed tabs */
.tabs { border-bottom: 1px solid var(--border-2); gap: 4px; align-items: flex-end; padding: 0 2px; }
.tabs a, .tabs button:not(.tab-plus) { border: 1px solid var(--border-2); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); color: var(--text-2); padding: 9px 18px; margin-bottom: -1px; font-weight: 600; }
.tabs a.active, .tabs button:not(.tab-plus).active { background: var(--surface); color: var(--accent); border-color: var(--border-2); border-bottom: 1px solid var(--surface); box-shadow: inset 0 3px 0 var(--accent); }
.tabs .tab-plus { border-radius: 10px 10px 0 0; width: 44px; height: 38px; margin: 0 4px -1px 0; box-shadow: none; }
/* "More" links */
.more-link { color: var(--accent); font-weight: 700; font-size: 12px; text-decoration: none; }
.more-link:hover { text-decoration: underline; }
/* selection */
.sel-col { width: 34px; text-align: center; }
.sel-col input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.bulk-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 12px; border-radius: 10px; background: rgba(109, 92, 246, 0.08); border: 1px solid rgba(109, 92, 246, 0.3); }
.bulk-bar b { color: var(--accent); }
.badge { font-size: 12px; }
.btn { font-weight: 600; }
.stat .value { font-weight: 800; }
/* collapsed rail: icons never shrink, labels take no width */
.nav a svg { flex: none; }
@media (min-width: 961px) {
  .sidebar .lbl { display: inline-block; max-width: 0; overflow: hidden; }
  .sidebar:hover .lbl, .sidebar.pinned .lbl { max-width: 200px; }
  .sidebar .nav a { justify-content: flex-start; }
}

.gpu-list { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- info popovers (stream list) ---------- */
.info-btn { width: 18px; height: 18px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: inline-grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.info-btn svg { width: 12px; height: 12px; }
.popover { position: absolute; z-index: 80; min-width: 380px; max-width: 560px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; animation: pop 0.15s; }
.pop-table th { position: static; }
.pager select.input { min-width: 84px; }

/* ---------- stream page header + solid action buttons + viewport-fit player ---------- */
.topbar h1 .title-accent { color: var(--accent); font-weight: 800; }
.btn.solid-accent { background: var(--accent-2); border-color: transparent; color: #fff; }
.btn.solid-accent:hover { filter: brightness(1.08); background: var(--accent-2); }
.btn.solid-ok { background: var(--ok); border-color: transparent; color: #fff; }
.btn.solid-pink { background: #e5177f; border-color: transparent; color: #fff; }
.btn.solid-pink:hover { filter: brightness(1.08); background: #e5177f; }
/* the player fills its column: no empty strip beside it on wide screens (the column itself is capped by the grid) */
.player-host { max-width: none; width: 100%; }

.dvr-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 160px; overflow: auto; }
.dvr-item svg { width: 13px; height: 13px; }

/* pure white page like Flussonic; only the sidebar and controls carry colour */
:root { --shadow-sm: none; }
[data-theme="light"] .topbar, .topbar { background: #fff; }
[data-theme="light"] .card, .card { box-shadow: none; }
.login-wrap { background: #fff; }

.track-line { font-family: var(--font); font-size: 12.5px; padding: 2px 0; }
.track-link { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(109,92,246,0.35); }
.mi .box h4 .hint { text-transform: none; }
/* overview facts: icon + value, no pill boxes */
.fact { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); margin-left: 14px; white-space: nowrap; }
.fact svg { width: 15px; height: 15px; color: var(--muted); }

/* compact description card, smaller player, tidy media info rows */
.desc-card { padding: 10px 16px 6px; }
.desc-card h3 { margin-bottom: 6px; font-size: 13px; }
.desc-card .input, .desc-card select.input { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.desc-card .field label { font-size: 11.5px; }
.desc-card .chlogo.lg { width: 40px; height: 40px; border-radius: 9px; padding: 3px; }
.desc-card .ov-desc { gap: 10px; }
.track-line { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.track-line:last-child { border-bottom: 0; }
.track-line .tid { font-weight: 800; color: var(--accent); font-size: 12px; }
.track-line .tcodec { color: var(--text); font-weight: 600; }
.track-line .tbr { color: var(--text-2); font-variant-numeric: tabular-nums; }
.track-line .pid { color: var(--muted); font-size: 11.5px; white-space: nowrap; }

/* overview header: small buttons, mode switch without a box, player right under it */
.ov-top { margin-bottom: 8px; gap: 8px; }
.ov-top .btn.sm svg { width: 14px; height: 14px; }
.mode-seg { background: transparent; border: 0; padding: 0; gap: 4px; }
.mode-seg button { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.mode-seg button.active { background: var(--accent); color: #fff; }
.mode-seg button:not(.active) { color: var(--muted); }
.mode-seg button:not(.active):hover { background: var(--surface-2); color: var(--text); }

/* cluster page */
.cluster-tbl tr.self td { background: rgba(109, 92, 246, 0.05); }
.cluster-tbl .meter { display: inline-block; vertical-align: middle; }
.cluster-tbl td.num, .cluster-tbl td { white-space: nowrap; }
.cluster-tbl td:first-child { white-space: normal; }

/* listener sections (Flussonic look) */
.lst-titlebar { display: flex; align-items: center; gap: 8px; }
.lst-title { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; text-transform: none; color: var(--text-2); }
.lst-info { display: inline-flex; color: var(--accent); cursor: help; }
.lst-info svg { width: 15px; height: 15px; }
.btn.xs { padding: 0; width: 22px; height: 22px; border-radius: 6px; justify-content: center; }
.btn.xs svg { width: 13px; height: 13px; }
.lst-head { font-size: 12.5px; font-weight: 700; color: var(--text); padding: 10px 0 4px; }
.lst-section { padding: 8px 0 10px; }
/* problem badges in the top bar */
.alert-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; border: 1px solid; font-size: 11px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.alert-pill.warn { background: var(--warn-bg); border-color: rgba(217, 119, 6, 0.5); color: var(--warn-fg); }
.alert-pill.err { background: var(--err-bg); border-color: rgba(225, 29, 72, 0.5); color: var(--err-fg); }
.alert-pill svg { width: 14px; height: 14px; }

/* top bar: stats + alerts stacked on the right */
.topbar .right { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; }
.topbar .stats { margin-left: 0; }
.topbar .topalerts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.topbar .topalerts:empty { display: none; }
/* sign-in page */
.login-page { min-height: 100vh; background: #fff; display: flex; flex-direction: column; align-items: center; padding: 9vh 20px 40px; }
.login-hero { display: flex; align-items: center; gap: 40px; margin-bottom: 44px; }
.login-hero .biglogo { width: 168px; height: 168px; display: grid; place-items: center; flex: none; filter: drop-shadow(0 18px 30px rgba(47, 107, 255, 0.35)); }
.login-hero .biglogo svg { width: 168px; height: 168px; }
.login-hero .words { display: flex; flex-direction: column; line-height: 1; }
.login-hero .brand-name { font-size: 56px; font-weight: 400; letter-spacing: 0.06em; color: #2563eb; }
.login-hero .admin-ui { font-size: 88px; font-weight: 800; letter-spacing: 0.02em; color: #1e3a8a; margin-top: 6px; }
.login-form { width: 100%; max-width: 380px; }
.u-field { margin-bottom: 26px; }
.u-input { width: 100%; border: 0; border-bottom: 1px solid #9aa3b5; border-radius: 0; padding: 8px 2px; font: inherit; font-size: 15px; color: #111827; background: transparent; outline: none; }
.u-input::placeholder { color: #8b93a7; }
.u-input:focus { border-bottom: 2px solid #2563eb; padding-bottom: 7px; }
.login-form .btn.sign { background: #1d4ed8; border-color: #1d4ed8; color: #fff; padding: 9px 24px; border-radius: 5px; font-size: 14px; box-shadow: none; }
.login-form .btn.sign:hover { background: #1e40af; }
.login-form .alert { margin-bottom: 14px; }
.login-page .ver { color: #9aa3b5; font-size: 11.5px; margin-top: 28px; }
@media (max-width: 760px) {
  .login-hero { flex-direction: column; gap: 18px; text-align: center; }
  .login-hero .biglogo { width: 120px; height: 120px; }
  .login-hero .biglogo svg { width: 62px; height: 62px; }
  .login-hero .brand-name { font-size: 34px; }
  .login-hero .admin-ui { font-size: 50px; }
}

/* top stats: one capsule, items separated by | (Flussonic) */
.topbar .stats { gap: 8px; align-items: center; }
.statbar { display: inline-flex; align-items: stretch; border: 1px solid var(--border-2); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.statbar .pill { border: 0; border-radius: 0; box-shadow: none; background: transparent; padding: 5px 12px; border-left: 1px solid var(--border-2); }
.statbar .pill:first-child { border-left: 0; }
.statbar .pill.err { color: var(--err-fg); }

/* sidebar: "newer version available" box */
.upd-box { margin: 0 8px 10px; padding: 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.22); background: rgba(255,255,255,0.08); color: #fff; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; font-size: 12px; line-height: 1.35; }
.upd-box .upd-ico { width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,0.14); display: grid; place-items: center; flex: none; }
.upd-box .upd-ico svg { width: 15px; height: 15px; }
.upd-box .upd-note { font-size: 11px; color: rgba(255,255,255,0.7); }
.upd-box .upd-err { font-size: 11px; color: #fca5a5; word-break: break-word; }
.upd-box .upd-txt .muted { color: rgba(255,255,255,0.6); }
.upd-box .upd-btn { background: #e5177f; border-color: transparent; color: #fff; width: 100%; justify-content: center; font-weight: 700; }
.upd-box .upd-btn:hover { background: #ff2d92; }
@media (min-width: 961px) {
  .sidebar .upd-box .lbl { display: none; }
  .sidebar:hover .upd-box .lbl, .sidebar.pinned .upd-box .lbl { display: inline-flex; max-width: none; }
  .sidebar .upd-box { padding: 6px; }
  .sidebar:hover .upd-box, .sidebar.pinned .upd-box { padding: 10px; }
}
.sidebar:hover .upd-box .upd-txt, .sidebar.pinned .upd-box .upd-txt { display: block; white-space: normal; max-width: none; opacity: 1; }
.sidebar:hover .upd-box .upd-btn, .sidebar.pinned .upd-box .upd-btn { opacity: 1; }

/* config editor */
textarea.input.conf-editor { min-height: 68vh; font-size: 13px; line-height: 1.5; resize: vertical; white-space: pre; overflow: auto; tab-size: 2; }
.section-title .hint { margin-left: 8px; font-weight: 400; font-size: 12px; color: var(--muted); }

/* first-run page */
.first-stream { padding: 36px 32px 28px; }
.first-stream .first-art { max-width: 380px; margin: 0 auto 8px; }
.first-stream .first-art svg { width: 100%; height: auto; display: block; }
.first-stream h2 { text-align: center; font-size: 26px; font-weight: 700; margin: 6px 0 26px; letter-spacing: -0.02em; }
.first-grid { display: grid; grid-template-columns: 1.1fr 1.6fr 1fr; gap: 16px; align-items: start; }
.first-grid .input-row .check { margin-left: 4px; }
@media (max-width: 900px) { .first-grid { grid-template-columns: 1fr; } }

.setup-title { font-size: 15px; font-weight: 600; color: #1e3a8a; margin-bottom: 18px; }
.login-form.setup-form { max-width: 860px; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; margin-bottom: 8px; }
.setup-head { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7280; margin-bottom: 14px; }
.setup-hint { font-size: 12.5px; color: #6b7280; line-height: 1.5; margin-top: -10px; }
.setup-hint a { color: #2563eb; }
@media (max-width: 760px) { .setup-grid { grid-template-columns: 1fr; gap: 20px; } }
/* tabs (Flussonic): tabs sit side by side without gaps; the selected one is bold, white and merges into the page — no underline, no stripe */
.tabs { gap: 0; padding: 0; border-bottom: 1px solid var(--border-2); align-items: flex-end; }
.tabs a, .tabs button:not(.tab-plus) { border: 1px solid var(--border-2); border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--surface-2); color: var(--text-2); padding: 9px 18px; margin: 0 -1px -1px 0; font-weight: 500; position: relative; box-shadow: none; }
.tabs a:hover, .tabs button:not(.tab-plus):hover { background: var(--surface); color: var(--text); }
.tabs a.active, .tabs button:not(.tab-plus).active { background: var(--surface); color: var(--text); font-weight: 700; border-bottom: 1px solid var(--surface); box-shadow: none; z-index: 1; }
.tabs .tab-plus { margin: 0 6px -1px 0; border-radius: 6px 6px 0 0; }

/* save-button states */
.btn.saving { opacity: 0.85; pointer-events: none; }
.btn.saved { background: var(--ok) !important; border-color: var(--ok) !important; color: #fff !important; }
.btn-spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: btnspin 0.7s linear infinite; }
@keyframes btnspin { to { transform: rotate(360deg); } }

/* the archive timeline: what exists, over the whole depth */
.dvr-bar { position: relative; height: 14px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--border-2); overflow: hidden; }
.dvr-bar i { position: absolute; top: 0; bottom: 0; background: linear-gradient(90deg, #6366f1, #2f6bff 60%, #06b6d4); opacity: 0.9; }
.stats-inline { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; color: var(--text-2); }
