/* Панель учителя — минимальные стили без внешних зависимостей (LAN offline) */

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #dde3e8;
    --text: #1f2933;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --good: #16a34a;
    --mid: #d97706;
    --bad: #dc2626;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px 20px 48px;
}

/* Toggle (переключатель ДЗ/Экзамены/Все) */
.toggle-group {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.toggle-btn {
    padding: 7px 14px;
    border: none;
    background: var(--surface);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.toggle-btn + .toggle-btn { border-left: 1px solid var(--border); }
.toggle-btn:hover { background: var(--surface-2); }
.toggle-btn.active { background: var(--primary); color: #fff; }
.toggle-group { max-width: 100%; overflow-x: auto; }
.toggle-btn { flex-shrink: 0; white-space: nowrap; }

/* Subnav (вкладки) */
.subnav {
    display: flex;
    gap: 6px;
    margin: 16px 0 0;
    border-bottom: 1px solid var(--border);
}
.subnav a {
    padding: 8px 16px;
    color: var(--text-2);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Topbar */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-top: 10px;
    padding-bottom: 10px;
}
.brand { font-weight: 700; font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
    padding: 6px 12px;
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
}
.nav a:hover { background: var(--bg); }
.nav a.active { background: var(--primary); color: #fff; }
.user-box { display: flex; align-items: center; gap: 10px; }
.user-name { color: var(--muted); }

/* Typography */
h1 { font-size: 22px; margin: 20px 0 12px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-small { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; margin-top: 12px; }
.btn-danger { border-color: #fecaca; color: #b91c1c; }
.btn-danger:hover { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-danger-soft { color: #b91c1c; border-color: #fecaca; }
.btn-danger-soft:hover { background: #fef2f2; color: #b91c1c; }
.student-select {
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 15px;
    width: 100%;
    max-width: 420px;
    background: #fff;
}
.group-assign { max-width: 620px; }
.group-assign-list { display: flex; flex-direction: column; gap: 6px; }
.group-assign-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.group-assign-item:hover { background: #f8fafc; }
.group-assign-item input { accent-color: var(--primary); width: 16px; height: 16px; }
.group-assign-item span { flex: 1; }

.confirm-list { margin: 6px 0 12px; padding-left: 20px; }
.confirm-list li { margin: 2px 0; }
.deadline-option {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    background: var(--surface);
}
.deadline-option input[type="datetime-local"] {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 15px;
}

/* Страница назначения */
.assign-sections { margin-bottom: 16px; }
.assign-list { display: flex; flex-direction: column; gap: 6px; max-width: 620px; }
.assign-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}
.assign-item:hover { background: #f8fafc; }
.assign-item input { accent-color: var(--primary); width: 16px; height: 16px; }
.assign-item input:disabled { accent-color: #9ca3af; cursor: not-allowed; }
.assign-item span { flex: 1; }
.assign-item:has(input:disabled) { background: #f1f5f9; opacity: .8; }

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 16px 0;
}
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    text-decoration: none;
    color: var(--text);
}
.card-attention { border-color: var(--bad); }
.card-value { font-size: 30px; font-weight: 700; }
.card-attention .card-value { color: var(--bad); }
.card-label { color: var(--muted); margin-top: 4px; }

.result-link { text-decoration: none; }
.result-link:hover { opacity: .8; }
.col-center { text-align: center !important; }
.col-time { white-space: normal; line-height: 1.3; text-align: left; }

.sort-link {
    color: var(--text-2);
    text-decoration: none;
    white-space: nowrap;
}
.sort-link:hover { color: var(--primary); text-decoration: none; }
.sort-link.active { color: var(--primary); }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.table th, .table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table th { background: #f8fafc; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.col-check { width: 34px; text-align: center; }

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    flex-wrap: wrap;
}
.toolbar form {
    margin: 0;
    display: inline-flex;
    align-items: center;
}
.student-auto-ai-form { align-items: center; }
.student-auto-ai-form label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 14px;
}
.student-auto-ai-form input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--primary);
}
.card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.card-actions .btn,
.card-actions form,
.card-actions form .btn {
    width: 100%;
}
.card-actions form .btn {
    text-align: center;
}
.card-actions .btn {
    text-align: center;
}
.card-flex {
    display: flex;
    flex-direction: column;
}
.card-flex .card-actions {
    margin-top: auto;
}
.cards-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 16px 0;
}
.cards-4 .card {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}
@media (max-width: 900px) {
    .cards-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 540px) {
    .cards-4 {
        grid-template-columns: 1fr;
    }
}
.ai-review-select {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.ai-review-select-title {
    font-weight: 700;
}
.progress {
    width: 100%;
    height: 12px;
    background: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-bar {
    height: 100%;
    background: #3498db;
    border-radius: 6px;
    transition: width 0.3s ease;
}
.toolbar select {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    font-size: 14px;
    min-width: 0;
    max-width: min(320px, 100%);
    flex: 0 1 auto;
}
.add-student { margin-bottom: 18px; }
.add-student h2 { margin: 0 0 4px; }
.add-student-form { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.add-student-form input {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 15px;
    min-width: 180px;
}
.add-student-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }

.search-input {
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus-ring); }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e5e7eb;
    font-size: 12px;
}
.badge-shared { background: #dbeafe; color: #1e40af; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-mid { background: #fef3c7; color: #92400e; }
.badge-bad { background: #fee2e2; color: #991b1b; }
.step-list { list-style: none; padding-left: 0; margin: 0; }
.step-item { display: flex; align-items: flex-start; gap: 8px; }
.step-item .badge { flex-shrink: 0; }
.step-note { margin: 2px 0 8px 16px; }

/* Bars (CSS charts) */
.bar {
    position: relative;
    background: #e5e7eb;
    border-radius: 5px;
    height: 18px;
    min-width: 120px;
    overflow: hidden;
}
.bar-tall { height: 26px; flex: 1; }
.bar-fill { height: 100%; border-radius: 5px; }
.bar-good { background: var(--good); }
.bar-mid { background: var(--mid); }
.bar-bad { background: var(--bad); }
.bar-label {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #111827;
}
.chart { display: flex; flex-direction: column; gap: 8px; max-width: 700px; }
.chart-row { display: flex; align-items: center; gap: 10px; }
.chart-name { width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Matrix */
.matrix-wrap { overflow-x: auto; }
.table-matrix th, .table-matrix td { padding: 6px 8px; }
.matrix-student { min-width: 140px; }
.matrix-cell { text-align: center; width: 44px; padding: 0 !important; }
/* Центрирование заголовков и ячеек матрицы (перебивает .table th/td text-align) */
.table-matrix th.matrix-cell {
    text-align: center !important;
    vertical-align: middle;
    padding: 6px 0 !important;
}
.table-matrix td.matrix-cell {
    text-align: center !important;
    vertical-align: middle;
}
/* Номер и иконка центрируются одинаково — flex по всей ширине ячейки */
.table-matrix .matrix-head,
.table-matrix .cell-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 6px 0;
    line-height: 1;
}
.cell-link {
    display: block;
    padding: 6px 8px;
    font-size: 14px;
    text-decoration: none;
    background: transparent;
}
.cell-link:hover { background: #eef2f7; }
.cell-mid { color: #b45309; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.filter-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.filter-check input { accent-color: var(--primary); width: 16px; height: 16px; }

/* Live-доска: точки задач */
.table-live td, .table-live th { padding: 10px 12px; }
.tasks-dots { white-space: nowrap; }
.task-col {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin: 0 2px;
    padding: 2px 3px;
    border-radius: 6px;
    text-decoration: none;
}
a.task-col:hover { background: #eef2f7; }
.task-num { font-size: 10px; line-height: 1; color: var(--muted); }
a.task-col:hover .task-num { color: var(--primary); }
.task-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    vertical-align: middle;
}
.task-dot.inline { margin: 0 4px 0 0; width: 12px; height: 12px; }
.task-dot.inline { margin: 0 4px 0 0; width: 12px; height: 12px; }
.dot-ok { background: var(--good); }
.dot-bad { background: var(--bad); }
.dot-none { background: #e2e8f0; }

/* Детали вопроса */
.task-detail { max-width: 800px; }
.task-block { margin: 16px 0; }
.task-block-title {
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--muted);
    margin-bottom: 8px;
}

/* Review */
.card-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.card-block-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.report-list pre { overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-box { margin-top: 10px; padding: 10px; background: #f8fafc; border-radius: 6px; white-space: pre-wrap; }
.small-box { margin-top: 0; max-width: 360px; max-height: 120px; overflow: auto; font-size: 13px; }
.files-box { margin-top: 10px; }
.files-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.file-link {
    display: inline-block;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    background: #f8fafc;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 380px;
}
.login-card h1 { margin-top: 0; text-align: center; }
.login-card label { display: block; margin: 14px 0 6px; font-weight: 600; }
.login-card input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 16px;
}
.code-input { text-align: center; letter-spacing: 8px; font-size: 22px; }
.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.remember-row input { accent-color: var(--primary); width: 16px; height: 16px; }

/* Alerts */
.alert {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 10px 12px;
    margin: 12px 0;
}
.alert-ok {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

/* ============================================================
   Адаптивность (мобильные/планшеты)
   ============================================================ */

.review-condition { margin: 12px 0 4px; }
.review-condition .problem-block-title { margin-bottom: 8px; }

/* Форма оценки решения */
.grade-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.grade-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.grade-label { font-weight: 600; font-size: 13.5px; min-width: 96px; color: var(--text-2); }
.grade-option { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.grade-option input { accent-color: var(--primary); }
.grade-comment {
    flex: 1;
    min-width: 200px;
    padding: 8px 11px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 14px;
}
.grade-comment:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--focus-ring); }

/* Дедлайны */
.inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form input[type="datetime-local"] {
    padding: 6px 9px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 13.5px;
}
.bulk-deadline {
    padding: 6px 9px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 13.5px;
}
.shift-amount {
    padding: 6px 9px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 13.5px;
    width: 110px;
}

/* Выбор раздела статистики */
.stat-choice {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 18px;
    max-width: 760px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    text-decoration: none;
    color: var(--text);
    display: block;
    box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s, border-color .15s;
}
a.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--primary-border); text-decoration: none; }
.stat-icon { font-size: 34px; margin-bottom: 12px; }
.stat-card-title { font-weight: 700; font-size: 17px; margin-bottom: 6px; }
.stat-card-desc { color: var(--muted); font-size: 14px; }

/* Проблемные вопросы (аккордеон) */
.problem-list { display: flex; flex-direction: column; gap: 10px; }
.problem-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.problem-card[open] { border-color: var(--primary-border); }
.problem-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 13px 16px;
    cursor: pointer;
    list-style: none;
    flex-wrap: wrap;
}
.problem-head::-webkit-details-marker { display: none; }
.problem-head:hover { background: #f8fafc; }
.problem-num {
    font-weight: 700;
    color: var(--primary);
    font-size: 16px;
    min-width: 48px;
}
.problem-metrics { display: flex; align-items: center; gap: 16px; flex: 1; flex-wrap: wrap; }
.problem-stat { color: var(--muted); font-size: 13.5px; }
.problem-stat strong { color: var(--text); }
.problem-bar { min-width: 120px; flex: 1; max-width: 260px; }
.problem-bar .bar { min-width: 0; }
.problem-toggle { color: var(--muted); font-size: 14px; transition: transform .2s; }
.problem-card[open] .problem-toggle { transform: rotate(180deg); }
.problem-body {
    padding: 4px 16px 16px;
    border-top: 1px solid var(--border);
}
.problem-block { margin-top: 14px; }
.problem-block-title { font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); margin-bottom: 8px; }
.problem-files { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.problem-thumb img {
    max-height: 160px;
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: block;
}

/* Метка «меньше всего ответов» на проблемном вопросе */
.worst-answer-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: #fff3e0;
    border: 1px solid #f0c78a;
    color: #9a5b00;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.no-answers-badge { background: #fdeaea; border-color: #e6a5a5; color: #b02a2a; }

/* Ответы учеников под карточкой проблемного вопроса */
.answers-collapsible { margin-top: 2px; }
.answers-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    list-style: none;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fafc;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--primary);
    user-select: none;
}
.answers-summary::-webkit-details-marker { display: none; }
.answers-summary:hover { background: #eef2f7; border-color: var(--primary-border); }
.answers-arrow { color: var(--muted); font-size: 12px; transition: transform .2s; }
.answers-collapsible[open] .answers-arrow { transform: rotate(180deg); }
.answers-collapsible[open] .answers-summary { margin-bottom: 10px; }
.answers-collapsible .answers-label-hide { display: none; }
.answers-collapsible[open] .answers-label-show { display: none; }
.answers-collapsible[open] .answers-label-hide { display: inline; }
.answer-rows { list-style: none; margin: 0; padding: 0; }
.answer-row { padding: 10px 0; border-top: 1px solid var(--border); }
.answer-row:first-child { border-top: none; padding-top: 2px; }
.answer-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.answer-student { font-weight: 600; }
.answer-state { font-size: 12.5px; padding: 1px 9px; border-radius: 10px; white-space: nowrap; }
.answer-state-correct { background: #e5f6e5; color: #1d7a1d; }
.answer-state-incorrect { background: #fdeaea; color: #b02a2a; }
.answer-state-partial { background: #fff6e0; color: #9a6b00; }
.answer-state-pending { background: #eef1f5; color: #556; }
.answer-text { margin-top: 3px; font-size: 14px; }
.answer-files { margin-top: 6px; }
.answer-files-label { margin-top: 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; color: var(--muted); }
.answer-comment { margin-top: 4px; font-size: 13px; }

/* Горизонтальная прокрутка широких таблиц */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}
.table-scroll .table { min-width: 620px; }

/* Бургер-меню по умолчанию скрыто */
.nav-burger { display: none; }

/* Планшеты и крупные телефоны */
@media (max-width: 900px) {
    .container { padding: 12px 14px 48px; }
    h1 { font-size: 21px; }
    .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Мобильные */
@media (max-width: 700px) {
    .topbar-inner { flex-wrap: wrap; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
    .brand { flex: 1; }

    .nav-burger {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        width: 40px;
        height: 40px;
        padding: 8px;
        border-radius: 8px;
        cursor: pointer;
        border: 1px solid var(--border);
        background: var(--surface);
    }
    .nav-burger span {
        display: block;
        height: 2px;
        width: 100%;
        background: var(--text);
        border-radius: 2px;
        transition: transform .2s, opacity .2s;
    }
    /* Гамбургер → крестик */
    .nav-toggle:checked + .nav-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-toggle:checked + .nav-burger span:nth-child(2) { opacity: 0; }
    .nav-toggle:checked + .nav-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .nav, .user-box {
        display: none;
        width: 100%;
    }
    .nav-toggle:checked ~ .nav,
    .nav-toggle:checked ~ .user-box { display: flex; }

    .nav {
        flex-direction: column;
        gap: 2px;
    }
    .nav a {
        padding: 12px 12px;
        font-size: 16px;
    }
    .user-box {
        justify-content: space-between;
        border-top: 1px solid var(--border);
        padding-top: 10px;
    }

    h1 { font-size: 20px; }
    .cards { grid-template-columns: repeat(2, 1fr); }
    .card-value { font-size: 26px; }
    .toolbar select { flex: 1; }
    .btn { padding: 9px 14px; }
}

/* Узкие телефоны */
@media (max-width: 430px) {
    .cards { grid-template-columns: 1fr; }
    .card-block-head { flex-direction: column; gap: 6px; }
    .container { padding-left: 10px; padding-right: 10px; }
}
