:root {
    color-scheme: light;
    --bg: #0f172a;
    --bg-soft: #eef2ff;
    --surface: rgba(255, 255, 255, 0.94);
    --surface-strong: #ffffff;
    --surface-dark: #111827;
    --text: #0f172a;
    --muted: #5b6475;
    --line: rgba(148, 163, 184, 0.22);
    --primary: #6d28d9;
    --primary-2: #2563eb;
    --energy: #f97316;
    --mint: #10b981;
    --danger: #dc2626;
    --warning: #eab308;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.14);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    position: relative;
    min-height: 100vh;
}

body.user-shell {
    background:
        radial-gradient(circle at top left, rgba(249, 115, 22, 0.18), transparent 34%),
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.2), transparent 28%),
        linear-gradient(180deg, #0f172a 0, #131f38 16rem, #eff4ff 16rem, #f9fafb 100%);
}

body.admin-shell,
body.guest-shell {
    background:
        radial-gradient(circle at top left, rgba(109, 40, 217, 0.12), transparent 34%),
        linear-gradient(180deg, #f8fafc 0, #eef2ff 16rem, #f8fafc 100%);
}

a { color: inherit; text-decoration: none; }

.backdrop-orb {
    position: fixed;
    width: 24rem;
    height: 24rem;
    border-radius: 50%;
    filter: blur(70px);
    opacity: 0.35;
    pointer-events: none;
    z-index: 0;
}

.backdrop-orb-a { top: -6rem; right: -4rem; background: rgba(37, 99, 235, 0.28); }
.backdrop-orb-b { bottom: 8rem; left: -7rem; background: rgba(249, 115, 22, 0.18); }

.topbar,
.container {
    position: relative;
    z-index: 1;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.74);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.45);
    position: sticky;
    top: 0;
}

.brand-block {
    display: grid;
    gap: 0.35rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 900;
    font-size: 1rem;
    color: var(--text);
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 0.95rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #fff;
    box-shadow: 0 12px 30px rgba(109, 40, 217, 0.28);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
}

.topbar-copy { font-size: 0.92rem; }

.nav {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.nav-pills {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.72rem 1rem;
    border-radius: 999px;
    color: var(--muted);
    font-weight: 700;
    transition: 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.auth-page {
    min-height: calc(100vh - 6rem);
    display: grid;
    place-items: center;
    padding: 1.5rem 0;
}

.auth-card,
.panel,
.hero-card,
.stat-card,
.table-wrap {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.auth-card-wide {
    width: min(100%, 980px);
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    overflow: hidden;
}

.auth-showcase {
    padding: 2.4rem;
    background:
        linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(37, 99, 235, 0.88)),
        linear-gradient(135deg, rgba(249, 115, 22, 0.25), transparent);
    color: #f8fafc;
}

.auth-showcase h1,
.hero-card h1,
.section-header h1,
.panel h2 {
    margin: 0 0 0.45rem;
}

.auth-showcase p:last-child { margin-bottom: 0; }

.auth-form-shell {
    padding: 2.1rem;
    background: rgba(255, 255, 255, 0.9);
}

.auth-features,
.status-stack,
.stack {
    display: grid;
    gap: 0.8rem;
}

.auth-features {
    margin-top: 1.4rem;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.feature-chip,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 800;
    width: fit-content;
}

.feature-chip {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.hero-card,
.panel { padding: 1.35rem; }

.hero-card {
    display: grid;
    gap: 1.4rem;
    margin-bottom: 1.25rem;
}

.hero-user {
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(31, 41, 55, 0.92)),
        linear-gradient(135deg, rgba(249, 115, 22, 0.24), transparent 45%);
    color: #fff;
}

.hero-admin {
    background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(241,245,249,0.95));
}

.stats-grid,
.card-grid,
.panel-grid,
.video-grid,
.inline-grid {
    display: grid;
    gap: 1rem;
}

.stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card-grid-rich { margin-bottom: 1.2rem; }
.panel-grid.two-col { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.video-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.inline-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }

.stat-card {
    padding: 1.2rem;
    background: rgba(255, 255, 255, 0.14);
    color: inherit;
}

.hero-admin .stat-card {
    background: #fff;
}

.stat-card strong {
    display: block;
    font-size: 2.1rem;
    margin-bottom: 0.25rem;
}

.stat-card-accent {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.9), rgba(251, 146, 60, 0.82));
    color: #fff;
}

.stat-card-dark {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.9));
    color: #fff;
}

.card-link,
.button,
button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    min-height: 46px;
    border-radius: 16px;
    border: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    color: #fff;
    font-weight: 800;
    padding: 0.9rem 1rem;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.card-link:hover,
.button:hover,
button:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(37, 99, 235, 0.22);
}

.button-secondary {
    background: linear-gradient(135deg, #111827, #334155);
}

.button-ghost {
    background: rgba(255, 255, 255, 0.68);
    color: var(--text);
    box-shadow: none;
}

.feature-card {
    min-height: 11rem;
    align-items: flex-start;
    justify-content: flex-end;
    flex-direction: column;
    text-align: left;
    border-radius: 24px;
}

.feature-card strong,
.table-title {
    font-size: 1rem;
    font-weight: 800;
}

.feature-card small {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.92rem;
}

.feature-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.74rem;
    opacity: 0.84;
}

.feature-card-energy { background: linear-gradient(135deg, #7c3aed, #2563eb 70%); }
.feature-card-progress { background: linear-gradient(135deg, #ea580c, #f97316 75%); }
.feature-card-doc { background: linear-gradient(135deg, #0f172a, #334155 80%); }
.feature-card-admin { background: linear-gradient(135deg, #0f172a, #475569 80%); }

form { display: grid; gap: 1rem; }
label { display: grid; gap: 0.35rem; font-weight: 700; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.92rem 0.95rem;
    font: inherit;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.44);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
}

.checkbox input { width: auto; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-header-user h1,
.section-header-user p,
.hero-user .eyebrow,
.hero-user p {
    color: #fff;
}

.section-header-user {
    margin-top: 0.2rem;
    margin-bottom: 1.2rem;
}

.table-wrap {
    overflow-x: auto;
    background: rgba(255, 255, 255, 0.94);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    text-align: left;
    padding: 1rem;
    border-bottom: 1px solid #eaecf0;
    vertical-align: top;
}

th {
    background: #f8fafc;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.78rem;
}

.table-action {
    color: var(--primary-2);
    font-weight: 800;
}

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.73rem;
    color: var(--primary);
    font-weight: 900;
}

.flash {
    border-radius: 16px;
    padding: 0.95rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.flash-success { background: #ecfdf3; color: #166534; border-color: rgba(22, 101, 52, 0.12); }
.flash-error { background: #fef2f2; color: #b91c1c; border-color: rgba(185, 28, 28, 0.12); }

.video-player {
    width: 100%;
    border-radius: 18px;
    background: #000;
    margin-top: 0.6rem;
}

.premium-video-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(247,250,255,0.94));
}

.video-card-head {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 0.3rem;
}

.plain-list {
    margin: 0;
    padding-left: 1.1rem;
}

.metric-highlight {
    display: grid;
    gap: 0.25rem;
}

.metric-highlight strong {
    font-size: 2rem;
    line-height: 1;
}

.status-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.status-row:last-child { border-bottom: 0; }

.compact .status-row { padding: 0.65rem 0; }

.badge-success { background: rgba(16, 185, 129, 0.12); color: #047857; }
.badge-muted { background: rgba(148, 163, 184, 0.16); color: #475569; }
.badge-info { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.badge-admin { background: rgba(109, 40, 217, 0.12); color: #6d28d9; }

.panel-user-glow {
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 22px 42px rgba(15, 23, 42, 0.12);
}

.empty-state {
    min-height: 8rem;
    display: grid;
    place-items: center;
}

.error-box {
    white-space: pre-wrap;
    background: #0f172a;
    color: #f8fafc;
    padding: 1rem;
    border-radius: 14px;
}

@media (max-width: 920px) {
    .auth-card-wide {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .topbar,
    .section-header,
    .nav {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-pills {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .nav-link {
        white-space: nowrap;
    }

    th, td {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    .container {
        padding: 1rem 0.9rem 2.2rem;
    }

    .auth-showcase,
    .auth-form-shell {
        padding: 1.5rem;
    }
}
