:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #eef3f8;
    --ink: #17202a;
    --muted: #667085;
    --line: #dfe5ee;
    --accent: #0f766e;
    --accent-dark: #115e59;
    --warning: #b7791f;
    --radius: 8px;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-page {
    background: linear-gradient(135deg, #edf7f6 0%, #f7f9fb 48%, #eef3f8 100%);
}

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

.app-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    background: #111827;
    color: #f9fafb;
    padding: 28px 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
}

.brand-mark {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border-radius: var(--radius);
    background: var(--accent);
    color: #ffffff;
    font-weight: 800;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: #b6c1d1;
    margin-top: 3px;
}

.nav-list {
    display: grid;
    gap: 6px;
}

.nav-list a {
    border-radius: var(--radius);
    color: #cbd5e1;
    padding: 12px 14px;
}

.nav-list a:hover,
.nav-list .is-active {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.main-content {
    padding: 34px;
}

.topbar {
    align-items: center;
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    margin-bottom: 22px;
}

.topbar span {
    color: var(--muted);
    font-weight: 700;
}

.topbar a {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--accent-dark);
    font-weight: 800;
    padding: 9px 12px;
}

.page-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 26px;
}

.eyebrow {
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
}

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

h1 {
    font-size: 2.35rem;
    line-height: 1.1;
    margin-bottom: 10px;
}

h2 {
    font-size: 1.05rem;
    margin-bottom: 0;
}

.lede {
    color: var(--muted);
    margin-bottom: 0;
}

.primary-action {
    background: var(--accent);
    border-radius: var(--radius);
    color: #ffffff;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    min-width: 132px;
    padding: 12px 18px;
}

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

.stats-grid,
.dashboard-grid,
.module-grid {
    display: grid;
    gap: 18px;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.subscription-strip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
    padding: 18px 20px;
}

.subscription-strip span {
    color: var(--muted);
    display: block;
    font-size: 0.84rem;
    margin-bottom: 5px;
}

.subscription-strip strong {
    display: block;
}

.stat-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat-card {
    display: grid;
    gap: 8px;
    padding: 20px;
}

.stat-card span,
.panel-heading span {
    color: var(--muted);
    font-size: 0.88rem;
}

.stat-card strong {
    font-size: 2rem;
}

.stat-card small {
    color: var(--warning);
    font-weight: 800;
}

.dashboard-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.panel {
    padding: 22px;
}

.panel-heading {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
}

.module-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.module-tile {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius);
    display: flex;
    font-weight: 800;
    gap: 12px;
    min-height: 74px;
    padding: 16px;
}

.module-tile:hover {
    border-color: var(--accent);
}

.module-tile span {
    display: grid;
    flex: 0 0 34px;
    height: 34px;
    place-items: center;
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--accent);
}

.activity-list {
    display: grid;
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-list li {
    border-left: 3px solid var(--accent);
    color: var(--muted);
    padding: 5px 0 5px 12px;
}

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

.auth-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    max-width: 440px;
    padding: 32px;
    width: min(100%, 440px);
}

.auth-brand {
    color: var(--ink);
    margin-bottom: 28px;
}

.auth-brand small {
    color: var(--muted);
}

.auth-form {
    display: grid;
    gap: 12px;
    margin-top: 24px;
}

.auth-form label {
    color: var(--ink);
    font-weight: 800;
}

.auth-form input {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font: inherit;
    min-height: 46px;
    padding: 11px 13px;
}

.auth-form input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(15, 118, 110, 0.14);
}

.auth-form .primary-action {
    border: 0;
    cursor: pointer;
    margin-top: 8px;
}

.secondary-link {
    color: var(--accent-dark);
    display: inline-flex;
    font-weight: 800;
    justify-content: center;
    padding: 8px;
}

.alert {
    border-radius: var(--radius);
    font-weight: 700;
    margin-top: 18px;
    padding: 12px 14px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 18px;
    }

    .nav-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stats-grid,
    .subscription-strip,
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 640px) {
    .main-content {
        padding: 22px 16px;
    }

    .page-header {
        align-items: stretch;
        flex-direction: column;
    }

    .primary-action {
        width: 100%;
    }

    .stats-grid,
    .subscription-strip,
    .module-grid,
    .nav-list {
        grid-template-columns: 1fr;
    }
}
