:root {
    color-scheme: dark;
    --bg-0: #06101d;
    --bg-1: #0a1728;
    --bg-2: #0d1e33;
    --glass: rgba(17, 31, 52, .58);
    --glass-strong: rgba(14, 28, 48, .78);
    --glass-soft: rgba(255, 255, 255, .055);
    --glass-hover: rgba(255, 255, 255, .085);
    --stroke: rgba(255, 255, 255, .11);
    --stroke-strong: rgba(255, 255, 255, .17);
    --text: #f7fbff;
    --muted: #9fb2ca;
    --muted-2: #71849d;
    --primary: #48a7ff;
    --primary-2: #2476e7;
    --cyan: #72ddff;
    --success: #50d7a2;
    --warning: #ffc966;
    --danger: #ff7f99;
    --shadow-xl: 0 30px 90px rgba(0, 0, 0, .45);
    --shadow-md: 0 16px 42px rgba(0, 0, 0, .26);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 15px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg-0);
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 14% 14%, rgba(62, 150, 255, .20), transparent 28%),
        radial-gradient(circle at 86% 12%, rgba(92, 218, 255, .12), transparent 25%),
        radial-gradient(circle at 50% 100%, rgba(43, 95, 190, .15), transparent 40%),
        linear-gradient(150deg, var(--bg-0), var(--bg-1) 55%, #081522);
    background-attachment: fixed;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.45), transparent 85%);
}

a {
    color: #8dc9ff;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.glass {
    background:
        linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.025)),
        var(--glass);
    border: 1px solid var(--stroke);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .09),
        var(--shadow-md);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
}

.brand-mark {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    overflow: hidden;
    background:
        radial-gradient(circle at 25% 18%, rgba(255,255,255,.52), transparent 30%),
        linear-gradient(145deg, #58b7ff, #1f6fd9 72%);
    border: 1px solid rgba(255,255,255,.26);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.35),
        0 14px 32px rgba(27, 116, 224, .34);
}

.brand-mark::after {
    content: "";
    position: absolute;
    inset: auto 6px 5px;
    height: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,.17);
    filter: blur(5px);
}

.brand-mark span {
    position: relative;
    z-index: 1;
    font-weight: 900;
    font-style: italic;
    letter-spacing: -.08em;
    font-size: 17px;
}

.brand-title {
    margin: 0;
    font-size: 21px;
    line-height: 1.1;
    letter-spacing: -.035em;
}

.brand-subtitle {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-shell {
    width: min(100%, 450px);
}

.auth-brand {
    margin-bottom: 22px;
}

.auth-card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    padding: 31px;
}

.auth-card::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -110px;
    top: -120px;
    border-radius: 50%;
    background: rgba(76, 171, 255, .15);
    filter: blur(2px);
}

.auth-card > * {
    position: relative;
    z-index: 1;
}

.auth-title {
    margin: 0 0 9px;
    font-size: 31px;
    letter-spacing: -.05em;
}

.auth-copy {
    margin: 0 0 27px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.field {
    margin-bottom: 18px;
}

.field-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 720;
}

.input-wrap {
    position: relative;
}

.input {
    width: 100%;
    padding: 15px 46px 15px 15px;
    color: var(--text);
    background: rgba(3, 11, 22, .66);
    border: 1px solid rgba(255, 255, 255, .105);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.input:hover {
    background: rgba(4, 13, 25, .78);
    border-color: rgba(255,255,255,.16);
}

.input:focus {
    border-color: rgba(72, 167, 255, .82);
    box-shadow: 0 0 0 4px rgba(72, 167, 255, .12);
}

.input-icon-button {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 10px;
    color: var(--muted);
    background: transparent;
}

.input-icon-button:hover {
    background: var(--glass-soft);
    color: var(--text);
}

.auth-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin: 3px 0 22px;
    font-size: 13px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    white-space: nowrap;
}

.checkbox-label input {
    accent-color: var(--primary);
}

.primary-button {
    width: 100%;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 15px;
    padding: 14px 18px;
    color: white;
    font-size: 15px;
    font-weight: 780;
    background:
        linear-gradient(180deg, rgba(255,255,255,.16), transparent),
        linear-gradient(135deg, var(--primary), var(--primary-2));
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.25),
        0 15px 32px rgba(36, 118, 231, .27);
    transition: transform .18s ease, filter .18s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.07);
}

.primary-button:active {
    transform: translateY(0);
}

.auth-footer {
    margin-top: 18px;
    text-align: center;
    color: var(--muted-2);
    font-size: 12px;
}

.error-box {
    margin: 0 0 18px;
    padding: 13px 14px;
    border-radius: 14px;
    color: #ffd1da;
    background: rgba(255, 127, 153, .09);
    border: 1px solid rgba(255, 127, 153, .28);
    font-size: 13px;
    line-height: 1.5;
}

.dashboard-page {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 22px;
    background: rgba(6, 16, 29, .64);
    border-bottom: 1px solid rgba(255,255,255,.07);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-button,
.ghost-button {
    border: 1px solid var(--stroke);
    color: var(--text);
    background: var(--glass-soft);
    border-radius: 13px;
}

.icon-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
}

.ghost-button {
    padding: 10px 14px;
    font-weight: 700;
}

.icon-button:hover,
.ghost-button:hover {
    background: var(--glass-hover);
}

.page-shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 30px 0 96px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr);
    gap: 18px;
}

.hero-card {
    min-height: 282px;
    border-radius: var(--radius-xl);
    padding: 30px;
    position: relative;
    overflow: hidden;
}

.hero-card::after {
    content: "";
    position: absolute;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    right: -170px;
    bottom: -240px;
    background: radial-gradient(circle, rgba(72,167,255,.25), transparent 68%);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #a8d5ff;
    font-size: 12px;
    font-weight: 760;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 5px rgba(80, 215, 162, .11);
}

.hero-title {
    margin: 18px 0 10px;
    font-size: clamp(31px, 5vw, 48px);
    letter-spacing: -.055em;
    line-height: 1.05;
}

.hero-copy {
    max-width: 650px;
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.prompt-box {
    position: relative;
    z-index: 2;
    margin-top: 26px;
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px 10px 19px;
    border-radius: 19px;
    background: rgba(3, 11, 22, .62);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.prompt-box span {
    flex: 1;
    color: var(--muted);
}

.prompt-action {
    width: 45px;
    height: 45px;
    border: 0;
    border-radius: 14px;
    color: white;
    display: grid;
    place-items: center;
    background:
        linear-gradient(180deg, rgba(255,255,255,.16), transparent),
        linear-gradient(135deg, var(--primary), var(--primary-2));
}

.status-card {
    border-radius: var(--radius-xl);
    padding: 24px;
}

.status-title {
    margin: 0 0 18px;
    font-size: 16px;
}

.status-list {
    display: grid;
    gap: 12px;
}

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.06);
}

.status-name {
    color: var(--muted);
    font-size: 13px;
}

.status-value {
    font-size: 13px;
    font-weight: 760;
}

.status-value.ready {
    color: var(--success);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.kpi-card {
    min-height: 145px;
    padding: 20px;
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.kpi-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.kpi-value {
    margin-top: 18px;
    font-size: 27px;
    font-weight: 820;
    letter-spacing: -.04em;
}

.kpi-note {
    margin-top: 8px;
    color: var(--muted-2);
    font-size: 12px;
}

.mobile-nav {
    display: none;
}

@media (max-width: 860px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .status-card {
        display: none;
    }

    .kpi-grid {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
        overflow-x: auto;
        padding-bottom: 6px;
        scroll-snap-type: x mandatory;
    }

    .kpi-card {
        scroll-snap-align: start;
    }
}

@media (max-width: 620px) {
    .auth-page {
        padding: 18px;
    }

    .auth-card {
        padding: 24px 20px;
        border-radius: 24px;
    }

    .auth-title {
        font-size: 27px;
    }

    .auth-meta {
        align-items: flex-start;
    }

    .topbar {
        padding: 12px 15px;
    }

    .topbar .brand-subtitle,
    .topbar-actions .ghost-button {
        display: none;
    }

    .page-shell {
        width: min(100% - 28px, 1180px);
        padding-top: 18px;
        padding-bottom: 108px;
    }

    .hero-card {
        min-height: auto;
        padding: 23px 18px;
        border-radius: 24px;
    }

    .hero-title {
        font-size: 31px;
    }

    .hero-copy {
        font-size: 14px;
    }

    .prompt-box {
        min-height: 60px;
        margin-top: 20px;
        padding-left: 15px;
    }

    .kpi-grid {
        grid-template-columns: repeat(3, 78vw);
        gap: 12px;
    }

    .mobile-nav {
        position: fixed;
        z-index: 40;
        left: 50%;
        bottom: 12px;
        transform: translateX(-50%);
        width: min(calc(100% - 24px), 500px);
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        padding: 8px;
        border-radius: 22px;
    }

    .mobile-nav a {
        display: grid;
        place-items: center;
        gap: 4px;
        min-height: 54px;
        color: var(--muted);
        border-radius: 15px;
        font-size: 10px;
        font-weight: 680;
    }

    .mobile-nav a.active {
        color: white;
        background: rgba(72, 167, 255, .14);
    }

    .mobile-nav svg {
        width: 19px;
        height: 19px;
    }
}
