/* ===== 会计经审在线考试系统 共享样式 ===== */
:root {
  --primary: #1e5fbf;
  --primary-dark: #16498f;
  --primary-soft: #e8f0fc;
  --danger: #d64545;
  --danger-soft: #fdeaea;
  --ok: #2e9e5b;
  --ok-soft: #e6f6ee;
  --warn: #c98a12;
  --warn-soft: #fdf3dd;
  --bg: #f0f3f8;
  --card: #ffffff;
  --border: #d9e0ea;
  --text: #22304a;
  --muted: #6b7a93;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.center-text { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  box-shadow: 0 2px 10px rgba(30, 60, 110, .06);
}
.overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center;
  justify-content: center; padding: 20px;
}

/* 按钮 */
.btn {
  display: inline-block; border: 1px solid var(--border); border-radius: 7px;
  padding: 9px 18px; font-size: 15px; cursor: pointer; background: #fff; color: var(--text);
  text-decoration: none; line-height: 1.2;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #b93636; color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { background: #237f49; color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 表单 */
input[type=text], input[type=password], input[type=number], input[type=datetime-local],
select, textarea {
  border: 1px solid var(--border); border-radius: 7px; padding: 9px 12px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 95, 191, .12);
}
label.fld { display: block; margin-bottom: 14px; }
label.fld > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.row { display: flex; align-items: center; }
.row > * + * { margin-left: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* 表格 */
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl th, .tbl td { border: 1px solid var(--border); padding: 9px 12px; text-align: left; font-size: 14px; }
.tbl th { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; white-space: nowrap; }
.tbl tr:nth-child(even) td { background: #fafbfe; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12.5px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--primary-soft); color: var(--primary); }

/* 登录页 */
.login-card { width: 400px; max-width: 94vw; }
.login-card h1 { margin: 0 0 6px; font-size: 26px; text-align: center; }
.login-card .sub { color: var(--muted); margin: 0 0 22px; text-align: center; }
.login-err { color: var(--danger); font-size: 14px; min-height: 20px; margin-bottom: 8px; }

/* 考生须知 */
.notice-card { width: 560px; max-width: 94vw; }
.notice-card h2 { margin: 0 0 14px; text-align: center; }
.notice-text { max-height: 44vh; overflow: auto; white-space: pre-wrap; line-height: 1.8; border: 1px solid var(--border); border-radius: 8px; background: #fafbfe; padding: 14px 16px; font-size: 14.5px; }

/* 等待页 */
.wait-box { text-align: center; width: 520px; max-width: 94vw; }
.wait-box h2 { margin: 0 0 18px; }
.countdown {
  font-size: 64px; font-weight: 700; color: var(--primary);
  font-variant-numeric: tabular-nums; letter-spacing: 2px; margin: 10px 0;
}
.wait-meta { color: var(--muted); line-height: 1.9; }

/* 答题页 */
.exam-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  background: #14345e; color: #fff; padding: 10px 18px;
}
.exam-bar > * + * { margin-left: 16px; }
.exam-bar .exam-name { font-weight: 600; }
.exam-bar .student-name { opacity: .85; font-size: 14px; }
.timer { margin-left: auto; font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.warn { color: #ffb84d; }
.timer.critical { color: #ff6b6b; }
.exam-body { display: flex; padding: 16px; max-width: 1280px; margin: 0 auto; }
#nav-panel { margin-right: 16px; }
#view-exam { -webkit-user-select: none; user-select: none; }
#nav-panel {
  width: 220px; flex-shrink: 0; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; position: sticky; top: 70px; align-self: flex-start;
}
.nav-title { font-weight: 600; margin-bottom: 10px; }
#question-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.qnav {
  border: 1px solid var(--border); border-radius: 6px; background: #fff; text-align: center;
  padding: 6px 0; font-size: 13px; cursor: pointer; color: var(--text);
}
.qnav.answered { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.qnav.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.qnav.current.answered { background: var(--primary); color: #fff; }
.legend { margin-top: 12px; font-size: 12px; color: var(--muted); line-height: 1.9; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
#question-area { flex: 1; min-width: 0; }
.qcard { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 22px; margin-bottom: 16px; }
.qcard .qno { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.qcard .qtype { display: inline-block; background: var(--primary-soft); color: var(--primary); font-size: 12px; padding: 1px 8px; border-radius: 4px; margin-right: 8px; }
.qcard .stem { font-size: 16px; line-height: 1.7; margin-bottom: 14px; white-space: pre-wrap; }
.opt { display: flex; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.opt > * + * { margin-left: 10px; }
.opt:hover { background: var(--primary-soft); border-color: var(--primary); }
.opt.checked { background: var(--primary-soft); border-color: var(--primary); }
.opt input { margin-top: 3px; }
.opt .letter { font-weight: 700; color: var(--primary); min-width: 22px; }
.qtextarea { width: 100%; min-height: 120px; }
.save-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* 切屏提示 */
#cheat-banner {
  position: fixed; top: 54px; left: 0; right: 0; z-index: 15; background: var(--warn);
  color: #fff; text-align: center; padding: 8px; font-size: 14px; display: none;
}

/* 成绩页 */
.result-wrap { max-width: 860px; margin: 30px auto; padding: 0 16px; }
.score-grid { display: flex; margin: 18px 0; flex-wrap: wrap; }
.score-grid > * + * { margin-left: 16px; }
.score-grid > * { margin-bottom: 10px; }
.score-item { flex: 1; min-width: 140px; text-align: center; background: var(--primary-soft); border-radius: 10px; padding: 16px 10px; }
.score-item .v { font-size: 30px; font-weight: 700; color: var(--primary); }
.score-item .k { font-size: 13px; color: var(--muted); margin-top: 4px; }
.score-item.total .v { font-size: 42px; }
.status-note { background: var(--warn-soft); border: 1px solid #f0d9a8; border-radius: 8px; padding: 10px 14px; font-size: 14px; color: #7a5a12; margin: 14px 0; }
.detail-table { margin-top: 16px; }

/* 管理端 */
.topbar { background: #14345e; color: #fff; display: flex; align-items: center; flex-wrap: wrap; padding: 6px 18px; min-height: 54px; }
.topbar > * + * { margin-left: 14px; }
.topbar .brand { font-size: 17px; font-weight: 700; }
.tabs { display: flex; margin-left: 8px; }
.tabs > * + * { margin-left: 4px; }
.tab {
  background: transparent; border: none; color: rgba(255,255,255,.78); padding: 8px 16px;
  font-size: 15px; cursor: pointer; border-radius: 6px 6px 0 0;
}
.tab:hover { background: rgba(255,255,255,.1); }
.tab.active { background: var(--bg); color: var(--text); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .admin-info { font-size: 13px; opacity: .85; }
.admin-main { max-width: 1280px; margin: 0 auto; padding: 18px; }
.section-head { display: flex; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.section-head > * + * { margin-left: 12px; }
.section-head h2 { margin: 0; font-size: 19px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar > * + * { margin-left: 10px; }
.toolbar > * { margin-bottom: 6px; }
.toolbar .spacer { flex: 1; }
.filter-input { width: 200px !important; }
.summary-cards { display: flex; margin-bottom: 16px; flex-wrap: wrap; }
.summary-cards > * + * { margin-left: 14px; }
.summary-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 22px; text-align: center; min-width: 120px; }
.summary-card .v { font-size: 26px; font-weight: 700; color: var(--primary); }
.summary-card .k { font-size: 13px; color: var(--muted); }

/* 模态框 */
.modal-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(20, 40, 70, .45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal { background: #fff; border-radius: 12px; width: 640px; max-width: 96vw; max-height: 88vh; overflow: auto; padding: 24px; }
.modal h3 { margin: 0 0 18px; }
.modal .actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.modal .actions > * + * { margin-left: 10px; }
.opt-editor-row { display: flex; margin-bottom: 8px; align-items: center; }
.opt-editor-row > * + * { margin-left: 8px; }
.opt-editor-row .letter { width: 24px; font-weight: 700; color: var(--primary); }
.opt-editor-row input { flex: 1; }
.opt-editor-row .del { cursor: pointer; color: var(--danger); border: none; background: none; font-size: 16px; }

/* 批改页 */

/* 打印区 */
.print-only { display: none; }
#print-area { }
.print-head { text-align: center; margin-bottom: 14px; }
.print-head .school { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.print-head .title { font-size: 26px; font-weight: 700; margin: 6px 0; }
.print-head .meta { font-size: 13px; color: #444; }
.print-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.print-table th, .print-table td { border: 1px solid #333; padding: 6px 8px; font-size: 13.5px; text-align: left; word-wrap: break-word; overflow: hidden; }
.print-table th { background: #eee; }
/* 固定列宽，保证分页与换行一致、内容不溢出（排除标题行的跨列单元格）
   排名表共 7 列：序号/排名/姓名/准考证号/成绩/用时/交卷时间 */
.print-table th:not(.title-main):not(.title-sub):not(.title-meta):nth-child(1), .print-table td:nth-child(1) { width: 8%; }
.print-table th:not(.title-main):not(.title-sub):not(.title-meta):nth-child(2), .print-table td:nth-child(2) { width: 8%; }
.print-table th:not(.title-main):not(.title-sub):not(.title-meta):nth-child(3), .print-table td:nth-child(3) { width: 16%; }
.print-table th:not(.title-main):not(.title-sub):not(.title-meta):nth-child(4), .print-table td:nth-child(4) { width: 16%; }
.print-table th:not(.title-main):not(.title-sub):not(.title-meta):nth-child(5), .print-table td:nth-child(5) { width: 10%; }
.print-table th:not(.title-main):not(.title-sub):not(.title-meta):nth-child(6), .print-table td:nth-child(6) { width: 12%; }
.print-table th:not(.title-main):not(.title-sub):not(.title-meta):nth-child(7), .print-table td:nth-child(7) { width: 30%; }
/* 打印时：表头每页重复、数据行不跨页断开 */
.print-table thead { display: table-header-group; }
.print-table tr { page-break-inside: avoid; }
.print-stu-head { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 10px; }
.print-sign { margin-top: 28px; font-size: 15px; line-height: 2.7; }
.print-sign .sign-row { min-width: 320px; }
.print-table thead th.title-main { font-size: 19px; font-weight: 700; letter-spacing: 3px; border: none; background: #fff; padding: 4px; text-align: center; }
.print-table thead th.title-sub { font-size: 24px; font-weight: 700; letter-spacing: 6px; border: none; background: #fff; padding: 2px 4px 6px; text-align: center; }
.print-table thead th.title-meta { font-size: 12px; font-weight: 400; color: #444; border: none; background: #fff; padding-bottom: 10px; text-align: center; }
.print-footer { font-size: 14px; line-height: 1.9; padding-top: 8px; margin-top: 20px; border-top: 1px solid #333; }

@media print {
  body { background: #fff; }
  body > *:not(#view-result):not(#print-area) { display: none !important; }
  #view-result.hidden, #print-area.hidden { display: none !important; }
  #view-result:not(.hidden) { display: block !important; }
  #print-area { display: block !important; position: static; }
  #view-result { position: static; }
  #view-result .result-wrap { max-width: none; margin: 0; padding: 0; }
  #view-result .card, #print-area { box-shadow: none; border: none; border-radius: 0; }
  .no-print { display: none !important; }
  /* 考生成绩单答题明细表：表头每页重复、数据行不跨页断开 */
  .tbl thead { display: table-header-group; }
  .tbl tr { page-break-inside: avoid; }
  /* 签名栏在表格末尾自然排版（最后一页落款），不会与内容重叠；
     页码由浏览器打印设置"页眉和页脚"提供（每页自动显示 第X页 共Y页） */
  @page { margin: 12mm 10mm 14mm; }
}
