:root {
    --primary: #1c5da8;
    --primary-dark: #123f7c;
    --primary-soft: #e8f1fb;
    --navy: #0d3a75;
    --navy-deep: #0a2d5c;
    --bg: #eef2f8;
    --text: #22303e;
    --muted: #65748a;
    --border: #d7dfea;
    --success: #178a5c;
    --success-bg: #e4f6ee;
    --danger: #c43b30;
    --danger-bg: #fcebe9;
    --warn: #a46a0e;
    --warn-bg: #fff5e0;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(13, 45, 84, .06), 0 10px 26px rgba(13, 45, 84, .07);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.7 "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

h1, h2, h3 {
    margin: 0 0 10px;
    line-height: 1.35;
    color: var(--navy);
}

h1 {
    font-size: 24px;
}

h2 {
    font-size: 18px;
}

p {
    margin: 6px 0;
}

code {
    background: #f1f4f8;
    border-radius: 4px;
    padding: 1px 6px;
    font-family: Consolas, "Courier New", monospace;
    font-size: .92em;
}

.container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0 28px;
}

.topbar {
    background: linear-gradient(90deg, #0d3b7c 0%, #1655a6 55%, #1c66bf 100%);
    box-shadow: 0 2px 12px rgba(10, 45, 92, .22);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-inner {
    min-height: 42px;
    display: flex;
    align-items: center;
    /* 顶栏只剩导航：整体靠右，高度压扁 */
    justify-content: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 0 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    letter-spacing: .3px;
}

.brand:hover {
    text-decoration: none;
    color: #fff;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 8px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 5px 13px;
    border-radius: 7px;
    color: #d7e5f7;
    font-size: 13.5px;
    transition: background .15s, color .15s;
}

.nav-link:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, .22);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 -2px 0 rgba(255, 255, 255, .7);
}

.main {
    flex: 1 0 auto;
    width: 100%;
    padding: 26px 28px 64px;
}

.footer {
    flex: none;
    background: var(--navy-deep);
    color: #9db5d3;
    font-size: 13px;
    padding: 18px 0;
    text-align: center;
    border-top: 3px solid #175aa8;
}

.footer-inner {
    padding: 0 28px;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-head h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--navy);
}

.page-head h1::before {
    content: "";
    width: 5px;
    height: 22px;
    border-radius: 3px;
    background: linear-gradient(180deg, #3d86d6, var(--primary-dark));
    flex: none;
}

.page-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.page-actions form {
    margin: 0;
}

.sub {
    color: var(--muted);
    font-size: 13.5px;
    margin: 2px 0 0;
}

.panel {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(23, 70, 125, .07);
    padding: 20px;
    margin-bottom: 18px;
}

.bank-info p {
    color: #3a485a;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    cursor: pointer;
    background: #fff;
    color: var(--text);
    line-height: 1.4;
    transition: background .15s, border-color .15s, box-shadow .15s;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: #fff;
}

.btn-outline {
    border-color: #c4cedb;
    background: #fff;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f7faff;
}

.btn-danger {
    color: var(--danger);
    border-color: #e3b0aa;
}

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

.btn-link {
    padding: 6px 10px;
    color: var(--primary);
}

.btn-link:hover {
    background: var(--primary-soft);
    text-decoration: none;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 11px 22px;
    font-size: 15px;
}

.btn:disabled,
.btn.disabled {
    opacity: .55;
    cursor: not-allowed;
}

.notice {
    background: var(--warn-bg);
    border: 1px solid #f0d590;
    color: #6d4a0b;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    font-size: 14px;
}

.notice-ok {
    background: var(--success-bg);
    border-color: #a9ddc7;
    color: #0e5f40;
}

.notice-error {
    background: var(--danger-bg);
    border-color: #ecc1bd;
    color: #8f2a21;
}

.notice-warn ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.notice a {
    font-weight: 600;
}

.good-tip {
    background: var(--success-bg);
    color: #0e5f40;
    border: 1px solid #a9ddc7;
    padding: 14px 16px;
    border-radius: 8px;
}

.hl {
    color: var(--danger);
    font-weight: 700;
}

.stat-strip {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(23, 70, 125, .07);
    border-left: 4px solid var(--primary);
    padding: 12px 18px;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 26px;
    color: #44526a;
    font-size: 14px;
}

.stat-strip strong {
    color: var(--primary-dark);
    font-size: 16px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    text-align: center;
}

.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.filter-panel {
    padding: 12px 16px;
    margin-bottom: 6px;
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 14px;
    align-items: end;
}

.field-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.kw-box {
    flex: 1 1 260px;
    min-width: 0;
}

/* 题干关键词：标签 + 输入框 + 搜索按钮 同一行 */
.kw-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.kw-label {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.kw-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 160px;
}

.kw-submit {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* 每页题数放在搜索行最右侧 */
.kw-page-size {
    flex: 0 0 auto;
    white-space: nowrap;
}

.kw-input-wrap input {
    width: 100%;
    padding: 9px 34px 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

.kw-input-wrap input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(28, 93, 168, .13);
}

.kw-clear,
.smd-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: #e3e9f1;
    color: #55647a;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
}

.kw-clear:hover,
.smd-search-clear:hover {
    background: var(--danger);
    color: #fff;
}

.filter-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.smd {
    position: relative;
    min-width: 0;
    width: 220px;
    flex: 0 1 220px;
}

.smd-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    text-align: left;
}

.smd-toggle:hover {
    border-color: var(--primary);
}

.smd.open .smd-toggle {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(28, 93, 168, .13);
}

.smd-title {
    color: var(--muted);
    flex: none;
}

.smd-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
    color: #25364d;
}

.smd-panel {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 60;
    width: 100%;
    min-width: 300px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(18, 38, 66, .16);
    overflow: hidden;
}

.smd.open .smd-panel {
    display: flex;
}

.smd-search {
    position: relative;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.smd-search input {
    width: 100%;
    padding: 7px 30px 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13.5px;
}

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

.smd-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 6px;
}

.smd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 9px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 14px;
}

.smd-item:hover {
    background: #f1f5fa;
}

.smd-item input {
    flex: none;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.smd-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smd-count {
    flex: none;
    margin-left: auto;
    background: #edf1f6;
    color: var(--muted);
    border-radius: 999px;
    padding: 0 8px;
    font-size: 12px;
}

.smd-empty {
    text-align: center;
    color: var(--muted);
    padding: 16px;
    font-size: 13px;
}

.smd-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    background: #f7f9fc;
    padding: 8px 10px;
}

.file-result-head {
    margin: 18px 0 6px;
    font-size: 15px;
    color: #18385f;
}

.page-size {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 4px 8px 4px 12px;
    font-size: 13px;
    color: var(--muted);
    box-shadow: 0 1px 2px rgba(13, 45, 84, .05);
}

.page-size select {
    border: 1px solid #c5d0de;
    border-radius: 6px;
    padding: 4px 6px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    outline: none;
}

.page-size select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(28, 93, 168, .12);
}

.page-hint {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    color: #4c5c72;
}

.empty-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 60px 20px;
    text-align: center;
    color: var(--muted);
}

.qcard {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(23, 70, 125, .07);
    border-left: 6px solid #d9e5f2;
    padding: 20px 22px;
    margin-bottom: 18px;
    transition: border-color .2s;
}

.qcard.correct {
    border-left-color: var(--success);
}

.qcard.wrong {
    border-left-color: var(--danger);
}

.qmeta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 12px;
    font-size: 12.5px;
    background: #edf1f6;
    color: #46566c;
    white-space: nowrap;
}

.type-single {
    background: #e4eefc;
    color: #15579f;
    font-weight: 600;
}

.type-multiple {
    background: #eee7fb;
    color: #6a41bd;
    font-weight: 600;
}

.type-judge {
    background: #e0f5ef;
    color: #0c7459;
    font-weight: 600;
}

.difficulty-badge {
    background: #e4f3e9;
    color: #1d6b3a;
}

.answer-badge {
    background: #fdf0d8;
    color: #97600c;
    font-weight: 700;
    font-size: 15px;
    padding: 3px 14px;
}

.qstem {
    font-size: 15.5px;
    font-weight: 600;
    color: #1f2b3a;
    white-space: pre-wrap;
    margin-bottom: 14px;
    line-height: 1.8;
}

.qstem .kw-hl {
    background: #ffe58a;
    color: #7a4d00;
    font-weight: 700;
    border-radius: 3px;
    padding: 0 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.options {
    display: grid;
    gap: 6px;
    margin-bottom: 4px;
}

.opt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fbfcfe;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.opt:hover {
    border-color: #9db8d8;
    background: #f2f7fd;
}

.opt input {
    flex: none;
    margin: 2px 0 0;
    width: 15px;
    height: 15px;
    accent-color: var(--primary);
}

.opt:has(input:checked) {
    border-color: var(--primary);
    background: #f1f7fe;
}

.okey {
    flex: none;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    border-radius: 50%;
    background: #e7edf4;
    color: #2c3d55;
    font-weight: 700;
    font-size: 12.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.opt input:checked + .okey {
    background: var(--primary);
    color: #fff;
}

.ocontent {
    color: #2b394b;
    font-size: 14px;
    line-height: 1.5;
}

.opt input:disabled {
    opacity: .55;
}

.qcard.graded .opt {
    cursor: default;
}

.qactions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

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

.qstate.error {
    color: var(--danger);
    font-weight: 600;
}

.qstate.busy {
    color: var(--muted);
}

.qresult {
    display: none;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 9px;
    border: 1px solid #b9e1cf;
    background: var(--success-bg);
    color: #10402c;
    font-size: 14px;
}

.qcard.wrong .qresult {
    border-color: #eec4c0;
    background: var(--danger-bg);
    color: #6d241d;
}

.qresult.show {
    display: block;
}

.verdict {
    font-size: 15.5px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ans-lines {
    display: grid;
    gap: 3px;
}

.ans-lines .okpart {
    color: #0d6b45;
}

.qcard.wrong .ans-lines .okpart {
    color: #c43b30;
}

.ans-lines .badpart {
    color: var(--danger);
    font-weight: 600;
}

.ans-lines .misspart {
    color: #9a6408;
    font-weight: 600;
}

.ref-label {
    font-weight: 700;
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 22px 0 6px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-sizing: border-box;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: #3c4c60;
}

.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
}

.page-btn:disabled,
.page-btn.disabled {
    opacity: .45;
    cursor: not-allowed;
}

.page-ellipsis {
    color: var(--muted);
    padding: 0 3px;
}

.table-wrap {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.table th {
    background: #f6f8fb;
    color: #55647a;
    font-size: 13px;
    white-space: nowrap;
}

.table-sm th,
.table-sm td {
    padding: 7px 10px;
}

.row-main-error {
    background: #fff7f5;
    font-weight: 600;
}

.bar-track {
    background: #edf0f5;
    border-radius: 6px;
    height: 10px;
    max-width: 280px;
    overflow: hidden;
}

.bar-fill {
    background: #d96b5f;
    border-radius: 6px;
    height: 100%;
    min-width: 2px;
}

.rule-note {
    color: var(--muted);
    font-size: 13px;
    margin-top: 14px;
}

.upload-box {
    border: 1.5px dashed #b9c6d6;
    border-radius: 10px;
    background: #fafbfd;
    padding: 28px;
    text-align: center;
    margin-bottom: 16px;
}

.upload-box input[type="file"] {
    font-size: 14px;
}

.pw-box {
    max-width: 420px;
    margin: 0 0 16px;
}

.pw-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
}

.pw-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(28, 93, 168, .13);
}

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

.radio-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

/* “新增题目”表单 */
.add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px 16px;
    margin-bottom: 16px;
}

.add-field-full {
    grid-column: 1 / -1;
}

/* 必填项标签：红色标识 */
.field-required {
    color: var(--danger);
    font-weight: 600;
}

.add-field input,
.add-field select,
.add-field textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
}

.add-field textarea {
    resize: vertical;
    line-height: 1.6;
}

.add-field input:focus,
.add-field select:focus,
.add-field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(28, 93, 168, .13);
}

.add-field input:disabled {
    background: #f2f5f9;
    color: var(--muted);
}

.radio-card {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    background: #fff;
}

.radio-card:has(input:checked) {
    border-color: var(--primary);
    background: #f3f8fe;
}

.radio-card input {
    margin: 4px 0 0;
    accent-color: var(--primary);
}

.radio-card span {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.radio-card small {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.type-dist {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 6px 0 12px;
}

.panel-head-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.panel-head-row h2 {
    margin-bottom: 0;
}

.clear-bank-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.clear-bank-form input[type="password"] {
    width: 170px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--text);
}

.clear-bank-form input[type="password"]:focus {
    outline: none;
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(196, 59, 48, .12);
}

.exam-badge {
    background: #eef1f8;
    color: #39476a;
    border: 1px solid #d7dce8;
    font-weight: 600;
}

.warn-list {
    max-height: 260px;
    overflow-y: auto;
    font-size: 13px;
}

@media (max-width: 900px) {
    .topbar-inner,
    .main,
    .footer-inner,
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .smd {
        flex: 1 1 46%;
        width: auto;
    }
    .smd-panel {
        min-width: 100%;
        width: max(300px, 100%);
    }
}

@media (max-width: 620px) {
    .topbar-inner {
        justify-content: center;
    }

    .brand {
        font-size: 16px;
    }

    .smd {
        flex-basis: 100%;
    }
    .smd-panel {
        width: 100%;
    }

    .page-head {
        align-items: flex-start;
    }

    .qcard {
        padding: 16px;
    }

    /* 窄屏时搜索行允许换行，避免输入框被挤没 */
    .kw-row {
        flex-wrap: wrap;
    }
}
