/* ==========================================================================
   招聘初筛在线测评系统 — 样式表

   相比 v1 的 35 行 CSS，主要是补上这次新增功能的组件：
   维度进度条、统计卡、详情页逐题还原、分页、筛选表单、异常标记、模态框。
   全部为原生 CSS，无构建步骤，便于内网部署。
   ========================================================================== */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #e0e6ef;
    --border-strong: #c9d3e1;
    --text: #172033;
    --text-muted: #65738a;
    /* 原为 #8c99ad，白底对比度仅 2.89:1，低于 WCAG AA 的 4.5:1，已改为 5.38:1 */
    --text-faint: #5f6b80;
    --brand: #2867c8;
    --brand-dark: #1d4f9f;
    --brand-soft: #eef5ff;
    --positive: #1f7a4d;
    --positive-soft: #e8f6ee;
    --warn: #a35a00;
    --warn-soft: #fff4e5;
    --negative: #b32d2d;
    --negative-soft: #fff1f1;
    --radius: 9px;
    --radius-sm: 6px;
    --shadow: 0 1px 2px rgba(23, 32, 51, 0.04), 0 4px 12px rgba(23, 32, 51, 0.04);
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; }

code {
    font-family: var(--mono);
    font-size: 0.9em;
    background: #eef1f6;
    padding: 1px 5px;
    border-radius: 4px;
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 max(20px, calc((100vw - 1180px) / 2));
    min-height: 58px;
    background: #152238;
    color: #fff;
}

.topbar .brand {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

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

.topbar nav a {
    color: #c3d2e8;
    font-size: 14px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
}

.topbar nav a:hover { background: rgba(255, 255, 255, 0.09); color: #fff; text-decoration: none; }
.topbar nav a.active { background: rgba(255, 255, 255, 0.15); color: #fff; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar .who { font-size: 13px; color: #b9c8dd; }

.candidate-bar { justify-content: space-between; }

/* ---------------------------------------------------------------- 布局 */

.shell {
    max-width: 1180px;
    margin: 26px auto 60px;
    padding: 0 20px;
}

.shell.narrow { max-width: 420px; margin-top: 60px; }
.shell.candidate { max-width: 820px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin: 16px 0;
}

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    align-items: start;
}

.two-col > .card { margin: 0 0 16px; }

/* ------------------------------------------------------------ 文字与提示 */

.hint { color: var(--text-muted); font-size: 14px; }
.hint.small, .small { font-size: 13px; }
.inline-hint { margin-left: 4px; }
.list { margin: 10px 0 0; padding-left: 20px; }
.list li { margin: 4px 0; }

.notice {
    background: var(--brand-soft);
    border-left: 4px solid var(--brand);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 12px 14px;
    margin: 14px 0;
    font-size: 14px;
}

.notice.error { background: var(--negative-soft); border-left-color: var(--negative); }
.notice.warn  { background: var(--warn-soft); border-left-color: var(--warn); }
.notice ul { margin: 6px 0 0; padding-left: 20px; }

.tag {
    display: inline-block;
    background: #eef1f6;
    color: #45536b;
    border-radius: 12px;
    padding: 2px 9px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.tag.positive { background: var(--positive-soft); color: var(--positive); }
.tag.warn     { background: var(--warn-soft); color: var(--warn); }
.tag.negative { background: var(--negative-soft); color: var(--negative); }
/* 「必答」之类的强调标签：之前视图里用了 .tag.brand 但这里没定义，一直是灰的 */
.tag.brand    { background: var(--brand-soft); color: var(--brand); }

/* ------------------------------------------- 行内异步操作（标记必答等） */

/* .tag / .notice 自带 display，会盖掉浏览器 UA 的 [hidden]{display:none}，
   所以这两处必须显式声明，否则"取消必答"后标签还在（.modal[hidden] 同理，见文件末尾） */
.tag[hidden],
.notice[hidden] { display: none; }

/* 异步改动成功后闪一下这一行，明确"改的是这一条" */
tr.row-flash > td { animation: row-flash 1.2s ease-out; }

@keyframes row-flash {
    from { background: var(--brand-soft); }
    to   { background: transparent; }
}

/* 请求进行中：按钮变灰不可点，避免连点发出重复请求 */
.link-button[aria-busy="true"],
.link-button:disabled {
    color: var(--text-muted);
    cursor: progress;
    text-decoration: none;
}

/* 右下角轻提示：替代整页刷新后的顶部 notice */
.async-toast {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    max-width: min(420px, calc(100vw - 40px));
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--brand);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    font-size: 14px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.async-toast.is-visible { opacity: 1; transform: translateY(0); }
.async-toast.is-ok      { border-left-color: var(--positive); }
.async-toast.is-error   { border-left-color: var(--negative); }

/* ---------------------------------------------------------------- 表单 */

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px; }
.field .req { color: var(--negative); }

input[type="text"], input[type="password"], input[type="number"],
input[type="datetime-local"], input:not([type]), select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font: inherit;
    color: var(--text);
    background: #fff;
}

textarea { min-height: 92px; resize: vertical; }

input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 18px;
}

.checkbox-field { display: flex; align-items: flex-end; }

.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: 400;
    font-size: 14px;
    margin-bottom: 14px;
    cursor: pointer;
}

.checkbox input { width: auto; margin-top: 3px; flex: none; }

.option-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.option-table th { font-size: 13px; color: var(--text-muted); font-weight: 600; text-align: left; padding: 6px 8px; }
.option-table td { padding: 5px 8px; vertical-align: middle; }
.option-table .option-letter { width: 34px; font-weight: 700; color: var(--text-muted); }
.option-table select { width: 100%; min-width: 150px; }

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 16px;
    align-items: end;
}

.filter-form .actions { grid-column: 1 / -1; margin-top: 0; }
.filter-form .checkbox-field { align-items: center; margin-bottom: 14px; }

/* ---------------------------------------------------------------- 按钮 */

button, .button {
    display: inline-block;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 9px 16px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

button:hover, .button:hover { background: var(--brand-dark); text-decoration: none; }

.button.secondary, button.secondary { background: #e8edf5; color: #263651; }
.button.secondary:hover, button.secondary:hover { background: #dbe3ee; }

.button.danger, button.danger { background: var(--negative); }
.button.danger:hover, button.danger:hover { background: #962626; }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--brand);
    font: inherit;
    font-weight: 400;
    cursor: pointer;
}

.link-button:hover { background: none; text-decoration: underline; }

.topbar .link-button { color: #c3d2e8; }

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

form.inline { display: inline; }
form.inline button.link-button { margin-left: 10px; }

/* ------------------------------------------------------------ 统计卡片 */

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

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}

.stat-label { display: block; font-size: 13px; color: var(--text-muted); }
.stat-value { display: block; font-size: 26px; font-weight: 700; line-height: 1.3; }
.stat-value.positive { color: var(--positive); }
.stat-value.warn { color: var(--warn); }

/* ------------------------------------------------------------ 进度条 */

.bar-list { list-style: none; margin: 0; padding: 0; }
.bar-list li { margin-bottom: 14px; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; margin-bottom: 5px; }

.bar, .mini-bar {
    height: 8px;
    background: #e9eef5;
    border-radius: 99px;
    overflow: hidden;
}

.bar > span, .mini-bar > span {
    display: block;
    height: 100%;
    background: var(--brand);
    border-radius: 99px;
}

.mini-bar { width: 90px; display: inline-block; margin-right: 6px; vertical-align: middle; }

.progress-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.progress-text { font-size: 13px; color: var(--text-muted); }
.progress-bar { height: 6px; background: #e9eef5; border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.progress-bar > span { display: block; height: 100%; background: var(--positive); transition: width 0.2s ease; }

/* ---------------------------------------------------------------- 列表 */

.kv-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.kv-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #f0f3f8; }
.kv-list li:last-child { border-bottom: 0; }
.kv-list li.separator { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }
.kv-list span { color: var(--text-muted); }

/* ---------------------------------------------------------------- 表格 */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid #eef1f6; vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
.nowrap { white-space: nowrap; }
.detail-cell { font-family: var(--mono); font-size: 12px; color: var(--text-muted); max-width: 340px; word-break: break-all; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 18px; }
.mini-table th, .mini-table td { padding: 8px 10px; border-bottom: 1px solid #eef1f6; }

/* ---------------------------------------------------------------- 分页 */

.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager .current {
    min-width: 34px;
    text-align: center;
    padding: 5px 9px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: #fff;
}

.pager .current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------- 分享 */

.share-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: start;
    margin-top: 16px;
}

.link-box input { font-family: var(--mono); font-size: 13px; background: #f6f8fb; }
.qr-box { text-align: center; }
.qr-box img { border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; padding: 6px; }

/* ------------------------------------------------------------ 回执/详情 */

.receipt { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; margin: 14px 0; font-size: 14px; }
.receipt dt { color: var(--text-muted); }
.receipt dd { margin: 0; }

.score-big { margin: 4px 0 10px; }
.score-big strong { font-size: 30px; font-weight: 700; }

/* ------------------------------------------------------------ 候选人答题 */

.question { border: 0; border-top: 1px solid #eef1f6; padding: 18px 0 6px; margin: 0; }
.question:first-of-type { border-top: 0; }
.question-type { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; padding: 0; }
.question-text { font-weight: 600; line-height: 1.6; margin: 0 0 10px; }
.image-note { color: var(--text-muted); font-size: 13px; background: #f6f8fb; padding: 8px 11px; border-radius: var(--radius-sm); margin: 0 0 10px; }

.option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    margin: 7px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 400;
    line-height: 1.5;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.option:hover { border-color: var(--brand); background: #fafcff; }
.option input { width: auto; margin: 4px 0 0; flex: none; }
.option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 1px; }

.option-mark {
    flex: none;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 50%;
    background: #eef1f6;
    color: #45536b;
    font-size: 12px;
    font-weight: 700;
}

.option:has(input:checked) .option-mark { background: var(--brand); color: #fff; }
.option-text { flex: 1; }

/* ------------------------------------------------------------ 题目配图 */

.question-image {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 10px 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    padding: 6px;
}

.question-image-thumb {
    display: inline-block;
    max-width: 72px;
    max-height: 48px;
    width: auto;
    height: auto;
    margin: 0 8px 0 0;
    vertical-align: middle;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: #fff;
}

/* ------------------------------------------------------------ 逐题还原 */

.review-item { border-top: 1px solid #eef1f6; padding: 18px 0 8px; }
.review-item:first-of-type { border-top: 0; padding-top: 4px; }
.review-item header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.review-options { list-style: none; margin: 10px 0 0; padding: 0; }

.review-options li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 5px 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.review-options li.selected { border-color: var(--brand); background: var(--brand-soft); }
.review-options li.best { border-color: var(--positive); background: var(--positive-soft); }
.review-options li.selected.best { border-color: var(--positive); background: var(--positive-soft); }
.review-options .option-score { margin-left: auto; color: var(--text-muted); font-size: 13px; white-space: nowrap; }

.flag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; white-space: nowrap; }
.flag-selected { background: var(--brand); color: #fff; }
.flag-best { background: var(--positive); color: #fff; }

/* ---------------------------------------------------------------- 计时 */

.timer { display: flex; align-items: baseline; gap: 8px; }
.timer-label { font-size: 12px; color: #a9bad3; }
.timer-value { font-family: var(--mono); font-size: 19px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.timer-value.urgent { color: #ffb4b4; }

/* ---------------------------------------------------------------- 模态 */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 26, 43, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 50;
}

.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: var(--radius); padding: 26px; max-width: 420px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); }

/* ---------------------------------------------------------------- 其他 */

.trace {
    font-family: var(--mono);
    font-size: 12px;
    background: #f6f8fb;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    overflow-x: auto;
    max-height: 320px;
}

.plain { padding-bottom: 40px; }

@media (max-width: 720px) {
    .topbar { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px 18px; }
    .topbar nav { width: 100%; }
    .shell { margin-top: 18px; padding: 0 14px; }
    .card { padding: 17px; }
    .share-grid { grid-template-columns: 1fr; }
    .receipt { grid-template-columns: 1fr; gap: 2px; }
    .receipt dt { margin-top: 8px; }
    .review-options li { flex-wrap: wrap; }
    .review-options .option-score { margin-left: 0; }
}
