:root {
    --primary: 99 102 241;
    --primary-hover: 79 70 229;
    --background: 11 17 32;
    --surface: 30 41 59;
    --text: 248 250 252;
    --muted: 169 184 205;
    --accent: 139 92 246;
    --panel: #151f32;
    --panel-soft: #1b2940;
    --line: rgba(148, 163, 184, 0.2);
    --nav-bg: rgba(11, 17, 32, 0.94);
    color-scheme: dark;
}

html[data-theme="light"] {
    --primary: 67 56 202;
    --primary-hover: 55 48 163;
    --background: 246 248 253;
    --surface: 255 255 255;
    --text: 20 30 51;
    --muted: 74 88 110;
    --accent: 109 40 217;
    --panel: #fff;
    --panel-soft: #eef2fa;
    --line: rgba(59, 76, 105, 0.2);
    --nav-bg: rgba(250, 251, 255, 0.95);
    color-scheme: light;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, system-ui, sans-serif;
    background: rgb(var(--background));
    color: rgb(var(--text));
}

*:focus-visible {
    outline: 3px solid #a5b4fc;
    outline-offset: 3px;
}

.site-main input:focus-visible,
.site-main select:focus-visible,
.site-main textarea:focus-visible {
    outline: 3px solid #a5b4fc;
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 10000;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    background: #fff;
    color: #0f172a;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: translateY(0);
}

html[data-theme] .site-nav {
    background: var(--nav-bg);
    border-color: var(--line);
}

.site-nav .brand { order: 0; }
.site-nav .nav-links-container { order: 1; margin-left: auto; }
.nav-actions { order: 2; display: flex; align-items: center; gap: 1rem; margin-left: 1.5rem; position: relative; z-index: 1002; }
.nav-links-container > div { gap: 1.25rem; }
.nav-user { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-control { display: flex; align-items: center; border: 1px solid var(--line); border-radius: .7rem; background: var(--panel); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.theme-toggle, .theme-system { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .45rem .65rem; color: rgb(var(--text)); cursor: pointer; }
.theme-toggle { gap: .4rem; border-radius: .65rem 0 0 .65rem; }
.theme-system { border-left: 1px solid var(--line); border-radius: 0 .65rem .65rem 0; color: rgb(var(--muted)); }
.theme-system[aria-pressed="true"] { color: #c7d2fe; background: rgb(var(--primary) / .16); }
html[data-theme="light"] .theme-system[aria-pressed="true"] { color: #3730a3; }
.theme-toggle:hover, .theme-system:hover { background: rgb(var(--primary) / .12); }
.theme-icon { width: 1rem; height: 1rem; }
html[data-theme="dark"] .theme-icon-moon, html[data-theme="light"] .theme-icon-sun { display: none; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: rgb(var(--text));
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.05em;
}

.brand img {
    border-radius: 0.55rem;
}

.brand-dot {
    color: #a5b4fc;
}

.nav-links-container a[aria-current="page"] {
    color: rgb(var(--text));
    text-decoration: underline;
    text-decoration-color: rgb(var(--primary));
    text-underline-offset: .5em;
}

.flash-container {
    top: 6rem;
    right: 1rem;
    left: auto;
    max-width: calc(100vw - 2rem);
}

.flash-container > div {
    min-width: 0;
}

.site-main {
    width: 100%;
    min-height: calc(100vh - 16rem);
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.site-main > * {
    min-width: 0;
}

.site-main [class~="bg-surface/50"],
.site-main [class~="bg-surface/30"] {
    border-color: var(--line);
    box-shadow: 0 12px 35px rgb(3 10 25 / .08);
}
.site-main table { min-width: 38rem; }
.site-main th { white-space: nowrap; }
.site-main th, .site-main td { border-color: var(--line); }
.site-main input:disabled { opacity: 1; background: var(--panel-soft); }
.site-main a, .site-main button { overflow-wrap: anywhere; }

.site-main input:not([type="checkbox"]),
.site-main select,
.site-main textarea {
    min-width: 0;
}

.site-main input::placeholder,
.site-main textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.site-main input:not([type="checkbox"]),
.site-main select,
.site-main textarea {
    border-color: var(--line);
}
.auth-card input { background: rgb(var(--background) / .7); }
.auth-card { text-align: left; }
.auth-card h1, .auth-card > p { text-align: left; }
.auth-card a:not(.page-button) { line-height: 1.5; }

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgb(var(--text));
}

.password-field { position: relative; }
.site-main .password-field input { padding-right: 5rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: .5rem;
    transform: translateY(-50%);
    min-width: 3.75rem;
    min-height: 2.5rem;
    border-radius: .5rem;
    color: rgb(var(--text));
    font-size: .8rem;
    font-weight: 700;
}
.password-toggle:hover { background: rgb(var(--primary) / .12); }
.password-toggle[hidden] { display: none; }
.password-field input::-ms-reveal { display: none; }

html[data-theme] .auth-card {
    background: var(--panel);
    border-color: var(--line);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid rgba(165, 180, 252, 0.25);
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: #c7d2fe;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-eyebrow::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: #a5b4fc;
}

.hero-title {
    letter-spacing: -0.055em;
}

.hero-title span {
    color: #a5b4fc;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1.5rem;
    color: #cbd5e1;
    font-size: 0.875rem;
}

.hero-meta span::before {
    content: "✓";
    margin-right: 0.45rem;
    color: #a5b4fc;
}

.preview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    text-align: left;
}

.preview-heading p {
    color: #94a3b8;
    font-size: 0.875rem;
}

.carousel-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.carousel-controls button {
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 0.65rem;
    color: #e2e8f0;
    font-size: 0.875rem;
}

.carousel-controls button:hover {
    background: rgba(255, 255, 255, 0.08);
}

.site-footer {
    border-top: 1px solid var(--line);
    background: rgb(var(--surface) / .35);
    color: rgb(var(--muted));
    margin-top: 4rem;
    padding: 3.5rem max(1.5rem, calc((100% - 1120px) / 2));
    text-align: left;
    font-size: .875rem;
}
.footer-inner { display: grid; grid-template-columns: 2fr repeat(3, 1fr); gap: 2rem; }
.footer-inner h2 { color: rgb(var(--text)); font-size: .8rem; font-weight: 700; margin-bottom: 1rem; }
.footer-inner a:not(.brand) { display: block; margin-top: .75rem; }
.footer-inner a:hover { color: rgb(var(--primary)); }
.footer-intro p { margin-top: .7rem; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 2.5rem; padding-top: 1.5rem; }

.page-shell { width: 100%; max-width: 1120px; margin: 0 auto; text-align: left; }
.page-hero { padding: 2rem 0 3rem; max-width: 760px; }
.page-hero h1 { font-size: clamp(2.4rem, 5vw, 4rem); line-height: 1.08; letter-spacing: -.045em; font-weight: 800; margin: 1rem 0; }
.page-hero p { color: rgb(var(--muted)); font-size: 1.1rem; line-height: 1.7; max-width: 64ch; }
.eyebrow { color: rgb(var(--primary)); font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 1.25rem; padding: clamp(1.35rem, 3vw, 2rem); box-shadow: 0 12px 35px rgb(3 10 25 / .08); }
.panel h2, .panel h3 { color: rgb(var(--text)); font-weight: 700; }
.panel p, .panel li { color: rgb(var(--muted)); line-height: 1.7; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.content-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.content-grid .panel { height: 100%; }
.content-grid h2, .content-grid h3 { font-size: 1.2rem; margin-bottom: .65rem; }
.section-heading { margin: 3rem 0 1.25rem; }
.section-heading h2 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.025em; }
.section-heading p { color: rgb(var(--muted)); margin-top: .4rem; }
.step-number { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .8rem; background: rgb(var(--primary) / .12); color: rgb(var(--primary)); font-weight: 800; margin-bottom: 1.2rem; }
.text-link { color: rgb(var(--primary)); font-weight: 700; text-decoration: underline; text-underline-offset: .2em; }
.page-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.page-button { display: inline-flex; align-items: center; justify-content: center; padding: .8rem 1.1rem; background: rgb(var(--primary)); color: white; border-radius: .75rem; font-weight: 700; }
.page-button:hover { background: rgb(var(--primary-hover)); }
.page-button.secondary { color: rgb(var(--text)); background: var(--panel); border: 1px solid var(--line); }
.faq-list { display: grid; gap: .75rem; }
.faq-list details { background: var(--panel); border: 1px solid var(--line); border-radius: 1rem; padding: 1.25rem 1.5rem; }
.faq-list summary { cursor: pointer; font-weight: 700; }
.faq-list details p { margin-top: .8rem; color: rgb(var(--muted)); line-height: 1.7; }
.legal-page { width: 100%; max-width: 900px; margin: 0 auto; text-align: left; }
.legal-page > div { background: var(--panel); border: 1px solid var(--line); border-radius: 1.25rem; padding: clamp(1.5rem, 4vw, 3rem); }
.legal-page h2 { scroll-margin-top: 6rem; }
.legal-page a { color: rgb(var(--primary)); text-decoration: underline; }
.admin-dialog { width: min(32rem, calc(100% - 2rem)); max-height: calc(100% - 2rem); margin: auto; padding: 0; border: 0; border-radius: 1rem; background: transparent; color: rgb(var(--text)); }
.admin-dialog::backdrop { background: rgba(15, 23, 42, .75); }

html[data-theme="light"] .blob { opacity: .07; }
html[data-theme="light"] .brand-dot,
html[data-theme="light"] .hero-title span { color: #4338ca; }
html[data-theme="light"] .hero-eyebrow { color: #3730a3; border-color: #c7d2fe; }
html[data-theme="light"] .hero-meta,
html[data-theme="light"] .preview-heading p { color: #475569; }
html[data-theme="light"] .carousel-controls button { color: #1e293b; border-color: var(--line); }
html[data-theme="light"] .carousel-controls button:hover { background: #e8edf7; }
html[data-theme="light"] .text-white,
html[data-theme="light"] [class~="text-white/80"],
html[data-theme="light"] .text-slate-300,
html[data-theme="light"] .text-slate-400 { color: #24334d; }
html[data-theme="light"] .bg-primary.text-white,
html[data-theme="light"] .bg-red-500.text-white { color: #fff; }
html[data-theme="light"] .bg-white { background-color: #24334d; color: #fff; }
html[data-theme="light"] [class~="bg-white/5"],
html[data-theme="light"] [class~="bg-white/3"],
html[data-theme="light"] [class~="bg-white/10"] { background-color: rgba(51, 65, 85, .05); }
html[data-theme="light"] [class~="bg-slate-800/40"],
html[data-theme="light"] [class~="bg-slate-900/50"] { background-color: #fff; }
html[data-theme="light"] [class~="border-white/5"],
html[data-theme="light"] [class~="border-white/10"],
html[data-theme="light"] [class~="border-slate-900/90"] { border-color: var(--line); }
html[data-theme="light"] [class~="divide-white/5"] > :not([hidden]) ~ :not([hidden]) { border-color: var(--line); }
html[data-theme="light"] [class~="hover:text-white"]:hover { color: #1e293b; }
html[data-theme="light"] [class~="hover:bg-white/10"]:hover,
html[data-theme="light"] [class~="hover:bg-white/5"]:hover { background-color: rgba(51, 65, 85, .09); }
html[data-theme="light"] [class~="text-blue-400"] { color: #1d4ed8; }
html[data-theme="light"] [class~="text-emerald-400"],
html[data-theme="light"] [class~="text-emerald-500"] { color: #047857; }
html[data-theme="light"] [class~="text-yellow-400"],
html[data-theme="light"] [class~="text-amber-500"] { color: #92400e; }
html[data-theme="light"] [class~="text-red-400"],
html[data-theme="light"] [class~="text-red-500"] { color: #b91c1c; }
html[data-theme="light"] .bg-slate-900\/80 { background-color: rgba(15, 23, 42, .65); }

@media (max-width: 1200px) {
    .nav-actions { margin-left: auto; }
    html[data-theme] .menu-toggle { display: flex; }
    html[data-theme] .nav-links-container {
        position: fixed;
        top: 5.5rem;
        right: 1rem;
        width: min(22rem, calc(100vw - 2rem));
        height: auto;
        max-height: calc(100vh - 6.5rem);
        max-height: calc(100dvh - 6.5rem);
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 1rem;
        box-shadow: 0 18px 50px rgb(3 10 25 / .25);
        overflow-y: auto;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }
    html[data-theme] .nav-links-container > div { flex-direction: column; align-items: stretch; gap: .3rem; padding: .75rem; }
    html[data-theme] .nav-links-container a, html[data-theme] .nav-user { text-align: left; padding: .7rem .85rem; font-size: 1rem; }
    .nav-user { max-width: none; }

    html[data-theme] .nav-links-container:not(.is-open) {
        visibility: hidden;
        pointer-events: none;
    }

    html[data-theme] .nav-links-container.is-open {
        right: 1rem;
        visibility: visible;
    }
}

@media (max-width: 767px) {
    .nav-actions { gap: .7rem; }
    .theme-toggle { padding-inline: .5rem; }
    .theme-system { padding-inline: .5rem; }

    .site-main {
        padding-top: 7rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .site-main footer,
    footer {
        margin-top: 4rem;
    }

    .preview-heading {
        display: block;
    }
    .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .footer-intro { grid-column: 1 / -1; }
    .content-grid, .content-grid.three { grid-template-columns: 1fr; }
    .page-hero { padding-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
