/* ============================================================
   艾格沃图 · 网上阅卷系统 样式
   ============================================================ */
:root {
  --primary: #2e4a70;
  --primary-2: #3b82f6;
  --accent: #3b82f6;
  --bg: #f3f5f8;
  --card: #ffffff;
  --line: #e5e8ee;
  --text: #1f2937;
  --muted: #7a828e;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; }
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
code { background: #f1f3f7; padding: 1px 6px; border-radius: 5px; font-size: 12px; color: #334155; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px; padding: 40px 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #3a5578 0%, #16222f 60%, #0e1620 100%);
}
.login-brand { text-align: center; color: #fff; }
.login-brand .logo {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px;
  background: linear-gradient(135deg, #4f7cb3, #2e4a70); display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: #fff; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.login-brand h1 { margin: 0; font-size: 26px; letter-spacing: 2px; }
.login-brand p { margin: 6px 0 0; color: #b9c7d8; font-size: 14px; }
.login-card {
  width: 380px; max-width: 92vw; background: #fff; border-radius: 18px; padding: 30px 32px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.login-card h2 { margin: 0 0 18px; font-size: 20px; text-align: center; }
.login-tip { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); line-height: 1.8; text-align: center; }
.login-tip b { color: #334155; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span { font-size: 13px; color: #4b5563; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #d6dbe3; border-radius: 9px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.14); }
.field textarea { resize: vertical; min-height: 90px; }
.field-row { flex-direction: row; align-items: center; }
.field-row > span { flex: 0 0 auto; min-width: 90px; }
.field-row input, .field-row select { flex: 1; }
input.num { width: 80px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: 1px solid #d6dbe3; border-radius: 9px; background: #fff; color: #374151;
  font-size: 14px; font-weight: 500; cursor: pointer; font-family: inherit;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { background: #f6f8fa; border-color: #c3cad4; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #23405f; border-color: #23405f; }
.btn-danger { background: #fff; border-color: #f3c1c1; color: var(--danger); }
.btn-danger:hover { background: #fef2f2; border-color: #ef4444; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: rgba(46,74,112,.06); }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.18); color: #dfe6ee; }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 主外壳 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; flex: 0 0 230px; background: linear-gradient(180deg, #1c2735, #14202e);
  color: #cdd7e2; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-brand .logo {
  width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #4f7cb3, #2e4a70);
  display: flex; align-items: center; justify-content: center; font-size: 22px; color: #fff; font-weight: 700; flex: 0 0 auto;
}
.side-brand b { display: block; font-size: 16px; color: #fff; letter-spacing: 1px; }
.side-brand span { font-size: 11.5px; color: #8ea0b5; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.07); }
nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; }
.nav-group-title { font-size: 11px; color: #6f8298; text-transform: uppercase; letter-spacing: 1px; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #cdd7e2;
  font-size: 14px; margin: 2px 0; cursor: pointer; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-ico { width: 20px; text-align: center; font-size: 15px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
#tb-title h1 { font-size: 18px; margin: 0; }
#tb-title p { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.role-badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #eef2f8; color: #43556b; font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.user-chip b { display: block; font-size: 13px; line-height: 1.2; }
.user-chip span { font-size: 11.5px; color: var(--muted); }

/* ---------- 内容 ---------- */
#content { padding: 22px; max-width: 1240px; width: 100%; margin: 0 auto; }
.page { display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 18px; }
.page-head .muted { margin: 4px 0 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.card-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-title-row .subj-name { flex: 1; min-width: 160px; padding: 8px 12px; border: 1px solid #d6dbe3; border-radius: 8px; font-size: 14px; }
.subj-box { border-left: 3px solid var(--primary); }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.stat-ico { width: 44px; height: 44px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex: 0 0 auto; }
.stat-val { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--muted); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 9px 10px; color: #6b7280; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid #f0f2f6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafbfc; }

.badge { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #eef2f8; color: #566377; font-weight: 600; }
.badge-ok { background: #e6f7f1; color: #0f9d76; }
.badge-warn { background: #fef4e6; color: #c07a0c; }
.badge-gray { background: #f1f3f7; color: #8a9099; }

.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid #f0f2f6; }
.kv:last-child { border-bottom: none; }

/* ---------- Modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease;
}
.modal { background: #fff; border-radius: 16px; width: 460px; max-width: 94vw; max-height: 90vh; overflow: auto; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { border: none; background: transparent; font-size: 22px; color: #9aa3af; cursor: pointer; line-height: 1; }
.modal-x:hover { color: #374151; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #1f2937; color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(-8px); transition: all .25s;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: none; }
.toast-success { background: #0f9d76; }
.toast-error { background: #dc2626; }
.toast-warn { background: #c07a0c; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; background: #e8ecf2; padding: 5px; border-radius: 11px; width: fit-content; }
.tab { border: none; background: transparent; padding: 8px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; color: #566377; font-family: inherit; }
.tab.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- 答题卡预览 ---------- */
.preview-box { display: flex; flex-direction: column; align-items: center; gap: 12px; overflow: auto; padding: 6px 0; }
.card-paper { background: #fff; box-shadow: 0 4px 20px rgba(15,23,42,.12); border-radius: 4px; overflow: hidden; }
.card-paper svg { display: block; max-width: 100%; height: auto; }
.thumb { width: 74px; height: 96px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: #f4f6f9; }
.total-strip { background: #fef2f2; border: 1px solid #fbd5d5; border-radius: 10px; padding: 10px 16px; font-size: 14px; }
.total-strip b { color: #dc2626; font-size: 18px; }
.total-row { margin-top: 14px; padding: 10px 14px; background: #f5f7fb; border-radius: 8px; font-size: 15px; }
.total-row b { color: var(--primary); font-size: 18px; }

/* ---------- 进度条 ---------- */
.progressbar { height: 8px; background: #eef1f5; border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.progressbar > div { height: 100%; background: linear-gradient(90deg, #3b82f6, #2e4a70); border-radius: 999px; transition: width .3s; }
.mini-bar { display: inline-block; width: 120px; height: 8px; background: #eef1f5; border-radius: 999px; overflow: hidden; margin-right: 8px; vertical-align: middle; }
.mini-bar > div { height: 100%; background: #10b981; }

/* ---------- 阅卷 ---------- */
.grade-grid { align-items: start; }
.grade-grid .preview-box { max-height: 72vh; }
.score-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px solid #f0f2f6; }
.score-q { flex: 1; display: flex; align-items: baseline; gap: 8px; }
.score-q span { font-size: 12px; color: var(--muted); }
.score-in { width: 80px; padding: 7px 10px; border: 1px solid #d6dbe3; border-radius: 8px; font-size: 14px; text-align: center; }
.score-in:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,.14); }
.score-max { color: var(--muted); font-size: 13px; }
.score-total { margin-top: 14px; padding: 12px 16px; background: #f5f7fb; border-radius: 10px; font-size: 15px; text-align: right; }
.score-total b { color: var(--primary); font-size: 20px; }

.welcome-banner { background: linear-gradient(135deg, #2e4a70, #4f7cb3); color: #fff; border-radius: 14px; padding: 20px 24px; }
.welcome-banner h2 { margin: 0 0 6px; }
.welcome-banner p { margin: 0; color: #d6e0ec; font-size: 13.5px; }
.welcome-banner code { background: rgba(255,255,255,.16); color: #fff; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 阅卷：切块 / 双评 ---------- */
.crop-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.crop-item { margin-bottom: 16px; }
.crop-label { font-size: 13px; margin-bottom: 5px; }
.crop-img { max-width: 100%; display: block; border: 1px solid var(--line); border-radius: 4px; background: #fff; transform-origin: top center; }
.rounds-txt { width: 100%; font-size: 12px; color: var(--muted); padding-left: 2px; }

/* ---------- 品牌 Logo 图片 ---------- */
.login-brand .logo-img {
  width: 72px; height: 72px; margin: 0 auto 12px; border-radius: 18px;
  object-fit: contain; background: #fff; display: block;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.side-brand .logo-img {
  width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; flex: 0 0 auto;
}

/* ---------- 分区可视化 ---------- */
.rg-stage { position: relative; width: 100%; max-width: 680px; margin: 8px auto; border: 1px solid var(--line); background: #fff; }
.rg-img { display: block; width: 100%; height: auto; }
.rg-noimg { padding: 40px; text-align: center; color: var(--muted); }
.rg-box { position: absolute; border: 2px solid rgba(59,130,246,.85); background: rgba(59,130,246,.08); cursor: move; box-sizing: border-box; }
.rg-box.sel { border-color: #ef4444; background: rgba(239,68,68,.12); }
.rg-lbl { position: absolute; top: -18px; left: 0; font-size: 11px; background: rgba(59,130,246,.9); color: #fff; padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
.rg-handle { position: absolute; right: -5px; bottom: -5px; width: 10px; height: 10px; background: #3b82f6; border: 1px solid #fff; cursor: nwse-resize; }
.rg-tabs { display: flex; gap: 6px; margin-bottom: 8px; }

/* 按题阅卷裁剪图 */
.crop-box { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
