:root {
    --bg: #050811;
    --bg-elevated: #0b1120;
    --card: rgba(15, 23, 42, 0.76);
    --surface: rgba(9, 14, 27, 0.85);
    --border: rgba(71, 85, 105, 0.45);
    --border-bright: rgba(148, 163, 184, 0.35);
    --text: #f8fafc;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --success-hover: #16a34a;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --accent: #06b6d4;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(circle at 20% 10%, #0f172a 0%, var(--bg) 60%);
    color: var(--text);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.24;
    pointer-events: none;
    z-index: 0;
}

.glow-1 { width: 480px; height: 480px; background: #2563eb; top: -160px; left: -120px; }
.glow-2 { width: 440px; height: 440px; background: #06b6d4; bottom: -160px; right: -100px; }
.glow-3 { width: 320px; height: 320px; background: #7c3aed; top: 40%; left: 45%; opacity: 0.12; }

.glass-card {
    background: var(--card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.card-pad {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hidden {
    display: none !important;
}

/* ==================== BRAND & BADGES ==================== */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 8px 22px rgba(6, 182, 212, 0.32);
    flex-shrink: 0;
}

.brand-icon.lg {
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.brand-icon svg {
    width: 21px;
    height: 21px;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-name {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-sub {
    display: block;
    font-size: 0.74rem;
    color: var(--muted);
}

.pro-badge {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #a5f3fc;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(6, 182, 212, 0.3));
    border: 1px solid rgba(6, 182, 212, 0.45);
    padding: 2px 7px;
    border-radius: 999px;
}

h1 {
    font-size: 1.32rem;
    font-weight: 700;
    letter-spacing: -0.015em;
}

h2 {
    font-size: 0.98rem;
    font-weight: 700;
}

.subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.84rem;
}

/* ==================== LOGIN PAGE ==================== */
.login-screen {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 430px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrap input {
    width: 100%;
    padding-right: 60px;
}

.eye-btn {
    position: absolute;
    right: 10px;
    border: none;
    background: rgba(30, 41, 59, 0.8);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
}

.eye-btn:hover {
    color: var(--text);
}

.login-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--muted);
    cursor: pointer;
}

.check-row input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

.full-btn {
    width: 100%;
}

/* ==================== APP SHELL & SIDEBAR ==================== */
.app-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 272px 1fr;
    gap: 18px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 18px;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 18px;
    height: calc(100vh - 36px);
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    padding: 11px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-item span:nth-child(2) {
    flex: 1;
}

.nav-item:hover {
    background: rgba(30, 41, 59, 0.55);
    color: var(--text);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(6, 182, 212, 0.16));
    border-color: rgba(6, 182, 212, 0.42);
    color: #ffffff;
    box-shadow: 0 6px 18px rgba(6, 182, 212, 0.12);
}

.nav-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 999px;
}

.nav-item.active .nav-badge {
    color: #a5f3fc;
    border-color: rgba(6, 182, 212, 0.4);
}

.sidebar-spacer {
    flex: 1;
}

.sidebar-device-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.74rem;
    color: var(--muted);
    font-weight: 600;
}

.sd-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sd-body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sd-body > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sd-body strong {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sd-body span {
    font-size: 0.74rem;
    color: var(--muted);
}

.sd-telemetry {
    margin-top: 2px;
    font-size: 0.71rem !important;
    color: var(--accent) !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.telemetry-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}

.telemetry-pill.low-bat {
    border-color: rgba(245, 158, 11, 0.55);
    color: #fde68a;
}

.telemetry-pill.hot-temp {
    border-color: rgba(239, 68, 68, 0.6);
    color: #fecaca;
}

html[data-theme="light"] .telemetry-pill.low-bat {
    color: #b45309;
}

html[data-theme="light"] .telemetry-pill.hot-temp {
    color: #b91c1c;
}

.multi-telemetry {
    font-size: 0.74rem;
    color: var(--muted);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.sidebar-user-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    cursor: pointer;
    padding: 0;
}

.sidebar-user-link:hover strong {
    color: var(--accent);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-avatar.lg {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 1.35rem;
}

.user-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.user-meta strong {
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-meta span {
    font-size: 0.72rem;
    color: var(--muted);
}

/* ==================== MAIN AREA & TOPBAR ==================== */
.main-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.topbar {
    padding: 16px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.icon-btn {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    width: 38px;
    height: 38px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.icon-btn:hover {
    border-color: var(--border-bright);
}

.small-icon-btn {
    width: 32px;
    height: 32px;
    font-size: 0.9rem;
    font-weight: 700;
}

.mobile-only {
    display: none;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 0.84rem;
    font-weight: 600;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.dot.red { background: var(--danger); box-shadow: 0 0 8px rgba(239, 68, 68, 0.7); }
.dot.yellow { background: var(--warning); box-shadow: 0 0 8px rgba(245, 158, 11, 0.7); }
.dot.green {
    background: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.85);
    animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.22); opacity: 0.75; }
}

/* ==================== VIEWS & GRIDS ==================== */
.studio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

.devices-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 16px;
    align-items: start;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.link-btn {
    border: none;
    background: transparent;
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
}

.link-btn:hover {
    text-decoration: underline;
}

/* ==================== FORMS & BUTTONS ==================== */
.connection-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.connection-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--muted);
}

.url-field { flex: 1 1 200px; }
.id-field { width: 140px; }

.field input {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 10px 12px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.action-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.grow { flex: 1; }

.btn {
    border: none;
    border-radius: 10px;
    padding: 10px 15px;
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: background-color 0.15s, opacity 0.15s, transform 0.08s;
}

.btn.mini { padding: 6px 11px; font-size: 0.76rem; border-radius: 8px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.secondary { background: #1e293b; border: 1px solid var(--border); }
.btn.secondary:hover:not(:disabled) { background: #334155; }
.btn.success { background: var(--success); }
.btn.success:hover:not(:disabled) { background: var(--success-hover); }
.btn.danger { background: var(--danger); }
.btn.danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn.accent { background: linear-gradient(135deg, #06b6d4, #0284c7); }
.btn.accent:hover:not(:disabled) { filter: brightness(1.08); }

/* ==================== PAIRING & FLEET ==================== */
.pair-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(59, 130, 246, 0.14);
    border: 1px solid rgba(59, 130, 246, 0.45);
    border-radius: 12px;
    padding: 12px 14px;
}

.pair-meta { display: flex; flex-direction: column; gap: 3px; }
.pair-title { font-size: 0.83rem; }
.pair-expiry { font-size: 0.76rem; color: var(--muted); }
.pair-right { display: flex; align-items: center; gap: 10px; }
.pair-code {
    font-size: 1.55rem;
    letter-spacing: 0.16em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: #93c5fd;
}

.fleet-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.devices-count { color: var(--accent); font-size: 0.82rem; font-weight: 700; }
.devices-empty { font-size: 0.84rem; color: var(--muted); }

.fleet-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    transition: border-color 0.15s;
}

.fleet-card.selected {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.08);
}

.fleet-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fleet-info strong { font-size: 0.92rem; }
.fleet-info span { font-size: 0.78rem; color: var(--muted); }
.fleet-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ==================== CAMERA & AUDIO STUDIO ==================== */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cam-badges { display: flex; align-items: center; gap: 8px; }
.cam-pill {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 2px 9px;
    border-radius: 999px;
}

.camera-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #060a13;
    border-radius: 12px;
    border: 1px solid #1e293b;
    overflow: hidden;
    display: grid;
    place-items: center;
}

#cameraCanvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 0.88rem;
    background: rgba(6, 10, 19, 0.72);
    pointer-events: none;
}

.camera-stage:fullscreen {
    background: #000;
    border-radius: 0;
    border: none;
}

.viz-switch {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 4px;
}

.viz-btn {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
    cursor: pointer;
}

.viz-btn.active { background: #1e293b; color: var(--text); }

.audio-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: var(--muted);
}

.meter-readouts { display: flex; align-items: center; gap: 10px; }

.db-pill {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.76rem;
    color: var(--accent);
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.35);
    padding: 2px 8px;
    border-radius: 999px;
}

#waveformCanvas {
    width: 100%;
    height: 150px;
    background: #060a13;
    border-radius: 10px;
    border: 1px solid #1e293b;
}

.level-track {
    height: 8px;
    background: #060a13;
    border-radius: 999px;
    overflow: hidden;
}

.level-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e 0%, #06b6d4 55%, #f59e0b 82%, #ef4444 100%);
    transition: width 0.05s linear;
}

.slider-row { display: flex; align-items: center; gap: 10px; }
.volume-row {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    color: var(--muted);
}

.volume-row input[type="range"] { flex: 1; accent-color: var(--accent); }

.gate-readout {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    min-width: 36px;
    text-align: right;
}

.gate-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    color: var(--muted);
    background: var(--surface);
    white-space: nowrap;
}

.gate-badge.cutting {
    color: #a5f3fc;
    border-color: rgba(6, 182, 212, 0.5);
    background: rgba(6, 182, 212, 0.16);
}

.gate-badge.speech {
    color: #bbf7d0;
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.16);
}

.preset-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.phone-audio-box {
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.preset-label {
    font-size: 0.76rem;
    color: var(--muted);
}

.mini-chip {
    flex: 0 0 auto;
    padding: 6px 11px;
    font-size: 0.76rem;
}

.capture-filter-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-phones-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 14px;
}

.quick-phones-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
}

.quick-phones-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-phone-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.quick-phone-chip.active {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.14);
}

.inline-select-chip {
    flex: 1 1 140px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 10px;
    padding: 7px 11px;
    font-size: 0.8rem;
    font-weight: 600;
}

.inline-select-chip select {
    background: #0f172a;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 4px 8px;
    font-size: 0.78rem;
}

.capture-item video {
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    background: #060a13;
}

.log-search {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    padding: 6px 10px;
    font-size: 0.8rem;
    outline: none;
    min-width: 170px;
}

.gate-badge.alert-hot {
    color: #fecaca;
    border-color: rgba(239, 68, 68, 0.6);
    background: rgba(239, 68, 68, 0.22);
}

.studio-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toggle-chip {
    flex: 1 1 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.81rem;
    font-weight: 600;
    cursor: pointer;
}

.toggle-chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; background: #475569; }
.toggle-chip.active { border-color: var(--accent); background: rgba(6, 182, 212, 0.14); color: var(--text); }
.toggle-chip.active .chip-dot { background: var(--accent); box-shadow: 0 0 8px rgba(6, 182, 212, 0.8); }

.record-btn {
    flex: 1 1 125px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #1e293b;
    border: 1px solid var(--border);
}

.record-btn .rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); }
.record-btn.recording { background: rgba(239, 68, 68, 0.2); border-color: var(--danger); color: #fecaca; }
.record-btn.recording .rec-dot { animation: pulse-green 1s infinite; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label { font-size: 0.72rem; color: var(--muted); }
.stat strong { font-size: 0.9rem; }

/* ==================== CAPTURES & LOGS ==================== */
.captures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.capture-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.capture-item img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 10px;
    background: #060a13;
}

.capture-item audio {
    width: 100%;
    height: 36px;
}

.capture-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.capture-meta strong {
    font-size: 0.84rem;
    word-break: break-all;
}

.capture-meta span {
    font-size: 0.74rem;
    color: var(--muted);
}

.capture-actions {
    display: flex;
    gap: 8px;
}

.activity-log {
    list-style: none;
    max-height: 460px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.activity-log li {
    display: flex;
    gap: 10px;
    font-size: 0.82rem;
    color: #cbd5e1;
    background: var(--surface);
    border: 1px solid rgba(30, 41, 59, 0.9);
    border-radius: 9px;
    padding: 8px 12px;
}

.log-time {
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.error-banner,
.form-banner.error-banner {
    background: rgba(239, 68, 68, 0.14);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fecaca;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
}

.form-banner.success-banner {
    background: rgba(34, 197, 94, 0.14);
    border: 1px solid rgba(34, 197, 94, 0.45);
    color: #bbf7d0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
}

/* ==================== USERS & PROFILE ==================== */
.users-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
    align-items: start;
}

.profile-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.profile-hero-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.profile-hero-meta strong {
    font-size: 1.08rem;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.84rem;
}

.profile-row span {
    color: var(--muted);
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

html[data-theme="light"] .eye-btn {
    background: #e2e8f0;
    color: #334155;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-meta {
    font-size: 0.77rem;
    color: var(--muted);
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.role-pill,
.status-pill {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 8px;
    border-radius: 999px;
}

.role-pill {
    color: #bfdbfe;
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.role-pill.viewer {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.35);
}

.status-pill.active {
    color: #bbf7d0;
    background: rgba(34, 197, 94, 0.16);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.status-pill.disabled {
    color: #fecaca;
    background: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .studio-grid,
    .devices-grid,
    .users-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .app-shell {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .mobile-only {
        display: grid;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(2, 6, 23, 0.68);
        z-index: 40;
    }

    .sidebar {
        position: fixed;
        top: 12px;
        left: 12px;
        bottom: 12px;
        width: 270px;
        height: auto;
        z-index: 50;
        transform: translateX(-115%);
        transition: transform 0.22s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

@media (min-width: 961px) {
    .app-shell.sidebar-hidden {
        grid-template-columns: 1fr;
    }

    .app-shell.sidebar-hidden .sidebar {
        display: none;
    }
}

@media (max-width: 560px) {
    .controls-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== MULTI-VIEW GRID & MODALS ==================== */
.multi-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mini-select-chip {
    flex: 0 0 auto;
    padding: 5px 10px;
    font-size: 0.76rem;
}

.multi-summary-pill {
    margin-left: auto;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 11px;
    border-radius: 999px;
}

.multi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
}

.multi-grid.cols-1 {
    grid-template-columns: 1fr;
}

.multi-grid.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.multi-grid.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 960px) {
    .multi-grid.cols-2,
    .multi-grid.cols-3 {
        grid-template-columns: 1fr;
    }
}

.multi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.multi-card.listening {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.35);
}

.multi-card.loud {
    border-color: var(--danger);
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.45);
}

.multi-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.multi-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.multi-title-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.multi-title-wrap strong {
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multi-raw-id {
    font-size: 0.72rem;
    color: var(--muted);
}

.multi-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    background: #060a13;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.multi-stage canvas {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.multi-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #94a3b8;
    font-size: 0.82rem;
    background: rgba(6, 10, 19, 0.78);
    pointer-events: none;
}

.multi-mic-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(30, 41, 59, 0.9);
    overflow: hidden;
}

.multi-mic-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #06b6d4);
    transition: width 0.08s linear;
}

.multi-mic-fill.loud {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.multi-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn.flash-on {
    background: rgba(245, 158, 11, 0.25);
    border-color: var(--warning);
    color: #fde68a;
}

html[data-theme="light"] .btn.flash-on {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.72);
    backdrop-filter: blur(4px);
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.84rem;
}

.shortcut-row kbd {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(59, 130, 246, 0.16);
    border: 1px solid var(--border-bright);
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
    font-weight: 700;
}

/* ==================== LIGHT THEME ==================== */
html[data-theme="light"] {
    --bg: #eef2f7;
    --bg-elevated: #e2e8f0;
    --card: rgba(255, 255, 255, 0.9);
    --surface: rgba(241, 245, 249, 0.95);
    --border: rgba(148, 163, 184, 0.45);
    --border-bright: rgba(100, 116, 139, 0.55);
    --text: #0f172a;
    --muted: #475569;
}

html[data-theme="light"] body {
    background: radial-gradient(circle at 18% 10%, #e0f2fe 0%, var(--bg) 58%);
}

html[data-theme="light"] .ambient-glow {
    opacity: 0.14;
}

html[data-theme="light"] .glass-card {
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html[data-theme="light"] .nav-item:hover {
    background: rgba(226, 232, 240, 0.85);
}

html[data-theme="light"] .nav-item.active {
    color: #0369a1;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.16), rgba(6, 182, 212, 0.16));
}

html[data-theme="light"] .nav-item.active .nav-badge {
    color: #0369a1;
}

html[data-theme="light"] .pro-badge {
    color: #0369a1;
}

html[data-theme="light"] .btn.secondary {
    background: #e2e8f0;
    color: #0f172a;
}

html[data-theme="light"] .btn.secondary:hover:not(:disabled) {
    background: #cbd5e1;
}

html[data-theme="light"] .record-btn {
    background: #e2e8f0;
    color: #0f172a;
}

html[data-theme="light"] .record-btn.recording {
    background: rgba(239, 68, 68, 0.16);
    color: #b91c1c;
}

html[data-theme="light"] .activity-log li {
    color: #1e293b;
    border-color: rgba(203, 213, 225, 0.9);
}

html[data-theme="light"] .inline-select-chip select {
    background: #ffffff;
    color: #0f172a;
}

html[data-theme="light"] .gate-badge.cutting {
    color: #0e7490;
}

html[data-theme="light"] .gate-badge.speech {
    color: #15803d;
}

html[data-theme="light"] .gate-badge.alert-hot {
    color: #b91c1c;
}

html[data-theme="light"] .error-banner,
html[data-theme="light"] .form-banner.error-banner {
    color: #b91c1c;
}

html[data-theme="light"] .form-banner.success-banner {
    color: #15803d;
}

html[data-theme="light"] .role-pill {
    color: #1d4ed8;
}

html[data-theme="light"] .role-pill.viewer {
    color: #334155;
}

html[data-theme="light"] .status-pill.active {
    color: #15803d;
}

html[data-theme="light"] .status-pill.disabled {
    color: #b91c1c;
}
