/* =============================================================================
   FROSTCRYPT Design System — Obsidian
   Unified design language: precision, restraint, cold clarity.
   ============================================================================= */

/* Self-hosted display fonts */
@font-face {
    font-family: 'Bangers';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/bangers-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Bangers';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/bangers-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Permanent Marker';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/permanent-marker-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Permanent Marker';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/permanent-marker-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Self-hosted IBM Plex fonts */
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 300;
    font-stretch: 100%;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-300-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 300;
    font-stretch: 100%;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-300-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 400 600;
    font-stretch: 100%;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 400 600;
    font-stretch: 100%;
    font-display: swap;
    src: url('/fonts/ibm-plex-sans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/ibm-plex-mono-400-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/ibm-plex-mono-400-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/ibm-plex-mono-500-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'IBM Plex Mono';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/ibm-plex-mono-500-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Design Tokens */
:root {
    /* ── Core palette — near-monochrome obsidian ──────────────────────────── */
    --bg:          #05060a;
    --bg-raised:   #0a0b0e;
    --bg-elevated: #0e0f12;
    --bg-hover:    #1a1b1f;
    --bg-active:   #1f2024;
    --bg-selected: #252629;

    /* ── Borders — subtle depth ───────────────────────────────────────────── */
    --border:       rgba(255,255,255,0.07);
    --border-hover: rgba(255,255,255,0.12);
    --border-focus: rgba(94,211,243,0.7);
    --border-faint: rgba(255,255,255,0.04);
    --border-strong: rgba(255,255,255,0.18);

    /* ── Text — high-contrast hierarchy ───────────────────────────────────── */
    --text:           #e8eaed;
    --text-secondary: #9aa0a6;
    --text-tertiary:  #6e7378;
    --text-faint:     #50545a;
    --text-muted:     #6e7378;
    --text-disabled:  #35383c;

    /* ── Accent — surgical cyan ───────────────────────────────────────────── */
    --accent:        #5ed3f3;
    --accent-dim:    rgba(94,211,243,0.12);
    --accent-strong: rgba(94,211,243,0.25);
    --accent-text:   #7de0f7;

    /* ── Status colors ────────────────────────────────────────────────────── */
    --success:     #a3e6c8;
    --success-dim: rgba(163,230,200,0.08);
    --warning:     #fbbf24;
    --warning-dim: rgba(251,191,36,0.12);
    --star:        #f5c542;
    --danger:      #f87171;
    --danger-dim:  rgba(248,113,113,0.12);
    --info:        #60a5fa;
    --info-dim:    rgba(96,165,250,0.12);

    /* ── Typography ───────────────────────────────────────────────────────── */
    /* canonical: --font / --font-sans (inbox alias) */
    --font:      'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;

    /* ── Spacing — 4px base ───────────────────────────────────────────────── */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
    --s12: 48px; --s16: 64px;

    /* ── Radius ───────────────────────────────────────────────────────────── */
    --radius-sm:   4px;
    --radius-md:   6px;
    --radius-lg:   8px;
    --radius-xl:   12px;
    --radius-pill: 100px;

    /* ── Shadows ──────────────────────────────────────────────────────────── */
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.5);
    --shadow-xl:  0 16px 48px rgba(0,0,0,0.6);

    /* ── Motion — fast and precise ────────────────────────────────────────── */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-instant: 50ms;
    --dur-fast:    100ms;
    --dur-normal:  150ms;
    --dur-slow:    250ms;

    /* ── Z-index layers ───────────────────────────────────────────────────── */
    --z-base:    1;
    --z-sticky:  10;
    --z-dropdown: 100;
    --z-modal:   200;
    --z-command: 300;
    --z-toast:   400;
    --z-loading: 500;

    /* ── Webmail extended palette (aliases for inbox compatibility) ─────── */
    /* --bg-void = --bg, --bg-deep/base/surface = darker shades */
    /* --text-primary = --text, --font-sans = --font */
    --bg-void:    #05060a;
    --bg-deep:    #08090c;
    --bg-base:    #0c0d10;
    --bg-surface: #101114;
    --text-primary: #e8eaed;
    --border-none:   transparent;
    --border-subtle: rgba(255,255,255,0.07);
    --border-medium: rgba(255,255,255,0.12);
    --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* ── Webmail layout ──────────────────────────────────────────────────── */
    --header-h:          52px;
    --sidebar-w:         220px;
    --sidebar-collapsed: 56px;
    --list-w:            380px;
}

/* Light theme — auto (system preference) and manual (.light-theme) must stay in sync */
@media (prefers-color-scheme: light) {
    :root.auto-theme {
        --bg:          #f8f9fa;
        --bg-raised:   #f1f3f4;
        --bg-elevated: #f8f9fa;
        --bg-hover:    #f1f3f4;
        --bg-active:   #e8eaed;
        --bg-selected: #e1e3e6;
        --bg-void:     #f8f9fa;
        --bg-deep:     #f1f3f4;
        --bg-base:     #ffffff;
        --bg-surface:  #ffffff;
        --border:       rgba(0,0,0,0.08);
        --border-hover: rgba(0,0,0,0.12);
        --border-faint: rgba(0,0,0,0.04);
        --border-strong: rgba(0,0,0,0.2);
        --border-subtle: rgba(0,0,0,0.08);
        --border-medium: rgba(0,0,0,0.12);
        --border-none:   transparent;
        --text:           #1f2124;
        --text-secondary: #5f6368;
        --text-tertiary:  #80868b;
        --text-faint:     #9aa0a6;
        --text-muted:     #9aa0a6;
        --text-disabled:  #bdc1c6;
        --text-primary:   #1f2124;
        --accent:        #0d99c7;
        --accent-dim:    rgba(13,153,199,0.1);
        --accent-strong: rgba(13,153,199,0.2);
        --accent-text:   #0a7ea4;
        --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
        --shadow-md:  0 4px 16px rgba(0,0,0,0.1);
        --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
        --shadow-xl:  0 16px 48px rgba(0,0,0,0.15);
    }
}

/* Light theme — manual override (keep in sync with auto-theme above) */
:root.light-theme {
    --bg:          #f8f9fa;
    --bg-raised:   #f1f3f4;
    --bg-elevated: #f8f9fa;
    --bg-hover:    #f1f3f4;
    --bg-active:   #e8eaed;
    --bg-selected: #e1e3e6;
    --bg-void:     #f8f9fa;
    --bg-deep:     #f1f3f4;
    --bg-base:     #ffffff;
    --bg-surface:  #ffffff;
    --border:       rgba(0,0,0,0.08);
    --border-hover: rgba(0,0,0,0.12);
    --border-faint: rgba(0,0,0,0.04);
    --border-strong: rgba(0,0,0,0.2);
    --border-subtle: rgba(0,0,0,0.08);
    --border-medium: rgba(0,0,0,0.12);
    --border-none:   transparent;
    --text:           #1f2124;
    --text-secondary: #5f6368;
    --text-tertiary:  #80868b;
    --text-faint:     #9aa0a6;
    --text-muted:     #9aa0a6;
    --text-disabled:  #bdc1c6;
    --text-primary:   #1f2124;
    --accent:        #0d99c7;
    --accent-dim:    rgba(13,153,199,0.1);
    --accent-strong: rgba(13,153,199,0.2);
    --accent-text:   #0a7ea4;
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.08);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
    --shadow-xl:  0 16px 48px rgba(0,0,0,0.15);
}


/* =============================================================================
   Reset
   ============================================================================= */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
    background: var(--accent-strong);
    color: var(--text);
}

/* Scrollbar — Webkit */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* Scrollbar — Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}


/* =============================================================================
   Loading Screen
   ============================================================================= */

.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: var(--z-loading);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--s4);
    transition: opacity 0.25s var(--ease-out), visibility 0.25s var(--ease-out);
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text);
    font-family: var(--font-mono);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }


/* =============================================================================
   Focus States (Accessibility)
   ============================================================================= */

:focus { outline: none; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip to main content */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--accent);
    color: var(--bg);
    padding: var(--s2) var(--s4);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    z-index: calc(var(--z-loading) + 1);
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus {
    top: var(--s2);
}


/* =============================================================================
   Navigation
   ============================================================================= */

.nav {
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-faint);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text);
}

.nav-logo img {
    width: 28px;
    height: 28px;
    opacity: 0.9;
}

.nav-logo span {
    font-size: 0.8rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

.nav-back,
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.78rem;
    letter-spacing: 0.05em;
    transition: color var(--dur-fast) ease;
}

.nav-back:hover,
.nav-link:hover {
    color: var(--text);
}

@media (max-width: 768px) {
    .nav {
        padding: 0.75rem 1rem;
    }

    .nav-logo span {
        font-size: 0.7rem;
    }

    .nav-back,
    .nav-link {
        font-size: 0.7rem;
    }
}


/* =============================================================================
   Footer
   ============================================================================= */

.footer {
    padding: 2.5rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-faint);
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

@media (max-width: 768px) {
    .footer {
        padding: 1.5rem 1rem;
    }
}

.footer a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--dur-fast) ease;
}

.footer a:hover {
    color: var(--text);
}


/* =============================================================================
   Buttons
   ============================================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s2);
    padding: var(--s2) var(--s4);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--dur-fast) ease;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
}

.btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}

.btn-primary {
    background: var(--text);
    color: var(--bg);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,255,255,0.15);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    color: var(--text);
    background: var(--bg-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger-dim);
}

.btn-danger:hover {
    background: var(--danger-dim);
}

.btn-group {
    display: flex;
    gap: var(--s3);
    margin-top: var(--s4);
}


/* =============================================================================
   Icon Button
   ============================================================================= */

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--dur-fast);
    position: relative;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.5;
    fill: none;
}


/* =============================================================================
   Form Elements
   ============================================================================= */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-faint);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input.error {
    border-color: var(--danger);
}

.form-error {
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: none;
}

.form-error.visible {
    display: block;
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e7378' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-select option {
    background: var(--bg-elevated);
    color: var(--text);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
}


/* =============================================================================
   Toggle Switch (accessible)
   ============================================================================= */

.toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-faint);
}

.toggle-group:last-child { border-bottom: none; }

.toggle-info { flex: 1; }

.toggle-title {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.toggle-desc {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    inset: 0;
    background: var(--border-hover);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--dur-fast) ease;
}

.toggle-switch input:checked + .toggle-track {
    background: var(--accent);
}

.toggle-switch input:focus-visible + .toggle-track {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--text);
    border-radius: 50%;
    transition: transform var(--dur-fast) ease;
    pointer-events: none;
}

.toggle-switch input:checked ~ .toggle-knob {
    transform: translateX(20px);
}


/* =============================================================================
   Cards
   ============================================================================= */

.card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: border-color var(--dur-fast) ease;
}

.card:hover {
    border-color: var(--border-hover);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}


/* =============================================================================
   Alerts / Status Messages
   ============================================================================= */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    display: none;
}

.alert.visible { display: block; }

.alert-error,
.status-error {
    background: var(--danger-dim);
    border: 1px solid rgba(248,113,113,0.25);
    color: var(--danger);
}

.alert-success,
.status-success {
    background: var(--success-dim);
    border: 1px solid rgba(163,230,200,0.2);
    color: var(--success);
}



/* =============================================================================
   Modal
   ============================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.modal-overlay.visible { display: flex; }

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 450px;
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.modal-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions .btn { flex: 1; justify-content: center; }


/* =============================================================================
   Toast
   ============================================================================= */

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text);
    z-index: var(--z-toast);
    opacity: 0;
    transition: all 0.25s var(--ease-out);
    box-shadow: var(--shadow-lg);
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { border-color: rgba(163,230,200,0.25); }
.toast.error { border-color: rgba(248,113,113,0.3); }

/* Live region for screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}


/* =============================================================================
   Section Layout
   ============================================================================= */

.section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    text-align: center;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    text-align: center;
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 550px;
    margin: 0 auto 3rem;
    line-height: 1.7;
}

@media (max-width: 768px) {
    .section-title { font-size: 1.8rem; }
}


/* =============================================================================
   Auth Container (login, register, forgot-password, etc.)
   ============================================================================= */

.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2rem;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

.auth-footer a {
    color: var(--text);
    text-decoration: none;
    transition: opacity var(--dur-fast) ease;
}

.auth-footer a:hover {
    opacity: 0.7;
}


/* =============================================================================
   Session / List Items
   ============================================================================= */

.session-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-faint);
}

.session-item:last-child { border-bottom: none; }

.session-info { flex: 1; }

.session-device {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.session-meta {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.session-current {
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 500;
}


/* =============================================================================
   Scroll Animations
   ============================================================================= */

.reveal {
    opacity: 0;
    transform: translateY(50px) translateZ(0);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0) translateZ(0);
    transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.85) translateZ(0);
    transition: opacity 0.35s ease-out, transform 0.35s ease-out;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.reveal-scale.visible {
    opacity: 1;
    transform: scale(1) translateZ(0);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal-left {
    opacity: 0;
    transform: translate3d(-30px, 0, 0);
    transition: opacity 0.35s ease-out, transform 0.35s ease-out;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.reveal-left.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal-right {
    opacity: 0;
    transform: translate3d(30px, 0, 0);
    transition: opacity 0.35s ease-out, transform 0.35s ease-out;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.reveal-right.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal-blur {
    opacity: 0;
    filter: blur(8px);
    transform: translate3d(0, 25px, 0);
    transition: opacity 0.3s ease-out, filter 0.3s ease-out, transform 0.3s ease-out;
    will-change: transform, opacity, filter;
    backface-visibility: hidden;
}

.reveal-blur.visible {
    opacity: 1;
    filter: blur(0);
    transform: translate3d(0, 0, 0);
    transition: opacity 0.6s var(--ease-out), filter 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.fade-in {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.fade-in.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

/* Release GPU layers after animation completes */
.reveal.visible,
.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible,
.fade-in.visible,
.reveal-blur.visible {
    will-change: auto;
}

/* Staggered children */
.stagger-children .reveal,
.stagger-children .reveal-scale,
.stagger-children .reveal-left,
.stagger-children .reveal-right,
.stagger-children .reveal-blur {
    transition-delay: calc(var(--stagger-index, 0) * 0.1s);
}


/* =============================================================================
   Reduced Motion
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .reveal, .reveal-scale, .reveal-left, .reveal-right, .reveal-blur, .fade-in {
        opacity: 1;
        transform: none;
        filter: none;
        transition: none;
    }

    .card, .card-interactive, .btn {
        transition: none;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }
}


/* =============================================================================
   Inline Links
   ============================================================================= */

.inline-link {
    color: var(--text);
    text-decoration: none;
    transition: opacity var(--dur-fast) ease;
}

.inline-link:hover {
    opacity: 0.7;
}


/* =============================================================================
   Hero
   ============================================================================= */

.hero-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 300;
    letter-spacing: 0.02em;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 550px;
    margin: 0 auto;
    line-height: 1.7;
}

@media (max-width: 768px) {
    .hero-title { font-size: 1.8rem; }
}


/* =============================================================================
   Print
   ============================================================================= */

@media print {
    .nav, .footer, .loading-screen { display: none; }
    body { background: #fff; color: #000; }
}
