:root {
    --theme-page: #040b13;
    --theme-page-soft: #071421;
    --theme-panel: rgba(6, 20, 35, .94);
    --theme-panel-soft: rgba(9, 30, 49, .88);
    --theme-text: #eaf5ff;
    --theme-muted: #8ea6bc;
    --theme-line: rgba(80, 151, 195, .3);
    --theme-accent: #5be2ff;
    --theme-shadow: rgba(0, 0, 0, .38);
}

html[data-theme="light"] {
    --theme-page: #e8f1f8;
    --theme-page-soft: #dce9f3;
    --theme-panel: rgba(248, 252, 255, .96);
    --theme-panel-soft: rgba(232, 244, 252, .95);
    --theme-text: #0d2538;
    --theme-muted: #4f6b80;
    --theme-line: rgba(26, 98, 143, .25);
    --theme-accent: #087da5;
    --theme-shadow: rgba(28, 63, 88, .18);
}

.valhalla-theme-toggle {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 2147482000;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 2.55rem;
    padding: .55rem .8rem;
    border: 1px solid var(--theme-line);
    border-radius: 999px;
    background: var(--theme-panel);
    background: color-mix(in srgb, var(--theme-panel) 92%, transparent);
    box-shadow: 0 10px 28px var(--theme-shadow);
    color: var(--theme-text);
    font: 800 .63rem/1 system-ui, sans-serif;
    letter-spacing: .1em;
    backdrop-filter: blur(14px);
    cursor: pointer;
}

.valhalla-theme-toggle i {
    width: .72rem;
    height: .72rem;
    border: 2px solid var(--theme-accent);
    border-radius: 50%;
    box-shadow: inset -.2rem -.15rem 0 var(--theme-accent);
}

html[data-theme="light"] body {
    color: var(--theme-text);
    background-color: var(--theme-page) !important;
    background-image:
        radial-gradient(circle at 18% 0%, rgba(41, 178, 221, .13), transparent 35%),
        linear-gradient(145deg, var(--theme-page), var(--theme-page-soft)) !important;
}

html[data-theme="light"] :is(
    .access-header,
    .access-card,
    .admin-panel,
    .admin-status-grid article,
    .portal-card,
    .dashboard-shell,
    .command-section,
    .panel,
    .card,
    .hourly-panel,
    .flow-forge-card,
    .workspace-card,
    .record-card,
    .update-card
) {
    color: var(--theme-text);
    border-color: var(--theme-line) !important;
    background-color: var(--theme-panel) !important;
    box-shadow: 0 14px 36px var(--theme-shadow);
}

html[data-theme="light"] :is(
    p,
    small,
    label,
    .admin-panel-copy,
    .hero-copy,
    .risk-note,
    .panel-label
) {
    color: var(--theme-muted);
}

html[data-theme="light"] :is(h1, h2, h3, h4, strong, input, select, textarea) {
    color: var(--theme-text);
}

html[data-theme="light"] :is(input, select, textarea) {
    border-color: var(--theme-line);
    background: #f8fcff;
}

html[data-theme="light"] .protected-client-view::after,
html[data-theme="light"] body::after {
    opacity: .22;
}

@media (max-width: 560px) {
    .valhalla-theme-toggle {
        width: 2.8rem;
        justify-content: center;
        padding-inline: .5rem;
    }

    .valhalla-theme-toggle span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
}

@media print {
    .valhalla-theme-toggle {
        display: none !important;
    }
}
