/* ============================================
   ExamTest — Система тестирования ГИП
   Стиль по образцу aisok.ru
   ============================================ */

:root {
    --color-primary: #e91e63;
    --color-primary-dark: #c2185b;
    --color-primary-light: #f8bbd0;
    --color-navy: #1a237e;
    --color-navy-light: #283593;
    --color-bg: #f0f2f5;
    --color-white: #ffffff;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-border: #e0e0e0;
    --color-success: #4caf50;
    --color-error: #f44336;
    --color-warning: #ff9800;
    --color-gray: #999999;
    --shadow-card: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;
}

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

body.exam-body {
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   Header
   ============================================ */

.exam-header {
    background: var(--color-navy);
    color: var(--color-white);
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.exam-header__logo {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.exam-header__logo svg { width: 28px; height: 28px; }

.exam-header__logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--color-white);
    text-decoration: none;
    transition: opacity 0.2s;
}

.exam-header__logo-link:hover {
    opacity: 0.8;
}

.exam-header__settings {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-white);
    text-decoration: none;
    transition: background 0.2s;
}

.exam-header__settings:hover {
    background: rgba(255,255,255,0.2);
}

.exam-header__back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--color-white);
    text-decoration: none;
    transition: background 0.2s;
}
.exam-header__back:hover {
    background: rgba(255,255,255,0.2);
}

.exam-header__user {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.exam-header__username {
    opacity: 0.9;
}

.exam-header__logout {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: var(--color-white);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.exam-header__logout:hover {
    background: rgba(255,255,255,0.25);
}

/* ============================================
   Login Page
   ============================================ */

.exam-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
    padding: 20px;
}

.exam-login__card {
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
}

.exam-login__title {
    text-align: center;
    margin-bottom: 8px;
    font-size: 22px;
    font-weight: 700;
    color: var(--color-navy);
}

.exam-login__subtitle {
    text-align: center;
    color: var(--color-text-light);
    font-size: 14px;
    margin-bottom: 32px;
}

.exam-login__form .form-group {
    margin-bottom: 20px;
}

.exam-login__form label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-light);
    margin-bottom: 6px;
}

.exam-login__form input[type="text"],
.exam-login__form input[type="password"] {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: none;
    border-bottom: 2px solid var(--color-border);
    font-size: 16px;
    font-family: var(--font);
    background: transparent;
    transition: border-color 0.2s;
    outline: none;
}

.exam-login__form input:focus {
    border-bottom-color: var(--color-primary);
}

.exam-login__error {
    display: none;
    background: #fde8e8;
    color: var(--color-error);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
}

.exam-login__error.visible { display: block; }

.exam-login__submit {
    width: 100%;
    height: 48px;
    background: var(--color-primary);
    color: var(--color-white);
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
}

.exam-login__submit:hover {
    background: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(233,30,99,0.3);
}

.exam-login__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================
   Dashboard
   ============================================ */

.exam-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.exam-dashboard__welcome {
    margin-bottom: 32px;
}

.exam-dashboard__welcome h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 4px;
}

.exam-dashboard__welcome p {
    color: var(--color-text-light);
    font-size: 15px;
}

/* Block cards */
.exam-blocks {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

.exam-block-card {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.exam-block-card:hover {
    box-shadow: var(--shadow-hover);
}

.exam-block-card__header {
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
    color: var(--color-white);
    padding: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    user-select: none;
}

.exam-block-card__title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.exam-block-card__desc {
    font-size: 14px;
    opacity: 0.85;
}

.exam-block-card__chevron {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    opacity: 0.7;
}
.exam-block-card__header:hover .exam-block-card__chevron { opacity: 1; }
.exam-block-card.collapsed .exam-block-card__chevron { transform: rotate(-90deg); }
.exam-block-card__body {
    padding: 24px;
    transition: max-height 0.35s ease, padding 0.35s ease, opacity 0.25s ease;
    overflow: hidden;
}
.exam-block-card.collapsed .exam-block-card__body {
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

.exam-block-card__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.exam-block-card__sections {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.exam-block-card__sections.expanded {
    max-height: 1200px;
    overflow-y: auto;
}

.exam-section-list {
    list-style: none;
    margin: 12px 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.exam-section-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
}

.exam-section-item:last-child { border-bottom: none; }

.exam-section-item__name { flex: 1; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    text-decoration: none;
    gap: 8px;
}

.btn--primary {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.btn--primary:hover {
    background: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
    box-shadow: 0 4px 12px rgba(233,30,99,0.3);
}

.btn--outline {
    background: transparent;
    color: var(--color-navy);
    border-color: var(--color-navy);
}

.btn--outline:hover {
    background: var(--color-navy);
    color: var(--color-white);
}

.btn--outline-gray {
    background: transparent;
    color: var(--color-text-light);
    border-color: var(--color-border);
}

.btn--outline-gray:hover {
    background: var(--color-bg);
    border-color: var(--color-gray);
}

.btn--danger-outline {
    background: transparent;
    color: #c62828;
    border-color: #e57373;
}

.btn--danger-outline:hover {
    background: #fde8e8;
    border-color: #c62828;
}

.user-actions {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-check,
.check-all {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-navy);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-border);
    background: var(--color-white);
    color: var(--color-text-light);
    cursor: pointer;
    transition: all 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.btn-icon:hover {
    border-color: var(--color-navy);
    color: var(--color-navy);
    background: #f0f4ff;
}

.btn-icon--warn:hover {
    border-color: #f57c00;
    color: #f57c00;
    background: #fff3e0;
}

.btn-icon--success {
    border-color: #2e7d32;
    color: #2e7d32;
}

.btn-icon--success:hover {
    background: #e8f5e9;
}

.btn-icon--danger:hover {
    border-color: #c62828;
    color: #c62828;
    background: #fde8e8;
}

.btn-icon--sm {
    width: 28px;
    height: 28px;
}

.btn--sm {
    height: 36px;
    padding: 0 16px;
    font-size: 13px;
}

.btn--danger {
    background: var(--color-error);
    color: var(--color-white);
    border-color: var(--color-error);
}

.btn--success {
    background: var(--color-success);
    color: var(--color-white);
    border-color: var(--color-success);
}

.btn--block { width: 100%; box-sizing: border-box; }

/* History table */
.exam-history__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.exam-history__header h2 {
    margin: 0;
}

.exam-history {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-bottom: 40px;
}

.exam-history h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 16px;
}

.history-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--color-border);
}

.history-tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-gray);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.history-tab:hover { color: var(--color-navy); }

.history-tab.active {
    color: var(--color-navy);
    border-bottom-color: var(--color-navy);
}

.history-panel { display: none; }
.history-panel.active { display: block; }

.history-more {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 0 8px;
}
.history-more__count {
    font-size: 13px;
    color: var(--color-gray);
}

.history-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 15px;
    color: var(--color-navy);
}

.exam-table .btn--sm {
    min-width: 100px;
    text-align: center;
}

.badge {
    display: inline-block;
    white-space: nowrap;
    min-width: 70px;
    text-align: center;
}

.exam-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.exam-table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text-light);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exam-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.exam-table tbody tr:hover {
    background: #f8f9fa;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.badge--passed {
    background: #e8f5e9;
    color: var(--color-success);
}

.badge--failed {
    background: #fde8e8;
    color: var(--color-error);
}

.badge--inprogress {
    background: #fff3e0;
    color: #e65100;
}

.badge--training {
    background: #e8eaf6;
    color: var(--color-navy);
}

.badge--exam {
    background: #fce4ec;
    color: var(--color-primary);
}

/* ============================================
   Test Page
   ============================================ */

.exam-test {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px;
}

/* Top bar */
.exam-test__topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.exam-test__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-navy);
}

.exam-test__subtitle {
    font-size: 13px;
    color: var(--color-gray);
    margin-top: 2px;
}

.exam-test__timer {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--color-navy);
    background: var(--color-white);
    padding: 8px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    min-width: 160px;
    text-align: center;
}

.exam-test__timer.timer-warning {
    color: var(--color-warning);
}

.exam-test__timer.timer-critical {
    color: var(--color-error);
    animation: timerBlink 1s ease-in-out infinite;
}

@keyframes timerBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Question navigation grid */
.exam-test__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.qnav-badge {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
    border: 2px solid transparent;
}

.qnav-badge:hover {
    transform: scale(1.1);
}

.qnav-badge--unanswered {
    background: #bdbdbd;
    color: #555;
}

.qnav-badge--viewed {
    background: #fff;
    color: var(--color-text);
    border: 2px solid var(--color-navy);
}

.qnav-badge--current {
    box-shadow: 0 0 0 3px var(--color-navy);
    transform: scale(1.15);
    z-index: 2;
}

.qnav-badge--answered {
    background: var(--color-navy);
    color: var(--color-white);
}

.qnav-badge--correct {
    background: #2e7d32;
    color: var(--color-white);
}

.qnav-badge--incorrect {
    background: #c62828;
    color: var(--color-white);
}

.qnav-badge--skipped {
    background: #fff;
    color: var(--color-navy);
    border: 2px solid var(--color-navy);
}

.qnav-section-header {
    width: 100%;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-navy);
    padding: 6px 4px 2px;
    border-top: 1px solid var(--color-border);
    margin-top: 4px;
}

.qnav-section-header:first-child {
    border-top: none;
    margin-top: 0;
}

.qnav-badge--flagged::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: var(--color-warning);
    border-radius: 50%;
}

/* Question card */
.exam-test__question {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 32px;
    margin-bottom: 24px;
    min-height: 300px;
}

.question__text {
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 8px;
    color: var(--color-text);
}

.question__hint {
    font-size: 14px;
    color: var(--color-primary);
    margin-bottom: 24px;
    font-style: italic;
}

.question__image {
    margin: 16px 0;
    max-width: 100%;
    border-radius: var(--radius-sm);
}

/* Single / Multiple choice options */
.option-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    line-height: 1.5;
}

.option-item:hover {
    border-color: var(--color-navy-light);
    background: #f8f9ff;
}

.option-item.selected {
    border-color: var(--color-navy);
    background: #e8f0fe;
}

.option-item input[type="radio"],
.option-item input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--color-primary);
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.option-item__text { flex: 1; }

/* Text input question */
.question-text-input {
    margin-top: 16px;
}

.question-text-input input {
    width: 100%;
    max-width: 500px;
    height: 48px;
    padding: 0 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: var(--font);
    transition: border-color 0.2s;
}

.question-text-input input:focus {
    border-color: var(--color-primary);
    outline: none;
}

.question-text-input__hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--color-gray);
}

/* Matching question */
.matching-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.matching-left-list,
.matching-right-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.matching-left,
.matching-right {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.4;
    min-height: 52px;
    transition: all 0.2s;
}

.matching-left {
    border: 2px solid rgba(0,0,0,0.06);
}

.matching-right {
    border: 2px solid rgba(0,0,0,0.06);
    cursor: grab;
    user-select: none;
}

.matching-right:active { cursor: grabbing; }

.matching-right:hover {
    border-color: var(--color-navy);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.matching-right.sortable-ghost {
    opacity: 0.3;
    border: 2px dashed var(--color-navy);
}

.matching-right.sortable-chosen {
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-color: var(--color-navy);
    z-index: 10;
}

.matching-headers {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.matching-header {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-navy);
    padding: 8px 14px;
    background: rgba(0,0,0,0.03);
    border-radius: var(--radius);
    text-align: center;
}

.mm-groups__title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-navy);
    padding: 6px 0 10px;
}

.matching-badge {
    width: 28px;
    height: 28px;
    background: var(--color-navy);
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.matching-badge--right {
    background: var(--color-primary);
}

/* Ordering question */
.ordering-container {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ordering-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 15px;
    cursor: grab;
    transition: all 0.2s;
}

.ordering-item:active { cursor: grabbing; }

.ordering-item:hover {
    border-color: var(--color-navy-light);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.ordering-item.sortable-ghost {
    opacity: 0.4;
    border-style: dashed;
}

.ordering-item__number {
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    color: var(--color-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.ordering-item__text { flex: 1; }

.ordering-item__handle {
    display: none;
}

/* Bottom action bar */
.exam-test__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.exam-test__actions .btn--finish {
    margin-left: auto;
}

.exam-test__flag {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--color-text-light);
    cursor: pointer;
}

.exam-test__flag input { accent-color: var(--color-warning); }

/* ============================================
   Result Page
   ============================================ */

.exam-result {
    max-width: 960px;
    margin: 60px auto;
    padding: 24px;
}

.exam-result__card {
    background: var(--color-white);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    padding: 48px 40px;
    text-align: center;
}

.exam-result__circle {
    width: 160px;
    height: 160px;
    margin: 0 auto 24px;
    position: relative;
}

.exam-result__circle svg {
    width: 160px;
    height: 160px;
    transform: rotate(-90deg);
}

.exam-result__circle circle {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
}

.exam-result__circle .circle-bg {
    stroke: var(--color-border);
}

.exam-result__circle .circle-fill {
    stroke: var(--color-success);
    stroke-dasharray: 440;
    transition: stroke-dashoffset 1s ease;
}

.exam-result__circle .circle-fill--fail {
    stroke: var(--color-error);
}

.exam-result__percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: 800;
    color: var(--color-navy);
}

.exam-result__score {
    font-size: 18px;
    color: var(--color-text-light);
    margin-bottom: 16px;
}

.exam-result__status {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--color-text);
}
.exam-result__status--passed { color: #2e7d32; }
.exam-result__status--failed { color: #c62828; }

.exam-result__status {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.exam-result__status--passed { color: var(--color-success); }
.exam-result__status--failed { color: var(--color-error); }

.exam-result__time {
    font-size: 14px;
    color: var(--color-gray);
    margin-bottom: 32px;
}

.exam-result__actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.exam-result__review {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin: 24px 0 0;
}

.exam-result__review h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 12px;
}

.exam-result__legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 14px; height: 14px; border-radius: 3px; }
.legend-dot--correct { background: #2e7d32; }
.legend-dot--incorrect { background: #c62828; }
.legend-dot--skipped { background: #e0e0e0; }

.exam-result__question-view {
    background: #f9f9fb;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
}

.review-q__num {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 8px;
}

.review-q__text {
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 12px;
}

.review-q__hint { margin-bottom: 12px; font-weight: 600; font-size: 14px; }
.review-status--correct { color: #2e7d32; }
.review-status--incorrect { color: #c62828; }
.review-status--skipped { color: #999; }

.review-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 14px;
    border: 2px solid transparent;
    background: #fff;
}

.review-option--correct { background: #e8f5e9; border-color: #2e7d32; }
.review-option--incorrect { background: #fde8e8; border-color: #c62828; }
.review-option--missed { background: #fff; border-color: #2e7d32; border-style: dashed; }

.review-option__marker {
    font-weight: 700;
    min-width: 20px;
    font-size: 16px;
}

.review-option--correct .review-option__marker { color: #2e7d32; }
.review-option--incorrect .review-option__marker { color: #c62828; }
.review-option--missed .review-option__marker { color: #2e7d32; }

.review-text-answer { font-size: 14px; padding: 12px; }

.exam-result__details {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
    max-width: 800px;
    margin: 24px auto 0;
}

.exam-result__details h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 16px;
}

.result-answer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 14px;
    border-left: 4px solid transparent;
}

.result-answer-item--correct { background: #e8f5e9; border-left-color: #2e7d32; }
.result-answer-item--incorrect { background: #fde8e8; border-left-color: #c62828; }
.result-answer-item--skipped { background: #f5f5f5; border-left-color: #bdbdbd; }

.result-answer-item__num {
    font-weight: 700;
    min-width: 30px;
    color: var(--color-navy);
}

.result-answer-item__text { flex: 1; }

.result-answer-item__icon {
    font-size: 18px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
}

.result-answer-item--correct .result-answer-item__icon { color: #2e7d32; }
.result-answer-item--incorrect .result-answer-item__icon { color: #c62828; }
.result-answer-item--skipped .result-answer-item__icon { color: #bdbdbd; }

.result-answer-item__status {
    font-size: 12px;
    font-weight: 600;
    min-width: 70px;
    text-align: right;
}

.result-answer-item--correct .result-answer-item__status { color: #2e7d32; }
.result-answer-item--incorrect .result-answer-item__status { color: #c62828; }
.result-answer-item--skipped .result-answer-item__status { color: #999; }

/* ============================================
   Admin Panel
   ============================================ */

.exam-admin {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-top: 40px;
}

.exam-admin h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.exam-admin-settings {
    background: var(--color-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-top: 24px;
}

.exam-admin-settings h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 16px;
}

.settings-block {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.settings-block h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 12px;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.settings-row label {
    min-width: 180px;
    font-size: 14px;
    color: var(--color-text);
}

.settings-row input {
    width: 120px;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.settings-status {
    margin-left: 12px;
    font-size: 13px;
    font-weight: 600;
}

.user-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
}

.user-status-dot--active { background: var(--color-success); }
.user-status-dot--inactive { background: var(--color-gray); }

/* Modal */
.exam-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.exam-modal-overlay.visible {
    display: flex;
}

.exam-modal {
    background: var(--color-white);
    border-radius: 12px;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 48px rgba(0,0,0,0.2);
}

.exam-modal h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 24px;
}

.exam-modal .form-group {
    margin-bottom: 16px;
}

.exam-modal label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-light);
    margin-bottom: 6px;
}

.exam-modal input,
.exam-modal select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: var(--font);
}

.exam-modal input:focus,
.exam-modal select:focus {
    border-color: var(--color-primary);
    outline: none;
}

.exam-modal select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.exam-modal__credentials {
    background: #e8f5e9;
    padding: 16px;
    border-radius: var(--radius);
    margin: 16px 0;
    font-family: var(--font-mono);
}

.exam-modal__credentials p {
    margin-bottom: 6px;
    font-size: 14px;
}

.exam-modal__credentials strong {
    color: var(--color-navy);
}

.exam-modal__actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ============================================
   Toast notification
   ============================================ */

.exam-toast {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 14px 24px;
    border-radius: var(--radius);
    color: var(--color-white);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 2000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.exam-toast.visible { transform: translateX(0); }
.exam-toast--success { background: var(--color-success); }
.exam-toast--error { background: var(--color-error); }
.exam-toast--info { background: var(--color-navy); }

/* ============================================
   Loading spinner
   ============================================ */

.exam-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

.exam-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Responsive
   ============================================ */

/* ============================================
   Question text formatting
   ============================================ */

.question__instruction {
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 16px;
    font-size: 17px;
    line-height: 1.5;
}

.question__body-text {
    font-size: 16px;
    line-height: 1.7;
    color: var(--color-text);
}

.question__blank {
    display: inline-block;
    min-width: 100px;
    background: #f0f4ff;
    border-bottom: 2px dashed #9eafc8;
    color: #9eafc8;
    font-weight: 400;
    padding: 2px 8px;
    margin: 0 3px;
    text-align: center;
    letter-spacing: 1px;
    border-radius: 2px 2px 0 0;
    font-size: 14px;
}

.question__select-hint {
    color: var(--color-gray);
    font-style: italic;
}

.question__hint {
    font-size: 13px;
    color: #e65100;
    margin-top: 8px;
    font-style: italic;
}

/* ============================================
   Settings Page
   ============================================ */

.exam-settings-page {
    max-width: 1100px;
    margin: 100px auto 40px;
    padding: 0 24px;
}

.settings-card {
    background: var(--color-white);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    margin-bottom: 24px;
    overflow: hidden;
}

.settings-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 28px;
    background: var(--color-navy);
    color: var(--color-white);
}

.settings-card__header h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.settings-card__total {
    font-size: 14px;
    opacity: 0.8;
}

.settings-card__body {
    padding: 28px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
.btn--danger {
    background: #e53935;
    color: #fff;
    border: none;
}
.btn--danger:hover {
    background: #c62828;
}
.tree-block__header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border-radius: 8px;
    padding: 10px 12px;
    margin: 0 0 4px;
    background: #f0f2ff;
    border: 1px solid #e0e3f0;
    transition: all 0.2s;
}
.tree-block__header:hover {
    background: #e4e7ff;
    border-color: #c5caf0;
}
.tree-block__header:hover .tree-block__gear {
    opacity: 1;
}
.tree-block__icon {
    flex-shrink: 0;
    color: var(--color-primary);
    opacity: 0.7;
}
.tree-block__total {
    flex-shrink: 0;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    line-height: 18px;
}
.tree-block__gear {
    flex-shrink: 0;
    color: var(--color-gray);
    opacity: 0.3;
    transition: opacity 0.2s;
    margin-left: auto;
}
.tree-add-block {
    display: block;
    width: 100%;
    padding: 10px;
    margin-top: 12px;
    background: none;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-navy);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.tree-add-block:hover {
    border-color: var(--color-navy);
    background: rgba(26, 35, 126, 0.04);
}

.settings-card__fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-field input,
.settings-field select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.settings-field input:focus,
.settings-field select:focus {
    outline: none;
    border-color: var(--color-navy);
}

.settings-field select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-color: #fff;
    padding-right: 36px;
    cursor: pointer;
}

.settings-field-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}
.settings-field-row .settings-field { flex: 1; margin-bottom: 0; }
.settings-field--half { min-width: 0; }

.settings-field__time {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-field__time input {
    flex: 1;
}

.settings-field__hint {
    font-size: 13px;
    color: var(--color-gray);
    white-space: nowrap;
}

.settings-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.settings-msg {
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.3s;
}

.settings-msg--ok {
    color: #2e7d32;
}

.settings-msg--err {
    color: #c62828;
}

.settings-sections {
    border-left: 2px solid var(--color-border);
    padding-left: 28px;
}

.settings-sections h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: 12px;
}

.exam-table--compact {
    font-size: 13px;
}

.exam-table--compact th,
.exam-table--compact td {
    padding: 8px 12px;
}

.btn--block {
    width: 100%;
    padding: 0 14px;
    font-size: 16px;
    box-sizing: border-box;
}

/* Settings Tabs */
.stabs {
    display: flex;
    gap: 4px;
    margin-bottom: 28px;
    border-bottom: 2px solid var(--color-border);
}
.stabs__btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--color-gray);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}
.stabs__btn:hover { color: var(--color-navy); }
.stabs__btn--active {
    color: var(--color-navy);
    border-bottom-color: var(--color-navy);
}
.stab-panel { display: none; }
.stab-panel--active { display: block; }

/* Content Layout (tree + main) */
.content-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    min-height: 500px;
}
.content-sidebar {
    background: var(--color-white);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 16px;
    overflow-y: auto;
    max-height: 75vh;
}
.content-main {
    background: var(--color-white);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 24px;
    overflow-y: auto;
    max-height: 75vh;
}

/* Tree */
.tree-block { margin-bottom: 16px; }
.tree-block__name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-navy);
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tree-block__sections { display: flex; flex-direction: column; gap: 2px; }
.tree-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
}
.tree-section:hover { background: #f0f4ff; }
.tree-section--active {
    background: var(--color-navy);
    color: var(--color-white);
}
.tree-section__name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-section__count {
    font-size: 12px;
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    padding: 2px 6px;
    border-radius: 10px;
    background: rgba(0,0,0,0.08);
    margin-left: 8px;
}
.tree-section--active .tree-section__count { background: rgba(255,255,255,0.2); }
.tree-add-section {
    display: block;
    width: 100%;
    padding: 8px 12px;
    margin-top: 4px;
    border: 2px dashed var(--color-border);
    border-radius: 10px;
    background: none;
    color: var(--color-gray);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}
.tree-add-section:hover { border-color: var(--color-navy); color: var(--color-navy); }

/* Content Header */
.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--color-border);
}
.content-header__left { display: flex; align-items: baseline; gap: 12px; }
.content-header__left h2 { font-size: 20px; font-weight: 700; color: var(--color-navy); margin: 0; }
.content-header__count { font-size: 14px; color: var(--color-gray); }
.content-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.content-search {
    padding: 0 0 12px;
}
.content-search__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.content-search__icon {
    position: absolute;
    left: 12px;
    color: #999;
    pointer-events: none;
}
.content-search__input {
    width: 100%;
    padding: 10px 36px 10px 38px;
    border: 1px solid #dde;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.content-search__input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.08);
}
.content-search__clear {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.content-search__clear:hover {
    background: #f0f0f0;
    color: #333;
}
.qitem__section {
    font-size: 11px;
    color: #fff;
    background: var(--color-primary);
    padding: 1px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
mark {
    background: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
}

.link-editor-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 6px;
}
.link-editor-row__fields {
    flex: 1;
    display: flex;
    gap: 6px;
}
.link-editor-row__fields input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 13px;
}
.link-editor-row__fields input.link-url {
    flex: 1.2;
}
.link-editor-row__fields input.link-raw {
    flex: 1;
}
.link-editor-row__del {
    margin-top: 4px;
}

.block-edit-form {
    background: #f8f9ff;
    border: 1px solid #e0e3f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}
.block-edit-form .settings-field { margin-bottom: 12px; }
.block-edit-form .settings-field label { display: block; font-size: 13px; font-weight: 600; color: var(--color-navy); margin-bottom: 4px; }
.block-edit-form .settings-field input { width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }
.block-edit-form__actions { display: flex; align-items: center; gap: 10px; }

.block-sections-info { margin-top: 20px; }
.block-sections-info h4 { font-size: 16px; font-weight: 600; color: var(--color-navy); margin-bottom: 10px; }
.exam-table--compact { font-size: 14px; }
.exam-table--compact th, .exam-table--compact td { padding: 6px 12px; }

.settings-msg { font-size: 13px; color: #999; }
.settings-msg--ok { color: #4caf50; font-weight: 600; }

.content-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-gray);
    font-size: 15px;
}
.content-placeholder {
    text-align: center;
    padding: 80px 20px;
    color: var(--color-gray);
    font-size: 15px;
}

/* Question Items */
.questions-list { display: flex; flex-direction: column; gap: 4px; }
.qitem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    transition: all 0.15s;
}
.qitem:hover { border-color: var(--color-navy); background: #fafbff; }
.qitem__num {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-gray);
    min-width: 28px;
    text-align: center;
}
.qitem__body { flex: 1; min-width: 0; }
.qitem__text {
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qitem__meta { display: flex; gap: 10px; margin-top: 4px; }
.qitem__type {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    background: #e8f0fe;
    color: var(--color-navy);
}
.qitem__opts { font-size: 12px; color: var(--color-gray); }
.qitem__actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Question Modal */
.exam-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.exam-modal__header h3 { margin: 0; }
.exam-modal__close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--color-gray);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.exam-modal__close:hover { color: var(--color-text); }
.exam-modal__body { margin-bottom: 20px; overflow-y: auto; flex: 1; min-height: 0; }
.exam-modal__body .settings-field { margin-bottom: 14px; }
.exam-modal__footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}
.exam-modal--wide { max-width: 680px; }
.exam-modal--sm { max-width: 420px; }
.exam-modal textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}
.exam-modal textarea:focus { outline: none; border-color: var(--color-navy); }

/* Options Editor */
.opts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    margin-top: 16px;
}
.opts-header label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.choice-row, .match-pair-row, .order-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.choice-row input[type="text"],
.match-pair-row input[type="text"],
.order-item-row input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}
.choice-row input[type="text"]:focus,
.match-pair-row input[type="text"]:focus,
.order-item-row input[type="text"]:focus {
    outline: none;
    border-color: var(--color-navy);
}
.choice-row input[type="radio"],
.choice-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-navy);
    flex-shrink: 0;
}
.match-arrow { color: var(--color-gray); font-size: 16px; flex-shrink: 0; }
.order-num { font-weight: 600; color: var(--color-gray); min-width: 24px; text-align: right; }
.btn-icon--xs { width: 28px; height: 28px; font-size: 16px; border: none; }

/* Quota input in table */
.quota-input {
    width: 70px;
    padding: 6px 10px;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    text-align: center;
}
.quota-input:focus { outline: none; border-color: var(--color-navy); }

/* Training navigation buttons inside question */
.training-nav-btns {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
.btn--show-answer {
    border-color: var(--color-navy);
    color: var(--color-navy);
}
.btn--show-answer:hover {
    background: var(--color-navy);
    color: var(--color-white);
}

/* Question tabs */
.qtabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 20px;
}
.qtab {
    padding: 10px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 15px;
    font-weight: 500;
    color: var(--color-gray);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.qtab:hover { color: var(--color-navy); }
.qtab--active {
    color: var(--color-navy);
    border-bottom-color: var(--color-navy);
}

/* Answer view */
.answer-view { padding: 8px 0; }
.answer-view__status {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 20px;
}
.answer-view__status--correct {
    background: #e8f5e9;
    color: #2e7d32;
}
.answer-view__status--wrong {
    background: #ffeef0;
    color: #c62828;
}
.answer-view__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.answer-view__opt {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--color-border);
    background: var(--color-white);
    font-size: 14px;
    line-height: 1.5;
}
.answer-view__opt--correct {
    border-color: #4caf50;
    background: #e8f5e9;
}
.answer-view__opt--wrong {
    opacity: 0.6;
}
.answer-view__opt-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #4caf50;
}
.answer-view__opt-text { flex: 1; }
.answer-view__text-answer {
    padding: 16px;
    background: #e8f5e9;
    border-radius: var(--radius-sm);
    font-size: 15px;
    margin-bottom: 20px;
    border: 2px solid #4caf50;
}
.answer-view__subtitle {
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 10px;
    font-size: 14px;
}
.answer-view__ordered-list {
    padding-left: 24px;
    font-size: 14px;
    line-height: 1.8;
}
.answer-view__ordered-list li {
    padding: 4px 0;
}
.answer-view__match-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}
.answer-view__match-pair {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.answer-view__match-key { font-weight: 600; flex: 1; }
.answer-view__match-arrow { color: var(--color-navy); font-weight: 700; flex-shrink: 0; }
.answer-view__match-val { flex: 1; color: #2e7d32; font-weight: 500; }
.answer-view__explanation {
    margin-top: 20px;
    padding: 16px;
    background: #f5f5ff;
    border-left: 4px solid var(--color-navy);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.answer-view__explanation-title {
    font-weight: 600;
    color: var(--color-navy);
    margin-bottom: 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.answer-view__explanation-text {
    font-size: 14px;
    line-height: 1.6;
}
.answer-view__explanation-text a {
    color: var(--color-navy);
    text-decoration: underline;
    font-weight: 500;
}
.answer-view__explanation-text a:hover {
    color: var(--color-accent);
}

/* matching_multi (grouping) */
.mm-container { display: flex; flex-direction: column; gap: 16px; }
.mm-groups { display: flex; flex-wrap: wrap; gap: 16px; }
.mm-group {
    flex: 1 1 200px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: #fafbfc;
    min-width: 180px;
}
.mm-group__title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-navy);
    color: var(--color-navy);
}
.mm-group__drop {
    min-height: 40px;
    border: 2px dashed #ccc;
    border-radius: var(--radius-sm);
    padding: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    transition: border-color .2s, background .2s;
}
.mm-group__drop--over {
    border-color: var(--color-navy);
    background: rgba(41, 60, 145, .05);
}
.mm-pool {
    padding: 12px;
    background: #f0f0f0;
    border-radius: var(--radius-sm);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}
.mm-pool__title {
    width: 100%;
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    font-style: italic;
}
.mm-item {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: grab;
    font-size: 13px;
    transition: box-shadow .2s, transform .1s;
    user-select: none;
}
.mm-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.mm-item--dragging { opacity: .5; transform: scale(.95); }

/* matching editor in settings */
.match-pair-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.match-pair-row .match-key,
.match-pair-row .match-val {
    flex: 1;
    min-height: 56px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: vertical;
    font-family: inherit;
}
.match-arrow { color: var(--color-navy); font-weight: 700; padding-top: 16px; flex-shrink: 0; }

.opts-header__btns { display: flex; gap: 6px; }

.distractor-section { margin-top: 16px; border-top: 1px dashed var(--color-border); padding-top: 12px; }
.distractor-label { display: block; font-size: 13px; font-weight: 600; color: var(--color-gray); margin-bottom: 8px; }
.distractor-row { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.distractor-row .distractor-val {
    flex: 1;
    min-height: 56px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid #f0c040;
    border-radius: var(--radius-sm);
    resize: vertical;
    font-family: inherit;
    background: #fffbe6;
}
.distractor-tag {
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    background: #fff3cd;
    color: #856404;
    border-radius: var(--radius-sm);
    margin-top: 14px;
}

.matching-right--extra { opacity: 0.7; border-style: dashed !important; }

/* matching_multi editor in settings */
.match-group {
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 12px;
    background: #fafbfc;
}
.match-group__header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.match-group__name {
    flex: 1;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: vertical;
    font-family: inherit;
}
.match-group__items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.match-group__item { display: flex; align-items: flex-start; gap: 6px; }
.match-group__item-text {
    flex: 1;
    min-height: 52px;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    resize: vertical;
    font-family: inherit;
}
.match-group__add-item {
    align-self: flex-start;
    font-size: 12px;
    margin-top: 4px;
}

/* Question modal tabs */
.qm-tabs { display: flex; gap: 0; flex: 1; }
.qm-tabs__btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 6px 16px;
    font-size: 15px;
    font-weight: 600;
    color: #999;
    cursor: pointer;
    transition: color .2s, border-color .2s;
}
.qm-tabs__btn:hover { color: var(--color-text); }
.qm-tabs__btn--active {
    color: var(--color-navy);
    border-bottom-color: var(--color-navy);
}

/* Question preview */
.qm-preview { padding: 0; }
.qm-pv__empty { text-align: center; color: #999; padding: 40px 20px; font-size: 15px; }
.qm-pv__hint {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.qm-pv__card {
    background: #f8f9fb;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: 24px;
}
.qm-pv__text {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    margin-bottom: 20px;
    color: var(--color-text);
    white-space: pre-wrap;
}
.qm-pv__options { display: flex; flex-direction: column; gap: 8px; }
.qm-pv__option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: default;
}
.qm-pv__radio {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: 2px solid #bbb;
    flex-shrink: 0;
}
.qm-pv__checkbox {
    width: 18px; height: 18px;
    border-radius: 4px;
    border: 2px solid #bbb;
    flex-shrink: 0;
}
.qm-pv__text-input input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: #fff;
}
.qm-pv__ordering { display: flex; flex-direction: column; gap: 6px; }
.qm-pv__order-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}
.qm-pv__order-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--color-navy);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}
.qm-pv__matching { margin-top: 4px; }
.qm-pv__match-headers { margin-bottom: 8px; }
.qm-pv__match-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-navy);
    padding: 6px 10px;
    background: rgba(0,0,0,0.03);
    border-radius: var(--radius-sm);
    text-align: center;
}
.qm-pv__multi-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-navy);
    padding: 4px 0 8px;
}
.qm-pv__match-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qm-pv__match-col { display: flex; flex-direction: column; gap: 8px; }
.qm-pv__match-left,
.qm-pv__match-right {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    min-height: 44px;
}
.qm-pv__badge {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: #4caf50;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
    flex-shrink: 0;
}
.qm-pv__badge--right { background: #ff9800; }
.qm-pv__multi { margin-top: 4px; }
.qm-pv__multi-groups { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.qm-pv__multi-group {
    flex: 1 1 160px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: #fff;
}
.qm-pv__multi-group-title {
    font-weight: 600; font-size: 14px; color: var(--color-navy);
    margin-bottom: 8px; padding-bottom: 6px;
    border-bottom: 2px solid var(--color-navy);
}
.qm-pv__multi-drop {
    min-height: 36px;
    border: 2px dashed #ccc;
    border-radius: var(--radius-sm);
    padding: 6px;
}
.qm-pv__multi-pool {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 10px;
    background: #f0f0f0;
    border-radius: var(--radius-sm);
}
.qm-pv__multi-item {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.qm-pv__expl {
    margin-top: 12px;
    padding: 12px 16px;
    background: #f5f5ff;
    border-left: 4px solid var(--color-navy);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 13px;
}
.qm-pv__expl a { color: var(--color-navy); text-decoration: underline; }

/* answer-view for matching_multi */
.answer-view__group {
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 14px;
}

@media (max-width: 768px) {
    .exam-header { padding: 8px 12px; height: auto; flex-wrap: wrap; gap: 6px; }
    .exam-header__logo { font-size: 14px; }
    .exam-header__logo svg { width: 22px; height: 22px; }
    .exam-header__logo-link { gap: 8px; }
    .exam-header__user { gap: 8px; font-size: 13px; }
    .exam-header__username { display: none; }
    .exam-header__logout { padding: 5px 12px; font-size: 12px; }
    .exam-header__settings { width: 32px; height: 32px; }
    .exam-header__right { gap: 8px; }
    .exam-header__right .btn { font-size: 12px; padding: 6px 12px; }
    .exam-dashboard { padding: 16px 12px; max-width: 100%; }
    .exam-blocks { grid-template-columns: 1fr; }
    .exam-block-card__header { padding: 16px; }
    .exam-block-card__title { font-size: 18px; }
    .exam-block-card__desc { font-size: 13px; }
    .exam-block-card__body { padding: 16px; }
    .exam-block-card__actions { gap: 8px; }
    .exam-block-card__actions .btn { font-size: 13px; padding: 10px; }
    .exam-history { padding: 16px 12px; overflow-x: auto; }
    .history-panel { overflow-x: auto; }
    .history-panel table { min-width: 650px; }
    .exam-admin { overflow-x: auto; }
    .exam-admin table { min-width: 700px; }
    .history-tab { font-size: 13px; padding: 8px 14px; }
    .exam-history h2 { font-size: 18px; }
    .exam-dashboard__welcome h1 { font-size: 22px; }
    .tab-btn { font-size: 13px; padding: 8px 12px; }
    .exam-test { padding: 12px; }
    .exam-test__topbar { flex-direction: column; gap: 10px; padding: 12px; }
    .exam-test__timer { font-size: 20px; }
    .exam-test__question { padding: 16px; }
    .exam-test__actions { flex-wrap: wrap; gap: 8px; }
    .exam-test__actions .btn { font-size: 13px; padding: 10px 16px; flex: 1 1 auto; }
    .matching-container { grid-template-columns: 1fr; }
    .matching-headers { grid-template-columns: 1fr; }
    .matching-header { margin-bottom: 4px; }
    .qnav-badge { width: 32px; height: 32px; font-size: 11px; }
    .question-nav { padding: 12px; }
    .question-nav__badges { gap: 4px; }
    .section-title { font-size: 14px; }
    .exam-result__card { padding: 24px 16px; }
    .exam-result__percentage { font-size: 42px; }
    .exam-result__actions { flex-direction: column; gap: 10px; }
    .exam-result__actions .btn { width: 100%; text-align: center; }
    .exam-result__details { padding: 16px 12px; overflow-x: auto; }
    .settings-card__body { grid-template-columns: 1fr; }
    .settings-sections { border-left: none; padding-left: 0; border-top: 2px solid var(--color-border); padding-top: 20px; }
    .exam-settings-page { margin-top: 80px; padding: 0 12px; max-width: 100%; }
    .content-layout { grid-template-columns: 1fr; }
    .content-sidebar { max-height: 300px; }
    .stabs__btn { padding: 10px 16px; font-size: 14px; }
    .exam-modal { width: 95%; margin: 10px; max-height: 90vh; }
    .training-nav-btns { flex-direction: column; gap: 8px; }
    .training-nav-btns .btn { width: 100%; text-align: center; }
    .qtab { padding: 8px 16px; font-size: 14px; }
    .answer-view__opt { padding: 10px 12px; }
    .answer-view__match-pair { flex-wrap: wrap; gap: 6px; }
    .answer-view__explanation { padding: 12px; }
}
