:root {
    color-scheme: dark;

    --bg: #080f1c;
    --surface: #101b2d;
    --surface-raised: #17243a;
    --surface-hover: #1d2e47;

    --border: #293b53;
    --border-light: #3a4e68;

    --text: #edf4fc;
    --text-secondary: #acbbcf;
    --muted: #8294ac;

    --accent: #60d5fa;
    --accent-hover: #91e4ff;
    --accent-dark: #082d40;

    --success: #48d6a0;
    --warning: #f4c66a;
    --danger: #ff8088;

    --radius: 12px;
    --radius-small: 8px;
    --shadow: 0 24px 80px rgba(0, 0, 0, .35);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-size: 16px;
}

body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(
            ellipse at 50% 0%,
            #162c45 0%,
            transparent 55%
        ),
        var(--bg);
    color: var(--text);
    font-family:
        system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    line-height: 1.3;
    font-weight: 650;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* Authentication layout */

.auth-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

.auth-container {
    width: 100%;
    max-width: 460px;
}

.auth-container-wide {
    max-width: 640px;
}

/* Branding */

.brand {
    text-align: center;
    margin-bottom: 32px;
}

.brand-symbol {
    display: inline-flex;
    width: 64px;
    height: 64px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border: 1px solid var(--border-light);
    border-radius: 20px;
    background: var(--surface-raised);
    color: var(--accent);
    box-shadow: 0 0 40px rgba(96, 213, 250, .08);
}

.brand-symbol svg {
    width: 34px;
    height: 34px;
}

.brand-name {
    margin: 0;
    color: var(--text);
    font-size: 1.7rem;
    font-weight: 750;
    letter-spacing: -.05em;
}

.brand-name span {
    color: var(--accent);
}

.brand-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .78rem;
    letter-spacing: .18em;
    text-transform: uppercase;
}

/* Panels */

.panel {
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.panel-header {
    margin-bottom: 26px;
}

.panel-header h1 {
    margin-bottom: 8px;
    font-size: 1.4rem;
}

.panel-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: .9rem;
}

/* Forms */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    color: var(--text-secondary);
    font-size: .85rem;
    font-weight: 600;
}

.form-input {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-small);
    background: var(--bg);
    color: var(--text);
    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

.form-input::placeholder {
    color: var(--muted);
}

.form-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 213, 250, .12);
}

.form-input:disabled {
    cursor: not-allowed;
    opacity: .6;
}

.form-hint {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: .8rem;
}

.code-input {
    text-align: center;
    font-family: ui-monospace, monospace;
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: .3em;
}

/* Buttons */

.btn {
    display: inline-flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-small);
    cursor: pointer;
    font-weight: 650;
    transition:
        background .15s ease,
        border-color .15s ease;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-dark);
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: var(--accent-dark);
}

.btn-secondary {
    border-color: var(--border-light);
    background: var(--surface-raised);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* Notifications */

.alert {
    margin-bottom: 20px;
    padding: 12px 15px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-small);
    font-size: .88rem;
    overflow-wrap: anywhere;
}

.alert-error {
    color: var(--danger);
    border-color: rgba(255, 128, 136, .3);
    background: rgba(255, 128, 136, .07);
}

.alert-success {
    color: var(--success);
    border-color: rgba(72, 214, 160, .3);
    background: rgba(72, 214, 160, .07);
}

.alert-warning {
    color: var(--warning);
    border-color: rgba(244, 198, 106, .3);
    background: rgba(244, 198, 106, .07);
}

.alert-info {
    color: var(--accent);
    border-color: rgba(96, 213, 250, .3);
    background: rgba(96, 213, 250, .07);
}

/* Enrollment and recovery */

.setup-secret {
    padding: 16px;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-small);
    background: var(--bg);
    color: var(--accent);
    font-family: ui-monospace, monospace;
    font-size: 1rem;
    text-align: center;
    overflow-wrap: anywhere;
    user-select: all;
}

.recovery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 24px 0;
}

.recovery-code {
    padding: 12px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: ui-monospace, monospace;
    font-size: .75rem;
    text-align: center;
    overflow-wrap: anywhere;
    user-select: all;
}

/* Utilities */

.divider {
    height: 1px;
    margin: 24px 0;
    background: var(--border);
}

.text-center {
    text-align: center;
}

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

.text-small {
    font-size: .85rem;
}

.auth-footer {
    margin-top: 28px;
    color: var(--muted);
    text-align: center;
    font-size: .75rem;
}

.security-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.security-indicator::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    content: "";
}

/* Responsive layout */

@media (max-width: 540px) {
    .auth-layout {
        padding: 24px 16px;
    }

    .panel {
        padding: 24px 20px;
    }

    .brand {
        margin-bottom: 24px;
    }

    .brand-name {
        font-size: 1.5rem;
    }

    .recovery-grid {
        grid-template-columns: 1fr;
    }

    .recovery-code {
        font-size: .82rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition: none !important;
        animation: none !important;
    }
}
