.global-theme-toggle {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    right: max(1rem, env(safe-area-inset-right));
    z-index: 80;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.42);
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.92);
    color: #e2e8f0;
    font: 600 0.82rem/1 system-ui, sans-serif;
    box-shadow: 0 0.75rem 2rem rgba(2, 6, 23, 0.2);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.global-theme-toggle:hover,
.global-theme-toggle:focus-visible {
    border-color: #2688eb;
    outline: none;
}

.global-theme-toggle svg {
    width: 1rem;
    height: 1rem;
}

html[data-theme="light"] .global-theme-toggle {
    background: rgba(255, 255, 255, 0.94);
    color: #1e293b;
}

html[data-theme="dark"] {
    --legal-bg: #0b1220;
    --legal-surface: #111b2d;
    --legal-ink: #e5edf7;
    --legal-muted: #9aa9bc;
    --legal-line: #26354a;
    --legal-blue: #60a5fa;
    --legal-draft-bg: #382f12;
    --legal-draft-line: #8b6d22;
}

html[data-theme="light"] body.admin-pending,
html[data-theme="light"] body.admin-ready {
    background: #f4f7fb !important;
    color: #1e293b !important;
}

html[data-theme="light"] body.admin-ready .bg-slate-950,
html[data-theme="light"] body.admin-ready .bg-slate-900 {
    background-color: #ffffff !important;
}

html[data-theme="light"] body.admin-ready .bg-slate-800 {
    background-color: #f1f5f9 !important;
}

html[data-theme="light"] body.admin-ready .text-slate-100,
html[data-theme="light"] body.admin-ready .text-slate-200,
html[data-theme="light"] body.admin-ready .text-white {
    color: #1e293b !important;
}

html[data-theme="light"] body.admin-ready .text-slate-300,
html[data-theme="light"] body.admin-ready .text-slate-400 {
    color: #64748b !important;
}

html[data-theme="light"] body.admin-ready .border-slate-700,
html[data-theme="light"] body.admin-ready .border-slate-800 {
    border-color: #dbe3ee !important;
}

@media (max-width: 640px) {
    .global-theme-toggle {
        top: max(0.75rem, env(safe-area-inset-top));
        right: max(0.75rem, env(safe-area-inset-right));
    }

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