.button,
button {
    align-items: center;
    background: var(--primary);
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
}

.button:hover,
button:hover {
    background: var(--primary-strong);
}

.button.secondary {
    background: #e8eefc;
    color: var(--primary);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.panel,
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
}

.icon-button {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    height: 40px;
    min-height: 40px;
    padding: 0;
    width: 40px;
}

.icon-button:hover {
    background: #e0e7ff;
}

.mobile-menu-toggle {
    display: none;
}

.mobile-menu-toggle span {
    background: currentColor;
    border-radius: 99px;
    display: block;
    height: 2px;
    width: 18px;
}

.streak-pill {
    align-items: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    color: #c2410c;
    display: inline-flex;
    font-weight: 800;
    gap: 6px;
    min-height: 36px;
    padding: 6px 12px;
}

.user-chip {
    align-items: center;
    color: var(--text);
    display: inline-flex;
    gap: 10px;
}

.user-chip img,
.user-chip span,
.leader-row img,
.avatar-fallback {
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    font-weight: 800;
    height: 38px;
    justify-content: center;
    object-fit: cover;
    width: 38px;
}

.logout-link {
    color: var(--muted);
    font-weight: 700;
}

.auth-panel {
    margin: 0 auto;
    max-width: 460px;
}

.modern-auth-card {
    box-shadow: 0 24px 70px rgba(23, 32, 51, 0.16);
    width: min(100%, 460px);
}

.modern-auth-card h1 {
    margin: 0 0 8px;
}

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

.form-hint,
.auth-switch {
    color: var(--muted);
    font-size: 14px;
    margin-top: 8px;
}

.modern-auth-card .button {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    margin-top: 8px;
    width: 100%;
}

.dashboard-grid,
.cards {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dashboard-page {
    display: grid;
    gap: 20px;
}

.dashboard-hero {
    align-items: stretch;
    background:
        radial-gradient(circle at 88% 12%, rgba(139, 92, 246, 0.30), transparent 28%),
        linear-gradient(135deg, #312e81, #6366f1);
    border-radius: 8px;
    color: #ffffff;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 260px;
    overflow: hidden;
    padding: clamp(24px, 5vw, 42px);
}

.dashboard-hero .eyebrow,
.dashboard-hero p {
    color: rgba(255, 255, 255, 0.82);
}

.dashboard-hero h1 {
    font-size: clamp(30px, 5vw, 52px);
    line-height: 1.08;
    margin: 0 0 14px;
}

.dashboard-hero p {
    max-width: 680px;
}

.hero-cta {
    background: #ffffff;
    color: var(--primary-strong);
    margin-top: 12px;
}

.hero-cta:hover {
    background: #eef2ff;
}

.hero-summary {
    align-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    padding: 24px;
}

.hero-summary span,
.hero-summary small {
    color: rgba(255, 255, 255, 0.75);
}

.hero-summary strong {
    font-size: 46px;
    line-height: 1;
}

.stat-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 8px;
    min-height: 170px;
    padding: 20px;
}

.stat-card p,
.stat-card small,
.empty-state {
    color: var(--muted);
    margin: 0;
}

.stat-card strong {
    font-size: 30px;
    line-height: 1.1;
}

.stat-icon {
    align-items: center;
    background: var(--surface-soft);
    border-radius: 8px;
    color: var(--primary);
    display: inline-flex;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.progress-track {
    background: var(--surface-soft);
    border-radius: 999px;
    height: 9px;
    overflow: hidden;
}

.progress-track.large {
    height: 12px;
}

.progress-track span {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: inherit;
    display: block;
    height: 100%;
}

.dashboard-layout {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 360px;
}

.dashboard-main,
.dashboard-side {
    display: grid;
    gap: 20px;
}

.section-heading {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-heading h2,
.section-heading p {
    margin: 0;
}

.checklist {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.check-item {
    align-items: center;
    background: var(--surface-soft);
    border-radius: 8px;
    display: flex;
    gap: 12px;
    padding: 12px;
}

.check-item span {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    height: 26px;
    justify-content: center;
    width: 26px;
}

.check-item.done span {
    background: var(--success);
    border-color: var(--success);
}

.streak-days {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(7, 1fr);
}

.streak-days div {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.streak-days span {
    background: #e5e7eb;
    border-radius: 7px;
    height: 34px;
    width: 100%;
}

.streak-days span.active {
    background: #22c55e;
}

.streak-days small {
    color: var(--muted);
    font-size: 12px;
}

.continue-list,
.leader-list {
    display: grid;
    gap: 12px;
}

.module-row {
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    padding: 12px;
}

.module-row img {
    aspect-ratio: 1;
    background: var(--surface-soft);
    border-radius: 8px;
    object-fit: cover;
}

.module-row h3,
.module-row p {
    margin: 0 0 6px;
}

.module-row p {
    color: var(--muted);
}

.leader-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 44px 38px minmax(0, 1fr);
}

.leader-row strong,
.leader-row small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leader-row small {
    color: var(--muted);
}

.rank {
    color: var(--primary);
    font-weight: 900;
}

.leader-divider {
    border-top: 1px dashed var(--border);
    margin: 4px 0;
}

.toast-stack {
    bottom: 18px;
    display: grid;
    gap: 10px;
    position: fixed;
    right: 18px;
    z-index: 50;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    box-shadow: var(--shadow);
    color: var(--text);
    max-width: min(360px, calc(100vw - 36px));
    padding: 12px 14px;
}

@media (max-width: 980px) {
    .stat-grid,
    .dashboard-layout,
    .dashboard-hero {
        grid-template-columns: 1fr;
    }

    .header-shell {
        align-items: stretch;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        display: none;
        left: 0;
        padding: 16px;
        position: absolute;
        right: 0;
        top: 67px;
    }

    .header-shell.open,
    .header-shell.open .nav,
    .header-shell.open .header-actions {
        display: grid;
    }

    .nav,
    .header-actions {
        align-items: stretch;
        display: grid;
    }

    .mobile-menu-toggle {
        display: inline-grid;
    }
}

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

    .module-row {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .module-row .button {
        grid-column: 1 / -1;
    }

    .user-chip strong,
    .logout-link {
        display: none;
    }
}

.card img {
    aspect-ratio: 16 / 9;
    background: #e8eefc;
    border-radius: 6px;
    object-fit: cover;
}

label {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

input,
select,
textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    padding: 10px 12px;
    width: 100%;
}

.alert {
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
}

.alert-danger {
    background: #fee2e2;
    color: var(--danger);
}

.alert-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.password-meter {
    background: #e5e7eb;
    border-radius: 999px;
    height: 8px;
    margin-top: -4px;
    overflow: hidden;
}

.password-meter span {
    background: #dc2626;
    display: block;
    height: 100%;
    transition: width 180ms ease, background 180ms ease;
    width: 0;
}

.password-meter span.medium {
    background: #d97706;
    width: 66%;
}

.password-meter span.strong {
    background: #16a34a;
    width: 100%;
}

.password-meter span.weak {
    background: #dc2626;
    width: 33%;
}

.question {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    padding: 16px;
}

.content-block {
    border-top: 1px solid var(--border);
    margin-top: 24px;
    padding-top: 16px;
}
