:root {
  color-scheme: dark;
  --bg: #090b0d;
  --panel: #111519;
  --panel-soft: #161b20;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f6f7;
  --muted: #929ca5;
  --accent: #e7ff45;
  --accent-soft: rgba(231, 255, 69, 0.12);
  --danger: #ff6b6b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 75% -10%, #28301f 0, transparent 28%), var(--bg); color: var(--text); }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  height: 74px; padding: 0 clamp(20px, 5vw, 72px); display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line); background: rgba(9, 11, 13, 0.82); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand strong { display: block; font-size: 18px; line-height: 1; letter-spacing: .06em; }
.brand small { display: block; color: var(--muted); font-size: 9px; margin-top: 5px; letter-spacing: .22em; }
.brand-mark { width: 54px; height: 54px; border: 1px solid rgba(231,255,69,.35); border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); box-shadow: 0 0 60px rgba(231,255,69,.12); }
.brand-mark span { width: 18px; height: 18px; border: 4px solid var(--accent); border-radius: 50%; position: relative; }
.brand-mark span::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); top: 2px; right: -11px; box-shadow: 0 0 12px var(--accent); }
.brand-mark.compact { width: 38px; height: 38px; }
.brand-mark.compact span { transform: scale(.72); }
.topbar-actions, .hero-actions { display: flex; align-items: center; gap: 12px; }
.status-pill { display: flex; gap: 8px; align-items: center; padding: 9px 13px; background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(231,255,69,.2); border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.status-pill[data-state="reconnecting"] { color: var(--danger); background: rgba(255,107,107,.1); border-color: rgba(255,107,107,.2); }
.status-pill[data-state="reconnecting"] .dot { background: var(--danger); box-shadow: 0 0 12px var(--danger); }

.dashboard { width: min(1420px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 70px; }
.hero { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 24px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .22em; margin: 0 0 12px; }
h1 { max-width: 780px; font-size: clamp(36px, 6vw, 72px); letter-spacing: -.06em; line-height: .98; margin: 0 0 18px; }
h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.muted { color: var(--muted); max-width: 650px; font-size: 15px; line-height: 1.7; }
.hero-note { margin: 0; color: var(--muted); font-size: 15px; }
.primary-button, .secondary-button, .ghost-button {
  border: 0; border-radius: 10px; padding: 12px 18px; cursor: pointer; font-weight: 750; text-decoration: none; transition: transform .15s ease, opacity .15s ease, background .15s ease;
}
.primary-button { background: var(--accent); color: #111409; }
.secondary-button { background: var(--panel-soft); border: 1px solid var(--line); color: var(--text); }
.ghost-button { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.primary-button:hover, .secondary-button:hover, .ghost-button:hover { transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled, .ghost-button:disabled { opacity: .38; cursor: not-allowed; transform: none; }
.secondary-button[data-enabled="true"] { color: var(--accent); border-color: rgba(231,255,69,.32); background: var(--accent-soft); }
.compact-button { padding: 12px 16px; }

.stream-card, .details-card, .metric-card, .recordings-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(255,255,255,.035), transparent), var(--panel); border-radius: 18px; overflow: hidden; box-shadow: 0 25px 80px rgba(0,0,0,.22); }
.stream-header { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.stream-header div { display: flex; align-items: center; gap: 12px; }
.stream-header strong { color: var(--text); font-size: 13px; }
.live-indicator { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; display: flex; align-items: center; gap: 6px; transition: color .2s ease; }
.live-indicator i { width: 6px; height: 6px; background: var(--muted); border-radius: 50%; transition: background .2s ease, box-shadow .2s ease; }
.live-indicator[data-live="true"] { color: var(--accent); }
.live-indicator[data-live="true"] i { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.video-stage { aspect-ratio: 16 / 9; background: #030405; position: relative; display: grid; place-items: center; overflow: hidden; }
.video-stage img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; transition: transform .25s ease; }
.video-stage[data-rotated="true"] img { transform: rotate(180deg); }
.video-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 100px rgba(0,0,0,.25); }

.metrics-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 14px 0; }
.metric-card { padding: 20px; min-height: 136px; display: flex; flex-direction: column; }
.metric-card span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .14em; }
.metric-card strong { font-size: clamp(24px, 3vw, 38px); letter-spacing: -.04em; margin: auto 0 4px; }
.metric-card small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.battery-reading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: auto 0 4px; }
.battery-reading strong { margin: 0; font-size: clamp(20px, 2.4vw, 34px); }
.battery-icon { width: 42px; height: 20px; padding: 3px; border: 2px solid var(--muted); border-radius: 5px; position: relative; flex: 0 0 auto; }
.battery-icon::after { content: ""; position: absolute; width: 4px; height: 8px; right: -7px; top: 4px; border-radius: 0 3px 3px 0; background: var(--muted); }
.battery-icon i { display: block; width: 0; height: 100%; border-radius: 2px; background: var(--accent); transition: width .35s ease, background .35s ease; }
.battery-card[data-level="medium"] .battery-icon i { background: #ffc857; }
.battery-card[data-level="low"] .battery-icon i { background: var(--danger); }
.battery-card[data-available="false"] .battery-icon { opacity: .35; }
.battery-card[data-available="false"] .battery-reading strong { color: var(--muted); font-size: clamp(18px, 2vw, 28px); }
.details-card { padding: 24px; display: flex; align-items: start; justify-content: space-between; gap: 40px; }
.details-card dl { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; flex: 1; margin: 0; }
.details-card dl div { padding: 12px 14px; background: rgba(255,255,255,.025); border-radius: 10px; }
.details-card dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 8px; }
.details-card dd { margin: 0; font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.recordings-card { margin: 14px 0; padding: 24px; }
.recordings-header, .recording-item, .recording-player > div { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.recording-state { display: grid; gap: 5px; text-align: right; }
.recording-state strong { font-size: 13px; }
.recording-state strong[data-active="true"] { color: var(--accent); }
.recording-state small, .recording-item small, .recordings-empty { color: var(--muted); font-size: 11px; }
.recording-player { margin: 22px 0; padding: 16px; background: #050607; border: 1px solid var(--line); border-radius: 12px; }
.recording-player[hidden] { display: none; }
.recording-player video { display: block; width: 100%; max-height: 70vh; margin-top: 14px; background: #000; border-radius: 8px; }
.recordings-list { display: grid; gap: 8px; margin-top: 20px; }
.recording-item { padding: 14px; background: rgba(255,255,255,.025); border-radius: 10px; }
.recording-item > div { display: flex; align-items: center; gap: 9px; }
.recording-item > div:first-child { align-items: start; flex-direction: column; }
.recordings-empty { margin: 12px 0 0; }

.login-body { display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #252d1b, transparent 38%), var(--bg); }
.login-shell { width: min(100% - 32px, 430px); }
.login-panel { padding: 44px; border: 1px solid var(--line); border-radius: 22px; background: rgba(17,21,25,.86); box-shadow: 0 30px 120px rgba(0,0,0,.45); backdrop-filter: blur(18px); }
.login-panel .brand-mark { margin-bottom: 36px; }
.login-panel h1 { font-size: 42px; max-width: none; }
.login-form { display: grid; gap: 12px; margin-top: 30px; }
.login-form label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; }
.login-form input { width: 100%; padding: 15px 16px; border: 1px solid var(--line); border-radius: 10px; background: #0b0e10; color: var(--text); outline: none; font-size: 20px; letter-spacing: .18em; }
.login-form input:focus { border-color: rgba(231,255,69,.5); box-shadow: 0 0 0 4px rgba(231,255,69,.08); }
.login-form .primary-button { margin-top: 4px; }
.form-error { min-height: 20px; color: var(--danger); font-size: 12px; margin: 0; }
.local-note { margin: 25px 0 0; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 11px; }

@media (max-width: 900px) {
  .hero, .details-card { align-items: stretch; flex-direction: column; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .details-card dl { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .dashboard { width: min(100% - 24px, 1420px); padding-top: 28px; }
  .topbar { height: 64px; padding: 0 14px; }
  .topbar .status-pill { display: none; }
  h1 { font-size: 42px; }
  .hero-actions { align-items: stretch; flex-direction: column; }
  .metrics-grid, .details-card dl { grid-template-columns: 1fr; }
  .login-panel { padding: 30px; }
  .recordings-header, .recording-item { align-items: stretch; flex-direction: column; }
  .recording-state { text-align: left; }
  .recording-item > div:last-child { display: grid; grid-template-columns: 1fr 1fr; }
}
