/* =========================================
   Base: design tokens, document defaults,
   application shell, authentication and dashboard
   ========================================= */

/* =========
   Variables
   ========= */

:root {
    color-scheme: light;

    --bg-main: #f4f6f8;
    --bg-surface: #ffffff;
    --bg-surface-soft: #fafbfd;
    --bg-muted: #f3f4f6;
    --bg-sidebar: #ffffff;
    --bg-elevated: #ffffff;

    --text-main: #111827;
    --text-muted: #667085;
    --text-soft: #98a2b3;
    --text-inverse: #f9fafb;

    --border-soft: #e5e7eb;
    --border-strong: #d0d5dd;
    --border-accent: rgba(217, 41, 47, 0.18);
    --border: var(--border-soft);
    --brand-border: var(--border-soft);

    --brand-red: #d9292f;
    --brand-red-dark: #b42318;
    --brand-red-soft: rgba(217, 41, 47, 0.08);
    --brand-dark: #111827;

    --success-bg: #ecfdf3;
    --success-text: #166534;

    --warning-bg: #fff7ed;
    --warning-text: #9a3412;

    --danger-bg: #fff0f1;
    --danger-text: #b42318;

    --info-bg: #eff6ff;
    --info-text: #1d4ed8;

    --neutral-bg: #f3f4f6;
    --neutral-text: #374151;

    --input-bg: #ffffff;
    --input-text: #101828;

    --shadow-soft: 0 6px 18px rgba(16, 24, 40, 0.06);
    --shadow-card: 0 10px 28px rgba(16, 24, 40, 0.06);
    --shadow-hover: 0 12px 30px rgba(16, 24, 40, 0.08);
    --shadow-strong: 0 20px 56px rgba(16, 24, 40, 0.16);

    --radius-xs: 10px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;

    --container-max: 1600px;
    --dashboard-max: 2200px;
    --sidebar-width: 240px;
    --app-header-height: 64px;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

body[data-theme="dark"] {
    color-scheme: dark;

    --bg-main: #0b1018;
    --bg-surface: #121926;
    --bg-surface-soft: #18212f;
    --bg-muted: #202938;
    --bg-sidebar: #0d1420;
    --bg-elevated: #162030;

    --text-main: #edf2f7;
    --text-muted: #a9b3c3;
    --text-soft: #7f8aa0;
    --text-inverse: #ffffff;

    --border-soft: #243042;
    --border-strong: #334155;
    --border-accent: rgba(239, 68, 68, 0.22);
    --border: var(--border-soft);
    --brand-border: var(--border-soft);

    --brand-red: #ff5a5f;
    --brand-red-dark: #ef4444;
    --brand-red-soft: rgba(255, 90, 95, 0.10);
    --brand-dark: #f8fafc;

    --success-bg: rgba(34, 197, 94, 0.12);
    --success-text: #86efac;

    --warning-bg: rgba(245, 158, 11, 0.14);
    --warning-text: #fcd34d;

    --danger-bg: rgba(239, 68, 68, 0.14);
    --danger-text: #fca5a5;

    --info-bg: rgba(96, 165, 250, 0.14);
    --info-text: #93c5fd;

    --neutral-bg: #202938;
    --neutral-text: #c6ceda;

    --input-bg: #0f1724;
    --input-text: #edf2f7;

    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.28);
    --shadow-card: 0 14px 34px rgba(0, 0, 0, 0.28);
    --shadow-hover: 0 16px 38px rgba(0, 0, 0, 0.34);
    --shadow-strong: 0 24px 68px rgba(0, 0, 0, 0.42);
}

/* =========
   Base
   ========= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--bg-main);
    color: var(--text-main);
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.58;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    transition: background 0.2s ease, color 0.2s ease;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

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

button,
input,
select,
textarea {
    font: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin: 0 0 0.75rem 0;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.15;
}

p {
    margin: 0 0 1rem 0;
    color: var(--text-muted);
}

ul,
ol {
    margin: 0 0 1rem 0;
    padding-left: 1.25rem;
}

code,
pre,
kbd {
    font-family: "Cascadia Code", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

/* =========
   Layout
   ========= */

.layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-main);
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-soft);
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.content {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    padding: 24px;
    background: var(--bg-main);
}

.content > * {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
}

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

.page-title {
    margin: 0;
    color: var(--text-main);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    margin-left: auto;
}

.user-box {
    text-align: right;
    min-width: 0;
    max-width: 220px;
    padding: 6px 14px;
    border-radius: 12px;
    background: var(--bg-surface-soft);
    border: 1px solid var(--border-soft);
}

.user-name {
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.2;
}

.user-meta {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.3;
}

.user-meta--secondary {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-soft);
}

.user-meta--truncate,
.user-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========
   Sidebar
   ========= */

.brand,
.brand-logo-only,
.brand-stack {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
}

.brand-logo-only {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 44px;
    overflow: hidden;
}

.brand-logo {
    display: block;
    width: 190px;
    max-width: 100%;
    height: auto;
    flex-shrink: 0;
}

.brand-subtitle {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.3;
}

/* По умолчанию светлая тема */
.brand-logo--light {
    display: block;
}

.brand-logo--dark {
    display: none;
}

/* Темная тема */
body[data-theme="dark"] .brand-logo--light {
    display: none;
}

body[data-theme="dark"] .brand-logo--dark {
    display: block;
}

@media (max-width: 768px) {
    .brand-logo {
        width: 165px;
    }
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link,
.sidebar-sublink {
    position: relative;
    display: block;
    padding: 11px 12px;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 600;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-link.active::before,
.sidebar-sublink.active::before {
    content: "";
    position: absolute;
    left: -18px;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--brand-red);
}

.nav-link:hover,
.sidebar-sublink:hover {
    background: rgba(217, 41, 47, 0.08);
    color: var(--text-main);
}

.nav-link.active,
.sidebar-sublink.active {
    background: rgba(217, 41, 47, 0.12);
    color: var(--brand-red);
}

.nav-link--with-badge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    min-height: 20px;
    padding: 0;
    border: 1px solid rgba(22, 101, 52, 0.22);
    border-radius: 6px;
    background: var(--success-bg);
    color: var(--success-text);
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
}

.nav-badge__icon {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-link:hover .nav-badge,
.nav-link.active .nav-badge {
    border-color: rgba(22, 101, 52, 0.34);
    background: #dcfce7;
}

body[data-theme="dark"] .nav-badge {
    border-color: rgba(134, 239, 172, 0.28);
    background: var(--success-bg);
}

body[data-theme="dark"] .nav-link:hover .nav-badge,
body[data-theme="dark"] .nav-link.active .nav-badge {
    border-color: rgba(134, 239, 172, 0.42);
    background: rgba(34, 197, 94, 0.18);
}

.sidebar-group,
.sidebar-subgroup {
    border: 0;
}

.sidebar-group summary,
.sidebar-subgroup summary {
    list-style: none;
    cursor: pointer;
}

.sidebar-group summary::-webkit-details-marker,
.sidebar-subgroup summary::-webkit-details-marker {
    display: none;
}

.sidebar-link--summary,
.sidebar-sublink--track {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-sublink--track {
    font-weight: 700;
    color: var(--text-main);
}

.sidebar-sublink--course {
    padding-left: 16px;
    font-size: 13px;
    color: var(--text-muted);
}

.sidebar-submenu {
    display: grid;
    gap: 6px;
    margin: 6px 0 10px 8px;
}

.sidebar-submenu--deep {
    margin: 6px 0 10px 12px;
    padding-left: 8px;
    border-left: 1px solid var(--border-soft);
}

.sidebar-arrow,
.sidebar-arrow--small {
    font-size: 11px;
    color: var(--text-soft);
    transition: transform 0.15s ease;
}

.sidebar-group:not([open]) .sidebar-arrow,
.sidebar-subgroup:not([open]) .sidebar-arrow {
    transform: rotate(-90deg);
}

.sidebar-empty {
    padding: 8px 12px;
    color: var(--text-muted);
    font-size: 13px;
}

/* =========
   Theme toggle
   ========= */

.theme-toggle {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
    font-size: 18px;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(217, 41, 47, 0.28);
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.10);
}

/* =========
   Auth
   ========= */

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at top right, rgba(217, 41, 47, 0.08), transparent 30%),
        linear-gradient(135deg, var(--bg-main) 0%, var(--bg-surface-soft) 100%);
}

.auth-card {
    width: 100%;
    max-width: 460px;
    padding: 32px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo-full {
    width: 260px;
    margin: 0 auto 18px auto;
}

.auth-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
    margin: 0 auto 16px auto;
}

.auth-title {
    font-size: 24px;
    color: var(--text-main);
}

.auth-card--login,
.auth-card--recovery {
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    background: var(--bg-surface);
    box-shadow: 0 24px 64px rgba(16, 24, 40, 0.13);
}

.auth-card--recovery {
    max-width: 560px;
}

.auth-brand--compact {
    margin-bottom: 18px;
}

.auth-copy {
    margin: 8px auto 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-form .form-group {
    margin: 0;
}

.auth-hint,
.auth-request-id {
    margin: 7px 0 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.auth-errors,
.auth-field-errors {
    border-radius: 12px;
    color: var(--danger-text);
    background: var(--danger-bg);
}

.auth-errors {
    padding: 12px 14px;
    border: 1px solid var(--border-accent);
}

.auth-field-errors {
    margin-top: 6px;
    padding: 8px 10px;
}

.auth-errors .errorlist,
.auth-field-errors .errorlist {
    margin: 0;
    padding-left: 18px;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.auth-status-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin: 0 auto 12px;
    border-radius: 16px;
    color: var(--brand-red);
    background: var(--brand-red-soft);
    font-size: 28px;
    font-weight: 800;
}

.auth-eyebrow {
    margin: 0 0 8px;
    color: var(--brand-red);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-recovery-list {
    display: grid;
    gap: 9px;
    margin: 0 0 20px;
    padding: 16px 16px 16px 36px;
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    color: var(--text-muted);
    background: var(--bg-surface-soft);
    line-height: 1.45;
}

.auth-actions {
    display: flex;
}

.auth-request-id {
    text-align: center;
}

@media (max-width: 560px) {
    .auth-body {
        align-items: flex-start;
        padding: 16px;
    }

    .auth-card {
        margin-top: 8vh;
        padding: 24px 20px;
    }

    .auth-logo-full {
        width: min(230px, 100%);
    }
}

/* =========
   Welcome / dashboard
   ========= */

.welcome-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.52fr);
    align-items: center;
    gap: 28px;
    padding: 24px;
    margin-bottom: 0;
    border-radius: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-card);
}

.welcome-hero__main {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.welcome-badge,
.onboarding-badge,
.course-format-badge,
.course-format-badge-large {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--brand-red-soft);
    color: var(--brand-red);
    font-size: 13px;
    font-weight: 800;
}

.welcome-badge {
    align-self: flex-start;
    margin-bottom: 14px;
}

.welcome-title {
    max-width: 980px;
    font-size: clamp(1.8rem, 2.15vw, 2.45rem);
    line-height: 1.12;
    color: var(--text-main);
    margin: 0 0 20px;
}

.welcome-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

@media (max-width: 980px) {
    .topbar-right {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .user-box {
        width: 100%;
        max-width: none;
    }

    .user-meta--truncate,
    .user-name {
        white-space: normal;
    }
}

.welcome-hero__side {
    display: flex;
    align-items: center;
    width: 100%;
    padding-left: 28px;
    border-left: 1px solid var(--border-soft);
}

.welcome-focus-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
}

.welcome-focus-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    min-width: 0;
    padding: 4px 16px;
    border-left: 1px solid var(--border-soft);
}

.welcome-focus-item:first-child {
    padding-left: 0;
    border-left: 0;
}

.welcome-focus-item span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.welcome-focus-item strong {
    font-size: 26px;
    line-height: 1;
    font-weight: 800;
    color: var(--text-main);
}

.welcome-focus-item--accent strong {
    color: var(--brand-red);
}

.hero-card h2,
.hero-card h3 {
    color: var(--text-main);
}

.hero-card p {
    color: var(--text-muted);
}

/* =========================
   ЭТАП 1 — ЖИВАЯ ГЛАВНАЯ
   ========================= */

.home-page {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.home-page .panel {
    padding: 20px;
}

.home-page .panel-header {
    margin-bottom: 16px;
}

.home-page .panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.3;
}

.home-page .panel .link-inline {
    font-size: 13px;
    font-weight: 700;
}

.home-action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
}

.home-page .dashboard-grid {
    align-items: start;
    margin-top: 0;
}

.home-page .action-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 18px;
}

.home-page .onboarding-route {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 28px;
    padding-top: 4px;
}

.home-page .onboarding-route__content {
    min-width: 0;
}

.home-page .onboarding-route__title {
    margin: 0 0 16px;
    color: var(--text-main);
    font-size: 18px;
    line-height: 1.35;
}

.home-page .onboarding-route__progress {
    max-width: 920px;
}

.home-page .onboarding-route__progress-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 13px;
}

.home-page .onboarding-route__progress-meta strong {
    color: var(--text-main);
}

.home-page .onboarding-route__current {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 10px;
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.home-page .onboarding-route__current strong {
    color: var(--text-main);
    font-size: 14px;
}

.home-page .onboarding-route__action {
    display: flex;
    justify-content: flex-end;
}

.home-page .action-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    min-height: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.home-page .action-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--bg-surface);
    min-height: 132px;
}

.home-page .action-card__body--compact {
    justify-content: center;
    min-height: 84px;
}

.home-page .action-card__title {
    font-size: 17px;
    font-weight: 800;
    color: var(--brand-dark);
    line-height: 1.35;
    margin: 0;
}

.home-page .action-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.home-page .action-card__text {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-page .action-card__progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.home-page .action-card__progress-caption {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.home-page .action-card__footer {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 2px;
}

.home-page .action-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(217, 41, 47, 0.08);
    color: var(--brand-red);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.home-page .news-panel .mini-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-page .mini-list__item {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--brand-border);
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.home-page .mini-list__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.home-page .mini-list__item:hover {
    opacity: 0.86;
}

.home-page .mini-list__title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 800;
    color: var(--brand-dark);
    line-height: 1.4;
}

.home-page .mini-list__meta {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.home-page .mini-list__summary {
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
}

.home-page .track-progress-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-page .track-progress-card {
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--bg-surface);
}

.home-page .track-progress-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.home-page .track-progress-card__title {
    font-size: 16px;
    font-weight: 800;
    color: var(--brand-dark);
    line-height: 1.3;
}

.home-page .track-progress-card__meta {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.home-page .track-progress-card__footer {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--text-muted);
    font-size: 13px;
}

.home-page .skill-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.home-page .summary-box {
    min-height: 92px;
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--bg-surface);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.home-page .summary-box .stat-title {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.home-page .summary-box .stat-value {
    margin: 0;
    color: var(--brand-dark);
    font-size: 22px;
    font-weight: 900;
    line-height: 1.1;
}

.home-page .certificate-item {
    padding: 16px 18px;
}

.home-page .list-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-page .list-item {
    padding: 14px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: var(--bg-surface);
}

.home-page .list-item-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--brand-dark);
    line-height: 1.35;
    margin-bottom: 6px;
}

.home-page .list-item-title a {
    color: inherit;
    text-decoration: none;
}

.home-page .list-item-title a:hover,
.home-page .list-item-title a:focus-visible {
    color: var(--brand-red);
}

.home-page .list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.home-page .cards-grid {
    margin-top: -2px;
}

body[data-theme="dark"] .home-page .action-card__body,
body[data-theme="dark"] .home-page .track-progress-card,
body[data-theme="dark"] .home-page .summary-box,
body[data-theme="dark"] .home-page .list-item {
    background: var(--bg-elevated);
}

body[data-theme="dark"] .home-page .action-chip {
    background: rgba(255, 87, 87, 0.12);
}

body[data-theme="dark"] .home-page .mini-list__item {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 1280px) {
    .home-action-grid {
        grid-template-columns: 1fr;
    }

    .home-page .action-card__body {
        min-height: auto;
    }

    .home-page .onboarding-route {
        grid-template-columns: 1fr;
    }

    .home-page .onboarding-route__action {
        justify-content: flex-start;
    }
}

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

    .welcome-hero__side {
        padding-top: 22px;
        padding-left: 0;
        border-top: 1px solid var(--border-soft);
        border-left: 0;
    }
}

@media (max-width: 980px) {
    .home-page .skill-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .home-page .skill-summary-grid,
    .welcome-focus-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 20px;
    }

    .welcome-focus-item:nth-child(3) {
        padding-left: 0;
        border-left: 0;
    }

    .home-page .onboarding-route__progress-meta {
        align-items: flex-start;
    }

    .home-page .onboarding-route__action .btn {
        width: 100%;
    }

    .home-page .track-progress-card__top,
    .home-page .track-progress-card__footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

body[data-theme="dark"] .mini-list__item,
body[data-theme="dark"] .track-progress-card {
    background: var(--bg-elevated);
}

body[data-theme="dark"] .action-chip {
    background: rgba(255, 87, 87, 0.12);
}

@media (max-width: 1180px) {
    .home-action-grid {
        grid-template-columns: 1fr;
    }
}

/* Compact application shell: align with feature modules that stack at 860px. */
@media (max-width: 860px) {
    .layout {
        display: block;
        min-width: 0;
    }

    .sidebar {
        position: static;
        width: 100%;
        min-width: 0;
        height: auto;
        padding: 14px 16px 10px;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }

    .brand,
    .brand-logo-only,
    .brand-stack {
        min-height: 34px;
        margin-bottom: 10px;
    }

    .brand-logo {
        width: 150px;
    }

    .nav {
        flex-direction: row;
        gap: 6px;
        width: 100%;
        padding-bottom: 4px;
        overflow-x: auto;
        overflow-y: hidden;
        overscroll-behavior-x: contain;
        scrollbar-width: thin;
    }

    .nav > *,
    .nav-link,
    .sidebar-link--summary {
        flex: 0 0 auto;
    }

    .nav-link,
    .sidebar-link--summary {
        padding: 9px 11px;
        white-space: nowrap;
    }

    .content {
        width: 100%;
        min-width: 0;
        padding: 16px;
    }

    .content > * {
        max-width: 100%;
        min-width: 0;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 16px;
    }

    .page-title {
        font-size: clamp(1.45rem, 7vw, 1.8rem);
        overflow-wrap: anywhere;
    }

    .topbar-right {
        width: 100%;
        margin-left: 0;
        flex-wrap: nowrap;
        justify-content: flex-end;
    }

    .user-box {
        flex: 1 1 auto;
        max-width: none;
        text-align: left;
    }

    .topbar-right form {
        flex: 0 0 auto;
    }
}

@media (max-width: 480px) {
    .sidebar {
        padding-inline: 12px;
    }

    .content {
        padding: 14px 12px;
    }

    .topbar-right {
        gap: 8px;
    }

    .user-meta--secondary {
        display: none;
    }
}

/* =========================================
   2026 application shell
   A compact, shared frame for learning and administration screens.
   ========================================= */

body {
    font-size: 15px;
    line-height: 1.5;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 12px;
    z-index: 300;
    padding: 9px 13px;
    border-radius: 9px;
    background: var(--brand-red);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    transform: translateY(-160%);
    transition: transform 0.16s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

:where(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 3px solid rgba(217, 41, 47, 0.32);
    outline: 3px solid color-mix(in srgb, var(--brand-red) 36%, transparent);
    outline-offset: 2px;
}

.content:focus {
    outline: none;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) auto;
    align-items: center;
    min-height: var(--app-header-height);
    background: var(--bg-surface);
    background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
    backdrop-filter: blur(16px);
}

.app-header__brand {
    align-self: stretch;
    display: flex;
    align-items: center;
    padding: 0 18px;
    border-right: 1px solid var(--border-soft);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.app-header .brand-logo {
    width: 132px;
}

.app-header__nav {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: var(--app-header-height);
    padding: 0 24px;
}

.app-header__link {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0 13px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    transition: color 0.16s ease;
}

.app-header__link::after {
    content: "";
    position: absolute;
    right: 13px;
    bottom: 0;
    left: 13px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: transparent;
}

.app-header__link:hover,
.app-header__link.active {
    color: var(--brand-red);
}

.app-header__link.active::after {
    background: var(--brand-red);
}

.app-header__actions {
    display: flex;
    align-items: center;
    justify-self: end;
    gap: 9px;
    min-width: 0;
    min-height: var(--app-header-height);
    padding: 0 18px 0 12px;
    background: var(--bg-surface);
}

.app-header__learning-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    color: var(--text-soft);
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.app-header__learning-status strong {
    color: var(--text-muted);
    font-weight: 800;
}

.app-header__learning-status:hover,
.app-header__learning-status:hover strong {
    color: var(--brand-red);
}

.app-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 5px 9px;
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    background: var(--bg-surface-soft);
}

.app-user__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--brand-red-soft);
    color: var(--brand-red);
    font-size: 12px;
    font-weight: 900;
}

.app-user__identity {
    display: grid;
    min-width: 0;
    line-height: 1.2;
    text-align: right;
}

.app-user__identity strong,
.app-user__identity small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-user__identity strong {
    max-width: 180px;
    color: var(--text-main);
    font-size: 12px;
}

.app-user__identity small {
    max-width: 180px;
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 10px;
}

.app-header__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    min-height: 36px;
    padding: 0 11px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--bg-surface-soft);
    color: var(--text-main);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.app-header__button:hover {
    border-color: var(--border-accent);
    background: var(--brand-red-soft);
    color: var(--brand-red);
}

.theme-toggle.app-header__button {
    width: 36px;
    height: 36px;
    padding: 0;
}

.layout {
    min-height: calc(100vh - var(--app-header-height));
}

.sidebar {
    top: var(--app-header-height);
    height: calc(100vh - var(--app-header-height));
    padding: 16px 12px 24px;
}

.content {
    padding: 24px 28px 40px;
}

.content--dashboard > * {
    max-width: var(--dashboard-max);
}

.topbar {
    margin-bottom: 20px;
}

.page-title {
    font-size: clamp(1.55rem, 2vw, 2rem);
}

.nav {
    gap: 3px;
}

.nav-link,
.sidebar-sublink {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 42px;
    padding: 9px 11px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
}

.nav-link__icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-link__label {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.nav-link.active::before,
.sidebar-sublink.active::before {
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
}

.nav-link.active {
    background: var(--brand-red-soft);
}

.nav-badge {
    width: 20px;
    min-width: 20px;
    min-height: 18px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 900;
}

.nav-separator {
    display: block;
    height: 1px;
    margin: 7px 7px;
    background: var(--border-soft);
}

body[data-theme="dark"] .app-header {
    background: var(--bg-sidebar);
    background: color-mix(in srgb, var(--bg-sidebar) 94%, transparent);
}

body[data-theme="dark"] .app-header__actions {
    background: var(--bg-sidebar);
}

@media (max-width: 1100px) {
    .app-header {
        grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    }

    .app-header__nav {
        display: none;
    }

    .app-header__actions {
        justify-self: end;
    }
}

@media (max-width: 860px) {
    .app-header {
        grid-template-columns: minmax(132px, 1fr) auto;
    }

    .app-header__brand {
        padding-inline: 14px;
        border-right: 0;
    }

    .app-header .brand-logo {
        width: 122px;
    }

    .app-header__actions {
        padding-right: 12px;
    }

    .app-header__learning-status {
        display: none;
    }

    .sidebar {
        position: sticky;
        top: var(--app-header-height);
        z-index: 90;
        height: auto;
        padding: 8px 12px;
        background: var(--bg-sidebar);
        background: color-mix(in srgb, var(--bg-sidebar) 96%, transparent);
        backdrop-filter: blur(14px);
    }

    .nav {
        gap: 4px;
        padding-bottom: 0;
    }

    .nav-link,
    .sidebar-link--summary {
        min-height: 38px;
        padding: 8px 10px;
    }

    .nav-link.active::before,
    .sidebar-sublink.active::before {
        top: auto;
        right: 10px;
        bottom: -8px;
        left: 10px;
        width: auto;
        height: 2px;
        border-radius: 2px 2px 0 0;
    }

    .nav-separator {
        width: 1px;
        height: 24px;
        margin: 7px 3px;
    }

    .content {
        padding: 20px 16px 32px;
    }

    .topbar {
        display: flex;
        margin-bottom: 18px;
    }
}

@media (max-width: 620px) {
    .app-user__identity {
        display: none;
    }

    .app-header__actions {
        gap: 6px;
    }

    .app-header__logout {
        padding-inline: 9px;
    }

    .nav-link__icon {
        width: 17px;
        height: 17px;
    }
}

@media (max-width: 480px) {
    .app-header .brand-logo {
        width: 108px;
    }

    .app-header__brand {
        padding-left: 10px;
    }

    .app-user__avatar {
        display: none;
    }

    .content {
        padding: 16px 12px 28px;
    }
}
