:root {
  color-scheme: dark;
  --bg: #071018;
  --surface: #0d1823;
  --surface-2: #121f2c;
  --surface-3: #172635;
  --border: #223445;
  --border-soft: #182a39;
  --text: #eef6fc;
  --muted: #89a0b3;
  --blue: #2296f3;
  --blue-bright: #53b4ff;
  --green: #2bd68f;
  --amber: #f2b544;
  --red: #ff5f72;
  --sidebar: #081624;
  --sidebar-w: 68px;
  --topbar-h: 56px;
  --radius: 12px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
.archive-player { display: block; width: 100%; max-width: 960px; aspect-ratio: 16/9; max-height: 540px; background: #000; margin: 1rem 0; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

body.sidebar-expanded { --sidebar-w: 232px; }

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }

code {
  color: #b7ddfa;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .88em;
  overflow-wrap: anywhere;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(28px, 3vw, 36px); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 18px; letter-spacing: -.02em; }
p { color: var(--muted); line-height: 1.55; }
.muted, small { color: var(--muted); }
.hidden { display: none !important; }

.eyebrow {
  margin: 0 0 5px;
  color: #6e8aa0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-w);
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #13283a;
  background: linear-gradient(180deg, #07192a 0%, #071522 100%);
  transition: width .2s ease;
}

.sidebar-head {
  display: flex;
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #13283a;
  padding: 0 14px;
}

.brand { display: flex; min-width: 0; align-items: center; gap: 11px; font-weight: 800; white-space: nowrap; }

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--blue), #6ac5ff);
  color: #03111c;
  font-size: 18px;
  font-weight: 950;
  box-shadow: 0 0 28px rgba(34, 150, 243, .28);
}

.brand-mark.large { width: 54px; height: 54px; border-radius: 16px; font-size: 24px; }
.brand-label, .side-nav a span, .user-name { opacity: 0; transition: opacity .12s; }
.sidebar-expanded .brand-label, .sidebar-expanded .side-nav a span, .sidebar-expanded .user-name { opacity: 1; }

.sidebar-toggle {
  position: absolute;
  top: 17px;
  left: 51px;
  display: grid;
  width: 32px;
  height: 32px;
  place-content: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  transition: left .2s, border-color .15s;
}

.sidebar-expanded .sidebar-toggle { left: 185px; }
.sidebar-toggle:hover { border-color: var(--blue); }
.sidebar-toggle span { display: block; width: 13px; height: 1.5px; background: #b9cde0; }

.side-nav { display: flex; flex: 1; flex-direction: column; gap: 6px; padding: 18px 10px; }

.side-nav a {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 13px;
  color: #8faabd;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.side-nav a:hover { background: rgba(255, 255, 255, .035); color: var(--text); }
.side-nav a.active { border-color: rgba(34, 150, 243, .26); background: rgba(34, 150, 243, .15); color: #dff1ff; }
.side-nav svg { width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.side-nav a:first-child svg { fill: currentColor; stroke: none; }

.sidebar-foot { display: flex; height: 64px; align-items: center; gap: 12px; border-top: 1px solid #13283a; padding: 0 16px; white-space: nowrap; }
.user-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 50%; background: #17344c; color: #8fd0ff; font-weight: 800; text-transform: uppercase; }
.user-name { overflow: hidden; color: #b6c7d4; font-size: 13px; text-overflow: ellipsis; }

.topbar {
  position: fixed;
  inset: 0 0 auto var(--sidebar-w);
  z-index: 30;
  display: flex;
  height: var(--topbar-h);
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(7, 16, 24, .91);
  padding: 0 22px;
  backdrop-filter: blur(16px);
  transition: left .2s;
}

.topbar-summary { display: flex; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; }
.topbar-summary > span { display: flex; align-items: center; gap: 5px; border-right: 1px solid var(--border); padding: 6px 10px; white-space: nowrap; }
.topbar-summary > span:last-child { border-right: 0; }
.topbar-summary small { font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.topbar-summary strong { color: #9dd7ff; font-size: 11px; }
.topbar-account { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.topbar-account button { border: 0; background: transparent; color: #c7d6e2; cursor: pointer; }
.topbar-account button:hover { color: var(--blue-bright); }

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 30px) clamp(18px, 2.5vw, 38px) 70px;
  transition: margin-left .2s;
}

.workspace-heading, .stream-titlebar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.workspace-heading p, .stream-titlebar p { margin-bottom: 0; }
.breadcrumbs { display: flex; align-items: center; gap: 10px; margin: 0 0 15px; color: #6f879a; font-size: 13px; }
.breadcrumbs a:hover { color: var(--blue-bright); }
.breadcrumbs strong { color: #d5e4ef; }

.primary-tabs { display: flex; gap: 2px; margin: 0 0 20px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.primary-tabs a { flex: 0 0 auto; white-space: nowrap; position: relative; padding: 11px 17px; color: var(--muted); font-size: 13px; font-weight: 700; }
.primary-tabs a:hover { color: var(--text); }
.primary-tabs a.active { color: #dff2ff; }
.primary-tabs a.active::after { position: absolute; right: 10px; bottom: -1px; left: 10px; height: 2px; background: var(--blue); content: ""; }
.stream-tabs { margin-bottom: 26px; }

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  background: var(--surface-2);
  color: #d9e7f1;
  font-weight: 750;
  cursor: pointer;
  transition: transform .12s, border-color .12s, background .12s;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.button.primary { background: var(--blue); color: #03111c; }
.button.primary:hover { background: var(--blue-bright); }
.button.subtle { border-color: var(--border); background: var(--surface-2); color: #d9e7f1; }
.button.danger { border-color: rgba(255, 95, 114, .34); background: rgba(255, 95, 114, .1); color: #ff9aaa; }
.button.small { min-height: 31px; padding: 5px 10px; font-size: 12px; }
.button.full { width: 100%; }
.button-icon { font-size: 17px; font-weight: 500; }

.flash { margin: 0 0 18px; border: 1px solid; border-radius: 9px; padding: 11px 14px; font-size: 13px; }
.flash.success { border-color: rgba(43, 214, 143, .28); background: rgba(43, 214, 143, .1); color: #8ef3c2; }
.flash.error { border-color: rgba(255, 95, 114, .3); background: rgba(255, 95, 114, .1); color: #ffacb7; }
.flash.warning { border-color: rgba(242, 181, 68, .3); background: rgba(242, 181, 68, .1); color: #ffda8c; }

.panel, .table-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel { padding: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.panel-heading > span { color: var(--muted); font-size: 12px; }

.table-shell { overflow: hidden; }
.stream-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); padding: 14px; }
.search-box { display: flex; width: min(460px, 45vw); align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 8px; background: #08131d; padding: 0 11px; }
.search-box span { color: var(--muted); font-size: 20px; }
.search-box input { border: 0; background: transparent; box-shadow: none; padding-left: 0; }
.status-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.status-filters button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; background: transparent; padding: 6px 9px; color: var(--muted); font-size: 11px; cursor: pointer; }
.status-filters button:hover, .status-filters button.active { border-color: #37627f; background: #122536; color: var(--text); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #708598; }
.dot.online, .dot.good { background: var(--green); box-shadow: 0 0 8px rgba(43, 214, 143, .35); }
.dot.waiting, .dot.wait { background: var(--amber); }
.dot.error, .dot.bad { background: var(--red); }
.dot.disabled { background: #657484; }

.bulk-bar { display: none; min-height: 48px; align-items: center; gap: 8px; border-bottom: 1px solid var(--border); background: rgba(34, 150, 243, .08); padding: 8px 14px; }
.bulk-bar.visible { display: flex; }
.bulk-bar strong { margin-right: auto; color: #a8d8fa; font-size: 12px; }

.table-scroll { overflow-x: auto; }
.streams-table { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; }
.streams-table th { height: 42px; background: #111e2a; color: #7f97aa; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.streams-table th, .streams-table td { border-bottom: 1px solid var(--border-soft); padding: 13px 12px; vertical-align: middle; }
.streams-table th:nth-child(2) { width: 20%; }
.streams-table th:nth-child(3) { width: 29%; }
.streams-table th:nth-child(4) { width: 37%; }
.streams-table tbody tr { transition: background .12s; }
.streams-table tbody tr:hover, .streams-table tbody tr.selected { background: rgba(34, 150, 243, .045); }
.streams-table tbody tr[hidden] { display: none; }
.select-cell { width: 44px; text-align: center !important; }
.actions-cell { width: 88px; text-align: right !important; }
.streams-table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--blue); }
.stream-identity { display: flex; align-items: center; gap: 11px; }
.stream-avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 9px; background: #163a56; color: #8fd0ff; font-size: 14px; font-weight: 900; text-transform: uppercase; }
.stream-name { display: block; margin-bottom: 5px; color: #8bceff; font-size: 14px; font-weight: 800; }
.stream-name:hover { color: #c5e9ff; }
.status-line { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; text-transform: capitalize; }
.endpoint-cell { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.endpoint-cell > code { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-cell > span { color: var(--muted); font-size: 11px; }
.endpoint-cell > span strong { color: #c9dce9; }
.output-title { color: #d7e7f2; font-size: 12px; font-weight: 700; }
.inline-copy { display: flex; min-width: 0; align-items: center; gap: 7px; }
.inline-copy code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-copy button, .copy-button { border: 0; background: transparent; color: var(--blue-bright); font-size: 11px; cursor: pointer; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.row-actions form { margin: 0; }
.icon-button { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid var(--border); border-radius: 7px; background: #12202c; color: #a9c1d2; cursor: pointer; }
.icon-button:hover { border-color: var(--blue); color: #e1f3ff; }
.table-footer { padding: 12px 15px; color: var(--muted); font-size: 11px; }

.empty-state { border: 1px dashed #2b4357; border-radius: 14px; background: rgba(13, 24, 35, .72); padding: 80px 24px; text-align: center; }
.empty-state p { max-width: 480px; margin: 10px auto 22px; }
.empty-symbol { display: grid; width: 60px; height: 60px; margin: 0 auto 18px; place-items: center; border-radius: 18px; background: rgba(34, 150, 243, .12); color: var(--blue-bright); font-size: 24px; }
.empty-symbol.small { width: 42px; height: 42px; margin-bottom: 12px; border-radius: 12px; font-size: 18px; }

.stream-actions form { display: flex; gap: 8px; }
.status-badge { display: inline-flex; align-items: center; gap: 7px; width: fit-content; border: 1px solid var(--border); border-radius: 999px; background: #111e29; padding: 5px 10px; color: #aebfcb; font-size: 11px; font-weight: 800; text-transform: capitalize; }
.status-badge.good { border-color: rgba(43, 214, 143, .3); color: #78e7b4; }
.status-badge.good .dot { background: var(--green); }
.status-badge.wait { border-color: rgba(242, 181, 68, .3); color: #f4ca78; }
.status-badge.wait .dot { background: var(--amber); }
.status-badge.bad { border-color: rgba(255, 95, 114, .3); color: #ff9aaa; }
.status-badge.bad .dot { background: var(--red); }

.overview-grid { display: grid; grid-template-areas: "preview health" "preview chart" "description description"; grid-template-columns: minmax(0, 1.15fr) minmax(380px, .85fr); gap: 16px; align-items: stretch; }
.preview-card { display: flex; grid-area: preview; min-width: 0; flex-direction: column; }
.preview-surface { display: flex; min-height: 360px; flex: 1; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #172635; border-radius: 10px; background: radial-gradient(circle at center, #0d1d2a, #02070b 72%); padding: 30px; text-align: center; }
.preview-surface strong { font-size: 16px; }
.preview-surface p { max-width: 500px; margin: 9px auto 18px; font-size: 13px; }
.preview-play { display: grid; width: 68px; height: 68px; margin-bottom: 18px; place-items: center; border: 1px solid #31516a; border-radius: 50%; background: rgba(34, 150, 243, .09); color: #95d5ff; font-size: 24px; padding-left: 4px; }
.hls-preview { position: relative; overflow: hidden; aspect-ratio: 16 / 9; min-height: 0; padding: 0; background: #010406; }
.hls-preview video { display: block; width: 100%; height: 100%; background: #010406; object-fit: contain; }
.preview-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(circle at center, rgba(13, 29, 42, .92), rgba(2, 7, 11, .97) 72%); padding: 28px; transition: opacity .2s ease; }
.preview-overlay.hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.preview-overlay.unsupported, .preview-overlay.error { background: linear-gradient(145deg, rgba(42, 23, 25, .96), rgba(9, 9, 12, .98)); }
.preview-overlay.unsupported strong, .preview-overlay.error strong { color: #ff9aaa; }
.preview-spinner { width: 38px; height: 38px; margin-bottom: 18px; border: 3px solid rgba(74, 168, 255, .2); border-top-color: var(--blue-bright); border-radius: 50%; animation: preview-spin .9s linear infinite; }
.preview-overlay.unsupported .preview-spinner, .preview-overlay.error .preview-spinner { width: 46px; height: 46px; border: 1px solid rgba(255, 95, 114, .4); animation: none; }
.preview-overlay.unsupported .preview-spinner::after, .preview-overlay.error .preview-spinner::after { content: "!"; display: grid; height: 100%; place-items: center; color: #ff9aaa; font-size: 24px; font-weight: 900; }
.preview-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; color: var(--muted); font-size: 11px; }
.preview-meta > span:first-child { display: inline-flex; align-items: center; gap: 7px; color: #aebfcb; font-weight: 800; text-transform: uppercase; }
.preview-meta .dot { background: var(--amber); }
.preview-meta.ready .dot { background: var(--green); }
.preview-meta.unsupported .dot, .preview-meta.error .dot { background: var(--red); }
@keyframes preview-spin { to { transform: rotate(360deg); } }
.live-chip { display: inline-flex; align-items: center; gap: 6px; color: #79e5b1; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.url-strip { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin-top: 12px; border: 1px solid var(--border-soft); border-radius: 8px; background: #09131c; padding: 10px 12px; }
.url-strip button { border: 0; background: transparent; color: var(--blue-bright); cursor: pointer; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.metric-grid > div { min-width: 0; border: 1px solid var(--border-soft); border-radius: 8px; background: #0a151f; padding: 9px 10px; }
.metric-grid span { display: block; overflow: hidden; margin-bottom: 4px; color: var(--muted); font-size: 9px; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.metric-grid strong { font-size: 14px; white-space: nowrap; }
.metric-grid strong span { display: inline; margin: 0; color: inherit; font: inherit; }
.health-card { grid-area: health; min-width: 0; }
.health-card > .panel-heading { margin-bottom: 10px; }
.input-media-panel { margin-top: 12px; border-top: 1px solid var(--border-soft); padding-top: 12px; }
.media-info-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.media-info-heading .eyebrow { margin-bottom: 3px; }
.media-info-heading h3 { margin: 0; font-size: 14px; }
.media-info-heading > span { color: var(--muted); font-size: 10px; }
.media-stream-list { display: flex; flex-direction: column; gap: 6px; }
.media-stream-list > p { margin: 0; color: var(--muted); font-size: 12px; }
.media-stream-row { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 8px; border: 1px solid var(--border-soft); border-radius: 7px; background: #09131c; padding: 7px 9px; }
.media-track-badge { display: grid; width: 28px; height: 24px; place-items: center; border-radius: 6px; background: rgba(74, 168, 255, .12); color: #73bcff; font-size: 10px; font-weight: 900; text-transform: lowercase; }
.media-track-badge.audio { background: rgba(255, 95, 114, .11); color: #ff95a3; }
.media-stream-description { overflow: hidden; color: #d5e5ef; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chart-card { grid-area: chart; min-width: 0; }
.chart-card .panel-heading { margin-bottom: 10px; }
.chart-card canvas { display: block; width: 100%; height: 190px; max-height: 190px; border-radius: 9px; background: #09131c; }
.chart-legend { display: flex; gap: 13px; color: var(--muted); font-size: 11px; }
.chart-legend i { display: inline-block; width: 16px; height: 2px; margin-right: 5px; vertical-align: middle; }
.legend-in { background: var(--blue-bright); }
.legend-out { background: var(--green); }
.description-card { grid-area: description; }
.inline-settings { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }

.detail-list { margin: 18px 0 0; }
.detail-list > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; border-top: 1px solid var(--border-soft); padding: 11px 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { min-width: 0; margin: 0; }
.detail-list.compact > div { grid-template-columns: 1fr auto; font-size: 13px; }
.config-list { max-width: 900px; }
.site-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; align-items: start; }
.site-settings-grid .panel { min-width: 0; }
.site-settings-grid .muted, .setup-checklist { font-size: 12px; line-height: 1.6; }
.setup-checklist ol { padding-left: 22px; }
.setup-checklist li { margin-top: 6px; }

.events-card { margin-top: 16px; }
.event-list { display: flex; flex-direction: column; }
.event { display: grid; grid-template-columns: 155px 68px minmax(140px, auto) 1fr; gap: 12px; border-top: 1px solid var(--border-soft); padding: 10px 0; align-items: center; font-size: 12px; }
.event time, .event > span:last-child { color: var(--muted); }
.event-level { border-radius: 999px; background: #172635; padding: 3px 7px; color: #9eb3c4; font-size: 9px; font-weight: 800; text-align: center; text-transform: uppercase; }
.event-level.error { background: rgba(255, 95, 114, .12); color: #ff94a2; }
.empty-copy { margin-bottom: 0; }

.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
.settings-main { min-width: 0; }
.settings-aside { align-self: start; position: sticky; top: calc(var(--topbar-h) + 18px); }
.settings-aside ol { margin: 16px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.settings-aside li + li { margin-top: 10px; }
.live-aside h2 { color: var(--green); text-transform: capitalize; }
.form-stack { display: flex; flex-direction: column; gap: 17px; }
.form-stack label, .inline-settings label, .latency-control > label, .two-column label { display: flex; flex-direction: column; gap: 7px; color: #cbdbe6; font-size: 12px; font-weight: 750; }

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: #08131d;
  color: var(--text);
  padding: 9px 11px;
}

input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(34, 150, 243, .12); }
input[type="checkbox"] { min-height: 0; padding: 0; }
small { font-weight: 400; line-height: 1.5; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; }
.check-row input { width: auto; accent-color: var(--blue); }
.check-row.lower { align-self: end; min-height: 42px; }
.latency-control { display: flex; flex-direction: column; gap: 8px; }
.latency-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.latency-presets button { border: 1px solid var(--border); border-radius: 999px; background: #0b1721; padding: 5px 9px; color: var(--muted); font-size: 11px; cursor: pointer; }
.latency-presets button:hover, .latency-presets button.selected { border-color: var(--blue); background: rgba(34, 150, 243, .12); color: #bce4ff; }
.advanced-settings { border: 1px solid var(--border); border-radius: 9px; background: rgba(8, 19, 29, .5); padding: 13px 15px; }
.advanced-settings summary { cursor: pointer; color: #bdcfdb; font-size: 12px; font-weight: 800; }
.advanced-settings p { margin: 10px 0; font-size: 12px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border-soft); padding-top: 15px; }
.sticky-actions { grid-column: 1 / -1; display: flex; position: sticky; bottom: 12px; z-index: 5; justify-content: flex-end; gap: 8px; border: 1px solid var(--border); border-radius: 10px; background: rgba(13, 24, 35, .94); padding: 10px; backdrop-filter: blur(12px); }

.output-catalog { margin-bottom: 16px; }
.output-row { display: grid; grid-template-columns: 58px minmax(220px, .8fr) minmax(280px, 1.6fr) 74px 86px; gap: 12px; align-items: center; border-top: 1px solid var(--border-soft); padding: 13px 0; }
.output-row p { margin: 4px 0 0; font-size: 11px; }
.output-row code { border: 1px solid var(--border-soft); border-radius: 7px; background: #08131d; padding: 9px 10px; }
.output-row.unavailable { opacity: .54; }
.protocol-badge { display: inline-flex; width: fit-content; border: 1px solid rgba(43, 214, 143, .4); border-radius: 5px; padding: 4px 7px; color: #77e9b5; font-size: 10px; font-weight: 900; }
.protocol-badge.muted { border-color: var(--border); color: #9db0bd; }
.availability { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.availability.online { color: var(--green); }
.client-empty { padding: 45px 20px; text-align: center; }
.client-empty p { margin-bottom: 0; }
.client-table-wrap { overflow-x: auto; }
.client-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.client-table th, .client-table td { border-top: 1px solid var(--border-soft); padding: 11px; text-align: left; }
.client-table th { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.client-table td { font-size: 12px; }

.placeholder-grid { display: grid; place-items: center; min-height: 55vh; }
.placeholder-card { max-width: 620px; text-align: center; }
.placeholder-icon { display: grid; width: 56px; height: 56px; margin: 0 auto 16px; place-items: center; border-radius: 16px; background: rgba(34, 150, 243, .12); color: var(--blue-bright); font-size: 24px; }

.login-page { display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 50% 0, #103149 0, var(--bg) 46%); }
.login-card { width: min(100%, 430px); border: 1px solid var(--border); border-radius: 16px; background: rgba(13, 24, 35, .96); padding: 34px; box-shadow: 0 26px 80px rgba(0, 0, 0, .42); }
.login-logo { margin-bottom: 22px; }
.login-card h1 { font-size: 29px; }
.login-card > p { margin-bottom: 24px; }

@media (max-width: 1100px) {
  .overview-grid { grid-template-areas: "preview" "health" "chart" "description"; grid-template-columns: 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .site-settings-grid { grid-template-columns: 1fr; }
  .settings-aside { position: static; }
  .output-row { grid-template-columns: 58px 1fr auto; }
  .output-row code { grid-column: 2 / -1; }
  .output-row .copy-button { grid-column: 2; justify-self: start; }
}

@media (max-width: 800px) {
  :root { --sidebar-w: 58px; }
  body.sidebar-expanded { --sidebar-w: 220px; }
  .sidebar-head { padding: 0 10px; }
  .brand-mark { width: 36px; height: 36px; flex-basis: 36px; }
  .sidebar-toggle { left: 43px; }
  .sidebar-expanded .sidebar-toggle { left: 174px; }
  .topbar { padding: 0 10px; }
  .topbar-summary > span:nth-child(3), .topbar-summary > span:nth-child(4), .topbar-account span { display: none; }
  .workspace { padding-right: 14px; padding-left: 14px; }
  .workspace-heading, .stream-titlebar, .stream-toolbar { flex-direction: column; }
  .search-box { width: 100%; }
  .status-filters { width: 100%; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .inline-settings { grid-template-columns: 1fr; }
  .detail-list > div { grid-template-columns: 1fr; gap: 4px; }
  .event { grid-template-columns: 1fr 65px; }
  .event strong, .event > span:last-child { grid-column: 1 / -1; }
  .preview-surface { min-height: 290px; }
  .output-row { grid-template-columns: 48px 1fr; }
  .output-row > div:nth-child(2) { grid-column: 1 / -1; min-width: 0; }
  .output-row > .protocol-badge { grid-row: 1; }
  .output-row code, .output-row .copy-button { grid-column: 1 / -1; }
  .availability { grid-column: 2; grid-row: 1; justify-self: end; }
}
:root { --source-gap: 14px; }
.source-settings { margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
.form-grid label { min-width: 0; }
.form-grid label:not(.check-row) { display: flex; flex-direction: column; gap: 6px; }
.form-grid input, .form-grid select { width: 100%; }
.form-grid input[type="checkbox"] { width: auto; }
.form-grid select { background: var(--surface-2); color: inherit; border: 1px solid var(--border); border-radius: 7px; padding: 10px; }
.protocol-badge { text-transform: uppercase; }
.source-settings .table-wrap { overflow-x: auto; }
.source-settings table { width: 100%; text-align: left; border-collapse: collapse; }
.source-settings th, .source-settings td { padding: 10px; border-bottom: 1px solid var(--border-soft); }
.source-settings td { overflow-wrap: anywhere; }
.source-edit-row { display: grid; grid-template-columns: minmax(110px, .6fr) minmax(220px, 2fr) minmax(110px, .5fr) auto; gap: var(--source-gap); align-items: start; padding: 16px 0; border-bottom: 1px solid #26394a; }
.source-edit-row label { min-width: 0; }
.source-edit-row input { width: 100%; }
.source-order { display: flex; gap: 6px; padding-top: 26px; }
.source-live-status { margin-top: 16px; }
@media (max-width: 1050px) { .source-edit-row { grid-template-columns: 1fr 2fr; } .source-order { padding-top: 18px; } }
@media (max-width: 620px) { .source-edit-row { grid-template-columns: 1fr; } .source-order { padding-top: 0; } }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }
/* Transcoder: dense controls without allowing a ladder to widen the page. */
.encoder-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(160px,100%),1fr));gap:16px;margin:18px 0}
.encoder-grid label{display:flex;flex-direction:column;gap:8px;min-width:0}
.encoder-grid input,.encoder-grid select{width:100%;min-width:0}
.encoder-grid select{background:var(--surface-2);color:inherit;border:1px solid var(--border);border-radius:7px;padding:12px;font:inherit;min-height:43px}
.encoder-grid .check-row{flex-direction:row;align-items:center}.encoder-grid input[type="checkbox"]{width:auto}
.encoder-grid output{padding:12px;border:1px solid var(--border,#253847);border-radius:8px;color:#94adbf}
.video-track{border:1px solid var(--border,#253847);border-radius:12px;padding:20px;margin-top:20px;min-width:0}
.video-track summary{cursor:pointer;padding:12px 0;color:#90d0ff}
.encoder-option{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:10px;margin:12px 0}
.encoder-option input{min-width:0;width:100%}
@media(max-width:600px){.video-track{padding:12px}.encoder-option{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.encoder-option button{grid-column:1/-1}.video-track .panel-heading{align-items:flex-start;flex-wrap:wrap}}
.push-panel { margin-top: 20px; scroll-margin-top: 80px; }
.push-panel #new-push { scroll-margin-top: 80px; }
.push-card { padding: 20px 0; border-bottom: 1px solid var(--border, #253949); }
.push-card code { display: block; overflow-wrap: anywhere; }
.push-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; margin: 16px 0; }
.push-metrics dt { font-size: .75rem; color: var(--muted, #8fa6b7); }
.push-metrics dd { margin: 4px 0 0; font-weight: 600; }
.push-edit { margin: 16px 0; }
.push-card .form-actions { margin-top: 16px; flex-wrap: wrap; }
.push-panel summary { padding: 12px 0; cursor: pointer; }
