html.qs-v3 {
    color-scheme: dark;
    --v3-bg: #071018;
    --v3-panel: #0b151f;
    --v3-panel-2: #0e1a25;
    --v3-line: #263541;
    --v3-line-strong: #3d5361;
    --v3-text: #edf3f5;
    --v3-muted: #91a1aa;
    --v3-live: #86c83d;
    --v3-motion: #f2a51a;
    --v3-audio: #29c3cf;
    --v3-speech: #4d8df7;
    --v3-context: #f06e5e;
    --v3-error: #ef5757;
}

html.qs-v3 body {
    background: var(--v3-bg);
    color: var(--v3-text);
    font-family: "Segoe UI", Tahoma, sans-serif;
    letter-spacing: 0;
}

html.qs-v3 .shell {
    padding: 8px;
}

html.qs-v3 .app {
    width: min(1920px, calc(100vw - 16px));
    height: calc(100dvh - 16px);
    gap: 8px;
}

html.qs-v3 .header {
    min-height: 44px;
    padding: 0 8px;
}

html.qs-v3 .title {
    font-size: 20px;
    letter-spacing: 0;
}

html.qs-v3 .panel,
html.qs-v3 .controls,
html.qs-v3 .video-overlay,
html.qs-v3 .archive-panel {
    border-color: var(--v3-line);
    border-radius: 6px;
    background: var(--v3-panel);
    box-shadow: none;
}

html.qs-v3 #appPanel {
    min-height: 0;
    padding: 8px;
    overflow: hidden;
}

html.qs-v3 .player-grid {
    grid-template-columns: minmax(0, 3fr) minmax(320px, 1fr);
    gap: 8px;
}

html.qs-v3 #singleViewPanel {
    grid-template-rows: minmax(0, 1fr) auto auto auto;
}

html.qs-v3 .video-wrapper {
    border-color: var(--v3-line);
    border-radius: 6px;
}

html.qs-v3 .video-vignette {
    display: none;
}

html.qs-v3 .timeline-dock {
    margin-top: 7px;
}

html.qs-v3 .video-overlay {
    padding: 8px;
}

html.qs-v3 .overlay-row {
    gap: 7px;
}

html.qs-v3 .overlay-row.status-line {
    min-height: 22px;
}

html.qs-v3 .overlay-row.day-row {
    grid-template-columns: minmax(180px, 1fr) auto;
    gap: 8px;
    padding-top: 5px;
    border-top: 1px solid var(--v3-line);
}

html.qs-v3 .timeline {
    height: 62px;
    border-color: var(--v3-line);
    border-radius: 4px;
    background: #071018;
}

html.qs-v3 .timeline-labels {
    color: var(--v3-muted);
}

html.qs-v3 .overlay-chip {
    background: rgba(134, 200, 61, 0.14);
    border-color: rgba(134, 200, 61, 0.5);
    color: #b5e47c;
}

html.qs-v3 .overlay-button,
html.qs-v3 .overlay-select,
html.qs-v3 .day-label {
    min-height: 30px;
    border: 1px solid var(--v3-line);
    border-radius: 5px;
    background: #0a141e;
    color: var(--v3-text);
    box-shadow: none;
}

html.qs-v3 button {
    border-radius: 5px;
    box-shadow: none;
    transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

html.qs-v3 button:hover {
    transform: none;
    box-shadow: none;
}

html.qs-v3 .player-controls {
    gap: 6px;
}

html.qs-v3 .v3-wall-select {
    width: 96px;
}

html.qs-v3 .player-controls .icon[title="Speed"] {
    display: none;
}

html.qs-v3 .overlay-volume {
    width: clamp(74px, 7vw, 116px);
}

html.qs-v3 .wall-mode-bar {
    display: none;
}

html.qs-v3 .camera-workspace {
    min-width: 0;
    padding: 0;
    overflow: hidden;
}

html.qs-v3 .camera-workspace > .grid,
html.qs-v3 .workspace-panel,
html.qs-v3 #workspacePanelCameras {
    min-height: 0;
    height: 100%;
}

html.qs-v3 #workspacePanelCameras {
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

html.qs-v3 .v3-catalog-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    gap: 6px;
    padding: 0 0 7px;
    background: var(--v3-panel);
}

html.qs-v3 .v3-catalog-search {
    width: 100%;
    min-width: 0;
    height: 34px;
    border: 1px solid var(--v3-line);
    border-radius: 5px;
    padding: 0 10px;
    background: #071018;
    color: var(--v3-text);
}

html.qs-v3 .v3-menu-button {
    width: 32px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--v3-line);
    background: #071018;
    color: var(--v3-muted);
}

html.qs-v3 .v3-settings-menu {
    position: absolute;
    z-index: 40;
    top: 40px;
    right: 0;
    width: 230px;
    padding: 8px;
    border: 1px solid var(--v3-line-strong);
    border-radius: 6px;
    background: #0b151f;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.38);
}

html.qs-v3 .v3-settings-menu[hidden] {
    display: none;
}

html.qs-v3 .v3-settings-menu label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--v3-text);
    font-size: 12px;
}

html.qs-v3 .camera-list {
    gap: 8px;
    min-height: 0;
    overflow: auto;
    padding: 0 3px 6px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--v3-line-strong) transparent;
}

html.qs-v3 .camera-device-group {
    display: grid;
    gap: 5px;
}

html.qs-v3 .camera-device-title {
    position: sticky;
    top: 0;
    z-index: 4;
    min-height: 30px;
    border: 0;
    border-bottom: 1px solid var(--v3-line);
    border-radius: 0;
    background: rgba(11, 21, 31, 0.96);
    box-shadow: none;
}

html.qs-v3 .camera-device-toggle {
    min-height: 30px;
    padding: 4px 5px;
}

html.qs-v3 .camera-device-cameras {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
    gap: 6px;
}

html.qs-v3 .camera-button {
    position: relative;
    grid-template-columns: 116px minmax(0, 1fr);
    grid-template-rows: auto 28px;
    column-gap: 8px;
    row-gap: 3px;
    height: 92px;
    min-height: 92px;
    padding: 6px;
    border-color: var(--v3-line);
    border-radius: 6px;
    background: #0a141e;
}

html.qs-v3 .camera-button:hover {
    border-color: var(--v3-line-strong);
    background: #0d1924;
}

html.qs-v3 .camera-button.active {
    border-color: rgba(134, 200, 61, 0.82);
    background: #101d25;
    box-shadow: inset 3px 0 0 var(--v3-live);
}

html.qs-v3 .v3-camera-thumb {
    grid-row: 1 / 3;
    grid-column: 1;
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 4px;
    background: #03080c;
}

html.qs-v3 .v3-camera-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    opacity: 0;
    transition: opacity 180ms ease;
}

html.qs-v3 .v3-camera-thumb img.ready {
    opacity: 1;
}

html.qs-v3 .v3-camera-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: inherit;
    pointer-events: none;
}

html.qs-v3 .camera-button-title {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    gap: 4px;
}

html.qs-v3 .camera-button-label {
    color: var(--v3-text);
    font-size: 12px;
    font-weight: 600;
}

html.qs-v3 .camera-button-actions {
    gap: 3px;
}

html.qs-v3 .camera-settings-link,
html.qs-v3 .camera-map-link,
html.qs-v3 .camera-button-status,
html.qs-v3 .camera-quality-link,
html.qs-v3 .v3-pin-button {
    width: 22px;
    min-width: 22px;
    height: 22px;
    border-radius: 4px;
}

html.qs-v3 .camera-button:not(:hover):not(.active) .camera-settings-link,
html.qs-v3 .camera-button:not(:hover):not(.active) .camera-map-link {
    display: none;
}

html.qs-v3 .v3-pin-button {
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--v3-line-strong);
    background: transparent;
    color: var(--v3-muted);
}

html.qs-v3 .v3-pin-button svg {
    width: 13px;
    height: 13px;
}

html.qs-v3 .v3-pin-button.active {
    border-color: rgba(134, 200, 61, 0.6);
    color: var(--v3-live);
    background: rgba(134, 200, 61, 0.12);
}

html.qs-v3 .v3-mini-pulse {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    height: 26px;
    align-self: end;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

html.qs-v3 .v3-pulse-empty {
    opacity: 0.38;
}

html.qs-v3 .workspace-tab {
    border-color: var(--v3-line);
    border-radius: 5px;
    background: #0a141e;
}

html.qs-v3 .workspace-tab.active {
    border-color: rgba(134, 200, 61, 0.62);
    color: #dff5c5;
    background: rgba(134, 200, 61, 0.1);
}

html.qs-v3 body.v3-map-mode .player-grid {
    grid-template-columns: minmax(0, 1fr);
}

html.qs-v3 body.v3-map-mode .player-grid > .grid:first-child {
    display: none;
}

html.qs-v3 body.v3-map-mode .camera-map-shell {
    grid-template-rows: minmax(0, 1fr) auto;
    height: 100%;
}

html.qs-v3 body.v3-map-mode .camera-map-canvas {
    height: 100%;
    min-height: 520px;
    border-radius: 6px;
}

html.qs-v3 .camera-map-marker {
    box-shadow: 0 0 0 3px rgba(134, 200, 61, 0.16);
}

html.qs-v3 .camera-map-item {
    border-radius: 5px;
    border-color: var(--v3-line);
    box-shadow: none;
}

@media (max-width: 900px) {
    html.qs-v3 body {
        overflow: auto;
    }

    html.qs-v3 .shell {
        display: block;
        padding: 0;
        overflow: visible;
    }

    html.qs-v3 .app {
        width: 100%;
        min-height: 100dvh;
        height: auto;
        gap: 0;
    }

    html.qs-v3 .header {
        position: sticky;
        top: 0;
        z-index: 30;
        min-height: 48px;
        background: rgba(7, 16, 24, 0.96);
        border-bottom: 1px solid var(--v3-line);
    }

    html.qs-v3 #appPanel {
        overflow: visible;
        padding: 6px;
    }

    html.qs-v3 .player-grid {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        gap: 7px;
    }

    html.qs-v3 #singleViewPanel {
        height: auto;
        grid-template-rows: auto auto auto auto;
    }

    html.qs-v3 .video-wrapper {
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 0;
    }

    html.qs-v3 .timeline {
        height: 48px;
    }

    html.qs-v3 .overlay-row.day-row {
        grid-template-columns: minmax(0, 1fr);
    }

    html.qs-v3 .player-controls {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 2px;
    }

    html.qs-v3 .camera-workspace {
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    html.qs-v3 .camera-workspace > .grid,
    html.qs-v3 .workspace-panel,
    html.qs-v3 #workspacePanelCameras {
        height: auto;
        overflow: visible;
    }

    html.qs-v3 #workspacePanelCameras {
        display: grid;
    }

    html.qs-v3 .v3-catalog-toolbar {
        top: 48px;
        padding: 6px 0;
    }

    html.qs-v3 .camera-list {
        overflow: visible;
        max-height: none;
    }

    html.qs-v3 .camera-device-title {
        top: 88px;
    }

    html.qs-v3 .camera-button {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: minmax(150px, 44vw) auto 30px;
        width: 100%;
        height: auto;
        min-height: 210px;
        padding: 6px;
    }

    html.qs-v3 .v3-camera-thumb {
        grid-column: 1;
        grid-row: 1;
    }

    html.qs-v3 .camera-button-title {
        grid-column: 1;
        grid-row: 2;
        padding-top: 3px;
    }

    html.qs-v3 .v3-mini-pulse {
        grid-column: 1;
        grid-row: 3;
        height: 30px;
    }

    html.qs-v3 body.v3-map-mode .camera-map-canvas {
        min-height: 62dvh;
    }
}
