/* Question Bank - base styles */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    color: #222;
    background: #f4f6f9;
}

.container { max-width: 1140px; margin: 0 auto; padding: 0 16px; }

.app-header { background: #1f3a5f; color: #fff; }
.app-header .container { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.app-header a { color: #fff; text-decoration: none; }
.brand { font-size: 18px; font-weight: 600; }
.nav a { margin-left: 16px; opacity: .85; }
.nav a:hover { opacity: 1; }

.app-body { min-height: calc(100vh - 112px); padding-top: 24px; padding-bottom: 24px; }

.app-footer { height: 56px; line-height: 56px; color: #777; border-top: 1px solid #dde2e8; }

.btn {
    padding: 8px 16px;
    border: 0;
    border-radius: 4px;
    background: #1f3a5f;
    color: #fff;
    cursor: pointer;
}
.btn:hover { background: #2c5282; }

.result { margin-top: 12px; }
.result.ok { color: #1e7b34; }
.result.fail, .error { color: #b42318; }

/* ---------- Navigation dropdown ---------- */
.nav { display: flex; align-items: center; }
.dropdown { position: relative; margin-left: 16px; }
.dropdown > .dropdown-toggle { margin-left: 0; }
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 200px;
    padding: 6px 0;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 4px 14px rgba(0,0,0,.15);
    z-index: 10;
}
.dropdown:hover .dropdown-menu { display: block; }
.app-header .dropdown-menu a { display: block; margin: 0; padding: 8px 14px; color: #222; opacity: 1; }
.app-header .dropdown-menu a:hover { background: #eef2f7; }
.app-header .container { height: 56px; }
.dropdown { line-height: 56px; }
.dropdown-menu { line-height: normal; }

/* ---------- Master screens ---------- */
.page-head h1 { margin: 0 0 16px; font-size: 22px; color: #1f3a5f; }

.card {
    background: #fff;
    border: 1px solid #dde2e8;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
}

.form-grid { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.field { display: flex; flex-direction: column; flex: 1 1 220px; }
.field-sm { flex: 0 0 120px; }
.field label { font-weight: 600; margin-bottom: 4px; }
.field-check label { font-weight: normal; padding-bottom: 8px; }
.req { color: #b42318; }

.field input[type="text"],
.field input[type="number"],
.search {
    height: 34px;
    padding: 6px 10px;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    font: inherit;
}
.field input:focus, .search:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }

.form-actions { margin-top: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-light { background: #e6eaf0; color: #222; }
.btn-light:hover { background: #d7dde6; }
.msg.ok { color: #1e7b34; }
.msg.fail { color: #b42318; }

.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 12px; }
.search { width: 260px; max-width: 100%; }
.count { color: #666; }

.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 8px 10px; border-bottom: 1px solid #e6eaf0; text-align: left; }
.grid th { background: #f0f3f7; font-weight: 600; }
.grid tbody tr:hover { background: #f8fafc; }
.grid .empty { text-align: center; color: #777; padding: 20px; }
.col-sno { width: 50px; }
.col-num { width: 90px; }
.col-status { width: 90px; }
.col-actions { width: 130px; white-space: nowrap; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.on { background: #dcfce7; color: #166534; }
.badge.off { background: #f1f5f9; color: #64748b; }

.link { background: none; border: 0; padding: 0 6px; color: #2c5282; cursor: pointer; font: inherit; }
.link:hover { text-decoration: underline; }
.link.danger { color: #b42318; }

/* ---------- Class Section Mapping ---------- */
.field select {
    height: 34px;
    padding: 6px 10px;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    font: inherit;
    background: #fff;
    max-width: 360px;
}
.field select:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }

.section-box { margin-top: 14px; border: 1px solid #e6eaf0; border-radius: 4px; }
.section-box-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 12px; background: #f0f3f7; border-bottom: 1px solid #e6eaf0;
}
.select-all { font-weight: normal; cursor: pointer; }
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 6px 12px;
    padding: 12px;
    max-height: 260px;
    overflow-y: auto;
}
.check-item { cursor: pointer; padding: 4px 0; }

.chip {
    display: inline-block;
    margin: 2px 4px 2px 0;
    padding: 2px 10px;
    border-radius: 10px;
    background: #e8eef7;
    color: #1f3a5f;
    font-size: 12px;
}
.muted { color: #94a3b8; font-style: italic; }

/* ---------- Centered message popup ---------- */
.qb-popup-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, .45);
    z-index: 1000;
}
.qb-popup-overlay.show { display: flex; }

.qb-popup {
    width: 360px;
    max-width: 100%;
    padding: 28px 24px 22px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    text-align: center;
    animation: qbPopIn .18s ease-out;
}
@keyframes qbPopIn {
    from { transform: scale(.92); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.qb-popup-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    line-height: 56px;
    font-size: 26px;
    color: #fff;
}
.qb-popup.success .qb-popup-icon { background: #1e7b34; }
.qb-popup.error   .qb-popup-icon { background: #b42318; }
.qb-popup.warn    .qb-popup-icon { background: #b45309; font-weight: 700; }

.qb-popup-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.qb-popup.success .qb-popup-title { color: #1e7b34; }
.qb-popup.error   .qb-popup-title { color: #b42318; }
.qb-popup.warn    .qb-popup-title { color: #b45309; }

.qb-popup-text { color: #444; margin-bottom: 18px; word-wrap: break-word; white-space: pre-line; }
.qb-popup-ok { min-width: 100px; }

/* ---------- Syllabus Master ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.sel-count { font-weight: normal; color: #64748b; font-size: 12px; }

.chapter-entry { padding: 12px; border-bottom: 1px solid #e6eaf0; }
.chapter-entry textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    font: inherit;
    resize: vertical;
}
.chapter-entry textarea:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.chapter-entry-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.hint { color: #94a3b8; font-size: 12px; }

.chapter-grid td { padding: 4px 10px; }
.chapter-grid .chapter-input {
    width: 100%;
    height: 30px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    font: inherit;
    background: transparent;
}
.chapter-grid .chapter-input:hover { border-color: #dde2e8; }
.chapter-grid .chapter-input:focus { outline: none; border-color: #2c5282; background: #fff; }
.chapter-scroll { max-height: 380px; overflow-y: auto; }
.chapter-grid { table-layout: fixed; }
.chapter-grid thead th { position: sticky; top: 0; z-index: 2; }
.chapter-grid tfoot td { position: sticky; bottom: 0; z-index: 2; }
.chapter-grid .col-sno { width: 48px; }
.col-move { width: 80px; text-align: center; }
.col-del { width: 50px; text-align: center; }
.col-chapters { width: 120px; white-space: nowrap; }

.icon-btn {
    width: 26px; height: 26px;
    border: 1px solid #dde2e8;
    border-radius: 4px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
}
.icon-btn:hover:not(:disabled) { background: #eef2f7; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger { color: #b42318; }
.icon-btn + .icon-btn { margin-left: 4px; }

/* ---------- Content modal ---------- */
.qb-modal {
    width: 560px;
    max-width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    animation: qbPopIn .18s ease-out;
}
.qb-modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid #e6eaf0;
    font-size: 17px; font-weight: 600; color: #1f3a5f;
}
.qb-modal-x { border: 0; background: none; font-size: 24px; line-height: 1; color: #64748b; cursor: pointer; }
.qb-modal-x:hover { color: #222; }
.qb-modal-body { padding: 14px 18px; overflow-y: auto; }
.qb-modal-foot { padding: 12px 18px; border-top: 1px solid #e6eaf0; text-align: right; }

.modal-meta { background: #f8fafc; border: 1px solid #e6eaf0; border-radius: 4px; padding: 8px 12px; margin-bottom: 12px; }
.modal-meta div { padding: 2px 0; }
.modal-meta .meta-label { display: inline-block; width: 64px; color: #64748b; }
.chapter-list { margin: 0; padding-left: 28px; }
.chapter-list li { padding: 6px 0; border-bottom: 1px dashed #e6eaf0; }
.chapter-list li:last-child { border-bottom: 0; }

/* ---------- Multi-select dropdown ---------- */
.ms { position: relative; }
.ms-toggle {
    width: 100%;
    height: 34px;
    padding: 6px 30px 6px 10px;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    background: #fff;
    font: inherit;
    color: #64748b;
    text-align: left;
    cursor: pointer;
    position: relative;
}
.ms.has-value .ms-toggle { color: #222; }
.ms-toggle::after {
    content: "";
    position: absolute;
    right: 12px;
    top: 50%;
    margin-top: -3px;
    border: 5px solid transparent;
    border-top-color: #475569;
}
.ms.open .ms-toggle, .ms-toggle:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.ms-text { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.ms-panel {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: calc(100% + 4px);
    min-width: 200px;
    background: #fff;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 50;
}
.ms.open .ms-panel { display: block; }
.ms-all { display: block; padding: 8px 12px; border-bottom: 1px solid #e6eaf0; background: #f8fafc; cursor: pointer; font-weight: 600; }
.ms-options { max-height: 240px; overflow-y: auto; padding: 4px 0; }
.ms-item { display: block; padding: 6px 12px; cursor: pointer; font-weight: normal; }
.ms-item:hover { background: #eef2f7; }
.field .ms-all, .field .ms-item { margin: 0; }
.field .ms-item { font-weight: normal; }

/* ---------- Question Bank ---------- */
.page-head-flex { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.page-head-flex h1 { margin: 0; }
a.btn { display: inline-block; text-decoration: none; line-height: 18px; }
.card-title { font-weight: 600; color: #1f3a5f; margin-bottom: 12px; font-size: 15px; }
.muted-sm { color: #64748b; font-size: 12px; font-weight: normal; }
.field-md { flex: 0 0 160px; }

.q-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    font: inherit;
    line-height: 1.5;
    resize: vertical;
}
.q-textarea:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.char-count { text-align: right; color: #94a3b8; font-size: 12px; margin-top: 2px; }
.hint-box { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 4px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }

.image-row { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.image-preview { margin-top: 10px; display: flex; align-items: flex-start; gap: 12px; }
.image-preview img { max-width: 320px; max-height: 220px; border: 1px solid #dde2e8; border-radius: 4px; }

.answer-grid td { padding: 4px 8px; vertical-align: middle; }
.cell-input {
    width: 100%;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid #c5ccd6;
    border-radius: 4px;
    font: inherit;
}
.cell-input:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.answer-grid tr.is-correct td { background: #f0fdf4; }
.col-letter { width: 50px; text-align: center; }
.opt-letter { display: inline-block; width: 26px; height: 26px; line-height: 26px; border-radius: 50%; background: #e8eef7; color: #1f3a5f; font-weight: 600; text-align: center; }
.col-correct { width: 80px; text-align: center; }
.col-correct input { width: 18px; height: 18px; cursor: pointer; }
.col-arrow { width: 30px; text-align: center; color: #64748b; }
.col-move2 { width: 110px; text-align: center; white-space: nowrap; }
.answer-grid + .link { margin-top: 8px; padding-left: 0; }
.tf-group { display: flex; gap: 12px; }
.tf-option { display: flex; align-items: center; gap: 8px; padding: 10px 24px; border: 1px solid #c5ccd6; border-radius: 6px; cursor: pointer; font-weight: 600; }
.tf-option:has(input:checked) { border-color: #1e7b34; background: #f0fdf4; color: #1e7b34; }
.sticky-actions { position: sticky; bottom: 0; background: #f4f6f9; padding: 12px 0; margin-top: 0; border-top: 1px solid #dde2e8; z-index: 5; }

/* list */
.filter-grid .field { flex: 1 1 140px; min-width: 0; }
.filter-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.filter-actions .search { flex: 1 1 260px; width: auto; }
.page-size { color: #64748b; font-weight: normal; }
.page-size select { height: 28px; margin-left: 4px; border: 1px solid #c5ccd6; border-radius: 4px; }
.q-grid td { vertical-align: top; }
.q-cell { min-width: 240px; }
.col-id { width: 60px; color: #64748b; }
.col-cs { width: 130px; }
.col-chapter { width: 150px; }
.col-type { width: 130px; }
.col-level { width: 90px; }
.col-marks { width: 60px; text-align: center; }
.col-actions3 { width: 150px; white-space: nowrap; }
.col-actions3 a.link { text-decoration: none; padding: 0 6px; }
.img-tag { display: inline-block; font-size: 10px; padding: 0 5px; border-radius: 3px; background: #e0e7ff; color: #3730a3; vertical-align: middle; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; }
.pager .btn { padding: 6px 12px; }

.badge.diff-easy { background: #dcfce7; color: #166534; }
.badge.diff-moderate { background: #fef3c7; color: #92400e; }
.badge.diff-advance { background: #fee2e2; color: #991b1b; }

/* view popup */
.qb-modal:has(.q-meta) { width: 720px; }
.q-text { white-space: pre-wrap; line-height: 1.6; font-size: 15px; margin: 12px 0; }
.q-img-wrap { margin: 8px 0 12px; }
.q-img { max-width: 100%; max-height: 360px; border: 1px solid #dde2e8; border-radius: 4px; }
.q-answer, .q-extra { border-top: 1px dashed #dde2e8; padding-top: 10px; margin-top: 10px; }
.q-answer-title { font-weight: 600; color: #1f3a5f; margin-bottom: 6px; }
.q-answer-text { white-space: pre-wrap; background: #f8fafc; border: 1px solid #e6eaf0; border-radius: 4px; padding: 8px 10px; }
.q-options { margin: 0; padding-left: 28px; }
.q-options li { padding: 4px 6px; border-radius: 4px; }
.q-options li.correct { background: #f0fdf4; color: #166534; font-weight: 600; }
.q-options .tick { font-size: 12px; margin-left: 6px; }
.q-match th, .q-match td { padding: 6px 8px; }

/* sections on the question form */
.section-pick { margin-top: 12px; }
.section-pick .check-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); max-height: 160px; }
.ms.is-disabled .ms-toggle { background: #f1f5f9; color: #94a3b8; cursor: default; }

/* image cells (Match the Images / Match Word with Image) */
.img-grid td { vertical-align: middle; }
.img-cell { display: flex; align-items: center; gap: 12px; }
.thumb { width: 96px; height: 72px; object-fit: contain; background: #fff; border: 1px solid #dde2e8; border-radius: 4px; cursor: zoom-in; }
.thumb-empty { width: 96px; height: 72px; display: flex; align-items: center; justify-content: center; border: 1px dashed #c5ccd6; border-radius: 4px; color: #94a3b8; font-size: 12px; background: #f8fafc; }
.img-cell-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.img-cell-actions .link { padding: 0; }
.file-link { position: relative; overflow: hidden; display: inline-block; cursor: pointer; color: #2c5282; }
.file-link:hover { text-decoration: underline; }
.file-link input[type="file"] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
#imagePreviewImg { cursor: zoom-in; }
.zoom-wrap { text-align: center; }
.zoom-img { max-width: 100%; max-height: 70vh; }
.q-opt-img { max-width: 160px; max-height: 120px; border: 1px solid #dde2e8; border-radius: 4px; background: #fff; }
.q-match-img td { vertical-align: middle; }

/* ---------- Formatted text editor ---------- */
body, .rte, .q-text { font-family: "Segoe UI", "Nirmala UI", "Mangal", "Raavi", "Cambria Math", Arial, sans-serif; }
.rte-wrap { border: 1px solid #c5ccd6; border-radius: 4px; background: #fff; }
.rte-wrap:focus-within { border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.rte-toolbar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 6px; background: #f8fafc; border-bottom: 1px solid #e6eaf0; }
#optToolbar.rte-toolbar { border: 1px solid #e6eaf0; border-radius: 4px; margin-bottom: 8px; }
.rte-btn { min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid transparent; border-radius: 4px; background: none; font: inherit; font-size: 13px; color: #1f2937; cursor: pointer; }
.rte-btn:hover { background: #e8eef7; border-color: #c5ccd6; }
.rte-sep { width: 1px; height: 20px; background: #dde2e8; margin: 0 4px; }
.rte-symbols {
    position: absolute; left: 6px; top: 100%; z-index: 60; width: 520px; max-width: calc(100vw - 40px);
    max-height: 320px; overflow-y: auto; padding: 8px; background: #fff;
    border: 1px solid #c5ccd6; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.rte-sym-group { margin-bottom: 6px; }
.rte-sym-title { font-size: 11px; font-weight: 600; color: #64748b; margin: 2px 0 4px; }
.rte-sym { min-width: 30px; height: 30px; margin: 0 2px 2px 0; padding: 0 4px; border: 1px solid #e6eaf0; border-radius: 4px; background: #fff; font-size: 16px; cursor: pointer; }
.rte-sym:hover { background: #e8eef7; border-color: #2c5282; }

.rte { outline: none; line-height: 1.6; word-wrap: break-word; }
.rte-multi { min-height: 130px; max-height: 420px; overflow-y: auto; padding: 8px 10px; }
.rte-cell { min-height: 32px; padding: 5px 8px; border: 1px solid #c5ccd6; border-radius: 4px; background: #fff; }
.rte-cell:focus { border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.rte:empty::before { content: attr(data-placeholder); color: #94a3b8; pointer-events: none; }
.rte p, .q-text p { margin: 0 0 6px; }
.rte table, .q-text table { border-collapse: collapse; margin: 6px 0; }
.rte td, .rte th, .q-text td, .q-text th { border: 1px solid #c5ccd6; padding: 4px 8px; }
.rte ul, .rte ol, .q-text ul, .q-text ol { margin: 4px 0; padding-left: 24px; }
.q-text { white-space: normal; }
.col-correct { white-space: nowrap; width: 100px; }

/* ---------- options with images, passage questions, swap ---------- */
.col-optimg { width: 210px; }
.img-cell-sm .thumb, .img-cell-sm .thumb-empty { width: 64px; height: 48px; }
.choice-grid td { vertical-align: middle; }
.swap-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.part-card { border: 1px solid #dde2e8; border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; background: #fcfdfe; }
.part-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.part-no { font-weight: 700; color: #1f3a5f; min-width: 30px; }
.part-type { height: 32px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; background: #fff; min-width: 220px; }
.part-marks { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.part-marks input { width: 80px; height: 32px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.part-actions { margin-left: auto; }
.rte-part { min-height: 56px; }
.part-options { margin-top: 8px; }
input[readonly] { background: #f1f5f9; color: #475569; }
.q-passage { padding: 2px 0; }
.q-part { border-top: 1px dashed #dde2e8; padding-top: 8px; margin-top: 8px; }
.q-part-head { margin-bottom: 2px; }
.q-options .q-opt-img { margin-top: 4px; }

/* ---------- Bulk upload ---------- */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.bulk-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bulk-steps .card { margin-bottom: 16px; }
@media (max-width: 900px) { .bulk-steps { grid-template-columns: 1fr; } }
.step-no { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-right: 6px;
           border-radius: 50%; background: #2b579a; color: #fff; font-size: 13px; }
.step-text { margin: 0 0 12px; color: #475569; }
.drop-zone { position: relative; border: 2px dashed #c5ccd6; border-radius: 8px; padding: 22px 16px; text-align: center;
             background: #f8fafc; cursor: pointer; transition: border-color .15s, background .15s; }
.drop-zone:hover, .drop-zone.drag { border-color: #2c5282; background: #eef4fb; }
.drop-zone.has-file { border-style: solid; border-color: #16a34a; background: #f0fdf4; }
.drop-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-text b { color: #2c5282; }
.drop-file { margin-top: 8px; font-weight: 600; color: #166534; word-break: break-all; }

.bulk-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sum-chip { min-width: 110px; padding: 10px 14px; border-radius: 8px; border: 1px solid #e6eaf0; background: #f8fafc; }
.sum-n { font-size: 22px; font-weight: 700; line-height: 1.1; }
.sum-l { font-size: 12px; color: #64748b; }
.chip-ready   { background: #f0fdf4; border-color: #bbf7d0; } .chip-ready .sum-n { color: #166534; }
.chip-dup     { background: #fff7ed; border-color: #fed7aa; } .chip-dup .sum-n { color: #c2410c; }
.chip-similar { background: #fefce8; border-color: #fde68a; } .chip-similar .sum-n { color: #a16207; }
.chip-error   { background: #fef2f2; border-color: #fecaca; } .chip-error .sum-n { color: #b91c1c; }
.chip-total .sum-n { color: #1f3a5f; }

.bulk-tools { flex-wrap: wrap; }
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.status-tabs .tab { border: 1px solid #c5ccd6; background: #fff; border-radius: 16px; padding: 4px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.status-tabs .tab.active { background: #2c5282; border-color: #2c5282; color: #fff; }

.status-pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-ready   { background: #dcfce7; color: #166534; }
.st-dup     { background: #ffedd5; color: #c2410c; }
.st-similar { background: #fef9c3; color: #854d0e; }
.st-error   { background: #fee2e2; color: #b91c1c; }
.st-error-row td { background: #fffafa; }

.table-scroll { max-height: 60vh; overflow: auto; border: 1px solid #e6eaf0; border-radius: 4px; }
.table-scroll .grid thead th { position: sticky; top: 0; z-index: 1; }
.bulk-grid td { vertical-align: top; }
.col-row { width: 50px; text-align: right; color: #64748b; }
.col-bstatus { width: 100px; }
.col-remarks { width: 280px; font-size: 13px; }
.col-remarks > div + div { margin-top: 3px; }
.match-links { margin-top: 4px; }
.match-links .link { margin-right: 8px; }
.bulk-import { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.similar-check { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-right: auto; }

/* ---------- Find duplicates (Question List) ---------- */
.qb-modal:has(.dup-report) { width: 980px; }
.dup-count { margin: 4px 0 12px; }
.dup-group { border: 1px solid #e6eaf0; border-radius: 6px; margin-bottom: 12px; overflow: hidden; }
.dup-head { background: #f8fafc; padding: 8px 12px; border-bottom: 1px solid #e6eaf0; }
.dup-text { margin-top: 4px; font-weight: 600; color: #1f2937; }
.dup-table td { vertical-align: top; font-size: 13px; }
.dup-table tr.dup-exact td:first-child { box-shadow: inset 3px 0 0 #f97316; }
.dup-table tr.dup-deleted td { text-decoration: line-through; color: #94a3b8; }
.dup-preview-box { background: #fff; border: 1px dashed #c5ccd6; border-radius: 4px; padding: 10px; }
.empty-note { padding: 18px; text-align: center; color: #166534; font-weight: 600; }
.bulk-grid td { font-size: 14px; }

/* ---------- Blueprint ---------- */
.field-wide { flex: 2 1 320px; }
.field label .hint { font-weight: normal; }
.table-scroll-auto { max-height: none; }
.bp-pattern td, .bp-dist td { vertical-align: middle; }
.bp-pattern input, .bp-pattern select, .bp-dist input {
    height: 32px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; background: #fff; width: 100%;
}
.bp-pattern input:focus, .bp-pattern select:focus, .bp-dist input:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }
.bp-pattern .col-num { width: 120px; text-align: right; }
.bp-pattern .col-num input { text-align: right; }
.col-order { width: 120px; white-space: nowrap; }
.order-no { display: inline-block; width: 22px; font-weight: 700; color: #1f3a5f; }
.icon-btn { border: 1px solid #c5ccd6; background: #fff; border-radius: 4px; width: 26px; height: 26px; margin-left: 3px; cursor: pointer; font-size: 10px; color: #475569; }
.icon-btn:hover:not(:disabled) { background: #eef4fb; border-color: #2c5282; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.col-secname { width: 90px; }
.col-del { width: 40px; text-align: center; }
.col-del .link { font-size: 20px; line-height: 1; }
.mpq { font-weight: 700; color: #1f3a5f; }
.mpq.bad, .marks-check.bad, .bad { color: #b91c1c; }
.ok { color: #166534; }
.in-bank { color: #64748b; }
.marks-check { font-weight: 600; }

.bp-dist th, .bp-dist td { text-align: center; }
.bp-dist .col-chname { text-align: left; min-width: 200px; }
.bp-dist .col-chk { width: 30px; }
.bp-dist .col-sec { min-width: 92px; white-space: nowrap; }
.bp-dist .col-sec input { width: 54px; text-align: center; padding: 4px; }
.bp-dist .col-num { width: 80px; }
.th-sub { font-weight: normal; font-size: 11px; color: #64748b; white-space: nowrap; }
.avl { display: inline-block; min-width: 22px; margin-left: 4px; font-size: 11px; color: #94a3b8; text-align: left; }
.avl.short { color: #b91c1c; font-weight: 700; }
.ch-off td { color: #94a3b8; background: #fafafa; }
.bp-dist tfoot td { font-weight: 600; background: #f8fafc; }
.bp-dist tfoot .ok { color: #166534; }
.bp-dist tfoot .bad { color: #b91c1c; }

.bp-diff .diff-inputs { display: flex; gap: 14px; flex-wrap: wrap; }
.diff-box { flex: 1 1 200px; border: 1px solid #e6eaf0; border-radius: 8px; padding: 10px 12px; border-top-width: 4px; }
.diff-easy-box { border-top-color: #22c55e; }
.diff-moderate-box { border-top-color: #f59e0b; }
.diff-advance-box { border-top-color: #ef4444; }
.diff-box label { font-weight: 600; display: block; margin-bottom: 4px; }
.pct-input { display: flex; align-items: center; gap: 6px; }
.pct-input input { width: 90px; height: 34px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; font-size: 16px; text-align: right; }
.diff-calc { margin-top: 6px; font-size: 13px; color: #334155; min-height: 34px; }
.diff-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: #e6eaf0; margin: 14px 0 8px; }
.diff-bar span { display: block; height: 100%; transition: width .2s; }
.b-easy { background: #22c55e; } .b-moderate { background: #f59e0b; } .b-advance { background: #ef4444; }
.diff-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-weight: 600; }
.presets { font-weight: normal; color: #64748b; }

.gen-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.select-sm { height: 30px; padding: 2px 6px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; font-size: 13px; background: #fff; }
.instructions { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; line-height: 1.6; resize: vertical; }
.instructions:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.15); }

.bp-summary-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.bp-summary { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; min-width: 0; flex: 1 1 400px; }
.sum-item { background: #fff; border: 1px solid #dde2e8; border-radius: 16px; padding: 4px 12px; font-size: 13px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.sum-item.ok { border-color: #bbf7d0; background: #f0fdf4; }
.sum-item.bad { border-color: #fecaca; background: #fef2f2; }
.sum-item.warn { border-color: #fde68a; background: #fffbeb; }
.bp-buttons { display: flex; gap: 8px; }

.qb-modal:has(.bp-preview) { width: 900px; }
.bp-prev-head { text-align: center; border-bottom: 2px solid #1f3a5f; padding-bottom: 8px; margin-bottom: 8px; line-height: 1.6; }
.bp-prev-title { font-size: 18px; font-weight: 700; color: #1f3a5f; }
.bp-preview h4 { margin: 14px 0 6px; color: #1f3a5f; }
.bp-prev-table th, .bp-prev-table td { padding: 6px 8px; font-size: 13px; }
.bp-prev-table .col-num { text-align: right; width: auto; }
.bp-prev-diff { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.bp-prev-ins { background: #f8fafc; border: 1px solid #e6eaf0; border-radius: 4px; padding: 10px 12px; line-height: 1.6; }

.bp-list td { vertical-align: top; }
.pattern-cell { max-width: 360px; }
.pattern-chip { display: inline-block; background: #eef4fb; color: #1f3a5f; border-radius: 10px; padding: 1px 8px; margin: 0 4px 4px 0; font-size: 12px; }
.col-actions4 { width: 190px; white-space: nowrap; }
.col-actions4 a.link { text-decoration: none; padding: 0 6px; }
.bp-list .col-num { text-align: right; }
.field input[type="search"] { height: 34px; padding: 6px 10px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.drag-handle { display: inline-block; width: 16px; margin-right: 8px; color: #94a3b8; cursor: grab; letter-spacing: -3px; font-size: 14px; user-select: none; }
.drag-handle:hover { color: #2c5282; }
.bp-pattern tr.dragging td { opacity: .45; background: #eef4fb; }
.bp-pattern tr.drop-before td { box-shadow: inset 0 3px 0 #2c5282; }
.bp-pattern tr.drop-after td { box-shadow: inset 0 -3px 0 #2c5282; }
.card-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-toolbar > .hint { flex: 1 1 320px; min-width: 0; line-height: 1.4; }
.toolbar-buttons { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; white-space: nowrap; margin-left: auto; }
.toolbar-buttons .btn { margin: 0; }
.replicate-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: #f8fafc; }
.replicate-label { font-weight: 600; color: #1f3a5f; }
.replicate-bar select { height: 32px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; min-width: 320px; max-width: 100%; background: #fff; }
.replicate-bar .hint { flex: 1 1 260px; }
.copy-note { border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; border: 1px solid; }
.copy-note.warn { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.copy-note.ok { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.qb-modal:has(.rep-form) { width: 640px; }
.rep-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin: 4px 0 10px; }
.rep-grid label { display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; margin: 0; font-weight: 600; font-size: 13px; }
.rep-grid .rep-lbl { display: block; margin-bottom: 4px; white-space: nowrap; }
.rep-grid select, .rep-grid input { display: block; width: 100%; box-sizing: border-box; height: 34px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; font-weight: normal; background: #fff; }
.rep-grid .rep-wide { grid-column: 1 / -1; }
.rep-actions { display: flex; gap: 8px; margin-top: 12px; }
@media (max-width: 640px) { .rep-grid { grid-template-columns: 1fr; } }
.bp-list .col-actions4 { white-space: normal; width: 240px; line-height: 1.9; }

/* ---------- Question paper ---------- */
.field-auto { flex: 0 0 auto; }
.gen-buttons { flex-direction: row; gap: 8px; align-items: flex-end; }
.paper-info { margin-top: 12px; padding: 8px 12px; background: #f8fafc; border: 1px solid #e6eaf0; border-radius: 4px; font-size: 13px; }
.paper-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .paper-layout { grid-template-columns: 1fr; } .bank-col { position: static; } }
.paper-row { padding: 12px 14px; }
.help-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: -2px 0 10px; padding: 6px 10px; background: #f5f8fc; border: 1px solid #d8e2ee; border-radius: 6px; }
.help-row label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #1f3a5f; flex: 1 1 420px; }
.help-row input { flex: 1 1 auto; min-width: 200px; }
.help-row.help-empty { background: #fff8e6; border-color: #f0d58a; }
.paper-row-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; color: #1f3a5f; }
.slot { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 8px 10px; margin-bottom: 6px;
        border: 1px solid #e6eaf0; border-radius: 6px; background: #fff; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.slot:hover { border-color: #b6c3d4; }
.slot.selected { border-color: #2c5282; box-shadow: 0 0 0 2px rgba(44,82,130,.2); }
.slot.empty { border-style: dashed; border-color: #f59e0b; background: #fffbeb; }
.slot.bad { border-color: #ef4444; background: #fef2f2; }
.slot.dragging { opacity: .45; }
.slot.drop-ok { border-color: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.25); }
.slot.drop-no { border-color: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.2); cursor: not-allowed; }
.slot-no { font-weight: 700; color: #1f3a5f; white-space: nowrap; }
.slot-text { max-height: 4.6em; overflow: hidden; line-height: 1.5; }
.slot.selected .slot-text { max-height: none; }
.slot-text p { margin: 0 0 4px; }
.slot-empty-text { color: #92400e; font-size: 13px; }
.slot-chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: 4px; }
.slot-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; background: #eef4fb; color: #1f3a5f; }
.chip-light { background: #f1f5f9; color: #475569; }
.chip-warn { background: #fef3c7; color: #92400e; }
.chip-type { background: #1f3a5f; color: #fff; }
.slot-chips .badge { font-size: 11px; padding: 1px 8px; }
.check-list { margin: 0; padding-left: 20px; font-size: 13px; }
.check-list li { padding: 2px 0; }
.bank-col { position: sticky; top: 8px; }
.bank-panel { background: #fff; border: 1px solid #dde2e8; border-radius: 8px; display: flex; flex-direction: column; max-height: calc(100vh - 110px); }
.bank-head { padding: 10px 12px; border-bottom: 1px solid #e6eaf0; }
.bank-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px 12px; border-bottom: 1px solid #e6eaf0; }
.bank-filters select, .bank-filters input[type="search"] { height: 30px; padding: 2px 6px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; font-size: 13px; background: #fff; min-width: 0; }
.bank-filters input[type="search"] { grid-column: 1 / -1; }
.bank-check { grid-column: 1 / -1; font-size: 12px; color: #475569; }
.bank-list { overflow-y: auto; padding: 8px; flex: 1 1 auto; }
.bank-item { border: 1px solid #e6eaf0; border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; background: #fff; cursor: grab; }
.bank-item:hover { border-color: #2c5282; background: #f8fbff; }
.bank-item.dragging { opacity: .5; }
.bank-text { font-size: 13px; max-height: 3.9em; overflow: hidden; }
.bank-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 6px; }
.paper-summary-bar .bp-summary { flex: 1 1 500px; }
.field input[type="date"] { height: 34px; padding: 6px 10px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.field-xs { flex: 0 0 80px; }
.set-tabs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.set-label { font-weight: 600; color: #1f3a5f; margin-right: 4px; }
.set-tab { border: 1px solid #c5ccd6; background: #fff; border-radius: 6px; padding: 6px 14px; font: inherit; font-weight: 600; cursor: pointer; color: #1f3a5f; }
.set-tab.active { background: #1f3a5f; border-color: #1f3a5f; color: #fff; }
.set-count { font-weight: normal; font-size: 12px; margin-left: 4px; padding: 0 6px; border-radius: 8px; background: #fee2e2; color: #b91c1c; }
.set-count.ok { background: #dcfce7; color: #166534; }
.set-tabs .hint { margin-left: auto; }
.chip-set { background: #ede9fe; color: #5b21b6; }
.chip-edit { background: #e0f2fe; color: #075985; margin-bottom: 4px; }
.bank-item.in-other { background: #faf5ff; }
.slot.edited { border-left: 4px solid #0284c7; }
.slot-marks { font-weight: normal; font-size: 12px; color: #64748b; margin-top: 2px; }
.slot-marks.changed { color: #b45309; font-weight: 700; }
.qp-edit-overlay .qb-modal.qp-edit { width: 900px; max-height: 92vh; }
.qp-edit-note { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 4px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }
.qp-edit-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.qp-marks { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.qp-marks input, .qp-part-head input { width: 80px; height: 32px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.qp-field-label { font-weight: 600; margin: 6px 0 4px; }
.qp-rte { margin-bottom: 8px; }
.qp-rte .rte-multi { min-height: 80px; }
.qp-opts td { vertical-align: top; }
.qp-thumb { max-width: 90px; max-height: 60px; display: block; margin-bottom: 4px; border: 1px solid #e6eaf0; border-radius: 3px; }
.qp-part { border: 1px solid #e6eaf0; border-radius: 6px; padding: 8px 10px; margin: 10px 0; background: #fcfdfe; }
.qp-part-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.qp-part-head label { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.qp-suggest { margin-top: 12px; padding: 10px 12px; border: 1px dashed #c5ccd6; border-radius: 6px; background: #f8fafc; }
.qp-suggest input[type="text"] { width: 100%; margin-top: 6px; height: 32px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; box-sizing: border-box; }
.qp-edit-foot { display: flex; align-items: center; gap: 8px; }
.flex-gap { flex: 1 1 auto; }

/* ---------- Correction approvals ---------- */
.qb-modal:has(.cr-review) { width: 1100px; }
.cr-summary { margin-bottom: 8px; }
.cr-remark { margin: 6px 0 10px; font-size: 13px; }
.cr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .cr-cols { grid-template-columns: 1fr; } }
.cr-col { border: 1px solid #e6eaf0; border-radius: 6px; padding: 10px; min-width: 0; }
.cr-new { border-color: #93c5fd; background: #f8fbff; }
.cr-col-head { font-weight: 700; color: #1f3a5f; margin-bottom: 6px; }
.cr-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.cr-actions input { flex: 1 1 300px; height: 34px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.danger-btn { color: #b42318; }

/* icon actions on paper questions */
.slot { grid-template-columns: 64px minmax(0, 1fr) auto; }
.slot-actions { flex-direction: row; align-items: flex-start; gap: 2px; }
.icon-act { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0;
            border: 1px solid transparent; border-radius: 6px; background: transparent; color: #475569; cursor: pointer; }
.icon-act:hover { background: #eef4fb; border-color: #c7d6ea; color: #1f3a5f; }
.icon-act.danger { color: #b42318; }
.icon-act.danger:hover { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.icon-act:focus-visible { outline: 2px solid #2c5282; outline-offset: 1px; }
.slot .slot-actions { opacity: .75; transition: opacity .12s; }
.slot:hover .slot-actions, .slot.selected .slot-actions { opacity: 1; }
.bank-actions .icon-act { width: 28px; height: 28px; }

/* ---------- icon action buttons (all lists) ---------- */
.icon-act { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 30px; height: 30px; padding: 0 6px;
            border: 1px solid transparent; border-radius: 6px; background: transparent; color: #475569; cursor: pointer;
            text-decoration: none; font: inherit; font-size: 13px; vertical-align: middle; }
.icon-act svg { pointer-events: none; flex: 0 0 auto; }
.icon-act:hover { background: #eef4fb; border-color: #c7d6ea; color: #1f3a5f; text-decoration: none; }
.icon-act.danger { color: #b42318; }
.icon-act.danger:hover { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.icon-act.primary { color: #fff; background: #2c5282; }
.icon-act.primary:hover { background: #1f3a5f; color: #fff; }
.icon-act:focus-visible { outline: 2px solid #2c5282; outline-offset: 1px; }
.icon-act + .icon-act { margin-left: 2px; }
.icon-text { padding: 0 8px; }
td.col-actions, td.col-actions3, td.col-actions4, .bp-list td.col-actions4 { white-space: nowrap; width: auto; }
th.col-actions, th.col-actions3, th.col-actions4 { width: 1%; white-space: nowrap; }

/* ---------- Generate Paper (HOD) ---------- */
.hod-note { background: #f4f8fd; border-left: 3px solid #2f6fb3; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; color: #34495e; border-radius: 4px; }
.hod-sets { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.hod-set { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #dde3ea; border-radius: 8px; padding: 8px 10px; min-width: 260px; flex: 1 1 260px; max-width: 420px; background: #fff; }
.hod-set .badge { margin-left: 4px; }
.hod-set-act { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pattern-chip.hod-chip { background: #e9f7ef; color: #1e6b3a; font-weight: 600; }
.src-tabs { display: flex; border-bottom: 1px solid #dde3ea; }
.src-tab { flex: 1; background: #f6f8fa; border: 0; border-bottom: 2px solid transparent; padding: 9px 8px; cursor: pointer; font: inherit; font-weight: 600; color: #5a6a7a; }
.src-tab.active { background: #fff; color: #1f3a5f; border-bottom-color: #2f6fb3; }
.src-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: #e6edf5; font-size: 11px; font-weight: 600; margin-left: 4px; }
.src-tab.active .src-count { background: #2f6fb3; color: #fff; }
.hod-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 10px 0 6px; border-top: 1px solid #eef1f4; margin-top: 6px; }
.hod-filter label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; }
.hod-filter select { min-width: 170px; }
.hod-filter .hint { flex-basis: 100%; margin: 0; }
.hod-part { border: 1px solid #dde3ea; border-radius: 8px; margin-top: 12px; overflow: hidden; }
.hod-part.done { border-color: #b9dfc6; }
.hod-part-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 10px 12px; background: #f6f8fa; border-bottom: 1px solid #e3e8ee; }
.hod-part.done .hod-part-head { background: #f1faf4; }
.hod-plan { font-size: 12px; color: #5a6a7a; margin-top: 3px; }
.hod-plan .ok { color: #1e6b3a; font-weight: 600; }
.hod-collapsed { padding: 10px 12px; margin: 0; }
.hod-q { display: flex; gap: 12px; padding: 10px 12px; border-top: 1px solid #eef1f4; }
.hod-q:first-of-type { border-top: 0; }
.hod-q.on { background: #f0f7ff; box-shadow: inset 3px 0 0 #2f6fb3; }
.hod-q.blocked .hod-q-text, .hod-q.na .hod-q-text { opacity: .6; }
.hod-pick { flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; font-size: 12px; font-weight: 600; color: #34495e; padding-top: 2px; }
.hod-pick input { width: 18px; height: 18px; cursor: pointer; margin: 0; }
.hod-q.on .hod-pick span { color: #2f6fb3; }
.hod-q-body { flex: 1; min-width: 0; }
.hod-q-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 4px; }
.hod-q-chips .icon-act { margin-left: auto; min-width: 26px; height: 26px; }
.hod-q-text .q-text { margin: 0 0 4px; }
.hod-q-text .q-options { margin: 4px 0 0; }
.hod-q-text .q-img { max-height: 160px; }
.hod-why { font-size: 12px; color: #9a6a00; margin-top: 4px; }
.hod-final-title { font-size: 18px; margin: 22px 0 10px; color: #1f3a5f; }

/* ---------- Login / users ---------- */
.auth-page { min-height: 100vh; background: linear-gradient(160deg, #1f3a5f 0%, #2c5282 55%, #e9eef5 55.1%); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 10px; box-shadow: 0 12px 40px rgba(16,32,56,.22); padding: 28px 28px 22px; }
.auth-card h1 { font-size: 20px; margin: 18px 0 14px; color: #1f3a5f; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-logo { width: 44px; height: 44px; border-radius: 10px; background: #1f3a5f; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; letter-spacing: 1px; }
.auth-app { font-size: 17px; font-weight: 700; color: #1f3a5f; }
.auth-school { font-size: 12px; color: #5a6a7a; }
.auth-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; font-weight: 600; font-size: 13px; color: #34495e; }
.auth-field input, .auth-field select { height: 38px; padding: 6px 10px; border: 1px solid #c5ccd6; border-radius: 5px; font: inherit; font-weight: normal; font-size: 14px; width: 100%; background: #fff; }
.auth-field input:focus, .auth-field select:focus { outline: none; border-color: #2c5282; box-shadow: 0 0 0 3px rgba(44,82,130,.15); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 40px; }
.pw-eye { position: absolute; right: 4px; top: 4px; height: 30px; width: 32px; border: 0; background: transparent; cursor: pointer; font-size: 16px; opacity: .55; border-radius: 4px; }
.pw-eye:hover, .pw-eye.on { opacity: 1; background: #eef2f7; }
.auth-btn { width: 100%; height: 40px; font-size: 15px; font-weight: 600; margin-top: 4px; }
.auth-error { background: #fdecea; color: #8a1c12; border: 1px solid #f5c2bd; border-radius: 5px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.auth-info { background: #eef4fb; color: #1f3a5f; border: 1px solid #cfe0f3; border-radius: 5px; padding: 9px 12px; margin-bottom: 14px; font-size: 13px; }
.auth-rules { font-size: 12px; color: #6b7a8a; margin: -6px 0 14px; }
.auth-foot { margin-top: 14px; font-size: 12px; color: #6b7a8a; text-align: center; }
.caps-note { display: block; color: #9a6a00; font-size: 12px; margin: -8px 0 10px; }
.auth-inline { max-width: 460px; }
.auth-check { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; padding-top: 22px; }
.denied-card { max-width: 520px; margin: 40px auto; text-align: center; padding: 30px; }
.denied-card h1 { margin: 8px 0; color: #8a1c12; }
.denied-icon { font-size: 40px; }

.user-menu { margin-left: 16px; }
.user-menu .dropdown-toggle { display: inline-flex; align-items: center; gap: 8px; opacity: 1; }
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: #f59e0b; color: #1f2d3d; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11px; background: rgba(255,255,255,.18); border-radius: 10px; padding: 1px 8px; line-height: 18px; }
.dropdown-menu.dropdown-right { right: 0; left: auto; min-width: 220px; }
.user-head { padding: 10px 14px; border-bottom: 1px solid #e6eaf0; color: #222; line-height: 1.4; }
.user-head span { display: block; font-size: 12px; color: #6b7a8a; }
.logout-form { margin: 0; border-top: 1px solid #e6eaf0; }
.logout-form button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 14px; font: inherit; color: #b42318; cursor: pointer; line-height: normal; }
.logout-form button:hover { background: #fdecea; }
@media (max-width: 900px) { .user-name, .user-role { display: none; } }

.role-chip { display: inline-block; border-radius: 10px; padding: 1px 10px; font-size: 12px; font-weight: 600; }
.role-admin { background: #fde2e1; color: #8a1c12; }
.role-hod { background: #e3ecf7; color: #1f3a5f; }
.role-teacher { background: #e7f6ec; color: #1e6b3a; }
.badge.lock { background: #fff1c7; color: #7a5b00; }
.user-modal { max-width: 520px; }
.user-form { padding: 16px 18px 4px; }
.user-row { display: flex; gap: 12px; }
.user-row > .auth-field { flex: 1; }

.home-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-top: 16px; }
.home-tile { display: block; background: #fff; border: 1px solid #dde3ea; border-radius: 8px; padding: 16px; text-decoration: none; color: #222; transition: box-shadow .15s, border-color .15s; }
.home-tile:hover { border-color: #2c5282; box-shadow: 0 4px 14px rgba(31,58,95,.12); }
.home-tile b { display: block; color: #1f3a5f; font-size: 15px; margin-bottom: 4px; }
.home-tile span { font-size: 13px; color: #5a6a7a; }
.bp-pattern .col-comb { width: 90px; text-align: center; white-space: normal; line-height: 1.2; }
.bp-pattern td.col-comb input { width: 18px; height: 18px; cursor: pointer; }

/* ---------- Pictures inside question / option text ---------- */
img.qi-s, img.qi-m, img.qi-l { max-width: 100%; vertical-align: middle; margin: 1px 2px; }
img.qi-s { height: 1.6em; }
img.qi-m { max-height: 90px; }
img.qi-l { max-height: 220px; }
.rte img { cursor: pointer; }
.rte img.qi-on { outline: 2px solid #2c5282; outline-offset: 1px; }
.rte.rte-busy { opacity: .6; cursor: progress; }
.rte-imgbar { position: absolute; z-index: 1200; display: flex; gap: 2px; background: #fff; border: 1px solid #c9d3de; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.15); padding: 3px; }
.rte-imgbar button { border: 0; background: #f6f8fa; color: #1f3a5f; border-radius: 4px; padding: 4px 9px; font: 12px "Segoe UI", Arial, sans-serif; cursor: pointer; }
.rte-imgbar button:hover, .rte-imgbar button.on { background: #e3ecf7; font-weight: 600; }
.rte-imgbar button.danger { color: #b42318; }
.rte-imgbar button.danger:hover { background: #fdecea; }
.bp-pattern .col-or { width: 84px; text-align: center; white-space: normal; line-height: 1.2; }
.bp-pattern td.col-or input { width: 64px; text-align: center; }

/* ---------- OR question (internal choice) on the paper ---------- */
.slot.slot-or { margin-left: 28px; border-left: 3px solid #c7d7ec; background: #fafcff; }
.slot.slot-or.empty { background: #fffdf5; }
.or-tag { display: inline-block; font-weight: 700; font-size: 12px; letter-spacing: 1px; color: #1f3a5f; background: #e3ecf7; border-radius: 10px; padding: 1px 9px; }

/* Syllabus Master: Chapter No. per chapter */
.chapter-grid .col-chno { width: 170px; }
.chapter-grid .chapter-no { width: 100%; height: 30px; padding: 4px 6px; border: 1px solid #cfd6df; border-radius: 4px; background: #fff; font: inherit; }
.chapter-grid tr.row-warn .chapter-no { border-color: #d97706; background: #fff8eb; }
.chapter-grid tfoot .chapter-new td { background: #f5f8fc; border-top: 2px solid #dbe4f0; }
.chapter-grid tfoot .chapter-new .chapter-input { border-color: #c5ccd6; background: #fff; }
.chapter-grid tfoot .chapter-new .col-sno { color: #2c5282; font-weight: 700; }
.chapter-grid .col-add { width: 70px; text-align: center; }
.chapter-grid .col-add .btn { padding: 5px 12px; font-size: 13px; }
.chapter-grid tbody .chapter-input { border-color: #e3e8ee; background: #fff; }
.chapter-grid tbody tr { scroll-margin-top: 44px; scroll-margin-bottom: 52px; }
.chapter-grid tbody tr.row-new td { background: #ecfdf3; transition: background 1.2s; }

/* Blueprint paper pattern: the Question Type column gets the room (full type names visible) */
.bp-pattern { table-layout: auto; }
.bp-pattern th, .bp-pattern td { padding-left: 6px; padding-right: 6px; }
.bp-pattern .col-type { min-width: 290px; }
.bp-pattern td.col-type select { width: 100%; min-width: 270px; }
.bp-pattern .col-num { width: 86px; }
.bp-pattern td.col-num input { width: 70px; }
.bp-pattern .col-order { width: 96px; }
.bp-pattern th.col-num, .bp-pattern th.col-comb, .bp-pattern th.col-or { font-size: 12.5px; line-height: 1.2; white-space: normal; }

/* Subject Group Master */
.grp-members .col-grp-sec { width: 220px; }
.grp-members .col-grp-sec input { width: 100%; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.grp-members select { width: 100%; padding: 4px 6px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.grp-members tfoot td { background: #f5f8fc; border-top: 2px solid #dbe4f0; }

/* Blueprint of a subject group: rows and chapters per subject (paper section) */
.bp-pattern .col-subj { min-width: 190px; }
.bp-pattern td.col-subj select { width: 100%; }
.bp-pattern tr.bp-subj-head td, .bp-dist tr.dist-subj td { background: #eaf1fb; color: #1f3a5f; font-weight: 700; padding: 5px 8px; border-top: 2px solid #c9d8ee; }
.bp-dist tr.dist-unit td { background: #f5f7fa; color: #334155; padding: 5px 8px; border-top: 1px solid #dbe3ec; }
.bp-dist tr.dist-unit td.col-num { font-weight: 700; }
.bp-dist .unit-target { margin-left: 14px; font-weight: 400; font-size: 12px; color: #64748b; }
.bp-dist .unit-target input { width: 80px; margin-left: 4px; padding: 2px 6px; }
.bp-dist .unit-check { margin-left: 10px; font-size: 12px; }
.bp-dist .unit-check.ok { color: #15803d; }
.bp-dist .unit-check.bad { color: #b45309; font-weight: 600; }
.bp-prev-table td.bad { color: #b45309; font-weight: 700; }
.bp-dist td.col-sec.na { color: #c0c8d2; text-align: center; background: #f7f8fa; }
.bp-dist .th-subj { color: #1f3a5f; font-weight: 600; }
.paper-section-head { margin: 14px 0 8px; padding: 8px 12px; background: #eaf1fb; border-left: 4px solid #2c5282; color: #1f3a5f; font-weight: 700; border-radius: 4px; }

/* Important questions */
.star-on { color: #e0a100; }
.star-btn { border: 0; background: transparent; cursor: pointer; font-size: 17px; line-height: 1; padding: 0 0 0 4px; color: #b8c2cc; vertical-align: -1px; }
.star-btn:hover { color: #e0a100; }
.star-btn.on { color: #e0a100; }
.imp-filter, .imp-check { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; }
.imp-filter { margin-left: 6px; font-size: 13px; }
.chip.chip-imp { background: #fff4d6; color: #8a5a00; border: 1px solid #f1d38a; }
.in-imp { color: #b07d00; font-weight: 600; }

/* Bulk upload: template for one class / subject */
.tpl-grid { margin-bottom: 12px; }
.tpl-sections { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 0; }
.tpl-sec { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* Add Question: other chapters of a question covering several chapters */
.other-chapters { margin-top: 10px; padding: 8px 12px; border: 1px dashed #b9c7d8; border-radius: 6px; background: #f7fafd; }
.other-ch-head { margin-bottom: 6px; }
.other-ch-list { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.other-ch { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

/* Question Type Master form: three groups */
.qt-block { margin-bottom: 14px; }
.qt-block-title { font-weight: 700; color: #1f3a5f; font-size: 13px; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid #e6eaf0; }
.qt-block-title .muted-sm { text-transform: none; letter-spacing: 0; font-weight: normal; }
.qt-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: end; }
.qt-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qt-settings { grid-template-columns: 140px minmax(0, 1fr) minmax(0, 1fr); align-items: center; }
.qt-grid .field { min-width: 0; }
.qt-check { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid #e3e8ee; border-radius: 6px; background: #fafbfd; cursor: pointer; }
.qt-check input { margin-top: 3px; }
.qt-check span { display: flex; flex-direction: column; }
.qt-check small { color: #6b7a8a; font-size: 12px; }
.qt-note { margin: 8px 0 0; }
@media (max-width: 800px) { .qt-grid, .qt-grid-2, .qt-settings { grid-template-columns: 1fr; } }

/* blueprint pattern: editable % of the row (In Between / From Exercise / Important) */
.bp-pattern td.col-pct, .bp-pattern th.col-pct { min-width: 92px; }
.pct-input.pct-sm { display: inline-flex; align-items: center; gap: 3px; }
.bp-pattern td.col-pct .pct-input.pct-sm input { width: 56px; height: auto; padding: 4px 6px; font-size: 14px; text-align: right; }
.bp-pattern td.col-pct { text-align: center; }
.bp-pattern td.col-pct .in-bank { display: block; font-size: 11px; margin-top: 2px; white-space: nowrap; }

/* question paper: bank panel note for the selected place */
.bank-sel-note { margin: 6px 0; padding: 6px 10px; background: #eef4fb; border: 1px solid #c9daef; border-radius: 4px; font-size: 12.5px; line-height: 1.4; }
.bank-sel-note .link, .empty-note .link { padding: 0; font-size: inherit; }

/* ---- Table tool (question text): which lines show is chosen in the editor ---- */
.rte table.qt { border-collapse: collapse; margin: 6px 0; }
.rte table.qt td, .rte table.qt th { border: 0; padding: 3px 10px; vertical-align: top; }
.rte table.qt th { font-weight: bold; text-align: center; }
.rte table.qt td.cl, .rte table.qt th.cl { border-left: 1px solid #000; }
.rte table.qt td.cr, .rte table.qt th.cr { border-right: 1px solid #000; }
.rte table.qt.qt-top tr:first-child > td, .rte table.qt.qt-top tr:first-child > th { border-top: 1px solid #000; }
.rte table.qt.qt-head tr:first-child > td, .rte table.qt.qt-head tr:first-child > th { border-bottom: 1px solid #000; }
.rte table.qt.qt-rows tr + tr > td, .rte table.qt.qt-rows tr + tr > th { border-top: 1px solid #000; }
.rte table.qt.qt-bottom tr:last-child > td, .rte table.qt.qt-bottom tr:last-child > th { border-bottom: 1px solid #000; }
.q-text table.qt { border-collapse: collapse; margin: 6px 0; }
.q-text table.qt td, .q-text table.qt th { border: 0; padding: 3px 10px; vertical-align: top; }
.q-text table.qt th { font-weight: bold; text-align: center; }
.q-text table.qt td.cl, .q-text table.qt th.cl { border-left: 1px solid #000; }
.q-text table.qt td.cr, .q-text table.qt th.cr { border-right: 1px solid #000; }
.q-text table.qt.qt-top tr:first-child > td, .q-text table.qt.qt-top tr:first-child > th { border-top: 1px solid #000; }
.q-text table.qt.qt-head tr:first-child > td, .q-text table.qt.qt-head tr:first-child > th { border-bottom: 1px solid #000; }
.q-text table.qt.qt-rows tr + tr > td, .q-text table.qt.qt-rows tr + tr > th { border-top: 1px solid #000; }
.q-text table.qt.qt-bottom tr:last-child > td, .q-text table.qt.qt-bottom tr:last-child > th { border-bottom: 1px solid #000; }
/* editor only: faint guides where no line is printed, so cells can be seen */
.rte table.qt td, .rte table.qt th { outline: 1px dashed #cbd5e1; outline-offset: -1px; min-width: 40px; }
.rte table.qt.qt-on { box-shadow: 0 0 0 2px rgba(44,82,130,.35); }
.rte-tbar { position: absolute; z-index: 1200; background: #fff; border: 1px solid #c5ccd6; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.15); padding: 6px 8px; font-size: 12.5px; max-width: 640px; }
.rte-tbar-btns { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.rte-tbar-btns button { border: 1px solid #c5ccd6; background: #f8fafc; border-radius: 4px; padding: 3px 7px; cursor: pointer; font-size: 12px; }
.rte-tbar-btns button:hover { background: #eef2f7; }
.rte-tbar-btns button.danger { color: #b42318; }
.rte-tlines { margin-top: 6px; border-top: 1px solid #e6eaf0; padding-top: 6px; }
.rte-tlines-cols { display: flex; align-items: stretch; height: 30px; margin-bottom: 6px; }
.rte-tlines-cols .vcol { flex: 1; min-width: 30px; display: flex; align-items: center; justify-content: center; background: #f1f5f9; color: #64748b; font-size: 11px; }
.rte-tlines-cols .vcol.cur { background: #dbe7f5; color: #1e3a5f; font-weight: 600; }
.rte-tlines-cols .vline { width: 12px; border: 0; padding: 0; background: transparent; cursor: pointer; position: relative; }
.rte-tlines-cols .vline::after { content: ''; position: absolute; left: 5px; top: 2px; bottom: 2px; width: 2px; background: #cbd5e1; border-radius: 1px; }
.rte-tlines-cols .vline.on::after { background: #111; }
.rte-tlines-cols .vline:hover::after { background: #2c5282; }
.rte-tlines-h { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.rte-tlines-h label { font-weight: normal; margin: 0; cursor: pointer; }
.rte-tlines-p { margin-top: 4px; color: #64748b; }
.rte-tlines-p .link { padding: 0; font-size: 12px; }
.rte-tdlg-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 1300; display: flex; align-items: center; justify-content: center; }
.rte-tdlg { background: #fff; border-radius: 8px; width: 380px; max-width: calc(100vw - 32px); box-shadow: 0 12px 32px rgba(0,0,0,.25); }
.rte-tdlg-head { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid #e6eaf0; }
.rte-tdlg-body { padding: 14px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.rte-tdlg-body label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; margin: 0; }
.rte-tdlg-body label input[type=number], .rte-tdlg-body select { height: 32px; padding: 4px 8px; border: 1px solid #c5ccd6; border-radius: 4px; font: inherit; }
.rte-tdlg-body .rte-tdlg-wide { grid-column: 1 / -1; }
.rte-tdlg-body label.rte-tdlg-wide:has(input[type=checkbox]) { flex-direction: row; align-items: center; font-weight: normal; }
.rte-tdlg-foot { padding: 10px 16px; border-top: 1px solid #e6eaf0; display: flex; justify-content: flex-end; gap: 8px; }

/* paper builder: tables in the questions on the paper look as they print */
.slot-text table { border-collapse: collapse; margin: 4px 0; }
.slot-text td, .slot-text th { border: 1px solid #c5ccd6; padding: 2px 8px; }
.slot-text table.qt { border-collapse: collapse; margin: 6px 0; }
.slot-text table.qt td, .slot-text table.qt th { border: 0; padding: 3px 10px; vertical-align: top; }
.slot-text table.qt th { font-weight: bold; text-align: center; }
.slot-text table.qt td.cl, .slot-text table.qt th.cl { border-left: 1px solid #000; }
.slot-text table.qt td.cr, .slot-text table.qt th.cr { border-right: 1px solid #000; }
.slot-text table.qt.qt-top tr:first-child > td, .slot-text table.qt.qt-top tr:first-child > th { border-top: 1px solid #000; }
.slot-text table.qt.qt-head tr:first-child > td, .slot-text table.qt.qt-head tr:first-child > th { border-bottom: 1px solid #000; }
.slot-text table.qt.qt-rows tr + tr > td, .slot-text table.qt.qt-rows tr + tr > th { border-top: 1px solid #000; }
.slot-text table.qt.qt-bottom tr:last-child > td, .slot-text table.qt.qt-bottom tr:last-child > th { border-bottom: 1px solid #000; }

/* equations (LaTeX via KaTeX) */
.rte-math-preview { margin: 4px 0 6px; padding: 6px 10px; background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 4px; font-size: 14px; overflow-x: auto; }
.rte-math-label { color: #64748b; font-size: 12px; margin-right: 4px; }
.rte-eqdlg { width: 620px; }
.rte-eq-body { padding: 12px 16px; }
.rte-eq-tpl { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.rte-eq-tpl button { border: 1px solid #c5ccd6; background: #f8fafc; border-radius: 4px; padding: 3px 8px; cursor: pointer; font-size: 13px; min-width: 36px; }
.rte-eq-tpl button:hover { background: #eef2f7; }
.rte-eq-lbl { display: block; font-weight: 600; margin: 0 0 4px; }
.rte-eqdlg textarea { width: 100%; box-sizing: border-box; font: 14px/1.4 Consolas, "Courier New", monospace; padding: 6px 8px; border: 1px solid #c5ccd6; border-radius: 4px; }
.rte-eq-prev { margin-top: 10px; min-height: 48px; padding: 8px; border: 1px solid #e6eaf0; border-radius: 4px; background: #fff; overflow-x: auto; font-size: 16px; }

/* blueprint pattern: heading of the row under the question type */
.bp-pattern td.col-type input.bp-heading { display: block; width: 100%; min-width: 270px; margin-top: 4px; font-size: 12.5px; padding: 4px 6px; box-sizing: border-box; }
.bp-pattern td.col-type input.bp-heading::placeholder { color: #94a3b8; font-style: italic; }

/* blueprint: sections of a single-subject paper */
.bp-parts { margin: 0 0 10px; }
.bp-parts-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.bp-parts-head .btn { margin-left: auto; }
.bp-parts-table input[type=text] { width: 100%; box-sizing: border-box; }
.bp-parts-table .col-move { width: 96px; white-space: nowrap; }

/* question view: split a Match question into single pairs */
.split-bar { margin-top: 12px; padding-top: 10px; border-top: 1px solid #e6eaf0; }
.icon-act.split-act { font-size: 16px; line-height: 1; color: #2c5282; }

/* syllabus: units and exam ticks */
.unit-grid { margin: 6px 0 4px; }
.unit-grid input[type=text] { width: 100%; box-sizing: border-box; }
.unit-grid .col-move { width: 96px; white-space: nowrap; }
.chapter-grid .col-unit { width: 190px; }
.chapter-grid .col-unit select { width: 100%; }
.chapter-grid .col-exams { min-width: 180px; }
.chapter-grid tr.unit-head td { background: #eef4fb; font-weight: 600; border-top: 2px solid #c9daef; }
.ex-tick { display: inline-flex; align-items: center; gap: 3px; margin: 1px 8px 1px 0; font-weight: normal; font-size: 12px; white-space: nowrap; cursor: pointer; }
.ex-tick input { margin: 0; }
.ex-all { margin-top: 3px; font-weight: normal; }
.chapter-list li.unit-li { list-style: none; margin: 8px 0 2px -16px; }

/* ---------- multi delete (lists) ---------- */
.md-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; padding: 6px 10px; background: #fff4f4; border: 1px solid #f5c2c2; border-radius: 6px; }
.md-bar[hidden] { display: none; }
.md-count { font-weight: 600; color: #9f1239; }
.btn-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
input.md-pick, input.md-all { margin: 0 6px 0 0; vertical-align: middle; cursor: pointer; }
tr.md-on > td { background: #fff1f2; }

/* ---------- privacy notice ---------- */
.privacy h3 { margin: 18px 0 6px; font-size: 15px; color: #1f3a5f; }
.privacy ul { margin: 0 0 6px; padding-left: 20px; }
.privacy li { margin: 3px 0; }

/* ---------- Activity Log: compare with previous record ---------- */
.qb-modal:has(.ch-diff) { width: 1100px; }
.ch-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.ch-bar label { font-weight: normal; cursor: pointer; }
.ch-table th:first-child { width: 22%; }
.ch-table td, .ch-table tbody th { vertical-align: top; white-space: pre-wrap; word-break: break-word; text-align: left; }
.ch-table tbody th { font-weight: 600; background: #f8fafc; }
.ch-table.only-changed tr.ch-same { display: none; }
.ch-table tr.ch-changed td, .ch-table tr.ch-added td, .ch-table tr.ch-removed td { background: #fffdf5; }
.ch-table del { background: #fde2e1; color: #9f1c13; text-decoration: line-through; border-radius: 2px; }
.ch-table ins { background: #dcf5e3; color: #11602c; text-decoration: none; border-radius: 2px; }
.ch-tag { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 9px; font-size: 11px; font-weight: normal; background: #fef0c7; color: #93370d; }
.ch-none { color: #94a3b8; }

/* blueprint: invalid "Attempt any" */
.bp-pattern input.input-error { border-color: #d92d20; background: #fef3f2; }

/* ---------- User rights: buttons of things the user cannot do are hidden (the server refuses them too) ---------- */
body.no-add a[href$="/Create"], body.no-add a[href*="/Create?"], body.no-add a[href$="/BulkUpload"], body.no-add [data-rep],
body.no-edit a[href*="/Edit/"], body.no-edit a[href*="/Edit?"], body.no-edit [data-edit],
body.no-del [data-del], body.no-del .md-bar, body.no-del .md-all, body.no-del .md-pick,
body.no-print a[href*="/Print/"],
body.no-down a[href*="/BulkTemplate"], body.no-down #btnCsv { display: none !important; }
body.no-add.no-edit .card:has(> #masterForm) { display: none; }

.rights-table td, .rights-table th { text-align: center; }
.rights-table td:first-child, .rights-table th:first-child { text-align: left; }
.rights-table td.na { color: #cbd5e1; }
.rights-table tr.rights-group td { background: #f1f5f9; font-weight: 600; color: #1f3a5f; text-align: left; }
.rights-table input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; }

/* HOD final paper: follow the blueprint for chapters / levels */
.follow-bp { margin-top: 12px; padding: 8px 12px; background: #f8fafc; border: 1px solid #e6eaf0; border-radius: 6px; }
.follow-bp label { font-weight: normal; cursor: pointer; margin-right: 10px; }
.follow-bp .muted-sm { display: block; margin-top: 2px; }

#flTable tr.row-current td { background: #eef6ff; }
#finalListCard .list-head { gap: 12px; }
