:root {
  color-scheme: dark;
  --bg: #0b111b;
  --card: #131d2c;
  --line: #26354a;
  --text: #eff5ff;
  --muted: #98a9c1;
  --accent: #81efd2;
  --brand-blue: #38BAF2;
  --brand-orange: #F46A13;
}
* { box-sizing: border-box; }
body { margin: 0; padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px); background: var(--bg); color: var(--text); font: 16px/1.6 'Segoe UI', sans-serif; }
.glow { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 20% 25%, #17434b44, transparent 50%); }
header, main { position: relative; max-width: 1280px; margin: auto; padding: 28px 48px; }
header { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 24px; border-bottom: 1px solid var(--line); padding-top: max(28px, env(safe-area-inset-top, 0px)); background: #0b111bf2; backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-size: 23px; font-weight: 800; letter-spacing: 2px; line-height: 1; }
.brand img { width: 34px; height: 34px; border-radius: 8px; object-fit: contain; }
.brand-t { color: var(--brand-blue); }
.brand-r { color: var(--brand-orange); }
.accent { color: var(--accent); }
.tag, .eyebrow { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 2px; }
.tag { line-height: 1; transform: translateY(6px); }
.version-badge { flex: 0 0 auto; transform: translateY(6px); border: 1px solid var(--line); border-radius: 50px; padding: 4px 9px; color: var(--muted); font-size: 11px; line-height: 1.3; }
.main-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mobile-nav { display: none; }
.nav-link { padding: 10px 15px; border: 1px solid transparent; border-radius: 11px; color: var(--muted); font-size: 14px; font-weight: 650; line-height: 1.2; text-decoration: none; transition: color .16s ease, background .16s ease, border-color .16s ease; }
.nav-link:hover { color: var(--text); background: #ffffff08; }
.nav-link.active { border-color: #81efd233; background: #81efd215; color: var(--accent); }
header #logout { margin-left: 0; }
#main-nav[hidden] + #logout { margin-left: auto; }
main { min-height: 70vh; }
body.auth-pending #login { visibility: hidden; }
.login { display: flex; justify-content: center; align-items: center; min-height: 72vh; }
h1 { margin: 22px 0; font-size: clamp(36px, 5vw, 68px); letter-spacing: -2px; line-height: 1.12; }
h2 { margin: 16px 0; font-size: 25px; line-height: 1.25; }
p { color: var(--muted); }
.card { border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(140deg, #192539, #101925); box-shadow: 0 22px 70px #0002; padding: 32px; }
.signin { width: min(100%, 500px); padding: 44px; }
.login-title-row { display: flex; align-items: center; justify-content: flex-start; gap: 14px; margin-bottom: 24px; }
.login-title-row .symbol { width: 52px; height: 52px; flex: 0 0 auto; margin: 0; }
.login-title-row h2 { margin: 0; font-size: clamp(18px, 2.5vw, 25px); white-space: nowrap; }
.symbol { display: block; width: 64px; height: 64px; margin-bottom: 30px; border: 0; border-radius: 0; background: transparent; object-fit: contain; }
button, input, select { font: inherit; }
button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; border: 0; border-radius: 11px; padding: 0 18px; cursor: pointer; font-size: 14px; font-weight: 650; line-height: 1.15; text-align: center; }
button:disabled { opacity: .45; cursor: wait; }
.primary { background: var(--accent); color: #09251f; }
.quiet { background: #233147; color: var(--text); }
input, select { width: 100%; height: 48px; margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: #0c1422; color: var(--text); line-height: 1.2; }
label { display: flex; min-width: 0; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12px; }
form { display: flex; align-items: end; gap: 16px; margin: 24px 0; }
.signin form { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 18px 0; }
.signin form#password-login { margin-bottom: 0; }
.signin form label { width: 100%; }
.signin button { width: 100%; margin: 30px 0 20px; text-align: left; }
.signin form button { margin: 8px 0; }
.signin #password-login button { margin: 34px 0 0; }
#passkey-login { width: 100%; margin: 12px 0 0; }
.auth-panel { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.auth-panel h2 { margin: 8px 0; }
.auth-panel p { margin: 8px 0 16px; font-size: 14px; }
.totp-qr { display: block; width: 180px; height: 180px; margin: 16px auto; border-radius: 10px; background: white; }
#totp-secret { display: block; overflow-wrap: anywhere; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #0c1422; color: var(--text); font-size: 13px; user-select: all; }
.auth-panel form { display: flex; flex-direction: column; align-items: stretch; gap: 8px; margin: 20px 0 0; }
.auth-panel form button { margin: 8px 0; }
#recovery-codes pre { overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #0c1422; color: var(--accent); font-size: 14px; line-height: 1.8; user-select: all; }
#recovery-continue { width: 100%; margin: 12px 0 0; }
small { display: block; color: var(--muted); font-size: 12px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pagehead .stream-controls { width: auto; flex: 0 0 auto; }
.pagehead .stream-controls button { width: auto; min-width: 172px; }
.pagehead h1 { font-size: 40px; }
.pagehead p { margin: -8px 0 0; }
.pill { border: 1px solid var(--line); border-radius: 50px; padding: 7px 15px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.pill.live { color: var(--accent); }
.vm-status-card { display: grid; width: 100%; max-width: var(--stream-frame-width, 100%); grid-template-columns: minmax(155px, .72fr) minmax(0, 1.28fr); grid-template-areas: "heading states" "footer footer"; align-items: center; gap: 12px 18px; margin: 12px auto 0; border-radius: 17px; padding: 14px 16px; box-shadow: none; }
.vm-status-heading { grid-area: heading; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.vm-status-title { display: flex; min-width: 0; align-items: center; gap: 10px; }
.vm-status-mark { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 1px solid #81efd229; border-radius: 11px; background: #0c1422; color: var(--accent); }
.vm-status-mark svg { width: 21px; height: 21px; }
.vm-status-heading .eyebrow { font-size: 9px; letter-spacing: 1.5px; line-height: 1.1; }
.vm-status-heading h2 { margin: 3px 0 0; font-size: 16px; line-height: 1.2; }
.vm-status-heading #vm-status-refresh { width: 36px; min-width: 36px; min-height: 36px; flex: 0 0 36px; border: 1px solid #34445b; border-radius: 10px; padding: 0; color: var(--muted); transition: color .15s ease, border-color .15s ease, background .15s ease; }
.vm-status-heading #vm-status-refresh:hover:not(:disabled) { border-color: #81efd255; background: #81efd212; color: var(--accent); }
.vm-status-heading #vm-status-refresh svg { width: 17px; height: 17px; }
.vm-status-grid { grid-area: states; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.vm-status-item { display: flex; min-width: 0; flex-direction: column; justify-content: center; gap: 3px; border: 1px solid #26354a99; border-radius: 11px; padding: 8px 11px; background: #0c1422; line-height: 1.35; }
.vm-status-item span { color: var(--muted); font-size: 10px; }
.vm-status-item strong { display: flex; min-width: 0; align-items: center; gap: 7px; overflow: hidden; color: var(--text); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.vm-status-item strong::before { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: #e3ad55; box-shadow: 0 0 8px #e3ad5533; content: ''; }
.vm-status-item strong.vm-state-good { color: var(--accent); }
.vm-status-item strong.vm-state-good::before { background: var(--accent); box-shadow: 0 0 8px #81efd266; }
.vm-status-item strong.vm-state-muted { color: var(--muted); }
.vm-status-item strong.vm-state-muted::before { background: #8290a4; box-shadow: none; }
.vm-status-footer { grid-area: footer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; border-top: 1px solid #26354a99; padding-top: 11px; }
.vm-admin-actions { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 7px; justify-self: end; }
.vm-admin-actions button { min-height: 36px; padding: 0 11px; font-size: 11px; }
.vm-admin-actions .vm-danger { border: 1px solid #fa737344; background: #4b252d; color: #ffdadd; }
.vm-admin-actions .vm-danger:hover:not(:disabled) { background: #62303a; }
.vm-status-detail { grid-column: 1; grid-row: 1; margin: 0; color: #f2c879; font-size: 12px; line-height: 1.4; }
.stream-layout { display: grid; grid-template-columns: 1fr; gap: 18px; margin: 20px 0 30px; }
.screen { position: relative; display: grid; min-height: 360px; place-items: center; overflow: hidden; padding: 0; background: #050a10; }
video { display: block; width: 100%; }
.screen video { align-self: center; }
.player-controls { position: absolute; z-index: 2; right: 0; bottom: 0; left: 0; display: flex; min-height: 64px; align-items: center; gap: 12px; padding: 10px 16px; background: linear-gradient(transparent, #000d 28%); color: white; transition: opacity .18s ease; }
.screen.controls-hidden .player-controls { opacity: 0; pointer-events: none; }
.player-control-button { flex: 0 0 42px; width: 42px; min-width: 42px; min-height: 42px; height: 42px; border: 1px solid #ffffff30; border-radius: 9px; padding: 0; background: #111a; color: white; font-size: 17px; line-height: 1; }
.player-control-button:hover { background: #ffffff25; }
.player-mute-icon { display: block; width: 25px; height: 25px; }
.player-muted-slash { display: none; }
#player-mute.is-muted .player-sound-waves { display: none; }
#player-mute.is-muted .player-muted-slash { display: block; }
.player-more-icon { display: block; width: 24px; height: 24px; }
.player-seek-control { flex: 1 1 auto; min-width: 40px; }
.player-controls input[type="range"] { display: block; width: 100%; height: 24px; margin: 0; border: 0; border-radius: 0; padding: 0; background: transparent; accent-color: var(--accent); cursor: pointer; }
.player-volume-control { flex: 0 0 92px; width: 92px; margin: 0; }
.player-time { flex: 0 0 auto; min-width: 82px; color: white; font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.player-more-menu { position: absolute; z-index: 4; right: 48px; bottom: calc(100% - 4px); display: flex; width: 256px; flex-direction: column; gap: 14px; border: 1px solid #ffffff32; border-radius: 12px; padding: 16px; background: #111a27f5; box-shadow: 0 12px 36px #0009; }
.player-menu-row { display: flex; flex-direction: column; gap: 7px; color: white; font-size: 12px; }
.player-speed-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.player-speed-options button { min-width: 0; min-height: 36px; border: 1px solid #ffffff30; border-radius: 8px; padding: 0 4px; background: #ffffff10; color: white; font-size: 13px; font-variant-numeric: tabular-nums; }
.player-speed-options button:hover { background: #ffffff20; }
.player-speed-options button[aria-pressed="true"] { border-color: #81efd288; background: #81efd222; color: var(--accent); }
.player-menu-pip { width: 100%; min-height: 42px; justify-content: flex-start; border: 1px solid #ffffff30; padding: 0 12px; background: #ffffff10; color: white; font-size: 13px; }
.player-menu-pip:hover { background: #ffffff20; }
.screen:fullscreen { width: 100vw !important; height: 100vh !important; max-width: none !important; max-height: none !important; min-height: 0 !important; aspect-ratio: auto !important; border: 0; border-radius: 0; }
.screen:fullscreen video { width: 100%; height: 100%; object-fit: contain; }
body.stream-viewport { height: 100vh; height: 100dvh; overflow: hidden; }
body.stream-viewport > main { position: absolute; top: var(--stream-main-top, 92px); right: auto; bottom: 0; left: 50%; display: flex; width: 100%; max-width: 1280px; min-height: 0; flex-direction: column; transform: translateX(-50%); overflow: hidden; margin: 0; padding-block: clamp(12px, 2vh, 24px); }
body.stream-viewport > main > #dashboard { display: flex; width: 100%; min-height: 0; flex: 1 1 auto; }
body.stream-viewport #stream-page { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; }
body.stream-viewport #stream-page > .pagehead { width: min(var(--stream-frame-width, 100%), 100%); flex: 0 0 auto; margin-inline: auto; }
body.stream-viewport .stream-layout { display: flex; min-height: 0; flex: 1 1 auto; align-items: center; justify-content: center; container-type: size; margin: clamp(8px, 1.5vh, 18px) 0 clamp(10px, 1.8vh, 20px); }
body.stream-viewport .screen { display: flex; width: min(100cqw, 177.7778cqh); max-width: 100cqw; max-height: 100cqh; min-height: 0; height: auto; flex: 0 0 auto; aspect-ratio: 16 / 9; align-items: center; justify-content: center; }
body.stream-viewport #video { width: 100%; height: 100%; object-fit: contain; }
#placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; }
#placeholder .symbol { margin: 0; }
.stream-controls { display: flex; width: 100%; }
.stream-controls button { width: 100%; min-width: 0; }
.admin-page { display: flex; flex-direction: column; gap: 22px; }
.admin-subnav { display: flex; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.admin-subnav-link { border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; color: var(--muted); font-size: 13px; font-weight: 650; line-height: 1.25; text-decoration: none; }
.admin-subnav-link:hover { color: var(--text); border-color: #ffffff33; }
.admin-subnav-link.active { border-color: #81efd233; background: #81efd215; color: var(--accent); }
.admin-subpage { margin: 0; }
.stream-warning { position: sticky; top: 12px; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid #f0bd5b88; border-radius: 16px; padding: 16px 20px; background: #382d19f2; box-shadow: 0 14px 36px #0005; }
.stream-warning strong { color: #ffe2a0; }
.stream-warning p { margin: 3px 0 0; color: #e4d4b1; font-size: 14px; }
.stream-warning button { flex: 0 0 auto; min-width: 132px; background: #f3c56a; color: #2b200d; }
.security-page { display: flex; flex-direction: column; gap: 22px; }
.live-status-page { display: flex; flex-direction: column; gap: 22px; }
.stream-preferences-form { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)) auto; align-items: end; gap: 16px; margin: 22px 0 28px; }
.stream-preferences-form button { min-width: 210px; }
.stream-preferences-form .preference-note, .stream-preferences-form .encoding-help { grid-column: 1 / -1; margin: 0; }
.stream-preferences-form .encoding-help { color: var(--muted); font-size: 13px; line-height: 1.5; }
.sync-preferences-form { display: grid; grid-template-columns: minmax(220px, 320px) auto auto minmax(220px, 1fr); align-items: center; gap: 16px; margin: 22px 0 28px; }
.sync-preferences-form input[type="range"] { width: 100%; height: 30px; margin-top: 2px; padding: 0; accent-color: var(--accent); }
.sync-preferences-form output { color: var(--accent); font-size: 14px; font-weight: 700; white-space: nowrap; }
.sync-preferences-form button { min-width: 210px; }
.sync-preferences-form .sync-drift-option, .sync-preferences-form .preference-note { grid-column: 1 / -1; }
.sync-preferences-form .sync-drift-option { justify-self: start; }
.player-preferences-form { display: grid; grid-template-columns: minmax(240px, 1fr) auto minmax(220px, 1fr); align-items: center; gap: 16px; margin: 22px 0 28px; }
.player-preferences-form button { min-width: 210px; }
.player-audio-option { display: flex; flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
.player-audio-option input { width: 20px; height: 20px; accent-color: var(--accent); }
.preference-note { min-height: 48px; display: flex; align-items: center; color: var(--muted); font-size: 13px; }
.viewer-table { min-width: 820px; table-layout: auto; }
.viewer-table th, .viewer-table td { white-space: nowrap; }
@media (max-width: 1100px) {
  .stream-preferences-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stream-preferences-form button { grid-column: 1 / -1; width: 100%; min-width: 0; }
}
.viewer-table .empty-viewers { padding-block: 26px; color: var(--muted); text-align: center; }
.live-status-page .users-heading { align-items: end; }
.security-card { width: 100%; }
.security-status-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.security-status-row h2 { margin: 0; }
.security-status-row p { margin: 5px 0 0; font-size: 13px; }
.security-card > p { margin: 16px 0 28px; }
.security-note { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #0c1422; }
.passkey-add-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 14px; margin: 20px 0; }
.passkey-add-form button { min-width: 190px; }
.passkey-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.passkey-list li { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 10px 16px; }
.admin-page > .pagehead { align-items: end; }
.management { width: 100%; margin-bottom: 25px; }
.section-heading, .users-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.section-heading h2, .users-heading h2 { margin: 0; }
.section-heading p, .users-heading p { margin: 5px 0 0; font-size: 13px; }
.admin-create-form { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(190px, .55fr) auto; align-items: end; gap: 16px; margin: 22px 0 28px; }
.admin-create-form button { min-width: 172px; white-space: nowrap; }
#invitation-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 0 0 28px; border: 1px solid #81efd233; border-radius: 14px; padding: 18px; background: #81efd20b; }
#invitation-box p { grid-column: 1 / -1; margin: 0; }
#invitation-box input, #invitation-box button { height: 48px; }
.users-heading { margin: 0 0 14px; border-top: 1px solid var(--line); padding-top: 24px; }
.table-wrap { width: 100%; overflow-x: auto; }
.users-table { width: 100%; min-width: 760px; table-layout: fixed; border-collapse: collapse; text-align: left; font-size: 14px; }
.users-table col:nth-child(1) { width: 20%; }
.users-table col:nth-child(2) { width: 16%; }
.users-table col:nth-child(3) { width: 16%; }
.users-table col:nth-child(4) { width: 16%; }
.users-table col:nth-child(5) { width: 32%; }
.users-table th, .users-table td { border-bottom: 1px solid var(--line); padding: 14px 12px; vertical-align: middle; }
.users-table th { color: var(--muted); font-size: 12px; font-weight: 500; }
.users-table tbody tr:hover { background: #ffffff06; }
.user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.users-table .user-action { min-height: 38px; margin: 0; padding: 8px 12px; font-size: 12px; white-space: nowrap; }
.users-table .user-action.danger { background: #51282d; color: #ffd6d8; }
.table-wrap { border-radius: 12px; }
#message { margin: 20px 0; border: 1px solid #81efd244; border-radius: 12px; padding: 16px 24px; background: #142c2b; }
#message.error { border-color: #f38b8b88; background: #392023; }
.toast { position: fixed; z-index: 100; top: 16px; left: 50%; max-width: calc(100vw - 32px); transform: translate(-50%, -10px); border: 1px solid #81efd266; border-radius: 14px; padding: 13px 22px; background: #142c2b; box-shadow: 0 18px 50px #0008; color: var(--text); font-size: 14px; line-height: 1.4; text-align: center; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.error { border-color: #f38b8b88; background: #392023; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
[hidden] { display: none !important; }
.player-live-button { display: inline-flex; flex: 0 0 auto; min-width: 112px; min-height: 38px; align-items: center; gap: 7px; border: 1px solid #81efd288; border-radius: 9px; padding: 0 11px; background: #0d584fdd; color: #d7fff6; font-size: 12px; font-weight: 700; white-space: nowrap; }
.player-live-button:hover:not(:disabled) { background: #137b6f; }
.player-live-button:disabled { opacity: 1; cursor: default; }
.player-live-button.is-live { border-color: #ff6868aa; background: #441f25dd; color: #ffe1e1; }
.player-live-dot { display: none; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #ff5058; box-shadow: 0 0 10px #ff505899; }
.player-live-button.is-live .player-live-dot { display: inline-block; }
.recordings-page { display: flex; flex-direction: column; gap: 18px; padding-bottom: 28px; }
.recordings-storage { min-height: 20px; margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; background: #0c1422; color: var(--muted); font-size: 12px; line-height: 1.7; white-space: pre-line; overflow-wrap: anywhere; }
.recording-player-card { display: flex; flex-direction: column; gap: 14px; }
.recording-player-card video { width: 100%; max-height: min(68vh, 760px); background: #050a10; }
.recording-list { display: flex; flex-direction: column; gap: 12px; }
.recording-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 17px 18px; background: #111a27; }
.recording-row-main { min-width: 0; }
.recording-row h2 { overflow: hidden; margin: 0 0 6px; color: var(--text); font-size: 17px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.recording-row p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.recording-state { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px !important; border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; color: var(--text) !important; font-size: 12px !important; font-weight: 650; }
.recording-state::before { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: #8693a5; content: ''; }
.recording-state-recording { border-color: #ff505866; background: #441f2522; color: #ffdede !important; }
.recording-state-recording::before { background: #ff5058; box-shadow: 0 0 8px #ff505899; }
.recording-state-archiving, .recording-state-converting { border-color: #e9b65766; background: #49391e33; color: #ffe8b7 !important; }
.recording-state-archiving::before, .recording-state-converting::before { background: #f0ba54; }
.recording-state-hls_ready { border-color: #62b4ff66; background: #17355155; color: #d0ebff !important; }
.recording-state-hls_ready::before { background: #62b4ff; }
.recording-state-ready { border-color: #81efd255; background: #0e443b33; color: #c7fff1 !important; }
.recording-state-ready::before { background: #81efd2; }
.recording-state-error, .recording-state-archive_error, .recording-state-conversion_error { border-color: #f38b8b88; background: #392023; color: #ffd6d8 !important; }
.recording-state-error::before, .recording-state-archive_error::before, .recording-state-conversion_error::before { background: #ff7676; }
.recording-player-card #recording-player-status { margin: 9px 0 0; }
.recording-row .recording-error { margin-top: 5px; color: #ffb5b5; }
.recording-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.recording-actions button { min-height: 38px; padding: 8px 12px; font-size: 12px; }
.recording-download-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; border: 1px solid #38baf2; border-radius: 10px; padding: 9px 14px; background: #205a78; color: #effaff; font-size: 12px; font-weight: 700; line-height: 1.2; text-align: center; text-decoration: none; transition: background .16s ease, border-color .16s ease; }
.recording-download-button:hover { border-color: #66d0ff; background: #286b8e; }
.recording-convert-button { min-height: 38px; border: 1px solid #b68cff; border-radius: 10px; padding: 9px 14px; background: #593c81; color: #f6eeff; font-size: 12px; font-weight: 700; line-height: 1.2; transition: background .16s ease, border-color .16s ease; }
.recording-convert-button:hover:not(:disabled) { border-color: #d0b5ff; background: #6a4b95; }
.recording-convert-button:disabled { opacity: .65; cursor: wait; }
.recording-actions .danger { background: #51282d; color: #ffd6d8; }
.recordings-empty { padding: 24px; color: var(--muted); text-align: center; }
@media (max-width: 620px) {
  .recording-row { grid-template-columns: 1fr; }
  .recording-actions { justify-content: flex-start; }
  .recordings-page > .pagehead { align-items: center; }
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
@media (max-width: 800px) {
  header, main { padding: 22px; }
  header { padding-top: max(22px, env(safe-area-inset-top, 0px)); }
  .tag { display: none; }
  .login { padding: 28px 0; }
  .signin { padding: 28px; }
  .screen { min-height: 220px; }
  .users-table { min-width: 760px; }
  .vm-status-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "heading" "states" "footer"; gap: 11px; }
  .vm-admin-actions { grid-column: 1; justify-self: stretch; }
  .vm-status-footer { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .vm-status-detail { grid-column: 1; grid-row: auto; }
}
@media (max-width: 620px) {
  body.mobile-nav-active {
    --mobile-safe-bottom: min(env(safe-area-inset-bottom, 0px), 18px);
    --mobile-nav-height: calc(52px + var(--mobile-safe-bottom));
    --mobile-header-height: calc(45px + max(14px, env(safe-area-inset-top, 0px)));
    display: flex;
    min-height: 100vh;
    min-height: 100svh;
    flex-direction: column;
    overscroll-behavior-y: none;
  }
  html:has(body.mobile-nav-active) { overscroll-behavior-y: none; }
  body.mobile-nav-active:not(.stream-viewport) { min-height: 100lvh; padding-top: var(--mobile-header-height); padding-bottom: var(--mobile-nav-height); }
  body.mobile-nav-active.stream-viewport { height: 100lvh; }
  body.mobile-nav-active:not(.stream-viewport) > main { display: flex; width: 100%; min-height: auto; flex: 1 0 auto; flex-direction: column; margin: 0 auto; }
  body.mobile-nav-active:not(.stream-viewport) > main > #dashboard:not([hidden]) { display: flex; width: 100%; flex: 1 0 auto; flex-direction: column; }
  body.mobile-nav-active:not(.stream-viewport) > main > #dashboard:not([hidden]) > .app-page:not([hidden]) { width: 100%; flex: 1 0 auto; }
  body.mobile-nav-active > header { position: fixed; z-index: 40; top: 0; right: 0; left: 0; width: 100%; margin: 0; }
  header { flex-wrap: nowrap; gap: 8px; padding: max(14px, env(safe-area-inset-top, 0px)) 16px 14px; }
  .brand { gap: 8px; font-size: 18px; letter-spacing: 1px; }
  .brand img { width: 30px; height: 30px; }
  .version-badge { transform: none; padding: 3px 7px; font-size: 10px; }
  .main-nav { display: none; }
  .vm-status-card { gap: 10px; padding: 11px; }
  .vm-status-heading { gap: 8px; }
  .vm-status-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .vm-status-heading h2 { font-size: 14px; }
  .vm-status-heading button { min-height: 32px; padding-inline: 9px; }
  .vm-status-grid { gap: 6px; }
  .vm-status-item { padding: 7px 8px; }
  .vm-status-item strong { gap: 5px; font-size: 11px; }
  .vm-admin-actions { gap: 6px; }
  .vm-admin-actions button { min-height: 34px; flex: 1 1 90px; padding-inline: 7px; font-size: 10px; }
  header #logout { margin-left: auto; }
  header #logout { min-height: 40px; padding: 8px 11px; font-size: 12px; }
  .mobile-nav:not([hidden]) {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    height: var(--mobile-nav-height);
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 6px;
    border-top: 1px solid #ffffff18;
    padding: 0 max(12px, env(safe-area-inset-right, 0px)) var(--mobile-safe-bottom) max(12px, env(safe-area-inset-left, 0px));
    background: #0e1724f5;
    box-shadow: 0 -12px 32px #0004;
    backdrop-filter: blur(18px);
  }
  .mobile-nav-item {
    display: flex;
    min-width: 0;
    min-height: 47px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 4px 8px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
  }
  .mobile-nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; }
  .mobile-nav-item.active { border-color: #81efd233; background: #81efd215; color: var(--accent); }
  .mobile-nav-more { position: relative; min-width: 0; }
  .mobile-more-toggle { width: 100%; cursor: pointer; }
  .mobile-more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    display: grid;
    width: min(228px, calc(100vw - 24px));
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px;
    background: #111a27f5;
    box-shadow: 0 14px 36px #0009;
    backdrop-filter: blur(18px);
  }
  .mobile-more-menu a { border-radius: 9px; padding: 12px; color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; }
  .mobile-more-menu a:hover, .mobile-more-menu a:focus-visible { background: #ffffff10; color: var(--accent); }
  body.stream-viewport > main { bottom: var(--mobile-nav-height); }
  .pagehead { align-items: flex-start; }
  .pagehead h1 { font-size: 32px; }
  .pagehead > div { min-width: 0; }
  .live-status-page > .pagehead,
  .live-status-page .users-heading,
  .recordings-page > .pagehead,
  .section-heading,
  .users-heading,
  .security-status-row { align-items: stretch; flex-direction: column; gap: 12px; }
  .live-status-page > .pagehead .pill,
  .live-status-page .users-heading .pill { align-self: flex-start; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .recordings-page > .pagehead > button { width: 100%; }
  .recording-actions { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: stretch; }
  .recording-actions > * { width: 100%; }
  .table-wrap { overflow: visible; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .admin-subnav { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .admin-subnav::-webkit-scrollbar { display: none; }
  .admin-subnav-link { flex: 0 0 auto; white-space: nowrap; }
  .users-table { display: block; width: 100%; min-width: 0; table-layout: auto; border-collapse: separate; }
  .users-table colgroup, .users-table thead { display: none; }
  .users-table tbody { display: grid; gap: 12px; }
  .users-table tbody tr { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(140deg, #192539, #101925); }
  .users-table tbody tr:hover { background: linear-gradient(140deg, #192539, #101925); }
  .users-table tbody td { display: grid; grid-template-columns: minmax(100px, .8fr) minmax(0, 1.2fr); align-items: start; gap: 12px; border-bottom: 1px solid #26354a99; padding: 11px 13px; overflow-wrap: anywhere; }
  .users-table tbody td:last-child { border-bottom: 0; }
  .users-table tbody td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.45; }
  .viewer-table tbody td { white-space: normal; }
  .viewer-table .empty-viewers { display: block; padding: 16px; text-align: left; }
  .users-table:not(.viewer-table) tbody td:last-child { display: block; }
  .users-table:not(.viewer-table) tbody td:last-child::before { display: block; margin-bottom: 9px; }
  .user-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; gap: 7px; }
  .users-table .user-action { width: 100%; min-height: 44px; padding: 7px 9px; font-size: 11px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
  .admin-page > .pagehead { flex-direction: column; }
  .stream-warning { align-items: stretch; flex-direction: column; gap: 12px; }
  .stream-warning button { width: 100%; }
  .admin-create-form { grid-template-columns: 1fr; }
  .admin-create-form button { grid-column: 1; width: 100%; }
  .stream-preferences-form { grid-template-columns: 1fr; }
  .stream-preferences-form button { width: 100%; }
  .sync-preferences-form { grid-template-columns: 1fr; }
  .sync-preferences-form button { width: 100%; }
  .sync-preferences-form output { text-align: center; }
  .player-preferences-form { grid-template-columns: 1fr; }
  .player-preferences-form button { width: 100%; }
  .player-controls { display: grid; grid-template-columns: 38px minmax(0, 1fr) 88px 38px 38px; grid-template-rows: 38px 24px; gap: 4px; min-height: 80px; padding: 7px; }
  #player-play { grid-area: 1 / 1; }
  #player-time { grid-area: 1 / 2; min-width: 0; font-size: 11px; }
  #player-live { grid-area: 1 / 3; min-width: 88px; min-height: 34px; gap: 5px; padding: 0 6px; font-size: 10px; }
  #player-mute { grid-area: 1 / 4; }
  #player-more { grid-area: 1 / 5; }
  .player-volume-control, #player-fullscreen { display: none; }
  .player-seek-control { grid-area: 2 / 1 / 3 / 6; min-width: 0; }
  .player-control-button { flex-basis: 38px; width: 38px; min-width: 38px; min-height: 38px; height: 38px; }
  .player-more-menu { right: 42px; bottom: calc(100% - 4px); width: min(256px, calc(100% - 52px)); }
  .preference-note { min-height: 0; }
  .passkey-add-form { grid-template-columns: 1fr; }
  .passkey-add-form button { width: 100%; }
  #invitation-box { grid-template-columns: 1fr; }
  #invitation-box p { grid-column: 1; }
  #invitation-box button { width: 100%; }
  .management { padding: 22px; }
}
@media (max-width: 420px) {
  .login-title-row { gap: 8px; }
  .login-title-row .symbol { width: 36px; height: 36px; }
  .login-title-row h2 { font-size: clamp(14px, 5vw, 18px); }
  .admin-create-form { grid-template-columns: 1fr; }
  .admin-create-form button { grid-column: 1; }
}
