:root {
    --bg: #0e1114;
    --bg-soft: #1b2126;
    --bg-mid: #2b3136;
    --panel: rgba(17, 21, 26, 0.96);
    --panel-soft: rgba(22, 27, 32, 0.9);
    --text: #f4f6f8;
    --muted: #9ca7b1;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(124, 255, 0, 0.18);
    --accent: #7cff00;
    --accent-soft: #b2ff66;
    --accent-glow: rgba(124, 255, 0, 0.18);
    --success: #74d39d;
    --warning: #f0cc58;
    --danger: #ff7272;
    --shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
}

* {
    box-sizing: border-box;
}

html {
    background: #0b0e11;
}

body {
    margin: 0;
    color: var(--text);
    font-family: "Segoe UI", "Noto Sans", sans-serif;
    background:
        radial-gradient(circle at top right, rgba(124, 255, 0, 0.05), transparent 22%),
        linear-gradient(180deg, #0b0e11, #101419 42%, #0d1115);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0.01)),
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 95px,
            rgba(124, 255, 0, 0.022) 96px
        );
    opacity: 0.22;
}

a {
    color: inherit;
    text-decoration: none;
}

code, input, textarea, select {
    font-family: Consolas, "SFMono-Regular", monospace;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
    position: relative;
    z-index: 1;
}

.sidebar,
.content {
    position: relative;
}

.sidebar {
    padding: 34px 28px;
    background:
        linear-gradient(180deg, rgba(15, 18, 22, 0.98), rgba(12, 15, 18, 0.96)),
        linear-gradient(135deg, rgba(124, 255, 0, 0.035), transparent 26%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.content {
    padding: 34px;
}

.content-auth-only {
    min-height: 100vh;
    padding: 0;
}

.brand-lockup {
    display: grid;
    gap: 14px;
}

.brand-type {
    display: grid;
    gap: 6px;
}

.eyebrow {
    margin: 0;
    color: var(--accent-soft);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.76rem;
}

.brand-wordmark {
    margin: 0;
    font-size: clamp(2.1rem, 4vw, 3rem);
    line-height: 0.94;
    font-weight: 800;
    color: #f3f5f7;
}

.brand-subline {
    margin: 0;
    color: #dbe1e5;
    text-transform: uppercase;
    letter-spacing: 0.42em;
    font-size: 0.78rem;
}

.muted {
    color: var(--muted);
}

.hero-card {
    display: grid;
    gap: 16px;
    padding: 22px;
    border-radius: 22px;
    background:
        linear-gradient(180deg, rgba(20, 24, 28, 0.96), rgba(17, 21, 25, 0.92));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero-card h2,
.auth-head h2 {
    margin: 0;
    font-size: clamp(1.7rem, 3vw, 2.35rem);
    line-height: 1.05;
}

.hero-card p,
.auth-head p {
    margin: 0;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(124, 255, 0, 0.08);
    border: 1px solid rgba(124, 255, 0, 0.16);
    color: var(--accent-soft);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
}

.hero-chip::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.hero-points {
    margin: 0;
    padding-left: 18px;
    display: grid;
    gap: 8px;
    color: var(--muted);
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a {
    padding: 14px 16px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.nav a:hover {
    background: rgba(124, 255, 0, 0.08);
    border-color: rgba(124, 255, 0, 0.16);
    transform: translateX(2px);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

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

.guest-stage {
    position: relative;
    min-height: 100vh;
}

.guest-stage-backdrop {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(10, 13, 16, 0.86) 0%, rgba(10, 13, 16, 0.54) 46%, rgba(10, 13, 16, 0.82) 100%),
        url("./branding/dronehub-wallpaper.png") center center / cover no-repeat;
    box-shadow:
        inset 0 0 0 1px rgba(124, 255, 0, 0.05);
}

.guest-stage-inner {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
}

.panel {
    position: relative;
    background:
        linear-gradient(180deg, rgba(20, 24, 28, 0.96), rgba(17, 21, 25, 0.94));
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.02),
        inset 0 0 0 999px rgba(124, 255, 0, 0.008);
}

.panel.narrow {
    max-width: 560px;
}

.auth-panel {
    width: min(100%, 520px);
    background:
        linear-gradient(180deg, rgba(18, 22, 26, 0.95), rgba(15, 19, 23, 0.92));
    backdrop-filter: blur(8px);
}

.auth-head {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.totp-qr-card {
    display: grid;
    place-items: center;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.totp-qr {
    display: grid;
    place-items: center;
    min-width: 208px;
    min-height: 208px;
    border-radius: 0;
    overflow: hidden;
    background: #11161a;
}

.totp-qr img {
    display: block;
    border-radius: 0;
}

.totp-qr table,
.totp-qr td {
    border-radius: 0;
    border: 0;
    padding: 0;
}

.action-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.inline-danger-form {
    margin-top: 14px;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin-bottom: 16px;
}

.grid {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

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

.stream-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(340px, 0.9fr);
    gap: 20px;
    align-items: start;
    margin-bottom: 20px;
}

.stream-layout.details-collapsed {
    grid-template-columns: minmax(0, 1fr) 0;
}

.stream-main,
.stream-side {
    min-width: 0;
}

.stream-side {
    transition: transform 180ms ease, opacity 180ms ease, width 180ms ease, padding 180ms ease, border-color 180ms ease;
    overflow: hidden;
}

.stream-layout.details-collapsed .stream-side {
    transform: translateX(24px);
    opacity: 0;
    padding-left: 0;
    padding-right: 0;
    border-color: transparent;
    pointer-events: none;
}

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

.stack {
    display: grid;
    gap: 14px;
}

.stack-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.list {
    display: grid;
    gap: 12px;
}

.stream-card {
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.stream-card:hover {
    border-color: rgba(124, 255, 0, 0.16);
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(124, 255, 0, 0.12);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 88px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid transparent;
}

.badge.live {
    background: rgba(116, 211, 157, 0.12);
    color: var(--success);
    border-color: rgba(116, 211, 157, 0.2);
}

.badge.offline,
.badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    border-color: rgba(255, 255, 255, 0.08);
}

.badge.disabled {
    background: rgba(255, 114, 114, 0.12);
    color: var(--danger);
    border-color: rgba(255, 114, 114, 0.18);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, #8bff18, #74d300);
    color: #101409;
    font-weight: 700;
    padding: 12px 16px;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(124, 255, 0, 0.18);
}

.button.ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text);
    box-shadow: none;
}

.button.danger {
    background: linear-gradient(180deg, #ff7c7c, #c14444);
    color: #fff;
}

label {
    display: grid;
    gap: 8px;
    font-weight: 600;
    color: #dbe2e8;
}

input, textarea, select {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    padding: 12px 14px;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

input:focus, textarea:focus, select:focus {
    border-color: rgba(124, 255, 0, 0.34);
    box-shadow: 0 0 0 4px rgba(124, 255, 0, 0.08);
    background: rgba(255, 255, 255, 0.05);
}

textarea {
    resize: vertical;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.checkbox input {
    width: auto;
}

.checkbox-list {
    display: grid;
    gap: 8px;
    max-height: 280px;
    overflow: auto;
    padding-right: 8px;
}

.flash {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.flash.success {
    background: rgba(116, 211, 157, 0.1);
    border-color: rgba(116, 211, 157, 0.18);
}

.flash.error {
    background: rgba(255, 114, 114, 0.12);
    border-color: rgba(255, 114, 114, 0.18);
}

.player-shell {
    margin-top: 18px;
    border-radius: 18px;
    overflow: hidden;
    background: #05080b;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-mode-switch {
    display: inline-flex;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 18px;
}

.player-mode-switch .button {
    min-width: 110px;
}

.player-mode-switch .button.is-active {
    background: linear-gradient(180deg, #8bff18, #74d300);
    color: #101409;
    border-color: transparent;
}

.detail-toggle {
    min-width: 168px;
}

.player-pane {
    display: none;
}

.player-pane.is-active {
    display: block;
}

video {
    width: 100%;
    min-height: 300px;
    background: #05080b;
}

.webrtc-frame {
    width: 100%;
    min-height: 560px;
    border: 0;
    background: #05080b;
}

.stream-meta {
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 18px;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.02);
}

.stream-meta + .stream-meta {
    margin-top: 16px;
}

.stream-meta summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    cursor: pointer;
    font-weight: 700;
}

.stream-meta summary::-webkit-details-marker {
    display: none;
}

.stream-meta[open] summary {
    margin-bottom: 16px;
}

.meta-copy {
    margin-top: 0;
    margin-bottom: 16px;
}

.url-grid {
    display: grid;
    gap: 8px;
}

.url-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.copy-button {
    min-width: 112px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    vertical-align: top;
}

.code-list {
    display: grid;
    gap: 8px;
    padding-left: 20px;
}

@media (max-width: 1100px) {
    .shell,
    .grid.two,
    .grid.stats,
    .stream-layout,
    .stream-layout.details-collapsed {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding-bottom: 18px;
    }

    .guest-stage-inner {
        padding: 30px;
    }

    .guest-stage-backdrop {
        background:
            linear-gradient(180deg, rgba(10, 13, 16, 0.88), rgba(10, 13, 16, 0.9)),
            url("./branding/dronehub-wallpaper.png") center / cover no-repeat;
    }

    .stream-layout.details-collapsed .stream-side {
        transform: none;
        opacity: 1;
        padding-left: 24px;
        padding-right: 24px;
        border-color: rgba(255, 255, 255, 0.08);
        pointer-events: auto;
    }
}

@media (max-width: 640px) {
    .content,
    .sidebar {
        padding: 22px 18px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .guest-stage-inner {
        padding: 22px;
    }

    .panel {
        padding: 18px;
        border-radius: 20px;
    }

    .stream-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .url-row {
        grid-template-columns: 1fr;
    }

    .webrtc-frame {
        min-height: 360px;
    }

    .brand-wordmark {
        font-size: clamp(1.9rem, 8vw, 2.4rem);
    }
}
