/* Платформа «Оценка квалификации ЖКХ» — адаптивные стили (mobile-first).
   Палитра и шрифты — фирменный стиль aiszkh.ru (СПК ЖКХ):
   синий #004898, малиновый #dc143c, текст #3e405a, Raleway/Oswald. */

:root {
    --primary: #004898;
    --primary-light: #1065af;
    --primary-dark: #003165;
    --accent: #dc143c;
    --accent-hover: #b91d3b;
    --success: #2e9e5b;
    --success-bg: #e6f6ec;
    --error: #e20d3c;
    --error-bg: #fdecef;
    --warning: #d78100;
    --warning-bg: #fff4e0;
    --info: #0e60ab;
    --info-bg: #e8f1fb;
    --text: #3e405a;
    --text-light: #747793;
    --bg: #f6f6f7;
    --card: #fff;
    --border: #d7d8e4;
    --border-light: #e5e5e7;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 3px rgba(62, 64, 90, .08), 0 4px 16px rgba(62, 64, 90, .06);
    --shadow-2: 0 4px 10px rgba(62, 64, 90, .10), 0 12px 32px rgba(62, 64, 90, .10);
    --shadow-3: 0 12px 24px rgba(62, 64, 90, .18), 0 24px 64px rgba(62, 64, 90, .16);
    --tap: 44px;
    --topbar-h: 58px;
    --sidebar-w: 264px;
    /* геймификация */
    --xp: #8a6203;
    --xp-bg: #fdf6e3;
    --streak: #e2571b;
    --streak-bg: #fdeee6;
    /* градиенты */
    --grad-primary: linear-gradient(135deg, #003165, #0e60ab);
    --grad-accent: linear-gradient(135deg, #dc143c, #b91d3b);
    --grad-success: linear-gradient(135deg, #237a46, #2e9e5b);
    --grad-gold: linear-gradient(135deg, #b8860b, #e0a92e);
    /* отступы */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
    /* движение */
    --dur-fast: 120ms;
    --dur: 200ms;
    --dur-slow: 400ms;
    --ease: cubic-bezier(.2, .8, .3, 1);
}

@media (prefers-reduced-motion: reduce) {
    :root { --dur-fast: 1ms; --dur: 1ms; --dur-slow: 1ms; }
    *, *::before, *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* атрибут hidden обязан прятать элемент даже при наличии авторского display
   (например .btn { display: inline-flex } иначе показывал бы скрытые кнопки) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
}

h1, h2, h3, .brand-text {
    font-family: 'Oswald', 'Raleway', Arial, sans-serif;
    font-weight: 500;
    letter-spacing: .3px;
}

a { color: var(--primary-light); }
img { max-width: 100%; }

:focus-visible {
    outline: 3px solid rgba(16, 101, 175, .5);
    outline-offset: 2px;
}

svg.i {
    width: 1.1em; height: 1.1em;
    vertical-align: -0.18em;
    fill: currentColor;
    flex-shrink: 0;
}

/* ------------------------------------------------------------- шапка
   Светлая шапка в стиле aiszkh.ru: логотип СПК ЖКХ + подпись Oswald,
   страница кабинета — на фирменном фоне (градиент + line-art рисунок ЖКХ) */

/* фирменный фон aiszkh.ru на страницах кабинета тестируемого */
.layout-topbar {
    background: #fff url('../img/background_main.png') no-repeat center / cover fixed;
}

.topbar {
    background: rgba(255, 255, 255, .93);
    color: var(--primary);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 6px rgba(62, 64, 90, .12);
    backdrop-filter: blur(4px);
}
.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--primary); min-height: 42px; }
.brand-logo { height: 46px; width: auto; flex-shrink: 0; }
.brand-caption {
    font-family: 'Oswald', 'Raleway', Arial, sans-serif;
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1.15;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--primary);
}
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: .2px; }

.nav-toggle {
    margin-left: auto;
    background: rgba(0, 72, 152, .06);
    color: var(--primary);
    border: 1px solid rgba(0, 72, 152, .3);
    border-radius: 10px;
    width: var(--tap); height: var(--tap);
    font-size: 20px;
    cursor: pointer;
    display: block;
}
/* мобильный дефолт: off-canvas drawer слева (тёмный, текст белый) */
.nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    width: min(300px, 86vw);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    color: #fff;
    overflow-y: auto;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--dur) var(--ease), visibility 0s var(--dur);
}
.nav.open { transform: none; visibility: visible; transition-delay: 0s; }
.nav a {
    color: #fff;
    text-decoration: none;
    padding: 11px 12px;
    border-radius: 10px;
    min-height: var(--tap);
    display: flex;
    align-items: center;
}
/* Пункты меню — явные кнопки: рамка, фон, активная страница залита белым */
.nav > a {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.28);
    font-weight: 600;
    gap: 7px;
}
.nav > a:hover, .nav > a:focus { background: rgba(255,255,255,.2); }
.nav > a[aria-current="page"] {
    background: #fff;
    border-color: #fff;
    color: var(--primary);
}
.nav-user {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,.18);
    margin-top: 4px;
}
.nav-user-name { display: flex; flex-direction: column; font-size: 14px; }
.nav-user-name small { opacity: .75; font-size: 12px; }

@media (min-width: 900px) {
    .nav-toggle { display: none; }
    .nav {
        position: static;
        transform: none;
        visibility: visible;
        background: none;
        overflow: visible;
        flex-direction: row;
        align-items: center;
        width: auto;
        margin-left: auto;
        padding: 0;
    }
    .nav a { padding: 9px 12px; min-height: 0; font-size: 14.5px; white-space: nowrap; }
    /* на светлой шапке пункты меню — синие кнопки (в мобильном drawer остаются белыми на синем) */
    .nav a { color: var(--primary); }
    .nav > a {
        background: #fff;
        border: 1px solid rgba(0, 72, 152, .35);
    }
    .nav > a:hover, .nav > a:focus { background: rgba(0, 72, 152, .08); }
    .nav > a[aria-current="page"] {
        background: var(--primary);
        border-color: var(--primary);
        color: #fff;
    }
    .nav-user { border-top: none; margin: 0 0 0 8px; padding: 0 0 0 14px; border-left: 1px solid rgba(0, 72, 152, .25); color: var(--text); }
    .nav-user-name small { opacity: .65; }
    .layout-topbar .drawer-overlay { display: none; }
}

/* ------------------------------------------------------------ основное */

.page {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}
@media (min-width: 700px) { .page { padding: 24px; } }

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 16px;
    transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (min-width: 700px) { .card { padding: 26px; } }
a.card-hover:hover, .card-hover:hover {
    box-shadow: var(--shadow-2);
    transform: translateY(-2px);
}

h1, h2 { color: var(--primary); line-height: 1.25; }
h1 { font-size: 22px; margin-bottom: 14px; }
h2 { font-size: 19px; margin-bottom: 12px; }
h3 { font-size: 16px; margin: 18px 0 10px; color: var(--primary); }
@media (min-width: 700px) { h1 { font-size: 26px; } h2 { font-size: 21px; } }

.muted { color: var(--text-light); }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-head h1 { margin-bottom: 0; }
.page-head .spacer { flex: 1; }

.breadcrumbs { font-size: 14px; color: var(--text-light); margin-bottom: 12px; display: flex; gap: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--primary-light); text-decoration: none; }

/* ------------------------------------------------------------- кнопки */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: var(--tap);
    padding: 10px 18px;
    border: none;
    border-radius: 11px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, transform .05s;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #e9e8f2; color: var(--primary); }
.btn-secondary:hover { background: #dcdaea; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-outline { background: transparent; color: inherit; border: 1.5px solid currentColor; }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 13.5px; border-radius: 9px; }
.btn-full { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* -------------------------------------------------------------- формы */

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(16, 101, 175, .15);
}
.form-row { display: flex; flex-wrap: wrap; gap: 10px; }
.form-row > * { flex: 1 1 180px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; min-height: var(--tap); font-size: 15px; }
.checkbox-label input { width: 20px; height: 20px; }

/* ----------------------------------------------------------- сообщения */

.flashes { margin-bottom: 14px; }
.flash {
    padding: 12px 14px;
    border-radius: 11px;
    margin-bottom: 8px;
    font-size: 14.5px;
    border: 1px solid transparent;
}
.flash-error { background: var(--error-bg); color: #90211e; border-color: #f3c1bf; }
.flash-success { background: var(--success-bg); color: #1a5e36; border-color: #bfe6cd; }
.flash-warning { background: var(--warning-bg); color: #8a5300; border-color: #f2ddb0; }
.flash-info { background: var(--info-bg); color: #1b4a7e; border-color: #c4dcf5; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--success-bg); color: #1a5e36; }
.badge-red { background: var(--error-bg); color: #90211e; }
.badge-orange { background: var(--warning-bg); color: #8a5300; }
.badge-blue { background: var(--info-bg); color: #1b4a7e; }
.badge-grey { background: #ececf4; color: var(--text-light); }

/* -------------------------------------------------------------- вход */

/* фоновый рисунок ЖКХ (как на aiszkh.ru): бледная line-art сцена */
body.login-page {
    background: #fff url('../img/background_login.png') no-repeat center / cover fixed;
}
.login-wrap {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}
.login-card {
    background: rgba(255, 255, 255, .93);
    border-radius: var(--radius);
    box-shadow: 0 3px 7px rgba(0, 0, 0, .17);
    padding: 26px 22px;
    width: 100%;
    max-width: 420px;
}
.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.login-logo img { width: 132px; height: auto; }
.login-logo-caption {
    font-family: 'Oswald', Arial, sans-serif;
    font-size: 13px;
    line-height: 1.25;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--primary);
    text-align: center;
}
.login-title { text-align: center; margin-bottom: 4px; text-transform: uppercase; }
.login-sub { text-align: center; color: var(--text-light); font-size: 14px; margin-bottom: 18px; }
.login-links { text-align: center; margin-top: 14px; font-size: 14px; }

/* ---------------------------------------------------- карточки-плитки */

.tile-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .tile-grid { grid-template-columns: repeat(3, 1fr); } }

.tile {
    display: block;
    background: var(--card);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius);
    padding: 16px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .12s, border-color .12s;
}
a.tile:hover { transform: translateY(-2px); border-color: var(--primary-light); box-shadow: var(--shadow-2); }
.tile.disabled { opacity: .55; }
.tile-title { font-weight: 650; margin-bottom: 8px; color: var(--primary); }
.tile-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; color: var(--text-light); }

.category-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .category-grid { grid-template-columns: repeat(3, 1fr); } }
.category-card {
    text-align: center;
    padding: 18px 10px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border-light);
    background: var(--card);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .12s, border-color .12s;
}
a.category-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow-2); }
.category-card.disabled { opacity: .45; }
.category-count { font-size: 30px; font-weight: 800; color: var(--accent); }
.category-name { font-weight: 650; margin-top: 4px; }
.category-desc { font-size: 12.5px; color: var(--text-light); margin-top: 4px; }

/* ------------------------------------------------------------ KPI/отчёты */

.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 700px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .kpi-grid { grid-template-columns: repeat(5, 1fr); } }
.kpi {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
}
.kpi-value { font-size: 22px; font-weight: 800; color: var(--primary); word-break: break-word; }
.kpi-label { font-size: 12.5px; color: var(--text-light); margin-top: 2px; }

.report-nav {
    display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px;
    margin-bottom: 14px; -webkit-overflow-scrolling: touch;
}
.report-nav a {
    flex: 0 0 auto;
    padding: 8px 13px;
    border-radius: 999px;
    background: var(--card);
    border: 1.5px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 13.5px;
    white-space: nowrap;
}
.report-nav a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.chart-box { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.chart-box h3 { margin-top: 0; }
.chart-holder { position: relative; height: 280px; }
@media (min-width: 700px) { .chart-holder { height: 340px; } }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.filters .form-group { margin-bottom: 0; flex: 1 1 150px; }
.filters .btn { flex: 0 0 auto; }

/* -------------------------------------------------------------- таблицы */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; box-shadow: var(--shadow); background: var(--card); }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 560px;
}
table.data th, table.data td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}
table.data th {
    background: #f7f7fb;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: var(--text-light);
    position: sticky; top: 0;
}
table.data tr:hover td { background: #fafaff; }
table.data a { text-decoration: none; font-weight: 600; }
td.ok { color: var(--success); font-weight: 700; }
td.fail { color: var(--error); font-weight: 700; }

.pagination { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px; background: var(--card); border: 1px solid var(--border);
    text-decoration: none; color: var(--text); font-size: 14px; padding: 0 8px;
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------------------------------------------------------------- тест */

.test-shell { max-width: 860px; margin: 0 auto; }
.test-top {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: var(--topbar-h); z-index: 30;
    background: var(--bg);
    padding: 8px 0;
}
.question-counter { font-size: 15px; }
.timer {
    font-variant-numeric: tabular-nums;
    font-size: 19px; font-weight: 800;
    background: var(--card);
    border-radius: 10px;
    padding: 7px 13px;
    box-shadow: var(--shadow);
    color: var(--primary);
}
.timer.warning { color: var(--warning); }
.timer.danger { color: var(--error); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: .4; } }

.questions-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.question-nav-btn {
    width: 38px; height: 38px;
    border-radius: 9px;
    border: 1.5px solid var(--border);
    background: var(--card);
    font-size: 13.5px; font-weight: 600;
    color: var(--text);
    cursor: pointer;
}
.question-nav-btn.answered { background: var(--success-bg); border-color: #9fd7b4; color: #1a5e36; }
.question-nav-btn.skipped { background: var(--warning-bg); border-color: #ecd39c; color: #8a5300; }
.question-nav-btn.marked { box-shadow: inset 0 0 0 2px var(--accent); }
.question-nav-btn.current { background: var(--primary); border-color: var(--primary); color: #fff; }

.question-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.question-text { font-size: 17px; font-weight: 600; margin-bottom: 16px; line-height: 1.45; }

.answer-item {
    display: flex; gap: 12px; align-items: flex-start;
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 13px 14px;
    margin-bottom: 9px;
    cursor: pointer;
    background: #fff;
    transition: border-color .1s, background .1s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.answer-item:hover { border-color: var(--primary-light); }
.answer-item.selected { border-color: var(--accent); background: #fdf3ee; }
.answer-number {
    flex: 0 0 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px;
    background: #ececf4;
    font-size: 13px; font-weight: 700;
    color: var(--text-light);
}
.answer-item.selected .answer-number { background: var(--accent); color: #fff; }
.answer-text { font-size: 15.5px; }

.test-controls {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    margin-top: 16px;
    padding-bottom: env(safe-area-inset-bottom);
}
.test-controls .btn { flex: 1 1 130px; }
.test-controls .mark-checkbox { flex: 1 1 100%; }
@media (min-width: 700px) {
    .test-controls .btn { flex: 0 0 auto; }
    .test-controls .mark-checkbox { flex: 0 0 auto; margin-left: auto; }
}

/* ------------------------------------------------------------ результаты */

.results-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
@media (min-width: 700px) { .results-summary { grid-template-columns: repeat(5, 1fr); } }
.result-item { background: #f7f7fb; border-radius: 12px; padding: 14px; text-align: center; }
.result-value { font-size: 21px; font-weight: 800; color: var(--primary); }
.result-label { font-size: 12.5px; color: var(--text-light); margin-top: 3px; }
.result-item.result-passed { background: var(--success-bg); }
.result-item.result-passed .result-value { color: var(--success); }
.result-item.result-failed { background: var(--error-bg); }
.result-item.result-failed .result-value { color: var(--error); }

/* --------------------------------------------------------------- подвал */

.footer { background: transparent; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
.footer-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between;
    color: var(--text-light); font-size: 12.5px;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 12px; }
.footer-links a { color: var(--text-light); }

/* ---------------------------------------------------------- cookie-баннер */

.cookie-banner {
    position: fixed;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    /* ниже шапки (50): открытый drawer живёт в стекинг-контексте .topbar */
    z-index: 45;
    background: var(--primary-dark);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
    padding: 14px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.cookie-banner p { flex: 1 1 260px; font-size: 13.5px; line-height: 1.45; }
.cookie-banner a { color: #ffd9c4; }
@media (min-width: 700px) { .cookie-banner { left: auto; max-width: 560px; } }

/* --------------------------------------------------------------- ошибки */

.error-box { text-align: center; padding: 60px 20px; }
.error-box .error-code { font-size: 44px; font-weight: 800; color: var(--primary-light); margin-bottom: 10px; }
.error-box .error-message { color: var(--text-light); margin-bottom: 22px; font-size: 16px; }

/* --------------------------------------------------------------- разное */

.legal-body { max-width: 760px; line-height: 1.65; }
.legal-body h2 { margin: 18px 0 10px; }
.legal-body p { margin-bottom: 10px; }

.progress-bar { height: 8px; border-radius: 999px; background: #ececf4; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--success); border-radius: 999px; }

.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list code {
    background: #ececf4; border-radius: 7px; padding: 3px 8px; font-size: 12.5px;
}
details.panel { background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 10px; }
details.panel summary { cursor: pointer; font-weight: 650; color: var(--primary); min-height: 30px; }

/* ------------------------------------------------------------- чипы */

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 38px; padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 13.5px; font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
    -webkit-tap-highlight-color: transparent;
}
.chip:hover { border-color: var(--primary-light); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* --------------------------------------------------------- стат-плитки */

.stat {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px 14px;
    min-width: 0;
}
.stat-value {
    font-size: 22px; font-weight: 800; color: var(--primary);
    display: flex; align-items: center; gap: 6px;
    line-height: 1.2;
}
.stat-label { font-size: 12.5px; color: var(--text-light); margin-top: 2px; }
.stat-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.stat-delta { font-size: 12.5px; font-weight: 700; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--error); }
.stat-streak .stat-value { color: var(--streak); }
.stat-xp .stat-value { color: var(--xp); }

/* ------------------------------------------------------ кольцо прогресса */

.ring-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.ring {
    --value: 0;
    --ring-color: var(--primary-light);
    --size: 84px;
    --thick: 9px;
    width: var(--size); height: var(--size);
    border-radius: 50%;
    background: conic-gradient(var(--ring-color) calc(var(--value) * 1%), var(--border-light) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
    mask: radial-gradient(farthest-side, transparent calc(100% - var(--thick)), #000 calc(100% - var(--thick) + 1px));
}
.ring-center {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center;
}
.ring-center b { font-size: 17px; font-weight: 800; color: var(--text); }
.ring-center small { font-size: 10.5px; color: var(--text-light); }

/* -------------------------------------------------------------- тосты */

.toast-stack {
    position: fixed;
    z-index: 200;
    left: 12px; right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex; flex-direction: column; gap: 8px;
    pointer-events: none;
}
@media (min-width: 700px) {
    .toast-stack { left: auto; right: 20px; top: 74px; bottom: auto; width: 340px; }
}
.toast {
    pointer-events: auto;
    background: var(--card);
    color: var(--text);
    border-radius: 12px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-2);
    padding: 12px 14px;
    font-size: 14.5px;
    font-weight: 600;
    display: flex; align-items: center; gap: 10px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: #bfe6cd; background: var(--success-bg); color: #1a5e36; }
.toast-error { border-color: #f3c1bf; background: var(--error-bg); color: #90211e; }
.toast-info { border-color: #c4dcf5; background: var(--info-bg); color: #1b4a7e; }
.toast-xp { border-color: #ecd39c; background: var(--xp-bg); color: var(--xp); }

/* ------------------------------------------------------------- диалоги */

dialog.modal {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-3);
    padding: 24px 22px;
    width: min(92vw, 440px);
    color: var(--text);
}
dialog.modal::backdrop { background: rgba(62, 64, 90, .45); }
dialog.modal h3 { margin: 0 0 8px; color: var(--primary); font-size: 18px; }
dialog.modal p { color: var(--text-light); font-size: 14.5px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-hero { text-align: center; padding: 6px 0 2px; }
.modal-hero .modal-icon {
    width: 72px; height: 72px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--grad-gold); color: #fff;
    font-size: 32px; margin-bottom: 12px;
}
.modal-hero .modal-icon svg.i { width: 34px; height: 34px; }
@media (max-width: 699px) {
    dialog.modal.sheet {
        margin: auto 0 0;
        width: 100vw; max-width: 100vw;
        border-radius: 20px 20px 0 0;
        padding-bottom: calc(22px + env(safe-area-inset-bottom));
    }
}

/* ------------------------------------------------------- прогресс-бары */

.progress-lg { height: 12px; }
.progress-bar > span { transition: width var(--dur-slow) var(--ease); }
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-line .progress-bar { flex: 1; }
.progress-line .progress-caption { font-size: 12.5px; color: var(--text-light); white-space: nowrap; }


/* ------------------------------------------------------------- импорт */

.import-layout { max-width: 940px; display: grid; grid-template-columns: 1fr; gap: 16px; }
.import-layout .card { margin-bottom: 0; }

.choice-group { border: 0; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.choice-group legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 6px; }
.choice-card {
    display: flex; gap: 10px; align-items: flex-start;
    border: 1.5px solid var(--border); border-radius: 12px;
    padding: 12px 14px; cursor: pointer; background: var(--card);
}
.choice-card input { width: 20px; height: 20px; margin-top: 1px; flex: 0 0 auto; }
.choice-card:has(input:checked) {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(16, 101, 175, .12);
}
.choice-title { display: block; font-weight: 600; font-size: 15px; }
.choice-desc { display: block; font-size: 13px; color: var(--text-light); margin-top: 2px; }

.checkbox-block { margin-bottom: 12px; }
.checkbox-block .hint { font-size: 13px; color: var(--text-light); margin: 2px 0 0 28px; }

.stat-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* --------------------------------------------- комбобокс с поиском (группы) */

.combo { position: relative; min-width: 300px; flex: 1; }
.combo select.combo-hidden { display: none; }
.combo-input {
    width: 100%; padding: 7px 10px; font-size: 12.5px;
    border: 1px solid var(--border); border-radius: 8px; background: var(--card);
}
.combo-input:focus { outline: none; border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(16, 101, 175, .12); }
.combo-list {
    position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 280px; overflow-y: auto; background: var(--card);
    border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(62, 64, 90, .14);
}
.combo-option { padding: 8px 10px; font-size: 12.5px; cursor: pointer; }
.combo-option:hover, .combo-option.is-active { background: var(--bg); }
.combo-option.is-selected { font-weight: 600; color: var(--primary); }
.combo-empty { padding: 10px; font-size: 12.5px; color: var(--text-light); }

/* неактивные направления: затенены, но управление доступно */
tr.course-inactive td { background: var(--bg); }
tr.course-inactive td:first-child b,
tr.course-inactive td:first-child div { color: var(--text-light); }

/* ---------------------------------------- каркас с сайдбаром (персонал) */

.shell { display: flex; flex: 1; width: 100%; min-height: 100vh; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shell-main .page { max-width: 1400px; }

/* сайдбар: мобильный дефолт — off-canvas drawer */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 120;
    width: min(var(--sidebar-w), 86vw);
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    color: #fff;
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform var(--dur) var(--ease), visibility 0s var(--dur);
}
.sidebar.open { transform: none; visibility: visible; transition-delay: 0s; }

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(62, 64, 90, .5);
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
}
.drawer-overlay.show { opacity: 1; }
body.drawer-open { overflow: hidden; }

.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
    min-height: var(--topbar-h);
    padding: 0 18px;
    color: #fff; text-decoration: none; font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.14);
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.28) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

.snav-link {
    display: flex; align-items: center; gap: 10px;
    min-height: var(--tap);
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.92);
    text-decoration: none;
    font-size: 14.5px; font-weight: 550;
    transition: background var(--dur-fast);
}
.snav-link:hover, .snav-link:focus-visible { background: rgba(255,255,255,.12); }
.snav-link.is-active { background: #fff; color: var(--primary); font-weight: 700; }
.snav-link .i { width: 18px; height: 18px; opacity: .85; }
.snav-link.is-active .i { opacity: 1; }

.snav-group { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }
.snav-heading {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 12px 6px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .6px;
    text-transform: uppercase;
    color: rgba(255,255,255,.55);
}
.snav-heading .i { width: 15px; height: 15px; }
.snav-group.has-active .snav-heading { color: rgba(255,255,255,.85); }
.snav-sub { padding-left: 34px; font-size: 13.5px; min-height: 38px; }

.snav-section-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%;
    min-height: 40px;
    padding: 8px 12px 8px 34px;
    background: none; border: none;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.85);
    font: inherit; font-size: 13.5px; font-weight: 650;
    text-align: left;
    cursor: pointer;
}
.snav-section-toggle:hover { background: rgba(255,255,255,.1); }
.snav-section-toggle .chev { width: 14px; height: 14px; transition: transform var(--dur) var(--ease); }
.snav-section-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.snav-section .snav-sub { padding-left: 46px; }

.sidebar-user {
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(255,255,255,.14);
}

/* фокус на тёмном фоне сайдбара/drawer-меню */
.sidebar :focus-visible, .nav :focus-visible {
    outline-color: rgba(255,255,255,.65);
}

/* мобильная шапка макета с сайдбаром */
.appbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 12px;
    min-height: var(--topbar-h);
    padding: 0 12px;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    box-shadow: var(--shadow);
}
.drawer-toggle {
    width: var(--tap); height: var(--tap);
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: none; border-radius: 10px;
    cursor: pointer;
}
.drawer-toggle .i { width: 22px; height: 22px; }

@media (min-width: 1024px) {
    .sidebar {
        position: sticky; top: 0;
        height: 100vh;
        flex-shrink: 0;
        width: var(--sidebar-w);
        transform: none;
        visibility: visible;
    }
    .layout-sidebar .appbar,
    .layout-sidebar .drawer-overlay { display: none; }
}

/* ------------------------------------------------------------- печать */

@media print {
    .sidebar, .appbar, .topbar, .footer, .cookie-banner,
    .drawer-overlay, .toast-stack, .nav-toggle { display: none !important; }
    .page, .shell-main .page { max-width: none; padding: 0; }
    body { background: #fff; }
}
