:root {
  --bg: #0A0C10;
  --bg-raised: #0F1216;
  --panel: #14171C;
  --panel-alt: #1B1F26;
  --panel-hover: #20242C;
  --border: #262B33;
  --border-soft: #1D2129;
  --text: #E8EAED;
  --text-dim: #8B92A0;
  --text-mute: #565D6B;

  --active: #FF3B4E;
  --active-glow: rgba(255, 59, 78, 0.55);
  --error: #FFB020;
  --error-glow: rgba(255, 176, 32, 0.45);
  --standby: #6B7280;

  --dest-facebook: #4C8DFF;
  --dest-youtube: #FF7A59;
  --dest-tiktok: #2FE6C7;
  --dest-custom: #B98CFF;

  --radius: 10px;
  --radius-sm: 6px;
  --font-ui: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Auth pages (login / set-password) ---------- */
body.auth-body {
  background:
    radial-gradient(ellipse 1100px 650px at 15% -10%, rgba(255, 59, 78, 0.07), transparent 60%),
    radial-gradient(ellipse 900px 500px at 100% 10%, rgba(76, 141, 255, 0.05), transparent 55%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wrap { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; }

.brandblock { text-align: center; margin-bottom: 34px; }
.brand-mark {
  font-size: 32px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  display: inline-flex; align-items: center; gap: 10px;
}
.brand-mark .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--active); box-shadow: 0 0 14px var(--active-glow);
  display: inline-block; animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.brand-tag {
  margin-top: 6px; font-family: var(--font-mono); font-size: 11.5px;
  letter-spacing: 0.14em; color: var(--text-mute); text-transform: uppercase;
}

.card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 28px 26px 24px;
}

.error-banner {
  display: flex;
  align-items: center; gap: 9px;
  background: rgba(255, 176, 32, 0.08); border: 1px solid rgba(255, 176, 32, 0.3);
  color: #FFC661; font-size: 12.5px; font-weight: 500;
  padding: 10px 12px; border-radius: var(--radius-sm);
  margin-bottom: 18px;
  animation: shake .35s ease;
}
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.error-banner svg { width: 15px; height: 15px; flex-shrink: 0; }

.field { margin-bottom: 16px; }
.field-label {
  display: block; font-size: 10.5px; color: var(--text-mute); text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 7px; font-weight: 600;
}
.field input {
  width: 100%;
  background: var(--bg-raised); border: 1px solid var(--border); color: var(--text);
  font-size: 13.5px; padding: 11px 12px; border-radius: var(--radius-sm);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder { color: var(--text-mute); }
.field input:focus { border-color: var(--active); box-shadow: 0 0 0 3px rgba(255, 59, 78, 0.12); }
.field-hint { display: block; margin-top: 6px; font-size: 10.5px; color: var(--text-mute); }

.pw-row { position: relative; }
.pw-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-mute); padding: 4px;
  display: flex; align-items: center;
}
.pw-toggle:hover { color: var(--text-dim); }
.pw-toggle svg { width: 16px; height: 16px; }

.btn-login {
  width: 100%; margin-top: 6px;
  background: var(--active); color: #1a0508; border: none;
  font-weight: 700; font-size: 13.5px; letter-spacing: 0.02em;
  padding: 12px 0; border-radius: var(--radius-sm);
  box-shadow: 0 0 20px rgba(255, 59, 78, 0.3);
  transition: filter .15s ease, transform .1s ease;
}
.btn-login:hover { filter: brightness(1.08); }
.btn-login:active { transform: scale(0.99); }

.forgot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-mute); }

.footnote {
  margin-top: 26px; text-align: center;
  font-family: var(--font-mono); font-size: 10px; color: var(--text-mute);
  letter-spacing: 0.06em;
}

.fc-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 20px; }
.fc-head svg { width: 22px; height: 22px; color: var(--active); flex-shrink: 0; margin-top: 2px; }
.fc-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.fc-sub { font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* ---------- App shell (topbar + hamburger drawer) — shared by every page behind login ---------- */
.topbar {
  height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  border-bottom: 1px solid var(--border-soft); background: var(--bg-raised);
  position: sticky; top: 0; z-index: 50;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: var(--panel-alt); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand .brand-mark { font-size: 17px; }
.brand-tag-inline {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em;
  color: var(--text-mute); text-transform: uppercase;
}

.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  opacity: 0; pointer-events: none; transition: opacity .18s ease; z-index: 60;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 250px;
  background: var(--bg-raised); border-right: 1px solid var(--border-soft);
  transform: translateX(-100%); transition: transform .2s ease; z-index: 61;
  display: flex; flex-direction: column; padding: 16px 10px;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 18px; }
.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 10px; border-radius: var(--radius-sm); color: var(--text-dim);
  font-size: 13px; font-weight: 500; background: none; border: none;
  text-align: left; font-family: inherit; cursor: pointer;
}
.nav-item:hover { background: var(--panel-alt); color: var(--text); }
.nav-item-logout { margin-top: auto; color: #FF7A87; }
.nav-item-logout:hover { background: rgba(255, 59, 78, 0.1); color: #FF7A87; }

.content { padding: 22px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* ---------- Modal (confirm / error popup) — reused for logout, delete, etc. ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.modal-head { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.modal-head svg { width: 18px; height: 18px; color: var(--active); flex-shrink: 0; }
.modal-title { font-size: 14.5px; font-weight: 700; }
.modal-body { font-size: 12.5px; color: var(--text-dim); line-height: 1.6; margin-bottom: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions form { display: contents; }
.btn-ghost {
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-weight: 600; font-size: 12.5px; padding: 8px 14px; border-radius: var(--radius-sm);
}
.btn-ghost:hover { background: var(--panel-alt); color: var(--text); }
.btn-danger {
  background: var(--active); color: #1a0508; border: none;
  font-weight: 700; font-size: 12.5px; padding: 8px 14px; border-radius: var(--radius-sm);
}
.btn-danger:hover { filter: brightness(1.08); }

/* ---------- Nav: expandable Stream submenu ---------- */
.nav-item-expandable .chev { width: 14px; height: 14px; transition: transform .15s ease; opacity: .6; }
.nav-item-expandable.expanded .chev { transform: rotate(90deg); }
.sub-nav { padding-left: 14px; margin-top: 2px; margin-bottom: 8px; }
.sub-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-mute); font-size: 12.5px;
}
.sub-item:hover { color: var(--text-dim); background: var(--panel-alt); }
.sub-item .sdot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; background: #6B7280; }
.sub-item-empty { display: block; padding: 8px 10px; font-size: 12px; color: var(--text-mute); }

/* ---------- Page head / buttons ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 20px; font-weight: 700; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--active); color: #1a0508; border: none;
  font-weight: 700; font-size: 13px; padding: 10px 16px; border-radius: var(--radius-sm);
  box-shadow: 0 0 16px rgba(255, 59, 78, 0.28);
  transition: filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { background: var(--panel-alt); color: var(--text-mute); box-shadow: none; cursor: not-allowed; border: 1px solid var(--border); }
.btn svg { width: 15px; height: 15px; }

/* ---------- Stream grid & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.stream-card {
  position: relative;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius);
  padding: 16px; cursor: pointer; transition: border-color .15s ease;
  min-height: 120px; display: flex; flex-direction: column;
}
.stream-card:hover { border-color: var(--border); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.tally { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; }
.tally .dot { width: 7px; height: 7px; border-radius: 50%; }
.tally.active { color: var(--active); }
.tally.active .dot { background: var(--active); box-shadow: 0 0 8px var(--active-glow); }
.tally.standby { color: var(--text-mute); }
.tally.standby .dot { background: #6B7280; }
.tally.error { color: var(--error); }
.tally.error .dot { background: var(--error); box-shadow: 0 0 8px var(--error-glow); }

.proto-badge {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 4px; background: var(--panel-alt); color: var(--text-mute); border: 1px solid var(--border);
}

.card-name { margin-top: auto; padding-top: 14px; font-size: 15px; font-weight: 600; }
.card-name input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--active); color: var(--text);
  font-size: 15px; font-weight: 600; font-family: inherit; padding: 5px 7px; border-radius: 5px; outline: none;
}

.kebab-wrap { position: absolute; bottom: 10px; right: 10px; }
.kebab-btn {
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  border-radius: 5px; background: transparent; border: none; color: var(--text-mute);
  transition: background .15s ease, color .15s ease;
}
.kebab-btn:hover { background: var(--panel-hover); color: var(--text); }
.kebab-btn svg { width: 15px; height: 15px; }
.kebab-menu {
  position: absolute; bottom: 32px; right: 0; min-width: 150px;
  background: var(--panel-alt); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  display: none; flex-direction: column; padding: 5px; z-index: 5;
}
.kebab-menu.open { display: flex; }
.kebab-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 5px; font-size: 12.5px; color: var(--text-dim);
  background: none; border: none; text-align: left; width: 100%;
}
.kebab-item:hover { background: var(--panel-hover); color: var(--text); }
.kebab-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.kebab-item.danger { color: #FF7A87; }
.kebab-item.danger:hover { background: rgba(255, 59, 78, 0.1); }
.kebab-item:disabled { opacity: .35; cursor: not-allowed; }
.kebab-item:disabled:hover { background: none; color: var(--text-dim); }

.empty {
  grid-column: 1/-1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 70px 20px; text-align: center; color: var(--text-mute);
  border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 14px; }
.empty h3 { font-size: 15px; color: var(--text-dim); font-weight: 600; margin-bottom: 6px; }
.empty p { font-size: 12.5px; max-width: 280px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-alt); border: 1px solid rgba(111, 208, 140, 0.35);
  color: #6FD08C; font-size: 12.5px; font-weight: 600;
  padding: 10px 14px; border-radius: var(--radius-sm);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.toast svg { width: 15px; height: 15px; }

/* ---------- Form fields (shared by Create Stream / Create User / Edit User modals) ---------- */
.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field select {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--border); color: var(--text);
  font-size: 13px; padding: 10px 11px; border-radius: var(--radius-sm); outline: none; font-family: inherit;
}
.field select:focus { border-color: var(--active); }

.result-box { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 14px; }
.result-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.result-row + .result-row { border-top: 1px solid var(--border-soft); }
.result-label { font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.06em; }
.result-value { font-family: var(--font-mono); font-size: 14px; font-weight: 600; }

/* ---------- Admin: search + table ---------- */
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  padding: 9px 12px; margin-bottom: 14px;
}
.search-wrap svg { width: 15px; height: 15px; color: var(--text-mute); flex-shrink: 0; }
.search-wrap input { flex: 1; background: transparent; border: none; color: var(--text); font-size: 13px; outline: none; font-family: inherit; }
.search-wrap input::placeholder { color: var(--text-mute); }

.table-panel { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-mute); font-weight: 600;
  padding: 12px 16px; border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-hover); }
.u-name { font-weight: 600; }
.role-pill {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: 5px; border: 1px solid var(--border); color: var(--text-dim);
  display: inline-block; text-transform: uppercase;
}
.role-pill.admin { border-color: rgba(255, 59, 78, 0.35); color: #FF7A87; }
.num-cell { font-family: var(--font-mono); color: var(--text-dim); font-size: 12.5px; }
.actions-cell { display: flex; align-items: center; gap: 3px; position: relative; }
.empty-row td { text-align: center; color: var(--text-mute); padding: 40px 16px; font-size: 13px; }

.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn:disabled { opacity: .3; pointer-events: none; }

.kebab-menu-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-mute); padding: 6px 10px 4px; font-family: var(--font-mono); }
.kebab-empty { padding: 9px 10px; font-size: 12px; color: var(--text-mute); }

/* ---------- Admin tabs (Manage / System Overview / Server Health) ---------- */
.admin-tabs { display: flex; gap: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border-soft); }
.admin-tab { padding: 10px 2px; font-size: 13px; font-weight: 600; color: var(--text-dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--text); border-bottom-color: var(--active); }

/* ---------- System Overview: per-user collapsible sections ---------- */
.user-section { margin-bottom: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.user-section-head {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: none; border: none; color: inherit; text-align: left; font: inherit;
}
.user-section-head:hover { background: var(--panel-hover); }
.user-section-head .chev { width: 14px; height: 14px; color: var(--text-mute); transition: transform .15s ease; flex-shrink: 0; }
.user-section.collapsed .chev { transform: rotate(-90deg); }
.user-section-name { font-weight: 700; font-size: 14px; }
.user-section-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }
.user-section-body { padding: 0 16px 16px; }
.user-section.collapsed .user-section-body { display: none; }
.no-streams { font-size: 12.5px; color: var(--text-mute); padding: 6px 0 2px; }

/* ---------- Read-only Stream Detail banner (viewed via System Overview) ---------- */
.readonly-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-alt); border: 1px solid var(--border); color: var(--text-dim);
  font-size: 12.5px; font-weight: 500; padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px;
}
.readonly-banner svg { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-mute); }

/* ---------- Alert banner (Stream Detail, above Monitor) ---------- */
.alert-banner-stack { display: flex; flex-direction: column; gap: 8px; }
.alert-banner-stack:not(:empty) { margin-bottom: 16px; }
.alert-banner-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
}
.alert-banner-row svg { width: 16px; height: 16px; flex-shrink: 0; }
.alert-banner-row.warning { background: rgba(255, 176, 32, 0.08); border: 1px solid rgba(255, 176, 32, 0.3); color: #FFC661; }
.alert-banner-row.critical { background: rgba(255, 59, 78, 0.08); border: 1px solid rgba(255, 59, 78, 0.3); color: #FF7A87; }
.alert-banner-message { flex: 1; }
.alert-banner-time { font-family: var(--font-mono); font-size: 11px; opacity: 0.8; flex-shrink: 0; white-space: nowrap; }

/* ---------- Server Health: CPU / RAM / Network / Disk / Relay ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
@media (max-width: 720px) { .metric-grid { grid-template-columns: 1fr; } }
.metric-card { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px; }
.metric-card.warn { border-color: rgba(255, 176, 32, 0.4); }
.metric-label { font-size: 10.5px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-bottom: 10px; }
.metric-value { font-family: var(--font-mono); font-size: 24px; font-weight: 600; }
.metric-value.warn { color: var(--error); }
.metric-value.muted { font-size: 14px; color: var(--text-mute); font-weight: 500; }
.net-rows { display: flex; flex-direction: column; gap: 5px; }
.net-row { display: flex; align-items: baseline; gap: 7px; }
.net-arrow { font-weight: 700; font-size: 13px; width: 12px; }
.net-arrow.down { color: var(--dest-facebook); }
.net-arrow.up { color: var(--dest-youtube); }
.net-name { font-size: 11.5px; color: var(--text-dim); flex: 1; }
.net-value { font-family: var(--font-mono); font-size: 15px; font-weight: 600; }
.net-value small { font-size: 10.5px; color: var(--text-mute); font-weight: 500; }
.metric-sparkline { display: block; width: 100%; height: 28px; margin-top: 10px; }
.metric-sparkline.hidden { display: none; }
.metric-sparkline polyline { fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.spark-cpu, .spark-ram { stroke: var(--text-dim); }
.spark-down { stroke: var(--dest-facebook); }
.spark-up { stroke: var(--dest-youtube); }

.info-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; }
.info-row-label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.info-row-value { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }

.disk-bar { width: 100%; height: 8px; background: var(--bg-raised); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.disk-bar-fill { height: 100%; background: var(--active); border-radius: 4px; }
.disk-meta { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }

/* ---------- Server Health: Internet Speed Monitor ---------- */
.speed-head-right { display: flex; align-items: center; gap: 10px; }
.speed-tested { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); }
.speed-stats { display: flex; flex-wrap: wrap; margin-top: 14px; }
.speed-stat { padding: 0 18px; position: relative; }
.speed-stat:first-child { padding-left: 0; }
.speed-stat:not(:first-child)::before { content: ''; position: absolute; left: 0; top: 1px; bottom: 1px; width: 1px; background: var(--border); }
.speed-stat-label { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); font-weight: 600; margin-bottom: 5px; }
.speed-stat-value { font-family: var(--font-mono); font-size: 16px; font-weight: 600; }

/* ---------- Report ---------- */
.report-alert-row {
  display: flex; align-items: baseline; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 12.5px;
}
.report-alert-row:last-child { border-bottom: none; }
.report-alert-type {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--error); flex-shrink: 0; width: 130px;
}
.report-alert-message { color: var(--text-dim); flex: 1; }
.report-alert-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-mute); flex-shrink: 0; }

/* ---------- Stream Detail: layout ---------- */
.content--wide { max-width: 1440px; }
.detail-grid {
  display: grid; gap: 18px; align-items: start;
  grid-template-columns: 1.5fr 1fr;
  grid-template-areas:
    "monitor side"
    "bitrate side"
    "log     side";
}
.area-monitor { grid-area: monitor; }
.area-side { grid-area: side; display: flex; flex-direction: column; gap: 18px; }
.area-bitrate { grid-area: bitrate; }
.area-log { grid-area: log; }
@media (max-width: 980px) {
  .detail-grid {
    grid-template-columns: 1fr;
    grid-template-areas: "monitor" "side" "bitrate" "log";
  }
}

.panel { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.panel-title { font-size: 12.5px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.panel-body { padding: 16px; }
.btn-compact { padding: 7px 12px; font-size: 11.5px; box-shadow: none; }
.btn-compact svg { width: 13px; height: 13px; }

/* ---------- Preview / status line ---------- */
.preview-wrap { padding: 16px 16px 0; }
.preview {
  position: relative; width: 100%; aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  background: repeating-linear-gradient(115deg, #12151a 0px, #12151a 2px, #0d0f13 2px, #0d0f13 4px);
  border: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: center;
}
.no-signal { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text-mute); }
.no-signal svg { width: 34px; height: 34px; opacity: .5; }
.no-signal span { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }

.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 16px; font-family: var(--font-mono); }
.status-word { font-size: 15px; font-weight: 600; letter-spacing: 0.04em; color: var(--standby); }
.status-word.active { color: var(--active); }
.status-word.error { color: var(--error); }
.preview.active { border-color: rgba(255, 59, 78, 0.3); }
.preview.error { border-color: rgba(255, 176, 32, 0.35); }
.status-meta { display: flex; flex-wrap: wrap; }
.stat-block { padding: 0 16px; position: relative; display: flex; flex-direction: column; gap: 4px; }
.stat-block:first-child { padding-left: 0; }
.stat-block:not(:first-child)::before { content: ''; position: absolute; left: 0; top: 1px; bottom: 1px; width: 1px; background: var(--border); }
.stat-block-label { font-family: var(--font-ui); font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-mute); font-weight: 600; }
.stat-block-value { font-size: 13px; color: var(--text); font-weight: 500; }
.status-uptime { margin-left: auto; text-align: right; }
.status-uptime .u-label { display: block; color: var(--text-mute); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px; font-family: var(--font-ui); }
.status-uptime .u-time { font-size: 17px; font-weight: 600; color: var(--text); letter-spacing: 0.03em; }

/* ---------- Bitrate (layout-only) / Error log (empty state) ---------- */
.bitrate-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-raised); border-radius: var(--radius-sm); }
.tab-btn { background: transparent; border: none; color: var(--text-dim); font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: 5px; }
.tab-btn.active { background: var(--panel-hover); color: var(--text); }
.panel-empty { padding: 30px 16px; text-align: center; color: var(--text-mute); font-size: 12.5px; }

/* ---------- Input card ---------- */
.protocol-toggle { display: flex; background: var(--bg-raised); border-radius: var(--radius-sm); padding: 4px; gap: 4px; margin-bottom: 18px; }
.protocol-btn {
  flex: 1; background: transparent; border: none; color: var(--text-dim);
  font-weight: 700; font-size: 12.5px; letter-spacing: 0.04em; padding: 10px 0; border-radius: 6px;
}
.protocol-btn.active { background: var(--active); color: #1a0508; box-shadow: 0 0 18px rgba(255, 59, 78, 0.35); }

.field-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 10px 10px 12px;
}
.field-row input { flex: 1; background: transparent; border: none; color: var(--text); font-family: var(--font-mono); font-size: 12.5px; outline: none; }
.copy-btn {
  display: flex; align-items: center; gap: 5px;
  background: var(--panel-alt); border: 1px solid var(--border); color: var(--text-dim);
  font-size: 11px; font-weight: 600; padding: 6px 9px; border-radius: 5px; flex-shrink: 0;
}
.copy-btn:hover { background: var(--panel-hover); color: var(--text); }
.copy-btn svg { width: 13px; height: 13px; }
.copy-btn.copied { color: #6FD08C; border-color: rgba(111, 208, 140, 0.4); }
.hint { font-size: 11.5px; color: var(--text-mute); line-height: 1.6; margin-top: 2px; }
.btn-block { width: 100%; justify-content: center; margin-bottom: 16px; }
.btn:disabled { pointer-events: none; }

/* ---------- Destinations card ---------- */
.toggle-all-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-raised); border-radius: var(--radius-sm); margin-bottom: 12px; }
.toggle-all-row span { font-size: 12px; color: var(--text-dim); font-weight: 600; }

.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background: var(--border); border-radius: 20px; transition: background .18s ease; cursor: pointer; }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #0c0e12; transition: transform .18s ease; }
.switch input:checked + .track { background: var(--active); }
.switch input:checked + .track .thumb { transform: translateX(16px); background: #fff; }

.dest-row { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-top: 1px solid var(--border-soft); }
.dest-row:first-of-type { border-top: none; }
.dest-info { flex: 1; min-width: 0; }
.dest-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.dest-url { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.dest-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.dest-actions .icon-btn { width: 28px; height: 28px; }
.dest-actions .icon-btn svg { width: 15px; height: 15px; }
.icon-btn.danger:hover { color: var(--active); border-color: rgba(255, 59, 78, 0.3); background: rgba(255, 59, 78, 0.08); }

.platform-pill { font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px; color: #0a0c10; flex-shrink: 0; }
