/* ===== Базовые стили ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fa;
    color: #1e293b;
    line-height: 1.6;
}
a { text-decoration: none; color: inherit; }

/* ===== Страница входа ===== */
body.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
}
.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.6s ease-out;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.login-container h1 { font-weight: 700; font-size: 2rem; color: #1e293b; margin-bottom: 0.5rem; text-align: center; }
.login-container .subtitle { color: #64748b; text-align: center; margin-bottom: 2rem; }
.input-group input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 14px;
    font-size: 1rem;
    outline: none;
    background: #f8fafc;
    transition: all 0.3s;
}
.input-group input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #fff;
}
.btn-login {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 1rem;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5); }
.btn-login:active { transform: translateY(0); }
.error-message { background: #fee2e2; color: #b91c1c; padding: 12px; border-radius: 12px; margin-top: 1rem; font-size: 0.9rem; text-align: center; }

/* ===== Дашборд ===== */
.dashboard-body { padding: 20px; min-height: 100vh; }
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 15px 25px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}
.dashboard-content { max-width: 1200px; margin: 0 auto; }
.btn-logout, .btn-back {
    background: #f1f5f9;
    color: #475569;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 500;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
}
.btn-logout:hover, .btn-back:hover { background: #e2e8f0; }
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}
.menu-card {
    background: #fff;
    padding: 30px 20px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.menu-card:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }
.menu-card .icon { font-size: 2rem; margin-bottom: 10px; }
.menu-card .title { font-weight: 600; font-size: 1.1rem; margin-bottom: 5px; color: #1e293b; }
.menu-card .desc { color: #64748b; font-size: 0.9rem; }

/* ===== Таблицы ===== */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f1f5f9; }
.data-table th { background: #f8fafc; font-weight: 600; color: #475569; font-size: 0.9rem; }
.data-table tr:hover { background: #f8fafc; }
.badge-type { background: #e0e7ff; color: #4338ca; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; }
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 500; }
.status-assigned { background: #fef3c7; color: #92400e; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-completed { background: #e0e7ff; color: #4338ca; }
.status-checked { background: #d1fae5; color: #065f46; }
.btn-action {
    background: #f1f5f9;
    color: #475569;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s;
    display: inline-block;
    margin-right: 5px;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.btn-action:hover { background: #e2e8f0; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-danger:hover { background: #fecaca; }
.btn-warning { background: #fef3c7; color: #92400e; }
.btn-undo { background: #f1f5f9; color: #475569; }
.btn-undo:hover { background: #e2e8f0; }
.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: #5a67d8; }
.btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}
.btn-secondary:hover { background: #e2e8f0; }
.empty-state { text-align: center; padding: 40px; background: #fff; border-radius: 16px; color: #64748b; }

/* ===== Формы и конструктор ===== */
.student-form, .test-form { background: #fff; padding: 30px; border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); max-width: 800px; }
.form-row { display: flex; gap: 20px; flex-wrap: wrap; }
.form-group { margin-bottom: 20px; flex: 1; min-width: 200px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: #475569; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    background: #f8fafc;
}
.form-group textarea { min-height: 100px; }
.question-block {
    border: 1px solid #e2e8f0;
    padding: 20px;
    margin: 15px 0;
    border-radius: 12px;
    background: #f9fafb;
}
.delete-question-btn {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    padding: 5px 15px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}
.delete-variant-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    vertical-align: middle;
}
.delete-variant-btn:hover { color: #b91c1c; }
.variant-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.sub-question-block {
    border-left: 3px solid #667eea;
    padding-left: 20px;
    margin: 15px 0;
}

/* ===== Редактор ===== */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}
.editor-toolbar button {
    min-width: 44px;
    height: 44px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.editor-toolbar button:hover { background: #f1f5f9; }
.underline-1 { text-decoration: underline; }
.underline-2 { text-decoration: underline double; }
.underline-wavy { text-decoration: underline wavy; }
.underline-dashed { text-decoration: underline dashed; }
.underline-dash-dot { border-bottom: 2px dashed #333; display: inline-block; }
.editor-area {
    border: 1px solid #e2e8f0;
    border-top: none;
    padding: 15px;
    min-height: 100px;
    border-radius: 0 0 12px 12px;
    background: #fff;
}

/* ===== Прохождение теста ===== */
.test-taking { padding: 0; background: #fff; min-height: 100vh; }
.progress-bar { width: 100%; height: 6px; background: #e2e8f0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #667eea, #764ba2); transition: width 0.3s; }
#test-container { max-width: 700px; margin: 0 auto; padding: 30px 20px; }
.question-slide { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.question-content { background: #fff; padding: 20px; border-radius: 16px; border: 1px solid #e2e8f0; margin-bottom: 20px; }
.navigation { display: flex; justify-content: space-between; margin-top: 20px; }
.prev-btn, .next-btn {
    padding: 12px 28px; border: none; border-radius: 12px; font-weight: 600; cursor: pointer;
    background: #667eea; color: white; transition: background 0.2s;
}
.prev-btn { background: #f1f5f9; color: #475569; }
.prev-btn:hover { background: #e2e8f0; }
.next-btn:hover { background: #5a67d8; }
.prev-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== Модальное окно ===== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: #fff; padding: 30px; border-radius: 16px; width: 90%; max-width: 450px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ===== Общие ===== */
.variant.correct { color: #065f46; font-weight: bold; }
.chosen { background: #d1fae5; padding: 2px 6px; border-radius: 4px; }
.message { padding: 15px; border-radius: 12px; margin-top: 20px; }
.message-error { background: #fee2e2; color: #b91c1c; }
.message-success { background: #d1fae5; color: #065f46; }
.score-display { font-size: 1.2rem; font-weight: 600; }

/* Адаптивность */
@media (max-width: 600px) {
    .dashboard-header { flex-direction: column; align-items: flex-start; }
    .form-row { flex-direction: column; }
    .menu-grid { grid-template-columns: 1fr; }
}

/* Активная кнопка подчёркивания */
.editor-toolbar button.active {
    background: #c7d2fe;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* Стили для карточек назначенных тестов (в view_student.php) */
.assigned-test-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.attempts-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}
.attempts-table th, .attempts-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 8px;
    text-align: left;
}
.attempts-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.badge-class {
    background: #f3e8ff;
    color: #6b21a8;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 5px;
}

.class-section {
    margin-bottom: 40px;
}

.class-title {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #1e293b;
    border-left: 4px solid #667eea;
    padding-left: 10px;
}

.knowledge-editor {
    min-height: 300px;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 12px 12px;
    padding: 15px;
    background: #fff;
}
.knowledge-content h2, .knowledge-content h3 {
    margin: 15px 0 10px;
}
.knowledge-content ul, .knowledge-content ol {
    margin: 10px 0 10px 20px;
}


/* Домашние задания */
.homework-widget {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-top: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.homework-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.homework-item {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.homework-date { color: #64748b; font-size: 0.9rem; }
.homework-description { margin-top: 10px; }

.delete-student-btn {
    background: #fee2e2;
    color: #b91c1c;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}
.delete-student-btn:hover {
    background: #fecaca;
}

/* ===== Усиленные поля ввода для теста ===== */
.answer-editor {
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 15px;
    min-height: 100px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.answer-editor:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    outline: none;
}
.answer-editor:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
}

.free-answer {
    width: 100%;
    padding: 12px;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1rem;
    min-height: 120px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.free-answer:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    outline: none;
}

.variant-label {
    display: block;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.2s;
}
.variant-label:hover {
    background: #f8fafc;
}
.variant-label input {
    margin-right: 8px;
}

.materials-block {
    margin-bottom: 12px;
}
.materials-text {
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.media-upload-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}
.question-audio audio {
    width: 100%;
    max-width: 400px;
}
/* ===== Конструктор теста (карточки заданий) ===== */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row > .form-group { flex: 1 1 240px; }
.field-hint { display: block; color: #64748b; margin-top: 4px; font-size: 0.85em; line-height: 1.35; }

.q-card { background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid #667eea; border-radius: 12px; padding: 14px 16px; margin: 14px 0; box-shadow: 0 1px 3px rgba(15, 23, 42, .05); }
.q-card-sub { border-left-color: #94a3b8; background: #f8fafc; margin: 10px 0; }
.q-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.q-num { font-weight: 700; color: #4338ca; min-width: 80px; }
.q-head .qtype { flex: 1 1 220px; max-width: 360px; }
.q-tools { margin-left: auto; display: inline-flex; gap: 4px; }
.icon-btn { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; padding: 4px 9px; cursor: pointer; font-size: 14px; line-height: 1.2; }
.icon-btn:hover { background: #e2e8f0; }
.q-del:hover { background: #fee2e2; border-color: #fecaca; }
.link-btn { background: none; border: none; color: #b91c1c; cursor: pointer; padding: 2px 4px; margin-left: 8px; }
.q-card textarea { width: 100%; box-sizing: border-box; resize: vertical; }
.variant-item { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.variant-item .v-text { flex: 1; }
.v-correct-label { white-space: nowrap; }
.add-sub-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.media-upload-container .btn-secondary { margin-right: 6px; margin-bottom: 4px; }

.add-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0; padding: 12px; background: #eef2ff; border-radius: 12px; position: sticky; bottom: 0; z-index: 5; }
.add-bar-title { font-weight: 600; margin-right: 4px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0 30px; }

.draft-banner { background: #fef9c3; border: 1px solid #fde68a; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.draft-banner button { margin-left: 8px; }

/* быстрая вставка */
.import-panel { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px; padding: 10px 14px; margin: 14px 0; position: relative; }
.import-panel summary { cursor: pointer; font-weight: 700; color: #166534; }
.import-body { margin-top: 10px; }
.import-steps { margin: 6px 0 12px 18px; color: #334155; line-height: 1.5; }
.import-body textarea#importText { width: 100%; box-sizing: border-box; margin: 12px 0 8px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.import-ok { background: #dcfce7; padding: 8px 12px; border-radius: 8px; margin-top: 10px; }
.import-warn { background: #fef3c7; padding: 8px 12px; border-radius: 8px; margin-top: 8px; color: #92400e; }

/* автопроверка и ответы */
.short-answer { width: 100%; max-width: 420px; padding: 12px 14px; font-size: 18px; border: 2px solid #cbd5e1; border-radius: 10px; margin-top: 12px; box-sizing: border-box; }
.short-answer:focus { border-color: #667eea; outline: none; }
.auto-summary { background: #eef2ff; border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.verdict { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85em; font-weight: 600; margin-left: 6px; }
.verdict-ok { background: #dcfce7; color: #166534; }
.verdict-bad { background: #fee2e2; color: #991b1b; }
.verdict-manual { background: #f1f5f9; color: #475569; }
.key-answer { margin-top: 8px; color: #166534; }
.test-filter { margin: 0 0 14px; padding: 8px 12px; width: 100%; max-width: 360px; border: 1px solid #cbd5e1; border-radius: 8px; box-sizing: border-box; }
.test-form { max-width: 980px; }
.form-group input[type="checkbox"], .form-group input[type="file"] { width: auto; padding: 0; background: none; }
.form-group .variants .v-text { flex: 1; width: auto; }
.q-card .form-group { margin-bottom: 14px; min-width: 0; }

/* ===== Банки уроков и курсов ===== */
.bank-hint { color: #64748b; margin: 0; max-width: 640px; line-height: 1.4; }
.bank-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 14px; }
.bank-toolbar .test-filter { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px; padding: 5px 14px; cursor: pointer; font-size: 14px; }
.chip:hover { background: #e2e8f0; }
.chip-active { background: #667eea; color: #fff; border-color: #667eea; }
.row-actions { white-space: nowrap; }
.row-actions form, .row-actions a, .row-actions button { margin: 2px 2px; }
.btn-danger:hover { background: #fee2e2; color: #991b1b; }
.check-all { display: block; margin: 8px 0; font-weight: 600; }
.student-checklist { max-height: 320px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; }
.student-group-title { font-weight: 700; color: #4338ca; margin: 10px 0 4px; }
.student-check { display: block; padding: 4px 0; cursor: pointer; }
.student-check input { width: auto; margin-right: 8px; }
.student-check .already { color: #94a3b8; }

/* ===== Редакторы (урок, курс, тест) ===== */
.builder-wide { max-width: 1240px; }
.builder-form { background: #fff; padding: 0 24px 24px; border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.builder-bar { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; background: rgba(255,255,255,.96); backdrop-filter: blur(4px); padding: 12px 0; margin-bottom: 14px; border-bottom: 1px solid #e2e8f0; }
.builder-bar-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.builder-bar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.save-state { color: #64748b; font-size: 14px; }
.save-state-dirty { color: #b45309; font-weight: 600; }
.block-title { margin: 6px 0 10px; font-size: 1.1rem; }
.side-hint { color: #64748b; font-size: .9rem; line-height: 1.4; margin: 0 0 12px; }
.side-label { display: block; margin: 16px 0 6px; font-weight: 600; color: #475569; }
.side-link { display: inline-block; margin-top: 10px; font-size: .9rem; }
.count-badge { color: #64748b; font-weight: 400; }

.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.lesson-side { position: sticky; top: 70px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; }
.lesson-side input[type="search"] { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; }
@media (max-width: 900px) {
    .lesson-layout { grid-template-columns: 1fr; }
    .lesson-side { position: static; }
}

.picked-list { list-style: none; margin: 0 0 10px; padding: 0; counter-reset: pk; }
.picked-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 6px; }
.picked-item-big { padding: 12px 14px; }
.picked-num { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; background: #667eea; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.picked-text { flex: 1; min-width: 0; font-size: .92rem; line-height: 1.3; }
.picked-text small { color: #64748b; }
.picked-empty { color: #64748b; background: #fff; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 12px; font-size: .9rem; margin-bottom: 8px; }
.pick-results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 280px; overflow: auto; }
.pick-results-big { max-height: 520px; }
.pick-result { width: 100%; text-align: left; background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; margin-bottom: 5px; cursor: pointer; font-size: .9rem; }
.pick-result:hover { background: #eef2ff; border-color: #c7d2fe; }
.pick-result-big { padding: 10px 12px; }
.pick-result small { color: #64748b; }
.pick-none { color: #94a3b8; padding: 8px; }
.course-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.course-col input[type="search"] { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; margin-bottom: 8px; }
@media (max-width: 800px) { .course-columns { grid-template-columns: 1fr; } }

/* редактор теории */
.theory-toolbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; position: sticky; top: 62px; z-index: 10; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 10px 10px 0 0; padding: 6px; }
.theory-toolbar button { background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; padding: 5px 9px; cursor: pointer; font-size: 13px; }
.theory-toolbar button:hover { background: #eef2ff; }
.theory-toolbar .tb-b { font-weight: 700; } .theory-toolbar .tb-i { font-style: italic; } .theory-toolbar .tb-u { text-decoration: underline; }
.tb-sep { width: 1px; height: 22px; background: #cbd5e1; margin: 0 4px; }
.theory-editor { min-height: 420px; border: 1px solid #e2e8f0; border-top: none; border-radius: 0 0 10px 10px; padding: 18px 20px; outline: none; background: #fff; }
.theory-editor:focus { border-color: #667eea; }
.theory-editor:empty::before { content: attr(data-placeholder); color: #94a3b8; }
.kb-import { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.kb-import select { max-width: 320px; }
.import-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* оформление теории (для учителя в редакторе и для ученика) */
.theory { line-height: 1.65; font-size: 1.02rem; color: #1e293b; overflow-wrap: anywhere; }
.theory h2 { font-size: 1.5rem; margin: 1.2em 0 .5em; }
.theory h3 { font-size: 1.2rem; margin: 1.1em 0 .4em; color: #3730a3; }
.theory h4 { font-size: 1.05rem; margin: 1em 0 .3em; }
.theory p { margin: .6em 0; }
.theory ul, .theory ol { padding-left: 1.4em; margin: .6em 0; }
.theory blockquote { margin: 1em 0; padding: 12px 16px; background: #eef2ff; border-left: 4px solid #667eea; border-radius: 0 10px 10px 0; }
.theory table { border-collapse: collapse; margin: 1em 0; max-width: 100%; display: block; overflow-x: auto; }
.theory th, .theory td { border: 1px solid #cbd5e1; padding: 8px 12px; text-align: left; vertical-align: top; }
.theory th { background: #f1f5f9; }
.theory mark { background: #fef08a; padding: 0 3px; border-radius: 3px; }
.theory img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.theory code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; }
.theory hr { border: none; border-top: 1px solid #e2e8f0; margin: 1.4em 0; }

/* курсы у ученика и у учителя */
.course-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 30px; }
.course-card { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; text-decoration: none; color: inherit; box-shadow: 0 1px 3px rgba(15,23,42,.05); transition: transform .12s, box-shadow .12s; }
.course-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,23,42,.1); }
.course-card-title { font-weight: 700; font-size: 1.05rem; }
.course-card-meta { color: #64748b; font-size: .88rem; }
.course-card-btn { align-self: flex-start; margin-top: 4px; }
.progress-bar { display: block; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 4px 0; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #667eea, #22c55e); border-radius: 999px; }
.course-progress { display: flex; flex-direction: column; gap: 4px; max-width: 520px; margin-bottom: 18px; }
.course-description { color: #475569; max-width: 700px; }
.lesson-cards { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.lesson-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid #e2e8f0; background: #fff; text-decoration: none; color: inherit; }
a.lesson-card:hover { border-color: #667eea; background: #f5f7ff; }
.lesson-card.lesson-done { border-color: #bbf7d0; background: #f0fdf4; }
.lesson-card.lesson-current { border-color: #667eea; box-shadow: 0 0 0 2px #e0e7ff; }
.lesson-card.lesson-locked { opacity: .55; background: #f8fafc; cursor: not-allowed; }
.lesson-icon { font-size: 22px; width: 30px; text-align: center; }
.lesson-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.lesson-info small { color: #64748b; }
.lesson-status { font-size: .85rem; color: #475569; text-align: right; }
.lesson-steps { color: #64748b; margin-bottom: 10px; }
.lesson-done-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; background: #dcfce7; border: 1px solid #86efac; border-radius: 12px; padding: 14px 18px; margin-bottom: 18px; font-weight: 600; }
.side-test { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.side-test-title { font-weight: 600; margin-bottom: 6px; }
.side-test-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .85rem; margin-bottom: 8px; }
.side-test-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.teacher-course-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.teacher-course-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.teacher-course-actions { display: flex; gap: 12px; align-items: center; }
.teacher-lesson-list { list-style: none; padding: 0; margin: 10px 0 0; }
.lesson-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid #f1f5f9; }
.lesson-row.lesson-locked { color: #94a3b8; }
.lesson-row.lesson-done { color: #166534; }

/* ===== Конструктор теста: сворачивание и навигатор ===== */
.test-builder { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 20px; align-items: start; }
.test-builder .test-form { max-width: none; }
.q-nav { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.q-nav h4 { margin: 0 0 8px; }
.q-nav ol { list-style: none; margin: 0; padding: 0; }
.nav-item { width: 100%; text-align: left; background: none; border: none; border-radius: 8px; padding: 6px 8px; cursor: pointer; font-size: .85rem; line-height: 1.3; color: #334155; }
.nav-item:hover { background: #eef2ff; }
.nav-error { color: #b91c1c; }
.nav-warn { color: #92400e; }
.q-nav-hint { color: #64748b; font-size: .8rem; line-height: 1.5; margin: 10px 0 0; }
@media (max-width: 1100px) {
    .test-builder { grid-template-columns: 1fr; }
    .q-nav { display: none; }
}
.q-summary { display: none; flex: 1; min-width: 0; color: #475569; font-size: .92rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-collapsed > .q-head > .q-summary { display: block; }
.q-collapsed > .q-head > .qtype { display: none; }
.q-collapsed > .fields { display: none; }
.q-collapsed { padding-top: 10px; padding-bottom: 10px; }
.q-collapsed > .q-head { margin-bottom: 0; }
.ai-filled { background: #fffbeb !important; border-color: #fbbf24 !important; }
