/* ========================================================================
   老师后台 · 浅色密集型（跟大屏游戏的深色刻意区分开，长时间录入不累眼）
   ===================================================================== */
:root {
  --ink: #16182b;
  --ink-2: #5b6079;
  --ink-3: #8b90a8;
  --line: #e3e6f0;
  --bg: #f5f6fb;
  --card: #fff;
  --brand: #4a3aff;
  --brand-soft: #eeecff;
  --gold: #b8860b;
  --good: #0a9e6e;
  --good-soft: #e6f7f1;
  --bad: #d92d54;
  --bad-soft: #fdecf0;
  --warn: #b26a00;
  --warn-soft: #fff5e3;
  --r: 12px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.25; }

/* ── 布局 ─────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 20px;
}
.topbar h1 { font-size: 1.05rem; font-weight: 800; }
.topbar .sp { flex: 1; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button {
  font: inherit; font-weight: 700; font-size: .9rem;
  color: var(--ink-2); background: transparent;
  border: 0; border-radius: 9px; padding: 7px 14px; cursor: pointer;
  transition: all .15s;
}
.tabs button:hover { background: var(--bg); color: var(--ink); }
.tabs button.on { background: var(--brand); color: #fff; }

.wrap { max-width: 1380px; margin: 0 auto; padding: 20px; }
.pane { display: none; }
.pane.on { display: block; animation: in .2s ease both; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-bottom: 16px; }
.card > h2 { font-size: 1rem; font-weight: 800; margin-bottom: 4px; }
.card > .sub { color: var(--ink-3); font-size: .85rem; margin-bottom: 14px; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sp { flex: 1; }
.dim { color: var(--ink-3); }
.sm { font-size: .85rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ── 表单 ─────────────────────────────────────────────────────── */
label.f { display: block; }
label.f > span { display: block; font-size: .8rem; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
input, select, textarea {
  font: inherit; width: 100%;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 9px;
  padding: 8px 11px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input[type=checkbox] { width: auto; accent-color: var(--brand); }
input[type=range] { width: 100%; accent-color: var(--brand); padding: 0; border: 0; }

.btn {
  font: inherit; font-weight: 700; font-size: .88rem;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: 9px;
  padding: 8px 15px; cursor: pointer; white-space: nowrap;
  transition: all .14s;
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.97); }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { filter: brightness(1.1); }
.btn.danger { color: var(--bad); border-color: #f3c3ce; background: var(--bad-soft); }
.btn.danger:hover { background: #fbdbe3; }
.btn.tiny { padding: 4px 9px; font-size: .78rem; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── 表格 ─────────────────────────────────────────────────────── */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th {
  position: sticky; top: 0; z-index: 2;
  text-align: left; font-weight: 700; font-size: .78rem; letter-spacing: .03em;
  color: var(--ink-2); background: #fafbfe;
  padding: 9px 11px; border-bottom: 1.5px solid var(--line); white-space: nowrap;
}
td { padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: #fafbff; }
tbody tr.off { opacity: .48; }
.nowrap { white-space: nowrap; }

.pill {
  display: inline-block; font-size: .74rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--ink-2); white-space: nowrap;
}
.pill.d1 { background: var(--good-soft); color: var(--good); }
.pill.d2 { background: var(--warn-soft); color: var(--warn); }
.pill.d3 { background: var(--bad-soft); color: var(--bad); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

/* ── 统计条 ───────────────────────────────────────────────────── */
.kpi { text-align: center; padding: 14px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.kpi b { display: block; font-size: 1.7rem; font-weight: 900; line-height: 1.1; }
.kpi span { font-size: .78rem; color: var(--ink-3); }

.bar-row { display: grid; grid-template-columns: minmax(130px, 200px) 1fr auto; gap: 12px; align-items: center; padding: 6px 0; }
.bar { height: 22px; border-radius: 6px; background: var(--bg); overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ffb703, var(--bad)); border-radius: 6px; transition: width .6s; }
.bar-row b { font-variant-numeric: tabular-nums; font-size: .85rem; min-width: 5.5em; text-align: right; }

/* ── 弹窗 ─────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; background: rgba(18, 20, 40, .55); padding: 18px; }
.modal.on { display: flex; }
.modal-box { background: #fff; border-radius: 16px; width: min(1050px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 30px 70px rgba(0, 0, 0, .3); }
.modal-hd { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 15px 20px; display: flex; align-items: center; gap: 12px; z-index: 2; }
.modal-hd h2 { font-size: 1rem; }
.modal-bd { padding: 20px; }
.modal-ft { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 13px 20px; display: flex; gap: 10px; justify-content: flex-end; }

/* 题目预览：模拟大屏效果 */
.preview {
  background: linear-gradient(160deg, #0b1026, #241a52);
  color: #f6f8ff; border-radius: 14px; padding: 22px; text-align: center;
}
.preview .p-stem { font-size: 1.5rem; font-weight: 800; line-height: 1.3; margin-bottom: 8px; }
.preview .p-stem .blank { color: #ffd166; }
.preview .p-zh { font-size: .85rem; color: #a9b2d8; margin-bottom: 14px; }
.preview .p-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preview .p-opt { background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .16); border-radius: 10px; padding: 8px 12px; font-size: .95rem; font-weight: 700; text-align: left; }
.preview .p-opt.ans { background: rgba(6, 214, 160, .28); border-color: #06d6a0; }
.preview .p-fill { background: rgba(0, 0, 0, .34); border: 2px solid #ffd166; border-radius: 10px; padding: 10px; color: #ffd166; font-weight: 800; font-size: 1.1rem; }

/* ── 提示条 ───────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-size: .88rem; font-weight: 600; z-index: 400;
  opacity: 0; pointer-events: none; transition: all .25s;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25); max-width: 90vw;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: var(--bad); }
.toast.good { background: var(--good); }

.note { border-radius: 10px; padding: 11px 14px; font-size: .86rem; margin-bottom: 12px; }
.note.info { background: var(--brand-soft); color: #33249c; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.good { background: var(--good-soft); color: var(--good); }

/* 登录遮罩 */
#login { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; background: linear-gradient(160deg, #0b1026, #241a52); }
#login .box { background: #fff; border-radius: 16px; padding: 30px; width: min(400px, 92vw); box-shadow: 0 24px 60px rgba(0, 0, 0, .4); }

.err-list { max-height: 260px; overflow: auto; font-size: .84rem; }
.err-list div { padding: 5px 9px; border-radius: 7px; margin-bottom: 3px; }
.err-list .e { background: var(--bad-soft); color: var(--bad); }
.err-list .w { background: var(--warn-soft); color: var(--warn); }
