/* ============================================================
   КИМУС.Медвежонок — фирменный стиль
   Светлый фон, белые карточки, фиолетовый акцент (ТЗ п.45)
   ============================================================ */

:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #ede9fe;
    --bg: #f6f5fb;
    --card: #ffffff;
    --text: #1e1b2e;
    --muted: #6b7280;
    --border: #e7e5f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(30, 27, 46, 0.06), 0 8px 24px rgba(30, 27, 46, 0.05);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
}

a { color: var(--primary); }
h1 { font-size: 26px; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 28px 0 14px; }
h3 { font-size: 16px; margin: 0 0 12px; }
p { margin: 8px 0; }
code { background: var(--primary-light); padding: 2px 6px; border-radius: 6px; font-size: 13px; }

.muted { color: var(--muted); font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; }

/* ---------- Каркас: топбар ---------- */
.with-topnav {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 28px 60px;
    min-height: 100vh;
}
main:not(.with-topnav) { padding: 0 20px 60px; }

/* Стеклянная липкая шапка */
.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 28px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 20px rgba(15, 23, 42, 0.06);
}
.tn-logo {
    display: flex; align-items: center; gap: 10px;
    text-decoration: none; color: var(--text);
    font-weight: 700; font-size: 15.5px;
    white-space: nowrap;
}
.tn-logo b { color: var(--primary); }
.logo-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff; font-weight: 800; font-size: 16px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}
.logo-badge.lg { width: 42px; height: 42px; font-size: 20px; }
.logo-text b { color: var(--primary); }

/* Горизонтальная навигация */
.tn-nav {
    display: flex; align-items: center; gap: 2px;
    flex: 1; min-width: 0;
}
.tn-nav > a, .tn-drop-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 13px; border-radius: 10px;
    color: var(--text-secondary); text-decoration: none;
    font-size: 13.5px; font-weight: 600;
    background: none; border: none; cursor: pointer;
    font-family: inherit;
    transition: background .18s, color .18s;
    white-space: nowrap;
}
.tn-nav > a svg, .tn-drop-btn svg { width: 16px; height: 16px; opacity: .75; }
.tn-nav > a:hover, .tn-drop-btn:hover { background: var(--primary-light); color: var(--primary); }
.tn-nav > a.active, .tn-drop-btn.active {
    background: linear-gradient(135deg, var(--primary), #9333ea);
    color: #fff;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}
.tn-nav > a.active svg, .tn-drop-btn.active svg { opacity: 1; }

/* Дропдауны */
.tn-dropdown { position: relative; }
.tn-drop-btn .chevron-ic, .tn-drop-btn svg:last-child { width: 13px; height: 13px; opacity: .5; }
.tn-drop-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.14);
    padding: 8px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity .18s, transform .18s;
}
.tn-drop-menu.open { opacity: 1; transform: translateY(0); pointer-events: auto; }
.tn-drop-right { left: auto; right: 0; }
.tn-drop-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 9px;
    color: var(--text); text-decoration: none;
    font-size: 13.5px; font-weight: 500;
}
.tn-drop-menu a svg { width: 16px; height: 16px; color: var(--muted); }
.tn-drop-menu a:hover { background: var(--primary-light); color: var(--primary); }
.tn-drop-menu a:hover svg { color: var(--primary); }
.tn-drop-menu a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.tn-logout { color: #dc2626 !important; }
.tn-logout svg { color: #dc2626 !important; }
.tn-user-info {
    padding: 9px 12px 11px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.tn-user-info b { display: block; font-size: 14px; }
.tn-user-info span { font-size: 12px; color: var(--muted); }

/* Правая часть шапки */
.tn-right { display: flex; align-items: center; gap: 10px; }
.tn-user { position: relative; }
.tn-user-btn {
    display: flex; align-items: center; gap: 9px;
    background: none; border: none; cursor: pointer;
    padding: 4px 8px; border-radius: 12px;
    font-family: inherit;
    transition: background .18s;
}
.tn-user-btn:hover { background: var(--primary-light); }
.topbar-name { font-size: 14px; font-weight: 600; color: var(--text); }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff; font-weight: 700; font-size: 14px;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
}
.burger { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 6px; border-radius: 8px; }
.burger:hover { background: var(--primary-light); }

/* Мобильная панель навигации */
.tn-mobile {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(4px);
    z-index: 200;
    padding: 76px 16px 30px;
    overflow-y: auto;
}
.tn-mobile.open { display: block; }
.tn-mobile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 76px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.tn-mobile > .nav-label { position: relative; }
.tn-mobile > a {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px;
    color: var(--text); text-decoration: none; font-size: 15px; font-weight: 500;
    background: #fff; margin-bottom: 6px;
    box-shadow: var(--shadow-sm);
}
.tn-mobile > a svg { width: 18px; height: 18px; color: var(--muted); }
.tn-mobile > a.active { background: linear-gradient(135deg, var(--primary), #9333ea); color: #fff; }
.tn-mobile > a.active svg { color: #fff; }

.nav-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); margin: 14px 6px 8px;
    font-weight: 700;
}

/* Заголовок страницы под шапкой */
.topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 0 0 14px;
}
.topbar h1 { margin: 0; font-size: 24px; flex: 1; font-weight: 800; }
.topbar-user { display: flex; align-items: center; gap: 10px; }

/* ---------- Карточки ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 14px;
}
.card.empty { color: var(--muted); text-align: center; padding: 36px; }
.card-list { display: flex; flex-direction: column; gap: 10px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
}
.stat { text-align: center; padding: 18px 12px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-cap { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.exam-row {
    display: flex; align-items: center; gap: 18px;
    text-decoration: none; color: var(--text);
    flex-wrap: wrap;
}
.exam-row > div:first-child { flex: 1; min-width: 220px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }

/* ---------- Бейджи ---------- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
    background: var(--primary-light); color: var(--primary-dark);
    white-space: nowrap;
}
.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-planned { background: #dbeafe; color: #1d4ed8; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-checking { background: #fef3c7; color: #b45309; }
.badge-finished { background: #e0e7ff; color: #4338ca; }
.badge-published, .badge-graded { background: #dcfce7; color: #15803d; }
.badge-in_progress { background: #dbeafe; color: #1d4ed8; }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; border-radius: 10px;
    border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: 14px;
    cursor: pointer; text-decoration: none;
    transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-block { width: 100%; margin-bottom: 10px; }
.btn-lg { padding: 13px 30px; font-size: 16px; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Формы ---------- */
label { display: block; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
input, select, textarea {
    display: block; width: 100%;
    margin-top: 5px; padding: 10px 12px;
    border: 1px solid var(--border); border-radius: 10px;
    font: inherit; font-size: 14px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12);
}
textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.form-actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.form-card { max-width: 860px; }
.form-card h2 { margin-top: 18px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: auto; margin: 0; }
.check.big { font-size: 15px; margin: 18px 0; }
.inline-form { display: flex; gap: 6px; margin-top: 12px; }
.inline-form input { margin-top: 0; }
.student-picker { max-height: 240px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.student-picker .check { padding: 4px 6px; }

.pw-meter { height: 5px; background: var(--border); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.pw-meter div { height: 100%; width: 0; transition: width 0.2s; }
.pw-meter .weak { background: #ef4444; }
.pw-meter .medium { background: #f59e0b; }
.pw-meter .good { background: #84cc16; }
.pw-meter .strong { background: var(--success); }

/* ---------- Алерты ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-info { background: #e0e7ff; color: #3730a3; }

/* ---------- Авторизация ---------- */
.auth-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.auth-card {
    width: 100%; max-width: 420px;
    background: #fff; border: 1px solid var(--border);
    border-radius: 20px; box-shadow: var(--shadow);
    padding: 34px 30px;
}
.auth-card h1 { font-size: 22px; }
.auth-logo {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 17px; text-decoration: none; color: var(--text);
    margin-bottom: 18px;
}
.auth-logo b { color: var(--primary); }
.auth-sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.auth-links { text-align: center; margin: 10px 0; font-size: 13.5px; }
.auth-bottom { text-align: center; margin-top: 16px; font-size: 14px; }
.divider {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted); font-size: 12px; margin: 16px 0;
    text-transform: uppercase; letter-spacing: 0.08em;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.ya {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fc3f1d; color: #fff; font-size: 12px; font-weight: 800;
}

/* ---------- Публичная главная ---------- */
.public-nav {
    display: flex; align-items: center; gap: 26px;
    max-width: 1120px; margin: 0 auto; padding: 18px 24px;
}
.public-nav .links { display: flex; gap: 22px; flex: 1; justify-content: center; }
.public-nav .links a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 14.5px; }
.public-nav .links a:hover { color: var(--primary); }
.public-nav .actions { display: flex; gap: 10px; }

.hero {
    max-width: 1120px; margin: 40px auto 20px; padding: 0 24px;
    display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 40px; align-items: center;
}
.hero h1 { font-size: 44px; line-height: 1.15; letter-spacing: -0.02em; }
.hero h1 em { color: var(--primary); font-style: normal; }
.hero .sub { font-size: 17px; color: var(--muted); margin: 18px 0 26px; max-width: 480px; }
.hero-actions { display: flex; gap: 12px; }

.hero-visual {
    background: #fff; border: 1px solid var(--border); border-radius: 20px;
    box-shadow: 0 20px 60px rgba(124, 58, 237, 0.12);
    padding: 22px; transform: rotate(1.5deg);
}
.hv-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.hv-timer {
    background: var(--primary); color: #fff; padding: 6px 14px;
    border-radius: 10px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.hv-task { background: var(--bg); border-radius: 12px; padding: 14px; margin-bottom: 10px; font-size: 13.5px; }
.hv-opt {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 7px 10px; margin-bottom: 6px; font-size: 13px;
}
.hv-opt.sel { border-color: var(--primary); background: var(--primary-light); }
.hv-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); }
.hv-opt.sel .hv-dot { border-color: var(--primary); background: var(--primary); }
.hv-stats { display: flex; gap: 10px; margin-top: 12px; }
.hv-stat { flex: 1; text-align: center; background: var(--bg); border-radius: 10px; padding: 10px 6px; }
.hv-stat b { display: block; color: var(--primary); font-size: 18px; }
.hv-stat span { font-size: 11px; color: var(--muted); }

.features {
    max-width: 1120px; margin: 60px auto; padding: 0 24px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px;
}
.feature {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}
.feature .icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-light); font-size: 21px; margin-bottom: 14px;
}
.feature b { display: block; margin-bottom: 6px; font-size: 16px; }
.feature p { color: var(--muted); font-size: 14px; margin: 0; }

.section-title { text-align: center; font-size: 30px; margin: 70px 0 8px; }
.section-sub { text-align: center; color: var(--muted); margin-bottom: 30px; }

/* ---------- Секция «Что это» ---------- */
.about-block {
    max-width: 1120px; margin: 70px auto 0; padding: 0 24px;
}
.about-inner {
    background: linear-gradient(135deg, #ffffff 0%, #f3efff 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 48px 44px;
    box-shadow: var(--shadow);
}
.about-inner h2 {
    text-align: center; font-size: 30px; margin: 0 0 18px;
}
.about-lead {
    max-width: 760px; margin: 0 auto 34px;
    text-align: center; font-size: 17px; line-height: 1.7; color: var(--text);
}
.about-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px;
}
.about-item {
    display: flex; gap: 14px; align-items: flex-start;
    background: #ffffff; border: 1px solid var(--border);
    border-radius: 16px; padding: 18px;
}
.about-item .icon {
    flex-shrink: 0;
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--primary-light); font-size: 20px;
}
.about-item b { display: block; margin-bottom: 4px; font-size: 14.5px; }
.about-item p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }

@media (max-width: 700px) {
    .about-inner { padding: 30px 20px; }
    .about-inner h2 { font-size: 24px; }
    .about-lead { font-size: 15px; }
}

.steps {
    max-width: 900px; margin: 0 auto; padding: 0 24px;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px;
}
.step { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.step .num {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary); color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}

.public-footer {
    margin-top: 80px; padding: 30px 24px;
    border-top: 1px solid var(--border);
    text-align: center; color: var(--muted); font-size: 13.5px;
}

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; }
    .hero h1 { font-size: 32px; }
    .hero-visual { display: none; }
    .public-nav .links { display: none; }
}

/* ---------- Приветственный баннер ---------- */
.welcome-banner {
    display: flex; justify-content: space-between; align-items: center; gap: 18px; flex-wrap: wrap;
    background: linear-gradient(120deg, var(--primary) 0%, #9333ea 60%, #6366f1 100%);
    border-radius: var(--radius); padding: 26px 28px; margin-bottom: 22px;
    color: #fff; box-shadow: 0 12px 32px rgba(124,58,237,0.25);
}
.welcome-banner h2 { margin: 0 0 4px; font-size: 22px; }
.welcome-banner .muted { color: rgba(255,255,255,0.85); margin: 0; }
.welcome-banner .muted b { color: #fff; }
.wb-stats { display: flex; gap: 26px; }
.wb-stat { text-align: center; }
.wb-stat b { display: block; font-size: 26px; font-weight: 800; }
.wb-stat span { font-size: 12px; color: rgba(255,255,255,0.8); }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; padding: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }
.data-table code { background: var(--bg); padding: 2px 8px; border-radius: 6px; font-size: 13px; }
.card-head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.mini-bar { display: inline-block; width: 90px; height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 8px; }
.mini-bar > div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; }

/* ---------- Чип роли в сайдбаре ---------- */
.role-chip {
    margin: 0 16px 10px; padding: 6px 12px;
    border-radius: 999px; font-size: 12px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 6px;
}
.role-chip.student { background: #dbeafe; color: #1d4ed8; }
.role-chip.teacher { background: #ede9fe; color: #6d28d9; }
.role-chip.org { background: #fef3c7; color: #92400e; }
.role-chip.sys { background: #dcfce7; color: #15803d; }

/* Цветовое кодирование ролей: акцент сайдбара */
body.role-org_admin .logo-badge { background: linear-gradient(135deg, #d97706, #b45309); }
body.role-teacher .logo-badge { background: linear-gradient(135deg, var(--primary), #7c3aed); }
body.role-student .logo-badge { background: linear-gradient(135deg, #2563eb, #1d4ed8); }

/* ---------- Выбор роли при регистрации ---------- */
.role-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 18px 0; }
.role-card {
    display: flex; flex-direction: column; gap: 4px;
    padding: 18px; border: 2px solid var(--border); border-radius: 14px;
    text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.role-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(124,58,237,0.12); }
.role-card b { font-size: 15.5px; }
.role-card span { color: var(--muted); font-size: 13px; }
.role-card .rc-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; color: #fff; }
.role-card .rc-icon svg { width: 22px; height: 22px; }
.rc-student .rc-icon { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.rc-student:hover { border-color: #3b82f6; }
.rc-teacher .rc-icon { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.rc-teacher:hover { border-color: #8b5cf6; }
.rc-director .rc-icon { background: linear-gradient(135deg, #f59e0b, #b45309); }
.rc-director:hover { border-color: #f59e0b; }
.role-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.15); }
.role-card input[type="radio"] { display: none; }
@media (min-width: 560px) { .role-cards { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Формы приглашений / импорт ---------- */
.invite-form label { display: block; margin-bottom: 12px; font-weight: 600; font-size: 13.5px; }
.invite-form input, .invite-form select {
    display: block; width: 100%; margin-top: 5px;
    padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 10px;
    font: inherit; font-weight: 400;
}
.invite-form input:focus, .invite-form select:focus { border-color: var(--primary); outline: none; }
.invite-form .btn { margin-top: 6px; }
.org-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.import-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.import-role {
    display: flex; flex-direction: column; gap: 3px;
    padding: 16px; border: 2px solid var(--border); border-radius: 14px;
    text-decoration: none; transition: border-color .15s;
}
.import-role:hover, .import-role.sel { border-color: var(--primary); }
.import-role b { font-size: 15px; }
.import-role span { color: var(--muted); font-size: 12.5px; }
.import-role .ir-icon { width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.import-role .ir-icon svg { width: 20px; height: 20px; }

/* ---------- Профиль в настройках ---------- */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.profile-item {
    background: var(--bg);
    border-radius: 12px;
    padding: 12px 16px;
}
.pi-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 4px;
}
.pi-value { font-size: 14.5px; font-weight: 600; }

/* ---------- Модальные окна импорта (как в журнале) ---------- */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    z-index: 300;
    align-items: flex-start; justify-content: center;
    padding: 60px 16px 30px;
    overflow-y: auto;
}
.modal-overlay.active { display: flex; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff;
    border-radius: 18px;
    width: 100%; max-width: 480px;
    box-shadow: 0 25px 80px rgba(15, 23, 42, 0.35);
    animation: modalUp .22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.modal.modal-wide { max-width: 760px; }
@keyframes modalUp { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-x {
    background: none; border: none; cursor: pointer;
    font-size: 26px; line-height: 1; color: var(--muted);
    padding: 2px 8px; border-radius: 8px;
}
.modal-x:hover { background: var(--primary-light); color: var(--primary); }
.modal-body { padding: 18px 22px; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--border);
}

/* Шаги импорта */
.imp-steps { display: flex; justify-content: center; gap: 22px; margin-bottom: 18px; flex-wrap: wrap; }
.imp-step { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.imp-num {
    width: 26px; height: 26px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    color: #fff; font-weight: 700; font-size: 13px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
}
.imp-divider { position: relative; text-align: center; margin: 14px 0; color: var(--muted); font-size: 12.5px; }
.imp-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid var(--border); }
.imp-divider span { background: #fff; padding: 0 12px; position: relative; }

/* Dropzone */
.imp-dropzone {
    border: 2px dashed var(--border);
    border-radius: 14px;
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    color: var(--muted);
    transition: border-color .18s, background .18s;
}
.imp-dropzone svg { width: 32px; height: 32px; margin-bottom: 8px; opacity: .6; }
.imp-dropzone p { margin: 4px 0; font-size: 14px; font-weight: 500; }
.imp-dropzone:hover, .imp-dropzone.drag { border-color: var(--primary); background: rgba(124, 58, 237, 0.04); }
.imp-filename { color: var(--primary); font-weight: 600; }

/* Сводка и таблица предпросмотра */
.imp-summary {
    background: var(--bg);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    margin-bottom: 12px;
}
.imp-table-wrap { max-height: 380px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; }

/* ---------- Тулбар, фильтры, табы ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.filters input, .filters select { width: auto; margin: 0; min-width: 140px; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin: 18px 0; flex-wrap: wrap; }
.tab {
    padding: 9px 18px; text-decoration: none; color: var(--muted);
    font-weight: 600; font-size: 14px; border-radius: 10px 10px 0 0;
    border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- Редактор КИМа ---------- */
.kim-editor { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.kim-structure { position: sticky; top: 14px; }
.struct-section { font-weight: 700; margin: 12px 0 6px; font-size: 13.5px; }
.struct-task {
    display: block; padding: 7px 10px; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: 13px;
    margin-bottom: 2px;
}
.struct-task:hover { background: var(--primary-light); }
.struct-task.active { background: var(--primary); color: #fff; }
.task-card .opts { margin: 8px 0; padding-left: 22px; }
.task-img { max-width: 100%; border-radius: 10px; margin: 10px 0; }

/* ---------- Проверка ---------- */
.review-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.student-answer {
    background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; margin: 10px 0; white-space: pre-wrap;
}
.correct-answer { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.comment-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.criteria-box { background: var(--bg); border-radius: 10px; padding: 10px 14px; font-weight: 400; white-space: pre-wrap; }

/* ---------- Экзамен ---------- */
.exam-shell { position: fixed; inset: 0; background: var(--bg); z-index: 200; display: flex; flex-direction: column; }
.exam-topbar {
    display: flex; align-items: center; gap: 18px;
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 12px 22px; flex-wrap: wrap;
}
.exam-brand { font-weight: 800; font-size: 17px; }
.exam-brand b { color: var(--primary); }
.exam-name { color: var(--muted); font-size: 14px; flex: 1; min-width: 120px; }
.exam-center { font-weight: 600; font-size: 14px; }
.exam-timer {
    font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums;
    background: var(--primary-light); color: var(--primary-dark);
    padding: 6px 16px; border-radius: 10px;
}
.exam-timer.low { background: #fee2e2; color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.save-status { font-size: 12.5px; color: var(--muted); min-width: 150px; }

.exam-body { display: flex; flex: 1; overflow: hidden; }
.exam-nav {
    width: 220px; background: #fff; border-right: 1px solid var(--border);
    padding: 16px; overflow-y: auto;
}
.nav-cap { font-weight: 700; margin-bottom: 12px; font-size: 14px; }
.exam-nav .muted { font-weight: 400; }
.nav-dot {
    width: 38px; height: 38px; margin: 3px;
    border-radius: 10px; border: 1px solid var(--border);
    background: #fff; cursor: pointer; font: inherit; font-weight: 600;
}
.nav-dot.answered { background: var(--primary-light); border-color: var(--primary); color: var(--primary-dark); }
.nav-dot.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.nav-dot.marked { box-shadow: 0 0 0 2px var(--warning) inset; }

.exam-main { flex: 1; margin: 18px 22px; overflow-y: auto; max-width: 900px; }
.task-num { font-size: 15px; margin-bottom: 12px; }
.task-text { font-size: 16.5px; line-height: 1.65; margin-bottom: 18px; }
.answer-input { font-size: 16px; padding: 13px 15px; }
.opt-row {
    display: flex; align-items: center; gap: 12px;
    border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; margin-bottom: 8px; cursor: pointer; font-weight: 400;
}
.opt-row:hover { border-color: var(--primary); }
.opt-row input { width: auto; margin: 0; }
.match-row { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.match-row span { flex: 1; background: var(--bg); border-radius: 8px; padding: 9px 12px; }
.match-row input { width: 130px; margin: 0; }
.exam-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.exam-loading { padding: 60px; text-align: center; color: var(--muted); }

.finish-screen { max-width: 520px; margin: 80px auto; text-align: center; padding: 40px; }
.finish-icon { font-size: 52px; margin-bottom: 12px; }

/* ---------- Модалка ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(30, 27, 46, 0.5);
    display: flex; align-items: center; justify-content: center; z-index: 300;
    padding: 20px;
}
.modal-card { background: #fff; border-radius: 16px; padding: 26px; max-width: 480px; width: 100%; box-shadow: var(--shadow); }

/* ---------- Результаты ---------- */
.result-hero { text-align: center; padding: 34px; }
.result-big { font-size: 64px; font-weight: 800; color: var(--primary); line-height: 1.1; }
.result-meta { color: var(--muted); margin-top: 12px; font-size: 14px; }
.intro-card { max-width: 760px; margin: 0 auto; }
.intro-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 18px 0; }
.rules { padding-left: 20px; }
.rules li { margin-bottom: 8px; }
.rules .warn { color: var(--warning); }

/* ---------- Гистограммы ---------- */
.histogram { display: flex; gap: 10px; align-items: flex-end; height: 180px; padding: 10px 0; }
.histo-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.histo-bar { background: linear-gradient(180deg, var(--primary), #a78bfa); border-radius: 8px 8px 0 0; min-height: 3px; }
.histo-label { font-size: 11px; color: var(--muted); margin-top: 6px; }
.meter { height: 10px; background: var(--border); border-radius: 6px; overflow: hidden; }
.meter div { height: 100%; background: var(--primary); }
.meter div.bad { background: var(--danger); }
.meter div.good { background: var(--success); }

.sparkline { display: flex; gap: 6px; align-items: flex-end; height: 160px; padding: 10px 0; overflow-x: auto; }
.spark-col { flex: 1; min-width: 36px; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; text-align: center; }
.spark-bar { background: linear-gradient(180deg, var(--primary), #a78bfa); border-radius: 6px 6px 0 0; min-height: 3px; }
.spark-label { font-size: 10px; color: var(--muted); margin-top: 4px; }

/* ---------- Интеграции ---------- */
.provider-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.provider-row:last-of-type { border-bottom: none; }

/* ---------- Адаптивность (ТЗ п.47) ---------- */
@media (max-width: 1180px) {
    /* Скрываем горизонтальную навигацию — переходим на мобильную панель */
    .tn-nav { display: none; }
    .tn-right .role-chip { display: none; }
    .burger { display: block; }
    .topnav { padding: 10px 16px; }
    .tn-mobile { display: none; }
    .tn-mobile.open { display: block; }
}
@media (max-width: 860px) {
    .with-topnav { padding: 18px 14px 40px; }
    .topbar-name { display: none; }
    .tn-logo .logo-text { display: none; }

    .kim-editor { grid-template-columns: 1fr; }
    .kim-structure { position: static; }
    .exam-nav { position: fixed; left: 0; top: 61px; bottom: 0; transform: translateX(-100%); transition: transform 0.2s; z-index: 210; }
    .exam-nav.open { transform: translateX(0); }
    .exam-body { position: relative; }
    .exam-main { margin: 12px; }
    .save-status { display: none; }
}
