:root {
    --brand: #6257E8;
    --brand-dark: #473CC7;
    --brand-hover: #746AF0;
    --brand-soft: #EFEEFF;
    --brand-border: #D0CCFF;
    --ink: #15156B;
    --text-2: #5D6072;
    --text-3: #8C8FA0;
    --border: #DCDDE6;
    --border-soft: #ECECF2;
    --card: #FFFFFF;
    --bg: #F4F4F8;
    --soft: #F8F8FB;
    --success: #1E8449;
    --success-soft: #EAF7EF;
    --warning: #B45309;
    --warning-soft: #FFF4E2;
    --danger: #C0392B;
    --danger-soft: #FDECEC;
    --info: #2D6CDF;
    --info-soft: #EAF2FF;
    --cyan: #0A98A6;
    --cyan-soft: #E5F6F6;
    --purple: #6257E8;
    --purple-soft: #EFEEFF;
    --lime: #B9E85B;
    --lime-soft: #F2F9DF;
    --coral: #F06A64;
    --coral-soft: #FFF0EF;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --shadow: 0 18px 44px rgba(23, 24, 39, .11);
    --shadow-soft: 0 8px 22px rgba(23, 24, 39, .08);
    --shadow-pressed: inset 0 0 0 1px rgba(23, 24, 39, .08);
    --glow: 0 10px 24px rgba(98, 87, 232, .2);
    --sidebar-w: 0px;
    --ease: cubic-bezier(.2, .8, .2, 1);

    /* Theme-scoped surfaces: overridden per [data-theme], default matches the
       original hand-picked values above exactly. */
    --sidebar-bg: var(--ink);
    --sidebar-fg: #FFFFFF;
    --sidebar-fg-rgb: 255, 255, 255;
    --on-accent: var(--ink);
    --elevated: var(--soft);
    --scrollbar-thumb: var(--border);
    --scrollbar-track: transparent;
    --code-bg: #10104A;
    --code-fg: #F2F3FF;
    --font-body: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
    --font-heading: var(--font-body);
    --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    --heading-transform: none;
    --heading-tracking: normal;
    --card-texture: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 13.5px/1.45 var(--font-body);
}
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    text-transform: var(--heading-transform);
    letter-spacing: var(--heading-tracking);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
a, button, summary, input, textarea, select, .card, .tag, .topic-node, .tree-nav a, .tree-nav .tree-item, .course-row, .choice-row, .filter-option, .question-help-btn, .question-help-tip, .question-hint-panel, .question-field, .notification-bell, .notification-bell strong, .bug-report-fab, .bug-report-fab span, .help-actions, .help-actions button {
    transition:
        background-color .2s var(--ease),
        border-color .2s var(--ease),
        color .2s var(--ease),
        box-shadow .2s var(--ease),
        opacity .2s var(--ease),
        transform .2s var(--ease);
}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    max-height: 100vh;
    padding: 18px 14px;
    background: rgba(247, 249, 255, .9);
    border-right: 1px solid rgba(221, 227, 241, .75);
    box-shadow: 8px 0 24px rgba(97, 112, 150, .12);
    backdrop-filter: blur(18px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
html { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 999px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
.mobile-menu-toggle,
.mobile-menu-backdrop {
    display: none;
}
.sidebar-nav {
    display: contents;
}
.logo-box { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.logo-box-branded {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 8px 8px 14px;
}
.logo-brand {
    display: block;
    width: 142px;
    max-width: 100%;
    height: auto;
}
.logo-mark {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: white;
    font-weight: 800;
    box-shadow: var(--shadow-soft);
}
.logo-box strong { display: block; font-size: 14px; }
.logo-box span { color: var(--brand); font-size: 11.5px; font-weight: 700; }
.logo-box-branded strong { font-size: 13px; }
.logo-box-branded span {
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.sec {
    margin: 16px 8px 5px;
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.nav {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 10px;
    border-radius: 10px;
    color: var(--text-2);
    font-weight: 600;
}
.nav:hover { background: var(--soft); color: var(--brand); transform: translateX(2px); box-shadow: var(--shadow-soft); }
.nav.active { background: var(--brand-soft); color: var(--brand); box-shadow: var(--shadow-pressed); }
.nav.active::before {
    content: "";
    position: absolute;
    left: -6px;
    width: 3px;
    height: 18px;
    border-radius: 99px;
    background: var(--brand);
}
.ai-tag {
    padding: 2px 6px;
    border-radius: 99px;
    background: var(--purple-soft);
    color: var(--purple);
    font-size: 10px;
    font-weight: 700;
}
.user-dock {
    margin-top: auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 46px;
    gap: 8px;
    align-items: center;
}
.user-menu {
    position: relative;
    min-width: 0;
}
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.notification-bell {
    position: relative;
    width: 46px;
    height: 46px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--card);
    color: var(--text-2);
    cursor: pointer;
    display: grid;
    place-items: center;
}
.notification-bell:hover {
    border-color: var(--brand-border);
    background: var(--soft);
    color: var(--brand);
    transform: translateY(-1px);
}
.notification-bell svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.notification-bell strong {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid white;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    display: grid;
    place-items: center;
    font-size: 10px;
    font-weight: 900;
    line-height: 1;
}
.user-box {
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    display: flex;
    gap: 10px;
    align-items: center;
}
.user-box:hover {
    border-color: var(--brand-border);
    box-shadow: var(--shadow-soft);
}
.user-actions {
    display: grid;
    gap: 8px;
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(.98);
    transform-origin: bottom center;
}
.user-menu[open] .user-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    animation: menu-rise .18s var(--ease);
}
.user-actions .btn { justify-content: center; width: 100%; }
.avatar {
    width: 30px;
    height: 30px;
    border-radius: 99px;
    background: var(--brand);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 800;
}
.user-box strong, .user-box span { display: block; }
.user-box span { color: var(--text-3); font-size: 11px; }

.main { margin-left: var(--sidebar-w); padding: 20px 26px 42px; max-width: 1480px; }
.topbar {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}
.crumb { color: var(--text-3); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.breadcrumb a { color: var(--brand); }
.breadcrumb a::after {
    content: "/";
    color: var(--text-3);
    margin-left: 6px;
}
.breadcrumb span { color: var(--text-3); }
.page-tools {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
h1 { margin: 2px 0 0; font-size: 19px; letter-spacing: -.01em; }
h2 { margin: 6px 0 8px; font-size: 26px; line-height: 1.12; letter-spacing: -.02em; max-width: 24ch; }
h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 700; }
p { color: var(--text-2); margin: 0 0 12px; max-width: 72ch; }
.topbar.compact { justify-content: flex-start; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.search {
    min-width: 210px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-3);
    background: var(--card);
    box-shadow: var(--shadow-pressed);
}
.kbd { float: right; border: 1px solid var(--border); border-radius: 6px; padding: 0 5px; font-size: 11px; }

.btn {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8.5px 15px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: var(--shadow-soft);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--glow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-pressed); }
.btn:disabled {
    cursor: not-allowed;
    opacity: .58;
    box-shadow: none;
    transform: none;
}
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: var(--card); color: var(--brand); border-color: var(--brand-border); }
.btn-plain { background: var(--card); color: var(--text-2); border-color: var(--border); }
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-2);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    box-shadow: var(--shadow-soft);
}
.icon-btn:hover { border-color: var(--brand-border); color: var(--brand); transform: translateY(-1px); box-shadow: var(--glow); }

.card {
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}
.card:hover { box-shadow: 11px 11px 26px rgba(97, 112, 150, .22), -11px -11px 26px rgba(255, 255, 255, .92); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.more { color: var(--brand); font-weight: 700; font-size: 12px; }
.insight {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 22px;
    margin-bottom: 16px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.eyebrow { color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi span { color: var(--text-2); font-size: 11.5px; }
.kpi strong { display: block; color: var(--brand); font-size: 28px; line-height: 1.1; letter-spacing: -.02em; margin-top: 5px; }
.kpi small { color: var(--text-3); }
.two-col { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1.1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.two-col-stretch { align-items: stretch; }
.lesson-side-panel { display: flex; flex-direction: column; }
.lesson-assistant {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-soft);
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.lesson-assistant-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.lesson-assistant-head .tree-title { margin: 0; }
.lesson-assistant-clear {
    padding: 3px 9px;
    border: 1px solid var(--border-soft);
    border-radius: 99px;
    background: transparent;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
    flex: 0 0 auto;
}
.lesson-assistant-clear:hover { border-color: var(--coral); color: var(--coral); }
.lesson-assistant-hint { margin: 8px 0 10px; color: var(--text-3); font-size: 12px; flex: 0 0 auto; }
.lesson-assistant-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 80px;
    overflow-y: auto;
    margin-bottom: 10px;
}
.lesson-assistant-log:empty { display: none; }
.lesson-assistant-entry { display: grid; gap: 6px; }
.lesson-assistant-q {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--bg-soft, #F3F4F8);
    font-size: 12.5px;
    font-weight: 650;
}
.lesson-assistant-a {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    font-size: 12.5px;
    color: var(--text-2);
    white-space: pre-wrap;
}
.lesson-assistant-a.is-loading { color: var(--text-3); font-style: italic; }
.lesson-assistant-a.is-error { color: var(--coral); border-color: var(--coral); }
.lesson-assistant-a > *, .selection-ask-answer > * { margin: 0 0 8px; }
.lesson-assistant-a > *:last-child, .selection-ask-answer > *:last-child { margin-bottom: 0; }
.lesson-assistant-a ul, .lesson-assistant-a ol, .selection-ask-answer ul, .selection-ask-answer ol { padding-left: 18px; }
.lesson-assistant-a code, .selection-ask-answer code {
    background: rgba(0, 0, 0, .06);
    padding: 1px 4px;
    border-radius: 4px;
    font-size: .92em;
}
.lesson-assistant-a .code-block, .selection-ask-answer .code-block { font-size: 11px; }
.lesson-assistant-form { display: grid; gap: 8px; }
.lesson-assistant-form textarea {
    width: 100%;
    resize: vertical;
    font: inherit;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
}

.selection-ask-btn {
    position: absolute;
    z-index: 200;
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid var(--brand-border);
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    box-shadow: var(--shadow);
}
.selection-ask-popup {
    position: absolute;
    z-index: 200;
    width: min(340px, calc(100vw - 32px));
    padding: 12px;
    display: grid;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.selection-ask-quote {
    padding: 6px 8px;
    border-radius: 6px;
    background: var(--bg-soft, #F3F4F8);
    color: var(--text-2);
    font-size: 11.5px;
    max-height: 80px;
    overflow-y: auto;
}
.selection-ask-popup textarea {
    width: 100%;
    resize: vertical;
    font: inherit;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
}
.selection-ask-actions { display: flex; justify-content: flex-end; gap: 8px; }
.selection-ask-answer {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-soft);
    font-size: 12.5px;
    color: var(--text-2);
    white-space: pre-wrap;
}
.selection-ask-answer.is-error { color: var(--coral); border-color: var(--coral); }
.profile-grid { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.admin-split { grid-template-columns: minmax(0, 1.5fr) minmax(320px, .9fr); }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.module-card { display: flex; flex-direction: column; min-height: 210px; }
.module-card .btn { margin-top: auto; justify-content: center; }
.course-card { display: flex; flex-direction: column; min-height: 260px; }
.course-card.available {
    background: var(--card);
    border-color: var(--border-soft);
}
.course-card.done {
    background: var(--success-soft);
    border-color: #BFE8CD;
}
.course-card.retry {
    background: var(--warning-soft);
    border-color: #F8D9A8;
}
.course-card.locked {
    background: #F1F3F6;
    border-color: #DDE1E8;
    color: var(--text-3);
}
.course-card.locked:hover {
    box-shadow: var(--shadow);
}
.coming-card {
    filter: grayscale(.25);
}
.course-card .btn { margin-top: auto; justify-content: center; }
.learning-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}
.learning-actions .btn {
    margin-top: 0;
}
.course-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: center;
}
.course-card-actions .btn {
    min-width: 170px;
    margin-top: 0;
    justify-content: center;
}
.course-search-panel {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
}
.course-search-label {
    min-width: 0;
}
.course-search-label span {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.course-search-input {
    min-height: 42px;
}
.course-search-count {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.course-search-empty {
    margin-top: 12px;
}
.course-assignment-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    grid-column: 1;
    margin: 2px 0;
}
.course-assignment-meta div,
.course-assignment-panel dl div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 9px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--soft);
}
.course-assignment-meta span,
.course-assignment-panel dt {
    color: var(--text-3);
    font-size: 10.5px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.course-assignment-meta strong,
.course-assignment-panel dd {
    margin: 0;
    color: var(--ink);
    font-weight: 800;
    overflow-wrap: anywhere;
}
.course-assignment-status {
    grid-column: 1 / -1;
    width: fit-content;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--info-soft);
    color: var(--info);
    font-size: 11px;
    font-weight: 900;
}
.course-assignment-status.overdue {
    background: var(--danger-soft);
    color: var(--danger);
}
.course-assignment-status.completed {
    background: var(--success-soft);
    color: var(--success);
}
.course-assignment-panel {
    display: grid;
    gap: 12px;
    padding: 14px;
    margin: 14px 0;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    background: var(--brand-soft);
}
.course-assignment-panel.overdue {
    border-color: #F4C7C2;
    background: var(--danger-soft);
}
.course-assignment-panel.completed {
    border-color: #BFE8CD;
    background: var(--success-soft);
}
.course-assignment-panel > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.course-assignment-panel > div:first-child strong {
    color: var(--brand);
    font-size: 16px;
}
.course-assignment-panel.overdue > div:first-child strong {
    color: var(--danger);
}
.course-assignment-panel.completed > div:first-child strong {
    color: var(--success);
}
.course-assignment-panel dl {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}
.course-assignment-panel p {
    max-width: none;
    margin: 0;
    color: var(--ink);
    font-weight: 700;
}
.course-completion-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    margin: 14px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow-soft);
}
.course-completion-box.compact {
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    background: var(--soft);
}
.course-completion-box .card-head {
    margin-bottom: 0;
}
.course-completion-box h3 {
    margin: 2px 0 0;
}
.course-completion-box p {
    max-width: none;
    margin: 0;
    color: var(--text-2);
    font-weight: 700;
}
.course-completion-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}
.completion-item {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--soft);
}
.completion-mark {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: var(--card);
}
.completion-mark::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: inherit;
    background: var(--text-3);
}
.completion-item strong,
.completion-item small {
    display: block;
    min-width: 0;
    overflow-wrap: anywhere;
}
.completion-item strong {
    color: var(--ink);
    font-size: 12.5px;
}
.completion-item small {
    margin-top: 2px;
    color: var(--text-3);
    font-weight: 700;
}
.completion-item.done {
    border-color: #BFE8CD;
    background: var(--success-soft);
}
.completion-item.done .completion-mark {
    border-color: #BFE8CD;
}
.completion-item.done .completion-mark::before {
    background: var(--success);
}
.completion-item.work {
    border-color: #F8D9A8;
    background: var(--warning-soft);
}
.completion-item.work .completion-mark {
    border-color: #F8D9A8;
}
.completion-item.work .completion-mark::before {
    background: var(--warning);
}
.completion-item.skipped {
    background: #F1F3F6;
    color: var(--text-3);
}
.completion-item.skipped .completion-mark::before {
    background: var(--text-3);
}
.assignment-card {
    margin-top: 16px;
}
.assignment-card h2 {
    max-width: none;
}
.assignment-form {
    display: grid;
    gap: 12px;
}
.assignment-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}
.assignment-required {
    align-self: center;
    min-height: 42px;
}
.assignment-comment {
    grid-column: 1 / -1;
}
.assignment-comment textarea {
    min-height: 82px;
}
.assignment-list {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}
.assignment-row {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--soft);
}
.assignment-row span {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 700;
}
.course-catalog {
    display: grid;
    gap: 12px;
}
.course-catalog .course-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 22px;
    align-items: center;
    min-height: 0;
}
.course-catalog .course-card .card-head,
.course-catalog .course-card h2,
.course-catalog .course-card p,
.course-catalog .course-card .bar {
    grid-column: 1;
}
.course-catalog .course-card .card-head {
    margin-bottom: 0;
}
.course-catalog .course-card h2 {
    max-width: none;
    margin: 0;
    font-size: 21px;
}
.course-catalog .course-card p {
    max-width: 92ch;
    margin-bottom: 0;
}
.course-catalog .course-card .bar {
    max-width: 520px;
    margin: 2px 0 0;
}
.course-catalog .course-card .btn {
    grid-column: 2;
    grid-row: 1 / span 4;
    align-self: center;
    min-width: 170px;
    margin-top: 0;
    justify-content: center;
}
.course-catalog .course-card .course-card-actions {
    grid-column: 2;
    grid-row: 1 / span 5;
}
.course-catalog .course-card .course-card-actions .btn {
    grid-column: auto;
    grid-row: auto;
    width: 100%;
}
.course-layout { grid-template-columns: minmax(0, 2fr) minmax(260px, .8fr); }
.course-road { max-width: none; }
.topic-path {
    display: grid;
    gap: 14px;
    margin-top: 18px;
}
.topic-node {
    position: relative;
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}
.topic-node:hover { border-color: var(--brand-border); transform: translateY(-1px); }
.topic-node::before {
    content: "";
    position: absolute;
    left: 34px;
    top: -14px;
    width: 2px;
    height: 14px;
    background: var(--border);
}
.topic-node:first-child::before { display: none; }
.topic-node span {
    width: 42px;
    height: 42px;
    border-radius: 99px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 800;
}
.topic-node.available {
    background: var(--card);
    border-color: var(--border);
}
.topic-node.done {
    background: var(--success-soft);
    border-color: #BFE8CD;
}
.topic-node.retry,
.topic-node.pending {
    background: var(--warning-soft);
    border-color: #F8D9A8;
}
.topic-node.locked {
    background: #F1F3F6;
    border-color: #DDE1E8;
    color: var(--text-3);
    cursor: not-allowed;
}
.topic-node.locked:hover {
    border-color: #DDE1E8;
    transform: none;
}
.topic-node.done span { background: #DDF2E5; color: var(--success); }
.topic-node.retry span,
.topic-node.pending span { background: #FFE9C2; color: var(--warning); }
.topic-node.locked span { background: #E4E7EC; color: var(--text-3); }
.topic-node strong { display: block; }
.topic-node small { color: var(--text-3); }
.module-num {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 800;
    margin-bottom: 12px;
}
.video-placeholder {
    min-height: 260px;
    border: 1px dashed var(--brand-border);
    border-radius: var(--radius);
    background: var(--brand-soft);
    color: var(--brand);
    display: grid;
    place-items: center;
    font-weight: 700;
    margin-bottom: 18px;
}
.video-player-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 8px 22px rgba(16, 24, 40, .05);
}
.video-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--soft);
}
.video-tab {
    width: auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 13px;
    background: var(--card);
    color: var(--text-2);
    font-weight: 800;
    cursor: pointer;
}
.video-tab:hover:not(:disabled) {
    border-color: var(--brand-border);
    color: var(--brand);
    transform: translateY(-1px);
}
.video-tab.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}
.video-tab:disabled {
    cursor: not-allowed;
    opacity: .48;
}
.video-stage {
    background: #000;
}
.video-frame {
    aspect-ratio: 16 / 9;
    background: var(--soft);
}
.video-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #000;
}
.video-rights-list {
    min-height: 0;
}
.video-rights {
    margin: -6px 0 16px;
    padding: 0;
    color: var(--text-3);
    font-size: 12px;
    font-style: italic;
}
.video-rights a {
    color: var(--brand);
    font-weight: 800;
    font-style: italic;
}
.video-rights[hidden] { display: none; }
.video-pane .video-placeholder {
    min-height: 260px;
    margin-bottom: 0;
    border: 0;
    border-radius: 0;
}
.lesson-body {
    color: var(--text-2);
    margin: 0 0 16px;
    max-width: 84ch;
}
.lesson-body p {
    margin: 0 0 14px;
    max-width: none;
}
.lesson-body h1,
.lesson-body h2,
.lesson-body h3,
.lesson-body h4,
.lesson-body h5,
.lesson-body h6 {
    color: var(--ink);
    max-width: none;
    letter-spacing: 0;
}
.lesson-body h1,
.lesson-body h2 {
    margin: 22px 0 12px;
    font-size: 22px;
    line-height: 1.2;
}
.lesson-body h3 {
    margin: 20px 0 10px;
    font-size: 18px;
    line-height: 1.25;
}
.lesson-body h4 {
    margin: 18px 0 8px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 900;
}
.lesson-body h5,
.lesson-body h6 {
    margin: 16px 0 8px;
    font-size: 13.5px;
    line-height: 1.35;
    font-weight: 800;
}
.lesson-body > :first-child {
    margin-top: 0;
}
.lesson-body strong {
    color: var(--ink);
    font-weight: 800;
}
.lesson-body em {
    color: var(--ink);
}
.lesson-body ul,
.lesson-body ol {
    margin: 0 0 16px 20px;
    padding: 0;
    color: var(--ink);
}
.lesson-body li {
    margin: 5px 0;
    padding-left: 3px;
}
.lesson-body hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}
.lesson-body .code-block {
    margin: 18px 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 8px;
    background: var(--code-bg);
    color: var(--code-fg);
}
.lesson-body .code-block-head {
    min-height: 34px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .05);
    color: var(--lime);
    font-size: 10px;
    font-weight: 800;
}
.lesson-body .code-block pre {
    margin: 0;
    padding: 16px 18px 18px;
    overflow-x: auto;
    tab-size: 4;
}
.lesson-body .code-block code {
    color: inherit;
    font: 12.5px/1.65 Consolas, "Cascadia Code", "Courier New", monospace;
    white-space: pre;
}
.lesson-body p code,
.lesson-body li code {
    padding: 2px 5px;
    border: 1px solid var(--brand-border);
    border-radius: 4px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font: 12px/1.4 Consolas, "Cascadia Code", "Courier New", monospace;
}
.task-box {
    border-left: 3px solid var(--brand);
    padding: 12px 14px;
    background: var(--soft);
    border-radius: 0 10px 10px 0;
    margin: 16px 0;
}
.timeline { display: grid; gap: 12px; border-left: 1px solid var(--border); padding-left: 14px; margin-bottom: 18px; }
.timeline a, .timeline span { position: relative; color: var(--text-2); font-weight: 600; }
.timeline a:hover { color: var(--brand); transform: translateX(2px); }
.timeline a::before, .timeline span::before {
    content: "";
    position: absolute;
    left: -19px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--border);
}
.timeline .hot::before { background: var(--brand); }
.timeline .hot { color: var(--brand); }
.timeline .done-state {
    color: var(--success);
    background: var(--success-soft);
    width: fit-content;
    padding: 4px 8px;
    border-radius: 99px;
}
.timeline .pending-state {
    color: var(--warning);
    background: var(--warning-soft);
    width: fit-content;
    padding: 4px 8px;
    border-radius: 99px;
}
.timeline .done-state::before { background: var(--success); }
.timeline .pending-state::before { background: var(--warning); }
.tree-title { margin-top: 16px; }
.tree-toggle > summary {
    margin: 0 0 10px;
    font-size: 13.5px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.tree-toggle > summary::-webkit-details-marker { display: none; }
.tree-toggle > summary .nav-chevron { color: var(--text-3); transition: transform .15s ease; }
.tree-toggle[open] > summary .nav-chevron { transform: rotate(180deg); }
.tree-toggle .tree-nav { margin-top: 10px; }
.tree-nav { display: grid; gap: 8px; }
.tree-nav a,
.tree-nav .tree-item {
    display: grid;
    grid-template-columns: 26px 1fr;
    gap: 8px;
    align-items: center;
    padding: 9px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    color: var(--text-2);
}
.tree-nav a:hover { border-color: var(--brand-border); color: var(--brand); }
.tree-nav .tree-root {
    display: block;
    font-weight: 800;
    color: var(--brand);
    background: var(--brand-soft);
    border-color: var(--brand-border);
}
.tree-nav a span,
.tree-nav .tree-item span {
    width: 26px;
    height: 26px;
    border-radius: 99px;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}
.tree-nav a strong,
.tree-nav .tree-item strong { font-size: 12.5px; }
.tree-nav a.available {
    background: var(--card);
    border-color: var(--border);
}
.tree-nav a.done,
.tree-nav .tree-item.done {
    background: var(--success-soft);
    border-color: #BFE8CD;
}
.tree-nav a.done span,
.tree-nav .tree-item.done span {
    background: #DDF2E5;
    color: var(--success);
}
.tree-nav a.retry,
.tree-nav .tree-item.retry,
.tree-nav a.pending {
    background: var(--warning-soft);
    border-color: #F8D9A8;
}
.tree-nav a.retry span,
.tree-nav .tree-item.retry span,
.tree-nav a.pending span {
    background: #FFE9C2;
    color: var(--warning);
}
.tree-nav .tree-item.locked {
    background: #F1F3F6;
    border-color: #DDE1E8;
    color: var(--text-3);
    cursor: not-allowed;
}
.tree-nav .tree-item.locked span {
    background: #E4E7EC;
    color: var(--text-3);
}
.tree-nav a.active {
    outline: 2px solid var(--brand-border);
    color: var(--brand);
}

.bar { height: 8px; background: var(--border-soft); border-radius: 99px; overflow: hidden; margin: 8px 0 14px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.bar.sm { height: 6px; min-width: 110px; margin: 0 0 4px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 12px; }
.kv span { color: var(--text-3); }
.kv strong { font-weight: 600; }
.tag {
    display: inline-flex;
    width: fit-content;
    border: 0;
    border-radius: 99px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
}
button.tag { cursor: pointer; }
button.tag:hover { filter: brightness(.97); }
.t-reg { background: var(--cyan-soft); color: var(--cyan); }
.t-work { background: var(--warning-soft); color: var(--warning); }
.t-done { background: var(--success-soft); color: var(--success); }
.t-ai { background: var(--purple-soft); color: var(--purple); }
.t-muted { background: var(--border-soft); color: var(--text-2); }
.ai-box {
    background: var(--purple-soft);
    border-color: #E4DBFA;
}
.ai-box.inline { padding: 12px; border-radius: var(--radius); border: 1px solid #E4DBFA; }

.daily-question {
    display: grid;
    gap: 14px;
}
.profile-dashboard {
    display: grid;
    gap: 16px;
    width: min(1344px, 100%);
    margin: 0 auto;
}
.continue-learning-card,
.next-action-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: center;
    margin: 0;
    border-color: var(--brand-border);
    background: var(--brand-soft);
}
.continue-learning-card h2,
.next-action-card h2 {
    max-width: none;
    margin-top: 4px;
    font-size: 22px;
}
.continue-learning-card p,
.next-action-card p {
    margin-bottom: 8px;
    max-width: none;
}
.continue-learning-card small,
.next-action-card small {
    color: var(--text-3);
    font-weight: 700;
}
.continue-learning-card .btn,
.next-action-card .btn {
    min-width: 190px;
    justify-content: center;
    white-space: nowrap;
}
.continue-learning-card.done,
.next-action-card.done {
    border-color: #BFE8CD;
    background: var(--success-soft);
}
.continue-learning-card.retry,
.next-action-card.retry {
    border-color: #F8D9A8;
    background: var(--warning-soft);
}
.continue-learning-card.locked,
.next-action-card.locked {
    border-color: #DDE1E8;
    background: #F1F3F6;
}
.next-action-card.daily {
    border-color: #F8D9A8;
    background: var(--warning-soft);
}
.next-action-card.available {
    border-color: var(--brand-border);
    background: var(--brand-soft);
}
.next-action-reason {
    display: grid;
    gap: 3px;
    margin: 10px 0;
    padding: 10px 12px;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, .68);
}
.next-action-reason strong {
    color: var(--brand);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.next-action-reason span {
    color: var(--ink);
    font-weight: 700;
}
.continue-learning-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}
.continue-learning-meta span,
.continue-learning-meta strong {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 800;
}
.continue-learning-meta span {
    background: var(--card);
    color: var(--brand);
    border: 1px solid var(--brand-border);
}
.continue-learning-meta strong {
    background: var(--soft);
    color: var(--text-2);
}
.profile-hero {
    display: grid;
    grid-template-columns: minmax(220px, .8fr) minmax(0, 1.4fr);
    gap: 18px;
    align-items: start;
    margin-bottom: 0;
}
.profile-main {
    display: flex;
    align-items: center;
    gap: 14px;
}
.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    background: var(--brand);
    color: white;
    font-size: 28px;
    font-weight: 900;
}
.profile-main h2 {
    margin: 4px 0 3px;
}
.profile-main p {
    margin: 0;
    color: var(--text-2);
}
.profile-inline-form {
    display: grid;
    gap: 12px;
}
.profile-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.profile-fields label:nth-child(4) {
    grid-column: 1 / -1;
}
.profile-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.profile-save-actions[hidden],
.tab-panel[hidden] {
    display: none;
}
.profile-hero {
    grid-template-columns: minmax(340px, .95fr) minmax(340px, 1.05fr);
    align-items: stretch;
}
.profile-info-card,
.profile-stats-card {
    min-height: 330px;
}
.profile-info-card { position: relative; }
.profile-settings-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    display: grid;
    place-items: center;
}
.account-settings-card { max-height: min(80vh, 760px); overflow-y: auto; }
.profile-inline-form {
    min-height: 100%;
    align-content: start;
}
.profile-name-input {
    max-width: 360px;
    font-size: 28px;
    line-height: 1.15;
    font-weight: 900;
    padding: 6px 8px;
}
.profile-inline-form:not(.is-editing) .profile-edit-control {
    display: none;
}
.profile-inline-form.is-editing [data-profile-view] {
    display: none;
}
.profile-inline-form.is-editing .profile-edit-control {
    display: block;
}
.profile-info-list {
    display: grid;
    gap: 10px;
    margin: 14px 0 0;
}
.profile-info-list div {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}
.profile-info-list dt {
    color: var(--text-3);
    font-weight: 800;
}
.profile-info-list dd {
    margin: 0;
    color: var(--ink);
    font-weight: 700;
    overflow-wrap: anywhere;
}
.profile-info-list textarea {
    min-height: 86px;
}
.profile-actions {
    margin-top: auto;
}
.profile-stats-card {
    display: flex;
    flex-direction: column;
}
.profile-stats-scroll {
    display: grid;
    gap: 8px;
    max-height: 238px;
    overflow-y: auto;
    padding-right: 4px;
}
.profile-stat-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--soft);
}
.profile-stat-row span {
    color: var(--text-2);
    font-weight: 700;
}
.profile-stat-row strong {
    color: var(--brand);
    font-size: 18px;
}
.daily-launch {
    display: grid;
    justify-items: center;
    margin: 8px 0 16px;
}
.quick-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    width: 100%;
}
.quick-actions > div {
    min-width: min(280px, 100%);
    margin-right: auto;
}
.quick-actions p {
    margin-bottom: 0;
}
.quick-actions .btn {
    min-height: 38px;
}
.quick-actions .btn strong {
    font-size: 11px;
    color: var(--text-3);
}
.profile-secondary-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}
.daily-game-button {
    width: min(520px, 100%);
    border: 1px solid #F8D9A8;
    border-radius: 999px;
    padding: 14px 22px;
    background: var(--warning-soft);
    color: var(--warning);
    box-shadow: 0 10px 26px rgba(180, 83, 9, .12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.daily-game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(180, 83, 9, .16);
}
.daily-game-button span {
    font-size: 15px;
    font-weight: 900;
}
.daily-game-button strong {
    font-size: 12px;
}
.daily-modal-card {
    border-color: #F8D9A8;
    background: var(--card);
}
.daily-question-text {
    font-size: 18px;
    font-weight: 900;
    color: var(--ink);
}
.game-choice {
    background: var(--card);
    border-color: #F8D9A8;
}
.game-choice:hover {
    background: #FFF7E8;
}
.achievement-center {
    margin: 0;
    border-radius: 24px;
    text-align: center;
    display: grid;
    align-content: center;
    gap: 12px;
}
.achievement-center .card-head {
    justify-content: center;
}
.achievement-strip.centered {
    justify-content: center;
}
.achievement-medal {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-weight: 900;
    border: 2px solid var(--border);
    background: var(--card);
    color: var(--text-2);
    box-shadow: 0 8px 20px rgba(16, 24, 40, .08);
}
.achievement-medal.earned {
    border-color: #BFE8CD;
    background: var(--success-soft);
    color: var(--success);
}
.achievement-medal.locked {
    background: #E4E7EC;
    color: var(--text-3);
    filter: grayscale(1);
}
.latest-ideas-card {
    margin: 0;
}
.idea-history-card {
    max-width: 920px;
    margin: 0 auto 16px;
}
.idea-history-panel {
    display: grid;
    gap: 10px;
}
.idea-history-panel h3 {
    margin-bottom: 0;
}
.idea-timeline {
    display: grid;
    gap: 0;
}
.idea-timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 10px;
    padding: 0 0 16px;
}
.idea-timeline-item::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 22px;
    bottom: 0;
    width: 2px;
    background: var(--border-soft);
}
.idea-timeline-item:last-child {
    padding-bottom: 0;
}
.idea-timeline-item:last-child::before {
    display: none;
}
.idea-timeline-dot {
    width: 20px;
    height: 20px;
    border: 2px solid var(--brand-border);
    border-radius: 999px;
    background: var(--brand-soft);
}
.idea-timeline-item strong,
.idea-timeline-item span,
.idea-timeline-item small {
    display: block;
}
.idea-timeline-item strong {
    color: var(--ink);
}
.idea-timeline-item span,
.idea-timeline-item small {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 800;
}
.idea-timeline-item p {
    max-width: none;
    margin: 4px 0;
    color: var(--text-2);
}
.idea-history-panel .idea-timeline-item {
    padding-bottom: 14px;
}
.idea-history-panel .empty-state {
    padding: 12px;
}
.moderator-comment-box {
    display: grid;
    gap: 7px;
    padding: 12px;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    background: var(--brand-soft);
}
.moderator-comment-box strong {
    color: var(--ink);
}
.moderator-comment-box p {
    margin: 0;
    max-width: none;
    color: var(--ink);
    font-weight: 700;
}
.moderator-comment-box small {
    color: var(--text-2);
    font-weight: 700;
}
.idea-next-step-box {
    display: grid;
    gap: 7px;
    margin: 0 0 16px;
    padding: 13px 14px;
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    background: var(--brand-soft);
}
.idea-next-step-box p {
    max-width: none;
    margin: 0;
    color: var(--ink);
    font-weight: 800;
    line-height: 1.45;
}
.idea-version-bar {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
}
.idea-version-bar strong,
.idea-version-bar small {
    display: block;
}
.idea-version-bar small {
    color: var(--text-3);
    font-weight: 700;
}
.idea-version-menu {
    position: relative;
}
.idea-version-menu summary {
    list-style: none;
}
.idea-version-menu summary::-webkit-details-marker {
    display: none;
}
.idea-version-options {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 10;
    display: grid;
    gap: 6px;
    width: min(320px, calc(100vw - 48px));
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    box-shadow: 0 14px 36px rgba(16, 24, 40, .16);
}
.idea-version-options a {
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 9px;
    background: var(--soft);
}
.idea-version-options a:hover,
.idea-version-options a.active {
    border-color: var(--brand-border);
    background: var(--brand-soft);
    color: var(--brand);
}
.tab-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tab-button {
    width: auto;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 12px;
    background: var(--card);
    color: var(--text-2);
    font-weight: 800;
    cursor: pointer;
}
.tab-button.active {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}
.center-actions {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}
.choice-list {
    display: grid;
    gap: 8px;
}
.achievement-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}
.achievement-card {
    display: grid;
    gap: 10px;
    align-content: start;
}
.achievement-card.locked {
    background: #F1F3F6;
    color: var(--text-3);
}
.achievement-badge {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-2);
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(16, 24, 40, .05);
}
.achievement-badge.earned {
    background: var(--success-soft);
    border-color: #BFE8CD;
    color: var(--success);
}
.achievement-badge.locked {
    background: #E4E7EC;
    color: var(--text-3);
    filter: grayscale(1);
}
.activity-list {
    display: grid;
    gap: 10px;
}
.activity-item {
    display: grid;
    gap: 3px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}
.activity-item:last-child { border-bottom: 0; }
.activity-item span,
.muted-text,
.news-card small {
    color: var(--text-3);
}
.activity-item small {
    color: var(--text-3);
    font-size: 11px;
}
.news-list {
    display: grid;
    gap: 14px;
}
.news-card p {
    color: var(--text-2);
    max-width: 86ch;
}
.event-empty {
    min-height: 260px;
    display: grid;
    align-content: center;
    gap: 8px;
}
.highlight-row {
    background: var(--brand-soft);
}

table.data { width: 100%; border-collapse: collapse; }
.table-scroll { width: 100%; overflow-x: auto; }
.data th {
    background: var(--soft);
    color: var(--text-3);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: left;
    padding: 9px;
    border-bottom: 1px solid var(--border);
}
.data td { padding: 10px 9px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.data tr:hover td { background: var(--soft); }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--brand-soft); }
.th-filter {
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    letter-spacing: inherit;
    text-transform: inherit;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.sort-mark {
    display: inline-block;
    min-width: 10px;
    color: var(--brand);
}
.id { color: var(--brand); font-weight: 800; white-space: nowrap; }
.sub { color: var(--text-3); font-size: 11px; margin-top: 2px; }

label { display: grid; gap: 6px; color: var(--text-2); font-weight: 700; }
.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-2);
    font-weight: 700;
}
.checkbox-line input { width: auto; }
.checkbox-line-wrap { align-items: flex-start; font-weight: 400; }
.checkbox-line-wrap input { margin-top: 4px; }
input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 10px;
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-pressed);
}
input:hover, textarea:hover, select:hover { border-color: var(--brand-border); }
input:focus, textarea:focus, select:focus {
    border-color: var(--brand);
    box-shadow: var(--shadow-pressed), 0 0 0 3px rgba(79, 70, 229, .14);
    outline: 0;
}
label.has-error input,
label.has-error textarea,
label.has-error select {
    border-color: var(--danger);
    background: var(--danger-soft);
}
.field-error {
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}
textarea { min-height: 98px; resize: vertical; }
.tall-textarea { min-height: 320px; }
.form-stack { display: grid; gap: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.autosave-status {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 700;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid button { width: fit-content; }
.question-card { display: grid; gap: 10px; }
.result-card { margin-bottom: 16px; }
.inline-result {
    margin: 16px 0;
    padding: 14px;
    border-radius: var(--radius);
    background: var(--soft);
}
.inline-result strong {
    display: block;
    margin: 8px 0 4px;
    color: var(--brand);
    font-size: 24px;
}
.exam-result-list {
    display: grid;
    gap: 12px;
}
.exam-result-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    padding: 14px;
    box-shadow: var(--shadow-soft);
}
.exam-question {
    color: var(--ink);
    font-weight: 700;
}
.answer-review {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 8px 12px;
    padding: 12px;
    border-radius: 12px;
    background: var(--soft);
}
.answer-review span {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}
.answer-review strong {
    font-weight: 600;
    white-space: pre-wrap;
}
.attempt-snapshot-row td {
    background: var(--soft);
}
.attempt-snapshot {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--card);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}
.attempt-snapshot summary {
    cursor: pointer;
    padding: 11px 12px;
    color: var(--brand);
    font-weight: 800;
}
.attempt-snapshot summary:hover {
    background: var(--brand-soft);
}
.attempt-snapshot-list {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid var(--border-soft);
}
.attempt-snapshot-item {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--soft);
}
.attempt-snapshot-item .card-head {
    margin-bottom: 0;
}
.snapshot-options {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--card);
}
.snapshot-options span {
    color: var(--text-3);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}
.snapshot-options strong {
    color: var(--ink);
    font-weight: 600;
    white-space: pre-wrap;
}
.alert {
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 14px;
    font-weight: 700;
}
.alert.danger { background: var(--danger-soft); color: var(--danger); border: 1px solid #F4C7C2; }
.alert.success { background: var(--success-soft); color: var(--success); border: 1px solid #BFE8CD; }
.inline-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.admin-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    align-items: end;
}
.admin-form-grid .btn { width: fit-content; align-self: end; }
.user-create-form { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.row-form { display: flex; gap: 8px; align-items: center; }
.action-list { display: grid; gap: 10px; }
.action-list .btn { justify-content: center; }
.link { color: var(--brand); font-weight: 700; }
.admin-user-page {
    display: grid;
    gap: 16px;
}
.detail-hero {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 16px;
}
.detail-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(100px, 1fr));
    gap: 10px;
    min-width: min(420px, 100%);
}
.detail-kpis div {
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--soft);
}
.detail-kpis strong { display: block; color: var(--brand); font-size: 22px; }
.detail-kpis span { color: var(--text-3); font-size: 11px; }
.admin-report-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.admin-report-card {
    display: grid;
    gap: 6px;
}
.admin-report-card strong {
    color: var(--brand);
    font-size: 25px;
    line-height: 1.1;
}
.admin-report-card p {
    margin: 0;
    max-width: none;
    font-size: 12px;
}
.course-accordion { display: grid; gap: 12px; }
.course-list { display: grid; gap: 10px; }
.course-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}
.course-row:hover { background: var(--brand-soft); border-color: var(--brand-border); transform: translateY(-1px); }
.course-row strong, .course-row span { display: block; }
.course-row span { color: var(--text-2); margin-top: 3px; }
.course-row small { color: var(--brand); font-weight: 800; white-space: nowrap; }
.course-detail {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--card);
}
.course-detail[open] { box-shadow: 0 8px 22px rgba(16, 24, 40, .06); }
.course-detail summary {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    background: var(--soft);
    font-weight: 700;
}
.course-detail summary:hover { color: var(--brand); }
.course-detail summary span { color: var(--brand); }
.course-progress-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}
.course-progress-card[open] {
    box-shadow: 0 8px 22px rgba(16, 24, 40, .05);
}
.course-progress-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px 92px;
    gap: 12px;
    align-items: center;
    padding: 13px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: var(--soft);
    cursor: pointer;
    list-style: none;
}
.course-progress-head::-webkit-details-marker {
    display: none;
}
.course-progress-head::marker {
    content: "";
}
.course-progress-head > strong {
    min-width: 0;
    overflow-wrap: anywhere;
}
.course-progress-head > .tag {
    justify-self: center;
    min-width: 72px;
    justify-content: center;
}
.course-progress-head::after {
    content: "Показать";
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    justify-self: end;
}
.course-progress-card[open] .course-progress-head::after {
    content: "Скрыть";
}
.course-topic-list {
    display: grid;
}
.course-topic-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px 96px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
}
.course-topic-row:last-child {
    border-bottom: 0;
}
.course-topic-row > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}
.course-topic-row strong {
    overflow-wrap: anywhere;
}
.course-topic-row > strong {
    color: var(--brand);
    text-align: right;
}
.course-topic-row span {
    color: var(--text-3);
    font-size: 12px;
    font-weight: 700;
}
.admin-log-list,
.admin-ai-call-list {
    display: grid;
    gap: 8px;
}
.admin-log-item,
.admin-ai-call-row {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--card);
    overflow: hidden;
}
.admin-log-summary {
    display: grid;
    grid-template-columns: 150px 260px minmax(0, 1fr) 84px 140px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}
.admin-log-summary::-webkit-details-marker {
    display: none;
}
.admin-log-summary::marker {
    content: "";
}
.admin-log-summary > strong {
    min-width: 0;
    overflow-wrap: anywhere;
}
.admin-log-summary > span:first-child,
.admin-log-summary > span:nth-child(4) {
    color: var(--text-3);
    font-weight: 800;
}
.admin-log-summary > span:nth-child(4) {
    text-align: right;
}
.admin-log-summary > .tag {
    justify-self: end;
}
.admin-log-summary.idea-summary {
    grid-template-columns: minmax(180px, 1fr) minmax(120px, .8fr) auto 80px 132px;
    cursor: default;
}
.admin-answer-list {
    display: grid;
    gap: 6px;
    padding: 0 14px 12px 176px;
}
.admin-answer-row {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--text-2);
    font-weight: 800;
}
.admin-answer-row .is-ok {
    color: var(--success);
}
.admin-answer-row .is-bad {
    color: var(--warning);
}
.admin-show-more {
    justify-self: center;
    margin-top: 4px;
}
.admin-ai-call-row {
    display: grid;
    grid-template-columns: 132px minmax(140px, .8fr) minmax(160px, .8fr) minmax(220px, 1.4fr);
    gap: 12px;
    align-items: start;
    padding: 12px 14px;
}
.admin-ai-call-row span:first-child {
    color: var(--text-3);
    font-weight: 800;
}
.admin-ai-call-row span:last-child {
    color: var(--text-2);
}
.topic-inline-form {
    display: grid;
    gap: 12px;
}
.topic-inline-grid {
    align-items: start;
}
.topic-inline-grid [data-topic-view] {
    overflow-wrap: anywhere;
}
.topic-inline-grid .topic-edit-control {
    display: none;
}
.topic-inline-form.is-editing [data-topic-view] {
    display: none;
}
.topic-inline-form.is-editing .topic-edit-control {
    display: block;
}
.topic-inline-actions {
    padding-top: 4px;
}
.topic-inline-actions[hidden] {
    display: none;
}
.admin-topic-questions {
    margin-top: 28px;
}
.admin-question-list {
    display: grid;
    gap: 12px;
}
.admin-question-detail {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(16, 24, 40, .04);
}
.admin-question-detail[open] {
    border-color: var(--brand-border);
    box-shadow: 0 8px 22px rgba(16, 24, 40, .06);
}
.admin-question-detail summary {
    cursor: pointer;
    display: grid;
    grid-template-columns: 34px auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 13px 16px;
    background: var(--card);
}
.admin-question-detail summary:hover {
    background: var(--brand-soft);
}
.admin-question-detail summary strong,
.admin-question-detail summary small,
.question-main {
    min-width: 0;
}
.question-index {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--soft);
    color: var(--brand);
    font-weight: 800;
}
.question-main {
    display: grid;
    gap: 3px;
}
.question-main strong {
    color: var(--ink);
    line-height: 1.25;
}
.admin-question-detail summary small {
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.question-edit-hint {
    color: var(--brand);
    font-size: 11px;
    font-weight: 800;
    opacity: 0;
    transform: translateX(-4px);
}
.admin-question-detail summary:hover .question-edit-hint,
.admin-question-detail[open] .question-edit-hint {
    opacity: 1;
    transform: translateX(0);
}
.admin-question-detail[open] summary {
    background: var(--brand-soft);
}
.admin-question-edit {
    padding: 16px;
    border-top: 1px solid var(--border-soft);
    background: var(--soft);
}
.compact-table th, .compact-table td { padding: 8px 10px; }
.kv.wide { grid-template-columns: 110px 1fr; }
.kv.wide strong { font-weight: 500; white-space: pre-wrap; }
hr { border: 0; border-top: 1px solid var(--border-soft); margin: 16px 0; }
.narrow-card { max-width: 760px; }
.empty-state {
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-3);
    background: var(--soft);
}
.modal-form-stack {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
.question-field {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 14px 14px;
    display: grid;
    gap: 10px;
}
.question-field:hover,
.question-field:focus-within {
    border-color: var(--brand-border);
    box-shadow: 0 8px 24px rgba(16, 24, 40, .06);
}
.question-help-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--brand-border);
    border-radius: 50%;
    background: var(--card);
    color: var(--brand);
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    font-weight: 900;
    opacity: 0;
    transform: translateY(-4px) scale(.96);
    box-shadow: var(--shadow);
    z-index: 2;
}
.question-field:hover .question-help-btn,
.question-field:focus-within .question-help-btn,
.question-help-btn:focus-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.question-help-btn:hover {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}
.question-help-btn:disabled {
    cursor: wait;
    opacity: .75;
}
.question-help-tip {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    width: max-content;
    max-width: 220px;
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    box-shadow: var(--shadow);
}
.question-help-tip::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 100%;
    border: 6px solid transparent;
    border-top-color: var(--ink);
}
.question-help-btn:hover .question-help-tip,
.question-help-btn:focus-visible .question-help-tip {
    opacity: 1;
    transform: translateY(0);
}
.question-hint-panel {
    border: 1px solid var(--brand-border);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--brand-soft);
    color: var(--ink);
    font-weight: 600;
    line-height: 1.5;
    white-space: pre-wrap;
    animation: hintIn .18s var(--ease);
}
.question-hint-panel[hidden] { display: none; }
.question-hint-panel.is-loading {
    color: var(--text-2);
}
.question-hint-panel.is-error {
    border-color: #F4C7C2;
    background: var(--danger-soft);
    color: var(--danger);
}
@keyframes hintIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.case-field {
    background: var(--soft);
}
.matching-field {
    background: var(--soft);
}
.matching-connect {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 72px;
    align-items: start;
    isolation: isolate;
}
.matching-lines {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}
.matching-line {
    fill: none;
    stroke: var(--brand);
    stroke-width: 3;
    stroke-linecap: round;
    filter: drop-shadow(0 3px 5px rgba(79, 70, 229, .22));
}
.matching-column {
    position: relative;
    z-index: 1;
    min-width: 0;
}
.matching-board-title {
    display: block;
    margin: 0 0 7px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.matching-items {
    display: grid;
    gap: 8px;
    align-content: start;
    height: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow-pressed);
}
.matching-card {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: var(--soft);
    color: var(--ink);
    font-weight: 700;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}
.matching-card:hover {
    border-color: var(--brand-border);
    background: var(--brand-soft);
    color: var(--brand);
    transform: translateY(-1px);
}
.matching-card.is-selected {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .14);
}
.matching-card.is-connected {
    border-color: var(--brand-border);
    background: var(--card);
}
.matching-card-left {
    cursor: pointer;
}
.matching-help {
    grid-column: 1 / -1;
    position: relative;
    z-index: 1;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}
.matching-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}
.matching-row {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(260px, 1.1fr);
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--card);
}
.matching-row:hover {
    border-color: var(--brand-border);
    background: var(--brand-soft);
}
.matching-left {
    min-width: 0;
    color: var(--ink);
    font-weight: 800;
    overflow-wrap: anywhere;
}
.matching-select {
    min-width: 0;
}
.matching-select select {
    margin: 0;
}
.case-field p {
    color: var(--ink);
    font-weight: 600;
    max-width: none;
}
.question-field legend {
    padding: 0 6px;
    font-weight: 800;
    color: var(--ink);
}
.choice-row {
    display: flex;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--card);
    color: var(--ink);
    font-weight: 500;
}
.choice-row:hover {
    border-color: var(--brand-border);
    background: var(--brand-soft);
}
.choice-row:has(input:checked) {
    border-color: var(--brand-border);
    background: var(--brand-soft);
    color: var(--brand);
}
.choice-row input[type="radio"],
.choice-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    box-shadow: none;
    accent-color: var(--brand);
}
.choice-row input[type="checkbox"] {
    border-radius: 4px;
}
.choice-row input[type="radio"]:focus,
.choice-row input[type="checkbox"]:focus {
    box-shadow: none;
}
.choice-row span {
    min-width: 0;
    line-height: 1.35;
}
.modal {
    width: min(760px, calc(100vw - 32px));
    border: 0;
    border-radius: var(--radius);
    padding: 0;
    box-shadow: 18px 18px 54px rgba(72, 84, 125, .26), -12px -12px 34px rgba(255, 255, 255, .76);
    opacity: 0;
    transform: translateY(14px) scale(.98);
}
.modal[open] {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: modal-in .22s var(--ease);
}
.modal::backdrop {
    background: rgba(21, 28, 58, .34);
    backdrop-filter: blur(5px);
    animation: fade-in .2s var(--ease);
}
.modal-card {
    padding: 18px;
    background: var(--card);
    border-radius: var(--radius);
}
.notifications-modal {
    width: min(920px, calc(100vw - 44px));
}
.notifications-modal-card {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 12px;
    height: min(760px, calc(100vh - 64px));
}
.notification-tabs {
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 10px;
}
.notification-feed {
    display: grid;
    gap: 10px;
    align-content: start;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 6px 2px 0;
}
.notification-item {
    position: relative;
    display: grid;
    gap: 6px;
    min-height: 92px;
    padding: 16px 132px 16px 16px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--card);
    box-shadow: var(--shadow-soft);
}
.notification-item:hover {
    border-color: var(--brand-border);
    background: var(--soft);
}
.notification-time {
    position: absolute;
    top: 14px;
    right: 16px;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}
.notification-title {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.3;
    overflow-wrap: anywhere;
}
.notification-text {
    max-width: none;
    margin: 0;
    color: var(--text-2);
    overflow-wrap: anywhere;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}
.export-modal-card p {
    max-width: none;
}
.export-scope-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.export-scope-grid .checkbox-line {
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--soft);
}
.export-scope-grid .checkbox-line:hover {
    border-color: var(--brand-border);
    background: var(--brand-soft);
}
.help-widget {
    position: fixed;
    right: 26px;
    bottom: 26px;
    z-index: 60;
}
.bug-report-fab {
    position: relative;
    width: 52px;
    height: 52px;
    border: 1px solid var(--brand-border);
    border-radius: 50%;
    background: var(--card);
    color: var(--brand);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 21px;
    font-weight: 900;
    box-shadow: var(--shadow);
}
.help-fab {
    z-index: 2;
}
.bug-report-fab:hover {
    background: var(--brand-dark);
    border-color: var(--brand);
    color: white;
    transform: translateY(-2px);
}
.help-actions {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    width: 230px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    display: grid;
    gap: 7px;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(.98);
    transform-origin: bottom right;
}
.help-actions::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 100%;
    border: 6px solid transparent;
    border-top-color: var(--card);
}
.help-widget:hover .help-actions,
.help-widget:focus-within .help-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}
.help-actions button {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--soft);
    color: var(--ink);
    cursor: pointer;
    text-align: left;
    font-weight: 700;
}
.help-actions button:hover {
    border-color: var(--brand-border);
    background: var(--brand-soft);
    color: var(--brand);
}
.bug-report-modal {
    width: min(680px, calc(100vw - 32px));
}
.bug-report-form label {
    display: grid;
    gap: 6px;
    color: var(--text-2);
    font-weight: 700;
}
.bug-report-form textarea {
    resize: vertical;
}
.bug-report-status {
    min-height: 18px;
    color: var(--text-3);
    font-weight: 700;
}
.bug-report-status.is-success { color: var(--success); }
.bug-report-status.is-error { color: var(--danger); }
.bug-report-status.is-loading { color: var(--text-2); }
.bug-report-list {
    display: grid;
    gap: 10px;
}
.bug-report-row {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--soft);
}
.bug-report-row strong {
    display: block;
    margin: 8px 0;
    white-space: pre-wrap;
}
.bug-report-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--text-3);
    font-size: 12px;
    font-weight: 700;
}
.bug-report-row .sub {
    display: inline-block;
    max-width: 100%;
    word-break: break-word;
}
.onboarding-backdrop,
.onboarding-spotlight,
.onboarding-popover {
    display: none;
}
.onboarding-active {
    overflow: hidden;
}
[data-onboarding-root].is-active .onboarding-backdrop,
[data-onboarding-root].is-active .onboarding-spotlight,
[data-onboarding-root].is-active .onboarding-popover {
    display: block;
}
.onboarding-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(16, 24, 40, .54);
    animation: fade-in .18s var(--ease);
}
.onboarding-spotlight {
    position: fixed;
    z-index: 81;
    border: 2px solid white;
    border-radius: 14px;
    box-shadow:
        0 0 0 9999px rgba(16, 24, 40, .54),
        0 14px 40px rgba(255, 255, 255, .16);
    pointer-events: none;
    transition:
        left .22s var(--ease),
        top .22s var(--ease),
        width .22s var(--ease),
        height .22s var(--ease);
}
.onboarding-popover {
    position: fixed;
    z-index: 82;
    padding: 16px;
    border: 1px solid var(--brand-border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 20px 60px rgba(16, 24, 40, .24);
    animation: popover-in .18s var(--ease);
}
.onboarding-popover h3 {
    margin: 4px 0 8px;
    font-size: 17px;
}
.onboarding-popover p {
    max-width: none;
}
.onboarding-step {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 99px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 11px;
    font-weight: 800;
}
.onboarding-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}
.filter-popover {
    position: fixed;
    z-index: 30;
    width: 292px;
    max-height: 380px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 12px 36px rgba(16, 24, 40, .16);
    animation: popover-in .18s var(--ease);
}
.filter-search { margin-bottom: 10px; }
.filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}
.filter-actions button {
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--soft);
    color: var(--text-2);
    padding: 7px 8px;
    cursor: pointer;
    font-weight: 700;
}
.filter-actions button:hover {
    border-color: var(--brand-border);
    color: var(--brand);
    transform: translateY(-1px);
}
.filter-options {
    max-height: 190px;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    gap: 0;
}
.filter-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    height: 38px;
    min-height: 38px;
    padding: 0 6px;
    border-radius: 8px;
    color: var(--ink);
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
}
.filter-option input {
    width: 16px;
    height: 16px;
    margin: 0;
}
.filter-option span {
    display: block;
    min-width: max-content;
    overflow: visible;
    white-space: nowrap;
}
.filter-option:hover { background: var(--soft); }

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
    background: var(--sidebar-bg);
}
.login-shell {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .82fr);
    gap: 0;
    border: 1px solid var(--border-soft);
    border-radius: 22px;
    background: var(--card);
    box-shadow: 16px 16px 44px rgba(97, 112, 150, .24), -16px -16px 44px rgba(var(--sidebar-fg-rgb), .86);
    overflow: hidden;
}
.login-brand-panel {
    min-height: 560px;
    padding: 42px;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 36px;
}
.login-brand-logo {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
}
.login-brand-logo .logo-mark {
    width: 46px;
    height: 46px;
    border: 1px solid rgba(var(--sidebar-fg-rgb), .24);
    box-shadow: 7px 7px 18px rgba(24, 20, 80, .24), -6px -6px 18px rgba(var(--sidebar-fg-rgb), .12);
}
.login-brand-logo img {
    width: 150px;
    max-width: 100%;
    padding: 9px 12px;
    border-radius: 12px;
    background: var(--card);
}
.login-brand-logo span {
    padding: 6px 10px;
    border: 1px solid rgba(var(--sidebar-fg-rgb), .3);
    border-radius: 999px;
    color: rgba(var(--sidebar-fg-rgb), .86);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}
.login-brand-panel .eyebrow {
    color: rgba(var(--sidebar-fg-rgb), .78);
}
.login-brand-panel h1 {
    max-width: 13ch;
    margin: 12px 0 14px;
    color: var(--sidebar-fg);
    font-size: 42px;
    line-height: 1.02;
    letter-spacing: -.02em;
}
.login-brand-panel p {
    max-width: 54ch;
    color: rgba(var(--sidebar-fg-rgb), .82);
    font-size: 15px;
}
.login-brand-note {
    display: grid;
    gap: 4px;
    padding-top: 18px;
    border-top: 1px solid rgba(var(--sidebar-fg-rgb), .18);
}
.login-brand-note strong {
    color: var(--sidebar-fg);
    letter-spacing: .06em;
}
.login-brand-note span {
    color: rgba(var(--sidebar-fg-rgb), .72);
    font-weight: 700;
}
.login-card {
    width: min(420px, 100%);
    background: var(--card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.login-shell .login-card {
    width: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 42px;
    align-self: center;
}
.login-card-head {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 28px;
}
.login-card-head strong,
.login-card-head span {
    display: block;
}
.login-card-head span {
    color: var(--brand);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}
.bitrix-card {
    width: min(560px, 100%);
}
.login-card h1 { margin: 18px 0 8px; font-size: 24px; }
.login-card h2 {
    margin: 0 0 8px;
    max-width: none;
    font-size: 28px;
}
.login-card p {
    max-width: none;
}
.login-shell .login-card .btn {
    justify-content: center;
    min-height: 42px;
}
.hint { color: var(--text-3); font-size: 12px; margin-top: 14px; }

.app-footer {
    display: flex;
    gap: 18px;
    justify-content: center;
    padding: 24px 0 12px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-3);
}
.app-footer a { color: var(--text-3); }
.app-footer a:hover { color: var(--text-2); }
.login-footer { padding-bottom: 24px; }

.legal-page { max-width: 760px; margin: 0 auto; line-height: 1.6; }
.legal-page h3 { margin: 26px 0 8px; font-size: 17px; }
.legal-page p, .legal-page ul { margin: 0 0 10px; color: var(--text-2); }
.legal-page ul { padding-left: 20px; }
.legal-page li { margin-bottom: 4px; }

@media (max-width: 880px) {
    html,
    body {
        overflow-x: hidden;
    }
    body {
        padding-bottom: 0;
    }
    body.login-page {
        padding-bottom: 24px;
    }
    .login-page {
        padding: 14px;
    }
    .login-shell {
        grid-template-columns: 1fr;
        border-radius: 16px;
    }
    .login-brand-panel {
        min-height: 0;
        padding: 24px;
        gap: 22px;
    }
    .login-brand-panel h1 {
        max-width: none;
        font-size: 28px;
    }
    .login-brand-logo .logo-mark {
        width: 40px;
        height: 40px;
    }
    .login-shell .login-card {
        padding: 24px;
    }
    body.mobile-menu-open {
        overflow: hidden;
    }
    .sidebar {
        position: fixed;
        inset: 0 0 auto 0;
        top: 0;
        z-index: 55;
        width: 100%;
        min-height: auto;
        max-height: none;
        padding: 10px 14px;
        flex-direction: row;
        align-items: center;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 22px rgba(16, 24, 40, .08);
    }
    .mobile-menu-toggle {
        width: 36px;
        height: 36px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: var(--card);
        display: grid;
        place-items: center;
        gap: 3px;
        padding: 8px;
        cursor: pointer;
        flex: 0 0 auto;
    }
    .mobile-menu-toggle span {
        display: block;
        width: 18px;
        height: 2px;
        border-radius: 99px;
        background: var(--brand);
    }
    .mobile-menu-toggle:hover {
        border-color: var(--brand-border);
        background: var(--brand-soft);
    }
    .sidebar-nav {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 90;
        width: min(320px, calc(100vw - 42px));
        padding: 74px 14px 18px;
        border-right: 1px solid var(--border);
        background: var(--card);
        box-shadow: 20px 0 48px rgba(72, 84, 125, .22);
        display: flex;
        flex-direction: column;
        gap: 8px;
        overflow-y: auto;
        transform: translateX(-104%);
        transition: transform .24s var(--ease);
    }
    .mobile-menu-open .sidebar-nav {
        transform: translateX(0);
    }
    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 50;
        border: 0;
        background: rgba(16, 24, 40, .42);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s var(--ease);
    }
    .mobile-menu-open .mobile-menu-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }
    .sidebar-nav::before {
        content: "Меню";
        position: fixed;
        left: 14px;
        top: 18px;
        color: var(--brand);
        font-size: 12px;
        font-weight: 900;
        letter-spacing: .12em;
        text-transform: uppercase;
    }
    .sidebar-nav .sec {
        margin-top: 14px;
    }
    .sidebar-nav .nav {
        min-height: 42px;
        padding: 11px 12px;
    }
    .logo-box {
        margin: 0;
        flex: 1;
        min-width: 0;
    }
    .logo-box-branded {
        align-items: center;
        flex-direction: row;
        gap: 9px;
        padding: 0;
    }
    .logo-brand {
        width: 112px;
        flex: 0 0 auto;
    }
    .logo-mark {
        width: 32px;
        height: 32px;
        border-radius: 9px;
    }
    .logo-box strong {
        font-size: 13px;
    }
    .logo-box span {
        font-size: 10px;
    }
    .main {
        margin-left: 0;
        padding: 72px 14px 22px;
    }
    .topbar {
        margin-bottom: 12px;
    }
    .crumb {
        font-size: 10px;
    }
    h1 {
        font-size: 18px;
    }
    h2 {
        font-size: 22px;
        max-width: none;
    }
    .card {
        padding: 14px;
        border-radius: 12px;
    }
    .topbar, .insight { align-items: flex-start; flex-direction: column; }
    .kpi-grid, .module-grid, .two-col, .form-grid, .admin-split, .detail-kpis, .admin-report-grid, .profile-hero, .profile-secondary-row, .profile-fields { grid-template-columns: 1fr; }
    .lesson-assistant { position: static; max-height: none; }
    .lesson-assistant-log { flex: none; max-height: 320px; }
    .profile-dashboard {
        display: flex;
        flex-direction: column;
    }
    .continue-learning-card,
    .next-action-card { order: 1; }
    .profile-hero { order: 2; gap: 12px; }
    .daily-launch,
    .profile-secondary-row { order: 3; }
    .latest-ideas-card { order: 5; }
    .profile-info-card,
    .profile-stats-card {
        min-height: 0;
    }
    .profile-main {
        align-items: flex-start;
    }
    .profile-avatar {
        width: 52px;
        height: 52px;
        border-radius: 18px;
        font-size: 23px;
    }
    .profile-name-input {
        max-width: 100%;
        font-size: 22px;
    }
    .profile-stats-scroll {
        max-height: none;
        grid-template-columns: 1fr;
    }
    .profile-fields label:nth-child(4) { grid-column: auto; }
    .profile-actions { justify-content: flex-start; }
    .profile-info-list div { grid-template-columns: 1fr; gap: 3px; }
    .continue-learning-card,
    .next-action-card {
        grid-template-columns: 1fr;
    }
    .continue-learning-card .btn,
    .next-action-card .btn {
        width: 100%;
    }
    .quick-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .quick-actions > div,
    .quick-actions .btn {
        width: 100%;
    }
    .course-catalog .course-card {
        grid-template-columns: 1fr;
    }
    .course-catalog .course-card .course-card-actions {
        grid-column: 1;
        grid-row: auto;
        width: 100%;
    }
    .course-catalog .course-card .btn {
        grid-column: 1;
        grid-row: auto;
        width: 100%;
        min-width: 0;
    }
    .course-catalog .course-card .bar {
        max-width: none;
    }
    .course-search-panel {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .course-search-count {
        justify-self: start;
    }
    .course-assignment-meta,
    .course-assignment-panel dl {
        grid-template-columns: 1fr;
    }
    .course-assignment-meta {
        grid-column: auto;
    }
    .course-assignment-panel > div:first-child {
        align-items: flex-start;
        flex-direction: column;
    }
    .course-completion-list {
        grid-template-columns: 1fr;
    }
    .course-completion-box.compact {
        padding: 12px;
    }
    .course-progress-head {
        align-items: flex-start;
        grid-template-columns: 1fr;
    }
    .course-progress-head > .tag,
    .course-progress-head::after {
        justify-self: start;
    }
    .course-topic-row {
        grid-template-columns: 1fr auto;
    }
    .course-topic-row > span {
        grid-column: 1 / -1;
    }
    .admin-log-summary,
    .admin-log-summary.idea-summary,
    .admin-ai-call-row {
        grid-template-columns: 1fr;
    }
    .admin-log-summary > span:nth-child(4) {
        text-align: left;
    }
    .admin-answer-list {
        padding: 0 14px 12px;
    }
    .learning-actions {
        flex-direction: column;
    }
    .learning-actions .btn {
        width: 100%;
    }
    .assignment-grid {
        grid-template-columns: 1fr;
    }
    .assignment-comment {
        grid-column: auto;
    }
    .daily-game-button { border-radius: var(--radius); align-items: flex-start; flex-direction: column; }
    .detail-hero { flex-direction: column; align-items: stretch; }
    .inline-form { grid-template-columns: 1fr; }
    .search { min-width: 0; width: 100%; }
    .answer-review, .admin-question-detail summary { grid-template-columns: 1fr; }
    .idea-version-bar {
        align-items: stretch;
        flex-direction: column;
    }
    .idea-version-menu summary {
        justify-content: center;
        width: 100%;
    }
    .idea-version-options {
        left: 0;
        right: auto;
        width: 100%;
    }
    .matching-connect {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .matching-lines {
        display: none;
    }
    .matching-row {
        grid-template-columns: 1fr;
    }
    .latest-ideas-card {
        overflow-x: auto;
    }
    .latest-ideas-card table {
        min-width: 520px;
    }
    .help-widget {
        right: 14px;
        bottom: 88px;
    }
    .bug-report-fab {
        width: 48px;
        height: 48px;
    }
    .help-actions {
        width: min(230px, calc(100vw - 28px));
    }
    .modal {
        width: calc(100vw - 22px);
        max-height: calc(100vh - 24px);
    }
    .modal-card {
        max-height: calc(100vh - 24px);
        overflow-y: auto;
    }
    .notifications-modal-card {
        height: calc(100vh - 24px);
        overflow: hidden;
    }
    .notification-feed {
        min-height: 0;
    }
    .notification-item {
        padding: 42px 12px 14px;
    }
    .notification-time {
        left: 12px;
        right: auto;
        top: 12px;
    }
    .user-dock {
        grid-template-columns: auto 46px;
        margin-top: 0;
        margin-left: auto;
    }
    .notification-bell {
        width: 46px;
        height: 46px;
        border-radius: 12px;
        box-shadow: none;
    }
    .user-menu {
        margin-top: 0;
        margin-left: 0;
    }
    .user-box {
        padding: 8px;
        border-radius: 12px;
    }
    .user-box > div:last-child {
        display: none;
    }
    .user-actions {
        position: absolute;
        left: auto;
        right: 0;
        top: calc(100% + 8px);
        bottom: auto;
        width: 190px;
        margin-top: 0;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        box-shadow: 0 14px 36px rgba(16, 24, 40, .14);
    }
}

@keyframes menu-rise {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(14px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes popover-in {
    from { opacity: 0; transform: translateY(-6px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

/* Slacla visual system: top navigation, flat work surfaces, editorial hierarchy. */
* {
    letter-spacing: 0 !important;
}

html {
    background: var(--bg);
}

body {
    min-width: 320px;
    font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
}

.app-header {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: 252px;
    height: 100vh;
    color: var(--sidebar-fg);
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(var(--sidebar-fg-rgb), .1);
}

.app-header-inner {
    width: 100%;
    height: 100%;
    padding: 22px 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    align-items: stretch;
    gap: 14px;
}

.sidebar-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 8px 20px;
    border-bottom: 1px solid rgba(var(--sidebar-fg-rgb), .1);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
}

.brand-glyph {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(var(--sidebar-fg-rgb), .28);
    border-radius: 7px;
    background: var(--lime);
    color: var(--on-accent);
    font-size: 19px;
    font-weight: 900;
}

.brand-copy {
    display: grid;
    line-height: 1;
}

.brand-copy strong {
    font-size: 18px;
    font-weight: 800;
}

.brand-copy small {
    margin-top: 4px;
    color: rgba(var(--sidebar-fg-rgb), .56);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.global-nav {
    min-width: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--sidebar-fg-rgb), .16) transparent;
}

.global-nav .nav {
    width: 100%;
    min-height: 38px;
    padding: 9px 11px;
    border-radius: 6px;
    color: rgba(var(--sidebar-fg-rgb), .68);
    font-size: 12.5px;
    font-weight: 650;
    white-space: nowrap;
}

.global-nav > .nav:hover,
.global-nav > .nav.active,
.global-nav > .nav-cluster > summary:hover,
.global-nav > .nav-cluster.active > summary,
.global-nav > .nav-cluster[open] > summary {
    background: rgba(var(--sidebar-fg-rgb), .1);
    color: var(--sidebar-fg);
    box-shadow: none;
    transform: none;
}

.global-nav > .nav.active::before {
    inset: 9px auto 9px -4px;
    width: 3px;
    height: auto;
    border-radius: 0 3px 3px 0;
    background: var(--lime);
}

.global-nav .ai-tag {
    margin-left: 3px;
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--lime);
    color: var(--on-accent);
    font-size: 9px;
}

.nav-cluster {
    position: relative;
    width: 100%;
}

.nav-cluster > summary {
    list-style: none;
    cursor: pointer;
}

.nav-cluster > summary::-webkit-details-marker {
    display: none;
}

.nav-chevron {
    margin-left: 5px;
    color: rgba(var(--sidebar-fg-rgb), .42);
    font-size: 13px;
}

.nav-popover {
    position: static;
    width: 100%;
    padding: 4px 0 5px 12px;
    display: grid;
    gap: 2px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.nav-popover-wide {
    width: 100%;
}

.nav-popover .nav {
    color: rgba(var(--sidebar-fg-rgb), .54);
    white-space: normal;
}

.nav-popover .nav:hover,
.nav-popover .nav.active {
    background: rgba(var(--sidebar-fg-rgb), .08);
    color: var(--sidebar-fg);
    box-shadow: none;
    transform: none;
}

.nav-popover .nav.active::before {
    display: none;
}

.nav-popover-label {
    padding: 8px 10px 4px;
    color: rgba(var(--sidebar-fg-rgb), .3);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.sidebar-balance {
    margin: auto 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid rgba(var(--sidebar-fg-rgb), .1);
    border-radius: 7px;
    background: rgba(var(--sidebar-fg-rgb), .05);
    color: rgba(var(--sidebar-fg-rgb), .58);
    font-size: 11px;
    font-weight: 700;
}
.sidebar-balance:hover {
    border-color: rgba(var(--sidebar-fg-rgb), .2);
    background: rgba(var(--sidebar-fg-rgb), .09);
    color: var(--sidebar-fg);
}
.sidebar-balance strong {
    color: var(--lime);
    font-size: 13px;
}

.header-actions,
.user-dock {
    margin: 8px 0 0;
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 8px;
}

.notification-bell {
    width: 40px;
    height: 40px;
    border-color: rgba(var(--sidebar-fg-rgb), .15);
    border-radius: 7px;
    background: rgba(var(--sidebar-fg-rgb), .06);
    color: rgba(var(--sidebar-fg-rgb), .76);
    box-shadow: none;
}

.notification-bell:hover {
    border-color: rgba(var(--sidebar-fg-rgb), .28);
    background: rgba(var(--sidebar-fg-rgb), .12);
    color: var(--sidebar-fg);
    transform: none;
}

.notification-bell strong {
    border-color: var(--sidebar-bg);
    background: var(--coral);
}

.user-menu {
    position: relative;
    /* .user-dock is a flex row (bell + this); without flex-grow this box only
       shrinks to its content width, leaving the row half-empty and anchoring
       the .user-actions dropdown (right:0 relative to this element) far short
       of the sidebar's real right edge - which is what pushed it off the left
       side of the sidebar. */
    flex: 1 1 auto;
    min-width: 0;
}

.user-box {
    min-width: 0;
    flex: 1;
    padding: 5px 7px;
    border-color: transparent;
    border-radius: 7px;
    color: var(--sidebar-fg);
    cursor: pointer;
}

.user-box:hover {
    border-color: rgba(var(--sidebar-fg-rgb), .14);
    background: rgba(var(--sidebar-fg-rgb), .06);
    box-shadow: none;
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--brand);
    color: #FFFFFF;
}

.user-box strong {
    max-width: 116px;
    overflow: hidden;
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-box span {
    max-width: 116px;
    overflow: hidden;
    color: rgba(var(--sidebar-fg-rgb), .48);
    font-size: 9.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-actions {
    inset: auto 0 calc(100% + 12px) auto;
    width: 220px;
    background: var(--card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transform-origin: bottom right;
}

.theme-switcher {
    position: relative;
    flex: 0 0 auto;
}
.theme-switcher-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(var(--sidebar-fg-rgb), .16);
    border-radius: 7px;
    background: rgba(var(--sidebar-fg-rgb), .06);
    color: var(--sidebar-fg);
    cursor: pointer;
}
.theme-switcher-btn:hover {
    border-color: rgba(var(--sidebar-fg-rgb), .3);
    background: rgba(var(--sidebar-fg-rgb), .1);
    transform: none;
}
.theme-switcher-btn svg {
    width: 18px;
    height: 18px;
}
.theme-switcher-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    z-index: 120;
    display: grid;
    gap: 2px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
}
.theme-switcher-label {
    padding: 4px 8px 6px;
    color: var(--text-3);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.theme-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}
.theme-option:hover { background: var(--soft); transform: none; box-shadow: none; }
.theme-option.active { background: var(--brand-soft); color: var(--brand-dark); }
.theme-swatch {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, .08);
}
.theme-swatch-default { background: linear-gradient(135deg, #6257E8 50%, #B9E85B 50%); }
.theme-swatch-terminal { background: linear-gradient(135deg, #07110B 50%, #39FF72 50%); }
.theme-swatch-obsidian { background: linear-gradient(135deg, #0D0F14 50%, #8B7CFF 50%); }
.theme-swatch-paper { background: linear-gradient(135deg, #F4F1EA 50%, #D84F3E 50%); }
.theme-swatch-synthwave { background: linear-gradient(135deg, #100B1D 50%, #FF4FD8 50%); }
.theme-swatch-sage { background: linear-gradient(135deg, #263D32 50%, #A7D46F 50%); }

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

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

.main {
    width: calc(100% - 252px);
    max-width: none;
    min-height: 100vh;
    margin: 0 0 0 252px;
    padding: 0 30px 64px;
}

.page-context.topbar.compact {
    min-height: 116px;
    margin: 0 0 24px;
    padding: 28px 0 22px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid var(--border);
}

.page-heading {
    min-width: 0;
}

.crumb {
    margin-bottom: 8px;
    color: var(--text-3);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.breadcrumb a {
    color: var(--brand-dark);
}

.breadcrumb a::after {
    content: "·";
}

.page-context h1 {
    margin: 0;
    font-size: 30px;
    line-height: 1.08;
    font-weight: 760;
}

.page-section {
    padding: 6px 9px;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text-3);
    background: var(--soft);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

h1,
h2,
h3 {
    color: var(--ink);
}

h2 {
    font-size: 28px;
    line-height: 1.16;
}

h3 {
    font-size: 14px;
}

.eyebrow {
    color: var(--brand-dark);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.card {
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: none;
}

.card:hover {
    box-shadow: none;
}

.card-head {
    margin-bottom: 14px;
}

.card-head h3 {
    margin: 0;
}

.btn {
    min-height: 38px;
    padding: 9px 14px;
    border-radius: 6px;
    box-shadow: none;
    font-weight: 700;
}

.btn:hover {
    box-shadow: none;
    transform: translateY(-1px);
}

.btn:active {
    box-shadow: none;
    transform: translateY(0);
}

.btn-primary,
.btn-primary:hover {
    background: var(--brand);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--brand-dark);
}

.btn-ghost {
    background: var(--brand-soft);
    border-color: var(--brand-border);
    color: var(--brand-dark);
}

.btn-plain {
    background: var(--card);
    border-color: var(--border);
    color: var(--ink);
}

.icon-btn {
    border-radius: 6px;
    background: var(--card);
    box-shadow: none;
}

.icon-btn:hover {
    box-shadow: none;
}

input,
textarea,
select,
.search {
    min-height: 40px;
    background: var(--card);
    border-color: var(--border);
    border-radius: 6px;
    box-shadow: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(98, 87, 232, .13);
}

.tag {
    border-radius: 4px;
    font-size: 10px;
}

.bar {
    height: 6px;
    border-radius: 3px;
    background: var(--border-soft);
}

.bar span {
    border-radius: 3px;
    background: var(--brand);
}

.insight {
    position: relative;
    min-height: 220px;
    margin-bottom: 20px;
    padding: 30px;
    overflow: hidden;
    background: var(--sidebar-bg);
    border: 0;
    border-radius: 8px;
    box-shadow: none;
    color: var(--sidebar-fg);
}

.insight::after {
    content: "S";
    position: absolute;
    right: 4%;
    bottom: -48px;
    color: rgba(var(--sidebar-fg-rgb), .055);
    font-size: 250px;
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
}

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

.insight .eyebrow {
    color: var(--lime);
}

.insight h2 {
    max-width: 680px;
    color: var(--sidebar-fg);
    font-size: 31px;
}

.insight p {
    color: rgba(var(--sidebar-fg-rgb), .65);
}

.insight .btn-primary {
    background: var(--lime);
    color: var(--on-accent);
}

.kpi-grid {
    gap: 0;
    margin-bottom: 20px;
    padding: 7px 0;
    overflow: hidden;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.kpi-grid .kpi {
    min-height: 104px;
    padding: 18px 22px;
    border: 0;
    border-right: 1px solid var(--border-soft);
    border-radius: 0;
}

.kpi-grid .kpi:last-child {
    border-right: 0;
}

.kpi strong {
    margin: 7px 0 3px;
    color: var(--ink);
    font-size: 30px;
}

.kpi:first-child strong {
    color: var(--brand);
}

.two-col,
.module-grid,
.profile-hero,
.profile-secondary-row,
.admin-report-grid {
    gap: 20px;
    margin-bottom: 20px;
}

.ai-box {
    background: var(--lime-soft);
    border-color: #D7E9AD;
}

.ai-box .t-ai {
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
}

.data {
    border-spacing: 0;
}

.data th {
    padding: 11px 12px;
    background: var(--soft);
    border-top: 1px solid var(--border-soft);
    border-bottom-color: var(--border);
    color: var(--text-3);
    font-size: 10px;
}

.data td {
    padding: 13px 12px;
}

.data tr:last-child td {
    border-bottom: 0;
}

.data tr:hover td {
    background: #F7F7FC;
}

.clickable-row:hover td {
    background: var(--brand-soft);
}

.link,
.more,
.id {
    color: var(--brand-dark);
}

.course-search-panel {
    margin-bottom: 14px;
    padding: 14px 16px;
    background: var(--card);
}

.course-catalog {
    gap: 12px;
}

.course-catalog .course-card {
    min-height: 0;
    padding: 22px 22px 22px 24px;
    border-left: 4px solid var(--brand);
}

.course-catalog .course-card.done {
    border-left-color: var(--success);
}

.course-catalog .course-card.retry {
    border-left-color: var(--warning);
}

.course-catalog .course-card.locked {
    border-left-color: var(--border);
    background: #F0F0F4;
}

.course-catalog .course-card h2 {
    font-size: 22px;
}

.course-assignment-panel,
.course-completion-box,
.completion-item,
.topic-node,
.tree-nav .tree-item,
.tree-nav a,
.course-row,
.course-detail,
.course-progress-card,
.exam-result-card,
.attempt-snapshot,
.snapshot-options span {
    border-radius: 6px;
    box-shadow: none;
}

.topic-node {
    border-left: 3px solid var(--border);
}

.topic-node.available,
.topic-node.pending {
    border-left-color: var(--brand);
}

.topic-node.done {
    border-left-color: var(--success);
}

.topic-node:hover,
.course-row:hover {
    box-shadow: none;
    transform: translateX(2px);
}

.profile-info-card {
    background: var(--sidebar-bg);
    border-color: var(--sidebar-bg);
    color: var(--sidebar-fg);
}

.profile-info-card h2,
.profile-info-card strong,
.profile-info-card dd {
    color: var(--sidebar-fg);
}

.profile-info-card p,
.profile-info-card dt,
.profile-info-card .eyebrow {
    color: rgba(var(--sidebar-fg-rgb), .56);
}

.profile-avatar {
    border-radius: 7px;
    background: var(--lime);
    color: var(--on-accent);
    box-shadow: none;
}

.profile-info-list div,
.profile-stat-row,
.activity-item {
    border-bottom-color: rgba(140, 143, 160, .2);
}

.profile-info-card .btn-plain {
    border-color: rgba(var(--sidebar-fg-rgb), .18);
    background: rgba(var(--sidebar-fg-rgb), .08);
    color: var(--sidebar-fg);
}

.next-action-card,
.continue-learning-card {
    border-left: 4px solid var(--brand);
    background: var(--card);
}

.next-action-card.done,
.continue-learning-card.done {
    border-left-color: var(--success);
    background: var(--card);
}

.next-action-card.retry,
.next-action-card.daily,
.continue-learning-card.retry {
    border-left-color: var(--warning);
    background: var(--card);
}

.next-action-card.locked,
.continue-learning-card.locked {
    border-left-color: var(--border);
}

.quick-actions {
    background: var(--brand-soft);
    border-color: var(--brand-border);
}

.achievement-card,
.news-card,
.admin-report-card {
    border-top: 3px solid var(--brand);
}

.achievement-card.locked {
    border-top-color: var(--border);
}

.achievement-badge,
.achievement-medal {
    border-radius: 7px;
    box-shadow: none;
}

.event-empty {
    min-height: 260px;
    padding: 34px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: var(--sidebar-bg);
    border-color: var(--sidebar-bg);
}

.event-empty h2 {
    color: var(--sidebar-fg);
}

.event-empty p {
    color: rgba(var(--sidebar-fg-rgb), .6);
}

.event-empty .eyebrow {
    color: var(--lime);
}

.alert,
.empty-state,
.question-field,
.choice-row,
.matching-card,
.matching-row,
.notification-item,
.filter-popover,
.modal-card {
    border-radius: 6px;
}

.modal::backdrop {
    background: rgba(23, 24, 39, .68);
    backdrop-filter: blur(3px);
}

.modal-card,
.notifications-modal-card {
    background: var(--card);
    box-shadow: 0 24px 70px rgba(23, 24, 39, .24);
}

.tab-button {
    border-radius: 5px;
}

.tab-button.active {
    background: var(--sidebar-bg);
    border-color: var(--sidebar-bg);
    color: var(--sidebar-fg);
}

.bug-report-fab {
    border-radius: 7px;
    background: var(--sidebar-bg);
    box-shadow: 0 10px 24px rgba(23, 24, 39, .18);
}

.bug-report-fab:hover {
    background: var(--brand-dark);
}

body.login-page {
    min-height: 100vh;
    padding: 0;
    display: block;
    background: var(--sidebar-bg);
}

.login-shell {
    width: 100%;
    max-width: none;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(420px, .8fr);
    overflow: hidden;
    background: var(--sidebar-bg);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.login-brand-panel {
    position: relative;
    min-height: 100vh;
    padding: 50px 7vw 46px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 60px;
    overflow: hidden;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
}

.login-brand-panel::after {
    content: "S";
    position: absolute;
    right: -5vw;
    bottom: -15vw;
    z-index: 0;
    color: rgba(var(--sidebar-fg-rgb), .04);
    font-size: 58vw;
    font-weight: 900;
    line-height: .75;
    pointer-events: none;
}

.login-brand-panel > * {
    position: relative;
    z-index: 1;
}

.login-brand-logo {
    align-self: flex-start;
}

.login-brand-logo .brand-copy {
    padding: 0;
    border: 0;
    color: inherit;
    text-transform: none;
}

.login-message {
    max-width: 680px;
}

.login-kicker {
    color: var(--lime);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-brand-panel h1 {
    max-width: none;
    margin: 16px 0 18px;
    color: var(--sidebar-fg);
    font-size: 68px;
    line-height: .98;
    font-weight: 760;
}

.login-brand-panel p {
    color: rgba(var(--sidebar-fg-rgb), .56);
    font-size: 21px;
}

.login-brand-note {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border: 0;
    color: rgba(var(--sidebar-fg-rgb), .44);
}

.login-brand-note strong,
.login-brand-note span {
    color: inherit;
    font-size: 10px;
    text-transform: uppercase;
}

.login-shell .login-card {
    min-width: 0;
    min-height: 100vh;
    padding: 50px 7vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--card);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.login-card-head {
    margin-bottom: 58px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--text-3);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-card h2 {
    margin: 0 0 10px;
    font-size: 36px;
}

.login-card > p {
    margin-bottom: 32px;
}

.login-card .form-stack {
    gap: 18px;
}

.login-card label {
    gap: 7px;
    color: var(--text-2);
    font-size: 11px;
}

.login-card input {
    min-height: 48px;
    padding: 12px 13px;
}

.login-shell .login-card .btn {
    min-height: 48px;
    margin-top: 6px;
    background: var(--sidebar-bg);
}

.login-shell .login-card .btn:hover {
    background: var(--brand-dark);
}

.login-card .hint {
    margin-top: 24px;
}

.bitrix-card {
    width: min(520px, calc(100vw - 32px));
    margin: 10vh auto;
    padding: 34px;
    background: var(--card);
    border: 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.bitrix-card .logo-mark {
    border-radius: 6px;
    background: var(--lime);
    color: var(--ink);
    box-shadow: none;
}

@media (max-width: 1100px) {
    .app-header {
        position: sticky;
        inset: auto;
        width: 100%;
        height: 72px;
        border-right: 0;
        border-bottom: 1px solid rgba(var(--sidebar-fg-rgb), .1);
    }

    .app-header-inner {
        width: min(100%, 1520px);
        height: 100%;
        margin: 0 auto;
        padding: 0 18px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .sidebar-top-row {
        padding: 0;
        border-bottom: 0;
        flex: 1;
    }

    .mobile-menu-toggle {
        order: 2;
        width: 40px;
        height: 40px;
        margin-left: auto;
        padding: 10px;
        display: grid;
        place-items: center;
        gap: 4px;
        border: 1px solid rgba(var(--sidebar-fg-rgb), .15);
        border-radius: 7px;
        background: rgba(var(--sidebar-fg-rgb), .06);
    }

    .mobile-menu-toggle span {
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background: var(--sidebar-fg);
    }

    .global-nav.sidebar-nav {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 90;
        width: min(340px, calc(100vw - 44px));
        padding: 86px 16px 24px;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        overflow-y: auto;
        background: var(--sidebar-bg);
        border: 0;
        box-shadow: 20px 0 60px rgba(0, 0, 0, .28);
        transform: translateX(-104%);
    }

    .mobile-menu-open .global-nav.sidebar-nav {
        transform: translateX(0);
    }

    .global-nav.sidebar-nav::before {
        content: "Навигация";
        position: absolute;
        top: 28px;
        left: 26px;
        color: var(--lime);
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .mobile-menu-close {
        position: absolute;
        top: 18px;
        right: 16px;
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(var(--sidebar-fg-rgb), .14);
        border-radius: 7px;
        background: rgba(var(--sidebar-fg-rgb), .06);
        color: var(--sidebar-fg);
        font-size: 24px;
        line-height: 1;
        cursor: pointer;
    }

    .mobile-menu-open .help-widget {
        opacity: 0;
        pointer-events: none;
    }

    .mobile-menu-open .app-header .header-actions,
    .mobile-menu-open .app-header .sidebar-balance {
        opacity: 0;
        pointer-events: none;
    }

    .global-nav .nav {
        width: 100%;
        min-height: 44px;
        padding: 12px;
        color: rgba(var(--sidebar-fg-rgb), .7);
    }

    .global-nav > .nav.active::before {
        inset: 11px auto 11px -4px;
        width: 3px;
        height: auto;
    }

    .nav-cluster {
        width: 100%;
    }

    .nav-popover,
    .nav-popover-wide {
        position: static;
        width: 100%;
        margin-top: 4px;
        padding: 4px 0 4px 12px;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .nav-popover .nav {
        color: rgba(var(--sidebar-fg-rgb), .58);
    }

    .nav-popover .nav:hover,
    .nav-popover .nav.active {
        background: rgba(var(--sidebar-fg-rgb), .08);
        color: var(--sidebar-fg);
    }

    .nav-popover-label {
        color: rgba(var(--sidebar-fg-rgb), .34);
    }

    .sidebar-balance,
    .header-actions,
    .user-dock {
        order: 3;
        margin: 0;
        align-self: center;
        flex: 0 0 auto;
    }

    .sidebar-balance span {
        display: none;
    }

    .sidebar-balance {
        padding: 8px 10px;
    }

    .main {
        width: 100%;
        margin-left: 0;
    }

    .user-box {
        min-width: 0;
        padding: 4px;
    }

    .user-box > div:last-child {
        display: none;
    }

    .user-actions {
        inset: calc(100% + 11px) 0 auto auto;
        opacity: 0;
        pointer-events: none;
        transform: translateY(8px) scale(.98);
    }

    .user-menu[open] .user-actions {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 880px) {
    .app-header {
        height: 64px;
    }

    .app-header-inner {
        padding: 0 12px;
    }

    .brand-glyph {
        width: 32px;
        height: 32px;
        font-size: 17px;
    }

    .brand-copy strong {
        font-size: 16px;
    }

    .brand-copy small {
        display: none;
    }

    .notification-bell,
    .mobile-menu-toggle {
        width: 38px;
        height: 38px;
    }

    .main {
        min-height: calc(100vh - 64px);
        padding: 0 14px 32px;
    }

    .page-context.topbar.compact {
        min-height: 98px;
        margin-bottom: 16px;
        padding: 20px 0 17px;
        flex-direction: row;
        align-items: flex-end;
    }

    .page-context h1 {
        font-size: 24px;
    }

    .page-section {
        display: none;
    }

    .card {
        padding: 16px;
        border-radius: 7px;
    }

    .insight {
        min-height: 0;
        padding: 22px;
        align-items: stretch;
    }

    .insight h2 {
        font-size: 25px;
    }

    .insight .btn {
        width: 100%;
        justify-content: center;
    }

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

    .kpi-grid .kpi {
        min-height: 96px;
        border-right: 1px solid var(--border-soft);
        border-bottom: 1px solid var(--border-soft);
    }

    .kpi-grid .kpi:nth-child(2n) {
        border-right: 0;
    }

    .kpi-grid .kpi:nth-last-child(-n+2) {
        border-bottom: 0;
    }

    .course-catalog .course-card {
        padding: 18px;
    }

    .profile-info-card {
        padding: 18px;
    }

    .table-scroll,
    .latest-ideas-card {
        overflow-x: auto;
    }
}

@media (max-width: 760px) {
    body.login-page {
        background: var(--card);
    }

    .login-shell {
        min-height: 100vh;
        grid-template-columns: 1fr;
        background: var(--card);
    }

    .login-brand-panel {
        min-height: 210px;
        padding: 26px 22px;
        gap: 28px;
    }

    .login-brand-panel::after {
        right: -28px;
        bottom: -64px;
        font-size: 300px;
    }

    .login-brand-panel h1 {
        margin: 14px 0 7px;
        font-size: 38px;
    }

    .login-brand-panel p {
        margin: 0;
        font-size: 15px;
    }

    .login-brand-note {
        display: none;
    }

    .login-shell .login-card {
        min-height: 0;
        padding: 34px 22px 44px;
    }

    .login-card-head {
        margin-bottom: 36px;
    }

    .login-card h2 {
        font-size: 31px;
    }

    body.login-page .help-widget {
        right: 14px;
        bottom: 14px;
    }
}

@media (max-width: 520px) {
    .brand-copy {
        display: none;
    }

    .app-header-inner {
        gap: 7px;
    }

    .mobile-menu-toggle {
        margin-left: auto;
    }

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

    .kpi-grid .kpi,
    .kpi-grid .kpi:nth-child(2n),
    .kpi-grid .kpi:nth-last-child(-n+2) {
        border-right: 0;
        border-bottom: 1px solid var(--border-soft);
    }

    .kpi-grid .kpi:last-child {
        border-bottom: 0;
    }
}

/* AI course builder and course hierarchy */
.generation-actions { margin: 0; }
.generation-section,
.generation-status,
.generation-profile,
.generation-outline,
.generation-ready,
.generation-wizard {
    margin-bottom: 20px;
}
.section-heading {
    margin-bottom: 14px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}
.section-heading h2 { margin: 4px 0 0; max-width: none; }
.generation-job-list { border-top: 1px solid var(--border); }
.generation-job-row {
    min-height: 72px;
    padding: 14px 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border-bottom: 1px solid var(--border);
}
.generation-job-row:hover { color: var(--brand-dark); }
.generation-job-row > a { min-width: 0; flex: 1; display: grid; gap: 3px; }
.generation-job-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.generation-job-row span { color: var(--text-3); font-size: 12px; }
.generation-job-state { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.course-row > a { min-width: 0; flex: 1; }
.course-row-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.danger-icon { width: 30px; height: 30px; padding: 0; color: var(--danger); border-color: var(--border); background: var(--card); font-size: 20px; line-height: 1; }
.danger-icon:hover,
.danger-button:hover { color: #FFFFFF; border-color: var(--danger); background: var(--danger); }
.danger-button { color: var(--danger); }
.generation-wizard { border-top: 1px solid var(--border); }
.generation-step-intro { padding: 20px 0; border-bottom: 1px solid var(--border); }
.generation-step-intro h2 { margin: 5px 0 8px; max-width: 60ch; }
.generation-step-intro p { margin: 0; }
.generation-intro,
.generation-options {
    padding: 26px 0;
    display: grid;
    gap: 18px;
    border-bottom: 1px solid var(--border);
}
.generation-intro h2 { margin: 0; max-width: none; }
.generation-intro textarea { min-height: 130px; }
.mode-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode-choice label { position: relative; cursor: pointer; }
.mode-choice input { position: absolute; opacity: 0; pointer-events: none; }
.mode-choice label > span {
    min-height: 94px;
    padding: 16px;
    display: grid;
    align-content: center;
    gap: 5px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--card);
}
.mode-choice input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.mode-choice small { color: var(--text-3); }
.generation-settings-grid { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(110px, .7fr)); gap: 12px; }
.generation-submit { padding-top: 18px; display: flex; justify-content: flex-end; }
.generation-status { padding: 22px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.generation-status-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.generation-status-head h2 { margin: 5px 0 18px; max-width: 50ch; }
.generation-progress { height: 8px; overflow: hidden; border-radius: 4px; background: var(--border-soft); }
.generation-progress span { height: 100%; display: block; background: var(--brand); transition: width .3s var(--ease); }
.generation-progress-meta { margin-top: 7px; display: flex; justify-content: space-between; color: var(--text-3); font-size: 11px; }
.diagnostic-form { max-width: 1040px; }
.diagnostic-heading { padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.diagnostic-heading p { margin: 7px 0 0; }
.diagnostic-heading-metrics { min-width: 110px; display: grid; justify-items: end; }
.diagnostic-heading-metrics strong { color: var(--brand); font-size: 30px; line-height: 1; }
.diagnostic-heading-metrics span { color: var(--text-3); font-size: 11px; }
.diagnostic-competency { margin: 0 0 28px; }
.diagnostic-competency-head { padding: 20px 0 14px; display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 14px; border-bottom: 1px solid var(--border); }
.diagnostic-competency-index { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; background: var(--sidebar-bg); color: var(--sidebar-fg); font-weight: 800; }
.diagnostic-competency-head h3 { margin: 3px 0 5px; font-size: 20px; }
.diagnostic-competency-head p { margin: 0; max-width: 74ch; }
.diagnostic-question-list { padding-top: 12px; }
.diagnostic-question { margin: 0 0 12px; padding: 18px; border: 1px solid var(--border); border-radius: 7px; background: var(--card); }
.diagnostic-question legend { width: calc(100% - 8px); padding: 0 4px; color: var(--ink); font-weight: 750; }
.diagnostic-question-number { margin-right: 8px; color: var(--brand); }
.diagnostic-question-copy { color: var(--ink); }
.diagnostic-question-meta { margin: 8px 0 13px; display: flex; flex-wrap: wrap; gap: 6px; }
.diagnostic-question-meta span { padding: 4px 7px; border-radius: 4px; background: var(--surface-2); color: var(--text-3); font-size: 10px; font-weight: 700; }
.diagnostic-options { display: grid; gap: 1px; }
.diagnostic-question textarea { min-height: 150px; }
.diagnostic-answer-hint { margin-top: 8px; display: block; color: var(--text-3); }
.diagnostic-submit { padding: 18px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); }
.diagnostic-submit > div { display: grid; gap: 3px; }
.diagnostic-submit span { color: var(--text-3); font-size: 11px; }
.generation-profile { padding: 22px 0; border-bottom: 1px solid var(--border); }
.generation-profile-summary { margin-top: 10px; display: grid; grid-template-columns: .7fr 1.5fr .7fr; gap: 1px; background: var(--border); border: 1px solid var(--border); }
.generation-profile-summary > div,
.generation-profile-grid > div { padding: 16px; display: grid; gap: 5px; background: var(--card); }
.generation-profile-summary small,
.generation-profile-grid small { color: var(--text-3); }
.generation-profile-summary strong,
.generation-profile-grid strong { font-size: 20px; }
.generation-profile-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.competency-result-list { margin-top: 16px; display: grid; gap: 12px; }
.competency-result-card { padding: 18px; border: 1px solid var(--border); border-radius: 7px; background: var(--card); }
.competency-result-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.competency-result-head h3 { margin: 4px 0 3px; font-size: 17px; }
.competency-result-head p { margin: 0; color: var(--text-3); font-size: 11px; }
.competency-result-head > strong { color: var(--brand); font-size: 26px; line-height: 1; }
.competency-result-progress { height: 6px; margin: 13px 0 16px; overflow: hidden; border-radius: 4px; background: var(--border-soft); }
.competency-result-progress span { height: 100%; display: block; background: var(--brand); }
.competency-result-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.competency-result-columns small { color: var(--text-3); font-weight: 750; }
.competency-result-columns ul { margin: 7px 0 0; padding-left: 18px; }
.competency-result-columns li + li { margin-top: 4px; }
.outline-topic { padding: 18px 0; display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr); gap: 24px; border-top: 1px solid var(--border); }
.outline-topic > div { display: grid; grid-template-columns: 28px 1fr; align-content: start; gap: 4px 10px; }
.outline-topic > div > span { grid-row: 1 / 3; color: var(--brand); font-weight: 800; }
.outline-topic small { color: var(--text-3); }
.outline-topic ol { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.outline-topic li { padding-left: 5px; }
.outline-topic li strong,
.outline-topic li span { display: block; }
.outline-topic li span { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.generation-ready { padding: 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--border); }
.generation-ready h2 { margin: 4px 0 0; max-width: none; }
.plan-choice-section { padding: 24px 0; border-top: 1px solid var(--border); }
.plan-choice-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plan-choice-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--card); }
.plan-choice-card.recommended { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.plan-choice-head { min-height: 46px; display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.plan-choice-head h3 { margin: 4px 0 0; font-size: 16px; }
.plan-choice-card p { min-height: 56px; margin: 0; }
.plan-choice-metrics { padding-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; border-top: 1px solid var(--border-soft); color: var(--text-3); font-size: 11px; }
.plan-choice-metrics strong { color: var(--ink); font-size: 20px; }
.plan-choice-card .btn { margin-top: auto; justify-content: center; }
.course-topic-groups,
.admin-course-topics { display: grid; gap: 24px; }
.course-topic-group,
.admin-course-topic { padding-top: 18px; border-top: 1px solid var(--border); }
.course-topic-heading { margin-bottom: 12px; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.course-topic-heading > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 5px; background: var(--sidebar-bg); color: var(--sidebar-fg); font-weight: 800; }
.course-topic-heading h3 { margin: 1px 0 3px; font-size: 16px; }
.course-topic-heading p { margin: 0; }
.tree-topic-label { padding: 14px 8px 5px; display: block; color: var(--text-3); font-size: 10px; font-weight: 800; text-transform: uppercase; }

@media (max-width: 880px) {
    .generation-settings-grid,
    .outline-topic,
    .plan-choice-list { grid-template-columns: 1fr 1fr; }
    .generation-settings-grid label:first-child { grid-column: 1 / -1; }
    .outline-topic > div { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
    .mode-choice,
    .generation-settings-grid,
    .generation-profile-grid,
    .generation-profile-summary,
    .competency-result-columns,
    .plan-choice-list { grid-template-columns: 1fr; }
    .generation-job-row,
    .generation-status-head,
    .generation-ready,
    .diagnostic-submit,
    .competency-result-head { align-items: stretch; flex-direction: column; }
    .diagnostic-heading { align-items: start; }
    .diagnostic-heading-metrics { justify-items: start; }
    .diagnostic-question { padding: 14px; }
    .diagnostic-question legend { width: 100%; }
    .generation-job-state { justify-content: space-between; }
    .generation-submit .btn,
    .generation-ready .btn { width: 100%; justify-content: center; }
    .course-topic-heading { grid-template-columns: 30px minmax(0, 1fr); }
    .course-topic-heading .btn { grid-column: 1 / -1; }
}

/* Final mobile containment: lesson content must never widen the viewport. */
@media (max-width: 880px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
    }

    .app-header,
    .app-header-inner,
    .main,
    .page-context,
    .page-heading,
    .page-tools,
    .two-col,
    .two-col > *,
    .lesson,
    .lesson-body,
    .topic-video-section,
    .video-player-card,
    .video-stage,
    .video-pane {
        min-width: 0;
        max-width: 100%;
    }

    .main {
        width: auto;
        margin: 0;
        padding: 0 14px 32px;
        overflow: hidden;
    }

    .two-col {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
    }

    .lesson-body {
        width: 100%;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    .lesson-body img,
    .lesson-body video,
    .lesson-body iframe,
    .lesson-body table {
        max-width: 100%;
    }

    .lesson-body .code-block,
    .lesson-body .code-block pre {
        max-width: 100%;
    }

    .lesson-body .code-block pre {
        overscroll-behavior-x: contain;
    }

    .video-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }

    .video-tab {
        flex: 0 0 auto;
    }

    .video-placeholder,
    .video-pane .video-placeholder {
        min-height: clamp(190px, 52vw, 260px);
        padding: 20px;
        text-align: center;
    }
}

@media (max-width: 520px) {
    .app-header {
        height: 56px;
    }

    .app-header-inner {
        padding: 0 10px;
        gap: 6px;
    }

    .brand-glyph {
        width: 34px;
        height: 34px;
    }

    .mobile-menu-toggle,
    .notification-bell {
        width: 34px;
        height: 34px;
    }

    .mobile-menu-toggle {
        padding: 8px;
    }

    .mobile-menu-toggle span {
        width: 16px;
    }

    .user-box {
        padding: 2px;
    }

    .avatar {
        width: 30px;
        height: 30px;
    }

    .main {
        min-height: calc(100vh - 56px);
        padding: 0 10px 28px;
    }

    .page-context.topbar.compact {
        min-height: 0;
        margin-bottom: 14px;
        padding: 16px 0 14px;
        align-items: flex-start;
    }

    .page-context h1 {
        font-size: 21px;
        overflow-wrap: anywhere;
    }

    .crumb {
        margin-bottom: 6px;
        line-height: 1.35;
        overflow-wrap: anywhere;
    }

    .page-tools .btn {
        max-width: 100%;
        white-space: normal;
    }

    .card {
        padding: 12px;
    }

    .lesson > h2,
    .lesson-body h1,
    .lesson-body h2 {
        font-size: 20px;
    }

    .lesson-body .code-block pre {
        padding: 13px;
    }

    .video-tabs {
        padding: 9px;
        gap: 6px;
    }

    .video-tab {
        padding: 7px 10px;
        font-size: 12px;
    }
}

.version-update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 16px;
    background: var(--sidebar-bg);
    color: var(--sidebar-fg);
    font-size: 13px;
    font-weight: 650;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .2);
}
.version-update-banner button {
    padding: 5px 14px;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 99px;
    background: var(--lime);
    color: var(--on-accent);
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.version-update-banner button:hover { filter: brightness(1.05); }

/* ================================================================
   THEME: TERMINAL — phosphor-green developer terminal
   ================================================================ */
:root[data-theme="terminal"] {
    --brand: #39FF72;
    --brand-dark: #22C956;
    --brand-hover: #63FF91;
    --brand-soft: #0F2A18;
    --brand-border: #1F5C34;
    --ink: #B8FFC9;
    --text-2: #73D98D;
    --text-3: #668A70;
    --border: #173D23;
    --border-soft: #123018;
    --card: #0B1810;
    --bg: #07110B;
    --soft: #0E1C13;
    --elevated: #102017;
    --success: #39FF72;
    --success-soft: #10301B;
    --warning: #E8C547;
    --warning-soft: #2E2A10;
    --danger: #FF6B6B;
    --danger-soft: #301414;
    --info: #52D6C7;
    --info-soft: #0F2926;
    --cyan: #52D6C7;
    --cyan-soft: #0F2926;
    --purple: #39FF72;
    --purple-soft: #0F2A18;
    --lime: #39FF72;
    --lime-soft: #10301B;
    --coral: #FF6B6B;
    --coral-soft: #301414;
    --radius: 4px;
    --radius-sm: 3px;
    --radius-lg: 6px;
    --shadow: 0 0 0 1px var(--border);
    --shadow-soft: 0 0 0 1px var(--border);
    --shadow-pressed: inset 0 0 0 1px var(--border);
    --glow: 0 0 0 1px var(--brand-border);
    --sidebar-bg: #050C08;
    --sidebar-fg: #B8FFC9;
    --sidebar-fg-rgb: 184, 255, 201;
    --on-accent: #07110B;
    --scrollbar-thumb: #1F5C34;
    --scrollbar-track: transparent;
    --code-bg: #0A1710;
    --code-fg: #B8FFC9;
    --font-body: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
    --font-heading: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
    --heading-transform: uppercase;
    --heading-tracking: .02em;
}

[data-theme="terminal"] body {
    position: relative;
}
[data-theme="terminal"] body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(184, 255, 201, .035),
        rgba(184, 255, 201, .035) 1px,
        transparent 1px,
        transparent 3px
    );
    mix-blend-mode: overlay;
    opacity: .5;
}
[data-theme="terminal"] .card,
[data-theme="terminal"] .kpi-grid,
[data-theme="terminal"] .login-shell,
[data-theme="terminal"] .login-card,
[data-theme="terminal"] .user-actions,
[data-theme="terminal"] .nav-popover,
[data-theme="terminal"] .modal-card,
[data-theme="terminal"] .theme-switcher-panel {
    border: 1px solid var(--border);
    box-shadow: none;
}
[data-theme="terminal"] .card:hover { box-shadow: 0 0 0 1px var(--brand-border); }
[data-theme="terminal"] .btn {
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
}
[data-theme="terminal"] .btn-primary {
    background: var(--brand);
    color: var(--on-accent);
    box-shadow: none;
}
[data-theme="terminal"] .btn-primary:hover { background: var(--brand-hover); box-shadow: none; transform: none; }
[data-theme="terminal"] .btn-primary::before { content: "$ "; opacity: .6; }
[data-theme="terminal"] .btn:hover { box-shadow: none; transform: none; }
[data-theme="terminal"] .btn-plain,
[data-theme="terminal"] .btn-ghost { border: 1px solid var(--border); }
[data-theme="terminal"] .eyebrow,
[data-theme="terminal"] .kpi strong,
[data-theme="terminal"] .kpi span,
[data-theme="terminal"] .tag,
[data-theme="terminal"] .page-section,
[data-theme="terminal"] .bar span::after {
    font-family: var(--font-mono);
}
[data-theme="terminal"] .tag {
    border-radius: 3px;
    border: 1px solid currentColor;
    background: transparent !important;
    text-transform: uppercase;
}
[data-theme="terminal"] .bar {
    border-radius: 2px;
    border: 1px solid var(--border);
    background: var(--card);
}
[data-theme="terminal"] .bar span {
    border-radius: 0;
    background: var(--brand);
}
[data-theme="terminal"] input,
[data-theme="terminal"] textarea,
[data-theme="terminal"] select,
[data-theme="terminal"] .search {
    border-radius: var(--radius-sm);
    background: var(--card);
    border-color: var(--border);
    color: var(--ink);
}
[data-theme="terminal"] input:focus,
[data-theme="terminal"] textarea:focus,
[data-theme="terminal"] select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 1px var(--brand);
}
[data-theme="terminal"] .data th {
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: .04em;
}
[data-theme="terminal"] .global-nav > .nav.active,
[data-theme="terminal"] .global-nav > .nav:hover {
    background: rgba(var(--sidebar-fg-rgb), .08);
    box-shadow: inset 2px 0 0 var(--brand);
}
[data-theme="terminal"] .brand-glyph {
    border-radius: var(--radius-sm);
}
[data-theme="terminal"] .app-header {
    border-right: 1px solid var(--border);
}
[data-theme="terminal"] .avatar,
[data-theme="terminal"] .diagnostic-competency-index,
[data-theme="terminal"] .course-topic-heading > span {
    border-radius: var(--radius-sm);
}

/* ================================================================
   THEME: OBSIDIAN — premium professional dark mode
   ================================================================ */
:root[data-theme="obsidian"] {
    --brand: #8B7CFF;
    --brand-dark: #6F5FE0;
    --brand-hover: #A499FF;
    --brand-soft: #211D3B;
    --brand-border: #352F55;
    --ink: #F2F3F5;
    --text-2: #9299A6;
    --text-3: #6C7280;
    --border: #272C37;
    --border-soft: #1E222C;
    --card: #151820;
    --bg: #0D0F14;
    --soft: #171A22;
    --elevated: #1B1F29;
    --success: #4ADE80;
    --success-soft: #17281E;
    --warning: #F5B94D;
    --warning-soft: #2C2416;
    --danger: #FF6B6B;
    --danger-soft: #2C1919;
    --info: #6CA8FF;
    --info-soft: #17212F;
    --cyan: #5FD3E8;
    --cyan-soft: #142A2E;
    --purple: #8B7CFF;
    --purple-soft: #211D3B;
    --lime: #B7F34A;
    --lime-soft: #202B12;
    --coral: #FF6B6B;
    --coral-soft: #2C1919;
    --shadow: 0 12px 32px rgba(0, 0, 0, .35);
    --shadow-soft: 0 6px 18px rgba(0, 0, 0, .28);
    --shadow-pressed: inset 0 0 0 1px rgba(0, 0, 0, .3);
    --glow: 0 8px 20px rgba(139, 124, 255, .22);
    --sidebar-bg: #090B10;
    --sidebar-fg: #F2F3F5;
    --sidebar-fg-rgb: 242, 243, 245;
    --on-accent: #0D0F14;
    --scrollbar-thumb: #2C313D;
    --scrollbar-track: transparent;
    --code-bg: #14161D;
    --code-fg: #E5E7EC;
    --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
    --font-heading: "Inter", "Segoe UI", system-ui, sans-serif;
}

[data-theme="obsidian"] .card,
[data-theme="obsidian"] .kpi-grid,
[data-theme="obsidian"] .login-shell,
[data-theme="obsidian"] .login-card,
[data-theme="obsidian"] .user-actions,
[data-theme="obsidian"] .nav-popover,
[data-theme="obsidian"] .modal-card,
[data-theme="obsidian"] .theme-switcher-panel {
    border: 1px solid var(--border);
    box-shadow: none;
}
[data-theme="obsidian"] .card:hover { box-shadow: var(--shadow-soft); }
[data-theme="obsidian"] .btn:hover { box-shadow: none; }
[data-theme="obsidian"] .btn-primary { box-shadow: none; }
[data-theme="obsidian"] .btn-primary:hover { box-shadow: var(--glow); }
[data-theme="obsidian"] input,
[data-theme="obsidian"] textarea,
[data-theme="obsidian"] select,
[data-theme="obsidian"] .search {
    background: var(--soft);
    border-color: var(--border);
    color: var(--ink);
}
[data-theme="obsidian"] input:focus,
[data-theme="obsidian"] textarea:focus,
[data-theme="obsidian"] select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(139, 124, 255, .18);
}
[data-theme="obsidian"] .data th {
    background: var(--soft);
}
[data-theme="obsidian"] .global-nav > .nav:hover,
[data-theme="obsidian"] .global-nav > .nav.active {
    background: rgba(var(--sidebar-fg-rgb), .08);
}
[data-theme="obsidian"] .kpi:first-child strong { color: var(--lime); }

/* ================================================================
   THEME: PAPER — warm editorial minimalism
   ================================================================ */
:root[data-theme="paper"] {
    --brand: #D84F3E;
    --brand-dark: #B83E2F;
    --brand-hover: #E36657;
    --brand-soft: #FBE7E3;
    --brand-border: #F0C4BC;
    --ink: #25231F;
    --text-2: #55524A;
    --text-3: #9A968C;
    --border: #D8D2C7;
    --border-soft: #E4DFD3;
    --card: #FFFDF8;
    --bg: #F4F1EA;
    --soft: #EEE9DF;
    --elevated: #EEE9DF;
    --success: #2D6755;
    --success-soft: #E3ECE6;
    --warning: #A6702B;
    --warning-soft: #F3E7D4;
    --danger: #B83E2F;
    --danger-soft: #F7E4E0;
    --info: #4C6E8C;
    --info-soft: #E6ECF1;
    --cyan: #4C6E8C;
    --cyan-soft: #E6ECF1;
    --purple: #8A6E9E;
    --purple-soft: #EFE7F2;
    --lime: #2D6755;
    --lime-soft: #E3ECE6;
    --coral: #D84F3E;
    --coral-soft: #FBE7E3;
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 8px;
    --shadow: 0 4px 16px rgba(60, 50, 30, .08);
    --shadow-soft: 0 2px 10px rgba(60, 50, 30, .06);
    --shadow-pressed: inset 0 0 0 1px rgba(60, 50, 30, .06);
    --glow: 0 4px 14px rgba(216, 79, 62, .18);
    --sidebar-bg: #E8E3D8;
    --sidebar-fg: #25231F;
    --sidebar-fg-rgb: 37, 35, 31;
    --on-accent: #FFFDF8;
    --scrollbar-thumb: #D8D2C7;
    --scrollbar-track: transparent;
    --code-bg: #2B2620;
    --code-fg: #F4F1EA;
    --font-body: "Inter", "Manrope", system-ui, sans-serif;
    --font-heading: "Inter", "Manrope", system-ui, sans-serif;
}

[data-theme="paper"] .page-context h1,
[data-theme="paper"] .login-brand-panel h1,
[data-theme="paper"] .insight h2 {
    font-family: "Lora", "Inter", serif;
    font-weight: 600;
    letter-spacing: 0;
}
[data-theme="paper"] .card,
[data-theme="paper"] .kpi-grid,
[data-theme="paper"] .login-shell,
[data-theme="paper"] .login-card,
[data-theme="paper"] .user-actions,
[data-theme="paper"] .nav-popover,
[data-theme="paper"] .modal-card,
[data-theme="paper"] .theme-switcher-panel {
    border: 1px solid var(--border);
    box-shadow: none;
}
[data-theme="paper"] .card:hover { box-shadow: var(--shadow-soft); }
[data-theme="paper"] .btn { box-shadow: none; }
[data-theme="paper"] .btn:hover { box-shadow: none; transform: none; }
[data-theme="paper"] .btn-primary:hover { background: var(--brand-hover); }
[data-theme="paper"] .btn-plain {
    background: var(--card);
    border-color: var(--border);
    color: var(--ink);
}
[data-theme="paper"] input,
[data-theme="paper"] textarea,
[data-theme="paper"] select,
[data-theme="paper"] .search {
    background: var(--card);
    border-color: var(--border);
    color: var(--ink);
    border-radius: var(--radius-sm);
}
[data-theme="paper"] input:focus,
[data-theme="paper"] textarea:focus,
[data-theme="paper"] select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(216, 79, 62, .12);
}
[data-theme="paper"] .data th {
    background: var(--soft);
    font-weight: 700;
    color: var(--text-2);
}
[data-theme="paper"] .tag {
    border-radius: var(--radius-sm);
}
[data-theme="paper"] .global-nav > .nav:hover,
[data-theme="paper"] .global-nav > .nav.active {
    background: rgba(var(--sidebar-fg-rgb), .08);
}
[data-theme="paper"] .brand-glyph,
[data-theme="paper"] .avatar,
[data-theme="paper"] .diagnostic-competency-index,
[data-theme="paper"] .course-topic-heading > span {
    border-radius: var(--radius-sm);
}
[data-theme="paper"] .bar span { background: var(--brand); }

/* ================================================================
   THEME: SYNTHWAVE — restrained neon futurism
   ================================================================ */
:root[data-theme="synthwave"] {
    --brand: #8A5CFF;
    --brand-dark: #6E3FE0;
    --brand-hover: #A379FF;
    --brand-soft: #241A3D;
    --brand-border: #3D2B5E;
    --ink: #F6F0FF;
    --text-2: #9E91B5;
    --text-3: #7A6D91;
    --border: #35254F;
    --border-soft: #2A1D42;
    --card: #1A122B;
    --bg: #100B1D;
    --soft: #1D1430;
    --elevated: #211633;
    --success: #4ADE80;
    --success-soft: #1B2E22;
    --warning: #F5B94D;
    --warning-soft: #2F2517;
    --danger: #FF5C7A;
    --danger-soft: #341826;
    --info: #43E6FF;
    --info-soft: #142A32;
    --cyan: #43E6FF;
    --cyan-soft: #142A32;
    --purple: #8A5CFF;
    --purple-soft: #241A3D;
    --lime: #43E6FF;
    --lime-soft: #142A32;
    --coral: #FF4FD8;
    --coral-soft: #341930;
    --shadow: 0 12px 32px rgba(0, 0, 0, .4);
    --shadow-soft: 0 6px 18px rgba(0, 0, 0, .32);
    --shadow-pressed: inset 0 0 0 1px rgba(0, 0, 0, .3);
    --glow: 0 0 22px rgba(138, 92, 255, .45);
    --sidebar-bg: #140A28;
    --sidebar-fg: #F6F0FF;
    --sidebar-fg-rgb: 246, 240, 255;
    --on-accent: #100B1D;
    --scrollbar-thumb: #3D2B5E;
    --scrollbar-track: transparent;
    --code-bg: #150E22;
    --code-fg: #F0E8FF;
    --font-body: "Inter", "Manrope", system-ui, sans-serif;
    --font-heading: "Inter", "Manrope", system-ui, sans-serif;
}

[data-theme="synthwave"] .card,
[data-theme="synthwave"] .kpi-grid,
[data-theme="synthwave"] .login-shell,
[data-theme="synthwave"] .login-card,
[data-theme="synthwave"] .user-actions,
[data-theme="synthwave"] .nav-popover,
[data-theme="synthwave"] .modal-card,
[data-theme="synthwave"] .theme-switcher-panel {
    border: 1px solid var(--border);
    box-shadow: none;
}
[data-theme="synthwave"] .card:hover {
    border-color: var(--brand-border);
    box-shadow: 0 0 24px rgba(138, 92, 255, .16);
}
[data-theme="synthwave"] .btn-primary {
    box-shadow: 0 0 16px rgba(138, 92, 255, .35);
}
[data-theme="synthwave"] .btn-primary:hover {
    box-shadow: var(--glow);
}
[data-theme="synthwave"] input,
[data-theme="synthwave"] textarea,
[data-theme="synthwave"] select,
[data-theme="synthwave"] .search {
    background: var(--soft);
    border-color: var(--border);
    color: var(--ink);
}
[data-theme="synthwave"] input:focus,
[data-theme="synthwave"] textarea:focus,
[data-theme="synthwave"] select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(138, 92, 255, .22), 0 0 16px rgba(138, 92, 255, .25);
}
[data-theme="synthwave"] .data th {
    background: var(--soft);
}
[data-theme="synthwave"] .global-nav > .nav.active {
    background: rgba(138, 92, 255, .16);
    box-shadow: inset 2px 0 0 var(--brand), 0 0 14px rgba(138, 92, 255, .18);
}
[data-theme="synthwave"] .global-nav > .nav:hover {
    background: rgba(var(--sidebar-fg-rgb), .07);
}
[data-theme="synthwave"] .bar {
    background: var(--border-soft);
}
[data-theme="synthwave"] .bar span {
    background: linear-gradient(90deg, var(--brand), var(--coral));
    box-shadow: 0 0 10px rgba(255, 79, 216, .35);
}
[data-theme="synthwave"] .notification-bell strong {
    box-shadow: 0 0 8px rgba(255, 79, 216, .6);
}
[data-theme="synthwave"] .avatar {
    box-shadow: 0 0 10px rgba(138, 92, 255, .45);
}

/* ================================================================
   THEME: SAGE — calm natural workspace
   ================================================================ */
:root[data-theme="sage"] {
    --brand: #44725A;
    --brand-dark: #345A46;
    --brand-hover: #57876A;
    --brand-soft: #E4EEE6;
    --brand-border: #C7DBCC;
    --ink: #243029;
    --text-2: #566058;
    --text-3: #97A098;
    --border: #DDE3D8;
    --border-soft: #E6EAE1;
    --card: #FBFCF8;
    --bg: #F3F5EE;
    --soft: #E9EEE5;
    --elevated: #E9EEE5;
    --success: #3F8F5E;
    --success-soft: #E4EFE7;
    --warning: #B0813A;
    --warning-soft: #F3E9D6;
    --danger: #B0473B;
    --danger-soft: #F5E4E1;
    --info: #4C7A8C;
    --info-soft: #E5EDF0;
    --cyan: #4C7A8C;
    --cyan-soft: #E5EDF0;
    --purple: #6E6C97;
    --purple-soft: #E9E8F1;
    --lime: #A7D46F;
    --lime-soft: #EBF4DE;
    --coral: #D5A85B;
    --coral-soft: #F5EAD6;
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 16px;
    --shadow: 0 10px 26px rgba(38, 61, 50, .1);
    --shadow-soft: 0 5px 16px rgba(38, 61, 50, .07);
    --shadow-pressed: inset 0 0 0 1px rgba(38, 61, 50, .06);
    --glow: 0 8px 20px rgba(68, 114, 90, .18);
    --sidebar-bg: #263D32;
    --sidebar-fg: #EDF4EC;
    --sidebar-fg-rgb: 237, 244, 236;
    --on-accent: #243029;
    --scrollbar-thumb: #C7DBCC;
    --scrollbar-track: transparent;
    --code-bg: #1D2B23;
    --code-fg: #EDF4EC;
    --font-body: "Manrope", "Inter", system-ui, sans-serif;
    --font-heading: "Manrope", "Inter", system-ui, sans-serif;
}

[data-theme="sage"] .card,
[data-theme="sage"] .kpi-grid,
[data-theme="sage"] .login-shell,
[data-theme="sage"] .login-card,
[data-theme="sage"] .user-actions,
[data-theme="sage"] .nav-popover,
[data-theme="sage"] .modal-card,
[data-theme="sage"] .theme-switcher-panel {
    border: 1px solid var(--border);
    box-shadow: none;
}
[data-theme="sage"] .card:hover { box-shadow: var(--shadow-soft); }
[data-theme="sage"] .btn { box-shadow: none; }
[data-theme="sage"] .btn:hover { box-shadow: none; transform: none; }
[data-theme="sage"] input,
[data-theme="sage"] textarea,
[data-theme="sage"] select,
[data-theme="sage"] .search {
    background: var(--card);
    border-color: var(--border);
    color: var(--ink);
    border-radius: var(--radius-sm);
}
[data-theme="sage"] input:focus,
[data-theme="sage"] textarea:focus,
[data-theme="sage"] select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(68, 114, 90, .14);
}
[data-theme="sage"] .data th {
    background: var(--soft);
}
[data-theme="sage"] .global-nav > .nav:hover,
[data-theme="sage"] .global-nav > .nav.active {
    background: rgba(var(--sidebar-fg-rgb), .1);
}
[data-theme="sage"] .bar span { background: var(--brand); }
[data-theme="sage"] .brand-glyph,
[data-theme="sage"] .avatar,
[data-theme="sage"] .diagnostic-competency-index,
[data-theme="sage"] .course-topic-heading > span {
    border-radius: var(--radius-sm);
}

/* ---------- Pagination, notices and status text ---------- */

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.pagination-status {
    color: var(--text-3);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.btn.is-disabled {
    opacity: .45;
    pointer-events: none;
}

.notice {
    border: 1px solid var(--border-soft);
    border-left: 3px solid var(--brand);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
    background: var(--soft);
}

.notice p { margin: 0; }
.notice-warning { border-left-color: #b8791f; }

.row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.state-done { color: var(--ok, #2f7d4f); }
.state-retry { color: var(--danger, #b23a2e); }

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    background: var(--border-soft);
    color: var(--text-2);
}

.pill-done { background: rgba(47, 125, 79, .14); color: #2f7d4f; }
.pill-retry { background: rgba(178, 58, 46, .14); color: #b23a2e; }
.pill-work { background: rgba(70, 110, 170, .14); color: #466eaa; }

.page-heading-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Content-level intro row (description + optional actions), sitting below the
   page's <h1> from the topbar. Named apart from .page-heading (the topbar's
   own wrapper) so the two are never confused - a page must not repeat its
   title as a second heading here. */
.content-lead {
    margin: 0 0 22px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}
.content-lead p { margin: 0; max-width: 62ch; }

.error-shell { align-items: center; justify-content: center; }
.error-shell .login-form-panel { max-width: 460px; }
p.small { font-size: 12px; }

/* ---------- Account management and billing blocks ---------- */

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 14px; }
.account-block > summary { display: inline-flex; cursor: pointer; list-style: none; }
.account-block > summary::-webkit-details-marker { display: none; }
.account-block[open] > summary { margin-bottom: 10px; }
.account-links { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-soft); }

.feature-list { list-style: none; margin: 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.feature-list li { padding-left: 20px; position: relative; color: var(--text-2); }
.feature-list li::before { content: "→"; position: absolute; left: 0; color: var(--brand); }

.form-error {
    border: 1px solid var(--danger, #b23a2e);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    color: var(--danger, #b23a2e);
    font-size: 13px;
}
