/* ==========================================================
   AI 学习测评系统 —— 全局样式
   主色：学校酒红 #8C1D2C / 金 #C9A227
   ========================================================== */
:root {
  --maroon: #8C1D2C;
  --maroon-dark: #6d1522;
  --maroon-soft: #b23a49;
  --gold: #C9A227;
  --gold-soft: #f0dfae;
  --ink: #1f2329;
  --ink-2: #4a5058;
  --ink-3: #8a9099;
  --line: #e8e3dc;
  --bg: #f6f3ef;
  --card: #ffffff;
  --ok: #1f8a5b;
  --warn: #c0392b;
  --radius: 16px;
  --shadow: 0 2px 8px rgba(31, 35, 41, .05), 0 12px 28px rgba(31, 35, 41, .06);
  --shadow-lg: 0 24px 60px rgba(31, 35, 41, .16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
a { color: var(--maroon); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d8d2ca; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c3bbb1; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--card);
}

.login-hero {
  position: relative;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(201, 162, 39, .22), transparent 55%),
    radial-gradient(900px 500px at 90% 90%, rgba(255, 255, 255, .10), transparent 60%),
    linear-gradient(150deg, #7d1725 0%, #8C1D2C 42%, #5f1220 100%);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.login-hero::after {
  content: "";
  position: absolute;
  right: -140px;
  bottom: -160px;
  width: 520px;
  height: 520px;
  background: url("/static/img/logo-alpha.png") center/contain no-repeat;
  opacity: .10;
  pointer-events: none;
}

.login-brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; }
.login-brand img {
  width: 52px; height: 52px; object-fit: contain;
  background: #fff; border-radius: 12px; padding: 5px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.login-brand .school { font-size: 15px; letter-spacing: .5px; font-weight: 600; }
.login-brand .school span { display: block; font-size: 12px; font-weight: 400; opacity: .72; letter-spacing: 2px; }

.login-hero h1 {
  position: relative; z-index: 2;
  font-size: 40px; line-height: 1.25; margin: 0 0 18px; letter-spacing: 1px;
}
.login-hero h1 em { font-style: normal; color: var(--gold-soft); }
.login-hero .lead { position: relative; z-index: 2; font-size: 15px; opacity: .82; max-width: 430px; margin-bottom: 30px; }

.hero-points { position: relative; z-index: 2; display: grid; gap: 14px; max-width: 430px; }
.hero-point { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; opacity: .92; }
.hero-point i {
  flex: none; width: 26px; height: 26px; border-radius: 8px;
  background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .18);
  display: grid; place-items: center; font-style: normal; font-weight: 700; font-size: 12px; color: var(--gold-soft);
}
.login-foot { position: relative; z-index: 2; font-size: 12px; opacity: .5; letter-spacing: .5px; }

.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; background: #fbfaf8;
}
.login-card { width: 100%; max-width: 380px; }
.login-card .logo-mini { display: none; }
.login-card h2 { font-size: 26px; margin: 0 0 6px; letter-spacing: .5px; }
.login-card .sub { color: var(--ink-3); margin: 0 0 28px; font-size: 13.5px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 7px; font-weight: 600; letter-spacing: .3px; }
.field input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  transition: border-color .15s, box-shadow .15s; outline: none;
}
.field input:focus { border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(140, 29, 44, .10); }

.btn-login {
  width: 100%; height: 48px; margin-top: 8px; border: 0; border-radius: 10px;
  background: linear-gradient(135deg, var(--maroon), var(--maroon-dark));
  color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 2px;
  box-shadow: 0 10px 22px rgba(140, 29, 44, .22);
  transition: transform .12s, box-shadow .2s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(140, 29, 44, .28); }
.btn-login:active { transform: translateY(0); }
.btn-login[disabled] { opacity: .65; cursor: not-allowed; transform: none; }

.login-error {
  margin-top: 14px; min-height: 20px; font-size: 13px; color: var(--warn);
}
.login-hint { margin-top: 26px; font-size: 12px; color: var(--ink-3); line-height: 1.8; border-top: 1px dashed var(--line); padding-top: 16px; }
.login-hint code { background: #f2ece6; padding: 1px 6px; border-radius: 4px; color: var(--maroon); }

/* ---------------- 顶部栏 ---------------- */
.topbar {
  height: 62px; 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: 40;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand .t1 { font-size: 15.5px; font-weight: 700; letter-spacing: .4px; line-height: 1.2; }
.brand .t2 { font-size: 11px; color: var(--ink-3); letter-spacing: 1.6px; }
.brand .divider { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }

.userbox { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--ink-2); }
.userbox .who { display: flex; flex-direction: column; line-height: 1.3; text-align: right; }
.userbox .who b { font-size: 13.5px; color: var(--ink); }
.userbox .who small { font-size: 11px; color: var(--ink-3); }
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  height: 34px; padding: 0 13px; border-radius: 9px; font-size: 12.5px;
  transition: all .15s;
}
.icon-btn:hover { border-color: var(--maroon); color: var(--maroon); background: #fdf7f8; }

/* ---------------- 主布局 ---------------- */
.layout {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: 18px;
  padding: 18px 22px 22px;
  height: calc(100vh - 62px);
  min-height: 560px;
}
.col { min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.col-scroll { overflow-y: auto; padding-right: 4px; }

.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}

/* ---------------- 取题栏 ---------------- */
.qbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
.qbar .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .3px; }
.qbar input {
  width: 96px; height: 38px; padding: 0 12px; text-align: center;
  border: 1px solid var(--line); border-radius: 9px; outline: none;
  font-weight: 700; font-size: 15px; letter-spacing: 1px; background: #fdfcfa;
}
.qbar input:focus { border-color: var(--maroon); box-shadow: 0 0 0 3px rgba(140, 29, 44, .09); background: #fff; }
.qbar .btn-load {
  height: 38px; padding: 0 18px; border: 0; border-radius: 9px;
  background: var(--maroon); color: #fff; font-size: 13px; font-weight: 600; letter-spacing: 1px;
  transition: background .15s;
}
.qbar .btn-load:hover { background: var(--maroon-dark); }
.qbar .hint { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.qbar .hint b { color: var(--maroon); cursor: pointer; font-weight: 600; }
.qbar .hint b:hover { text-decoration: underline; }

/* ---------------- 题目卡 ---------------- */
.qcard { padding: 20px 22px 22px; position: relative; overflow: hidden; }
.qcard::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, var(--maroon), var(--gold));
}
.qcard .qhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.qcard .qtitle { font-size: 18px; font-weight: 700; letter-spacing: .3px; line-height: 1.35; }
.qcard .qtitle .no { color: var(--maroon); margin-right: 8px; }
.qchips { display: flex; gap: 6px; flex-wrap: wrap; flex: none; }
.chip {
  font-size: 11px; padding: 3px 9px; border-radius: 20px; letter-spacing: .3px;
  background: #f5f1ec; color: var(--ink-2); border: 1px solid #ece6de; white-space: nowrap;
}
.chip.gold { background: #fbf4dd; color: #8a6d0b; border-color: #f0e2b6; }
.chip.maroon { background: #fbeef0; color: var(--maroon); border-color: #f3d9dd; }

.qbody {
  white-space: pre-wrap; font-size: 15px; line-height: 1.95; color: #2b3038;
  padding: 16px 18px; background: #fcfaf7; border: 1px solid #f0eae2; border-radius: 12px;
}
.qkp { margin-top: 14px; font-size: 12px; color: var(--ink-3); display: flex; gap: 8px; align-items: flex-start; }
.qkp b { color: var(--ink-2); font-weight: 600; flex: none; }

.q-empty {
  padding: 46px 24px; text-align: center; color: var(--ink-3);
}
.q-empty .big { font-size: 42px; margin-bottom: 10px; opacity: .25; }
.q-empty h3 { margin: 0 0 6px; font-size: 15px; color: var(--ink-2); }
.q-empty p { margin: 0; font-size: 13px; }

/* ---------------- 答题区 ---------------- */
.answer-panel { padding: 18px 20px 20px; }
.answer-panel .ahead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.answer-panel .ahead .at { font-size: 14px; font-weight: 700; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.answer-panel .ahead .at::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--maroon); box-shadow: 0 0 0 3px rgba(140, 29, 44, .12);
}
.answer-panel .ahead .counter { font-size: 11.5px; color: var(--ink-3); }

#answerInput {
  width: 100%; min-height: 168px; resize: vertical; padding: 14px 16px;
  border: 1.5px solid var(--line); border-radius: 12px; outline: none;
  line-height: 1.85; font-size: 14.5px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
#answerInput:focus { border-color: var(--maroon); box-shadow: 0 0 0 4px rgba(140, 29, 44, .08); }
#answerInput:disabled { background: #f8f6f3; color: var(--ink-2); }

.btn-submit {
  width: 100%; height: 56px; margin-top: 14px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #9d2233 0%, var(--maroon) 45%, #6b1420 100%);
  color: #fff; font-size: 16.5px; font-weight: 700; letter-spacing: 3px;
  box-shadow: 0 12px 26px rgba(140, 29, 44, .26);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: transform .12s, box-shadow .2s, filter .2s;
  position: relative; overflow: hidden;
}
.btn-submit::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
  transform: translateX(-100%); transition: transform .6s;
}
.btn-submit:hover { transform: translateY(-2px); box-shadow: 0 16px 32px rgba(140, 29, 44, .32); }
.btn-submit:hover::after { transform: translateX(100%); }
.btn-submit:disabled { background: #cfc9c2; box-shadow: none; cursor: not-allowed; transform: none; letter-spacing: 2px; }
.atip { margin-top: 10px; font-size: 11.5px; color: var(--ink-3); text-align: center; line-height: 1.7; }

/* ---------------- 聊天区 ---------------- */
.chat-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.chat-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); flex: none;
  background: linear-gradient(180deg, #fff, #fdfbf9);
}
.chat-avatar {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--maroon), #5f1220);
  display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 700;
  letter-spacing: .5px; box-shadow: 0 4px 10px rgba(140, 29, 44, .2);
}
.chat-avatar.grading { background: linear-gradient(135deg, #a9791a, #C9A227); box-shadow: 0 4px 10px rgba(201, 162, 39, .28); }
.chat-head .meta { flex: 1; min-width: 0; }
.chat-head .meta .n { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chat-head .meta .d { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.mode-badge {
  font-size: 10.5px; padding: 2px 8px; border-radius: 20px; font-weight: 600;
  background: #fbeef0; color: var(--maroon); border: 1px solid #f3d9dd; letter-spacing: .5px;
}
.mode-badge.grading { background: #fdf8e7; color: #8a6d0b; border-color: #f0e2b6; }
.mode-badge.graded { background: #eaf6ef; color: var(--ok); border-color: #cbe8d8; }

.lock-banner {
  display: none; align-items: center; gap: 10px; padding: 10px 16px; flex: none;
  background: #fdf1ef; border-bottom: 1px solid #f6d7d2; color: #a32b1c; font-size: 12.5px;
}
.lock-banner.show { display: flex; }
.lock-banner b { font-variant-numeric: tabular-nums; font-size: 14px; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 14px; }

.msg { display: flex; gap: 9px; max-width: 100%; }
.msg .bubble {
  padding: 10px 14px; border-radius: 12px; font-size: 13.8px; line-height: 1.8;
  white-space: pre-wrap; word-break: break-word; max-width: 82%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}
.msg.ai .bubble { background: #f7f5f1; color: #2a2f36; border: 1px solid #eee8e0; border-top-left-radius: 4px; }
.msg.me { flex-direction: row-reverse; }
.msg.me .bubble { background: linear-gradient(135deg, var(--maroon), #7a1826); color: #fff; border-top-right-radius: 4px; box-shadow: 0 4px 12px rgba(140, 29, 44, .18); }
.msg .ava { width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.msg.ai .ava { background: #f0e6d6; color: #8a6d0b; }
.msg.me .ava { background: #f5e7e9; color: var(--maroon); }
.msg.offtopic .bubble { background: #fdf6e3; border-color: #f0e2b6; color: #8a6d0b; font-weight: 600; }
.msg .time { font-size: 10.5px; color: #b8b2aa; align-self: flex-end; padding-bottom: 2px; flex: none; white-space: nowrap; }

.sys-note {
  text-align: center; font-size: 11.5px; color: #8a9099; padding: 2px 10px;
  background: #faf8f4; border-radius: 20px; margin: 0 auto; max-width: 92%;
  align-self: center; line-height: 1.7;
}
.chat-divider {
  display: flex; align-items: center; gap: 12px; margin: 6px 0;
  font-size: 11px; color: #a8a29b; letter-spacing: .5px;
}
.chat-divider::before, .chat-divider::after {
  content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, #e3ddd4, transparent);
}

.typing .bubble { display: flex; gap: 4px; align-items: center; padding: 14px 16px; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: #b9b2a8; display: block;
  animation: blink 1.2s infinite ease-in-out;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.chat-empty { margin: auto; text-align: center; color: var(--ink-3); padding: 20px; }
.chat-empty .ico { font-size: 34px; opacity: .3; margin-bottom: 8px; }
.chat-empty p { margin: 0 0 16px; font-size: 12.5px; }
.suggests { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 340px; margin: 0 auto; }
.suggest {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 7px 12px; border-radius: 20px; font-size: 12px; transition: all .15s;
}
.suggest:hover { border-color: var(--maroon); color: var(--maroon); background: #fdf7f8; }

.composer { flex: none; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: #fff; }
.composer .box {
  display: flex; align-items: flex-end; gap: 8px;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 8px 8px 14px;
  background: #fff; transition: border-color .15s, box-shadow .15s;
}
.composer .box:focus-within { border-color: var(--maroon); box-shadow: 0 0 0 4px rgba(140, 29, 44, .07); }
.composer textarea {
  flex: 1; border: 0; outline: none; resize: none; max-height: 120px; min-height: 26px;
  line-height: 1.7; font-size: 13.8px; background: transparent; padding: 2px 0;
}
.btn-send {
  width: 62px; height: 34px; border: 0; border-radius: 9px; flex: none;
  background: var(--maroon); color: #fff; font-size: 12.5px; font-weight: 600; letter-spacing: 1px;
  transition: background .15s, opacity .15s;
}
.btn-send:hover { background: var(--maroon-dark); }
.btn-send:disabled { background: #d6d0c9; cursor: not-allowed; }
.composer .foot { display: flex; justify-content: space-between; margin-top: 7px; font-size: 10.5px; color: var(--ink-3); }
.composer .foot .warn { color: #b0710f; }

/* ---------------- 评分结果 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(28, 24, 21, .48);
  backdrop-filter: blur(3px); display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.modal-mask.show { display: flex; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 18px; width: min(620px, 100%); max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 22px 26px 0; display: flex; align-items: flex-start; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 17px; letter-spacing: .5px; }
.modal-head .x { border: 0; background: #f4f0eb; width: 30px; height: 30px; border-radius: 8px; color: var(--ink-2); font-size: 15px; }
.modal-body { padding: 18px 26px 24px; }

.score-hero { display: flex; align-items: center; gap: 20px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); }
.ring {
  --p: 0; width: 96px; height: 96px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--maroon) calc(var(--p) * 1%), #eee9e2 0);
  display: grid; place-items: center;
}
.ring::before { content: ""; position: absolute; inset: 8px; background: #fff; border-radius: 50%; }
.ring .val { position: relative; text-align: center; line-height: 1.1; }
.ring .val b { font-size: 27px; color: var(--maroon); font-variant-numeric: tabular-nums; }
.ring .val span { font-size: 11px; color: var(--ink-3); display: block; margin-top: 2px; }
.score-meta h4 { margin: 0 0 4px; font-size: 15px; }
.score-meta .tagline { font-size: 12.5px; color: var(--ink-2); }
.score-meta .verdict { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 20px; }
.verdict.good { background: #eaf6ef; color: var(--ok); }
.verdict.bad { background: #fdf1ef; color: #a32b1c; }

.dim-list { display: grid; gap: 10px; margin: 14px 0 10px; }
.dim { }
.dim .top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.dim .top b { font-weight: 600; }
.dim .top span { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dim .bar { height: 7px; border-radius: 6px; background: #f0ece6; overflow: hidden; }
.dim .bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--maroon), #b23a49); transition: width .6s ease; }
.dim .note { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }

.section { margin-top: 13px; }
.section h5 { margin: 0 0 7px; font-size: 12.5px; letter-spacing: .5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.section h5::before { content: ""; width: 3px; height: 12px; background: var(--maroon); border-radius: 2px; }
.section p { margin: 0; font-size: 13px; line-height: 1.85; color: #333; }
.section ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.85; color: #333; }
.err-box { background: #fdf6f4; border: 1px solid #f6ded8; border-radius: 10px; padding: 12px 14px; font-size: 12.8px; line-height: 1.8; }
.err-box b { color: #a32b1c; }
.feedback-box { background: #fbf8f2; border-left: 3px solid var(--gold); border-radius: 8px; padding: 12px 14px; font-size: 13px; line-height: 1.8; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 520px) { .two-col { grid-template-columns: 1fr; gap: 0; } }

.modal-foot {
  display: flex; gap: 10px; margin-top: 18px; position: sticky; bottom: 0;
  background: #fff; padding: 12px 0 2px; box-shadow: 0 -8px 16px rgba(255, 255, 255, .9);
}
.btn { height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all .15s; }
.btn:hover { border-color: var(--maroon); color: var(--maroon); }
.btn.primary { background: var(--maroon); border-color: var(--maroon); color: #fff; flex: 1; }
.btn.primary:hover { background: var(--maroon-dark); color: #fff; }

/* ---------------- 提示条 ---------------- */
#toast {
  position: fixed; right: 24px; top: 74px;
  background: #2b2f36; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: all .22s; z-index: 200; max-width: 60vw;
  transform: translateY(-8px);
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.err { background: #a32b1c; }
#toast.ok { background: #1f7a52; }

/* ---------------- 记录页 ---------------- */
.page-wrap { max-width: 1080px; margin: 0 auto; padding: 26px 22px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 14px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 21px; letter-spacing: .5px; }
.page-head p { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--ink-3); }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; color: var(--maroon); font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: 3px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 12px 14px; background: #faf7f3; color: var(--ink-2); font-size: 12px; font-weight: 600; letter-spacing: .3px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #f4f0ea; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fdfbf8; }
.pill { font-size: 11px; padding: 2px 9px; border-radius: 20px; display: inline-block; }
.pill.graded { background: #eaf6ef; color: var(--ok); }
.pill.active { background: #fdf8e7; color: #8a6d0b; }
.pill.abandoned { background: #f2f0ed; color: #8a9099; }
.pill.submitted { background: #eef3fb; color: #2f5f9e; }
.score-num { font-weight: 700; color: var(--maroon); font-variant-numeric: tabular-nums; }
.link-btn { border: 0; background: none; color: var(--maroon); font-size: 12.5px; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.empty { padding: 50px; text-align: center; color: var(--ink-3); font-size: 13px; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tab { border: 1px solid var(--line); background: #fff; padding: 7px 15px; border-radius: 20px; font-size: 12.5px; color: var(--ink-2); }
.tab.on { background: var(--maroon); border-color: var(--maroon); color: #fff; }

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 10px; padding: 16px 18px; align-items: end; }
.form-grid .f { display: flex; flex-direction: column; gap: 5px; }
.form-grid label { font-size: 11.5px; color: var(--ink-3); }
.form-grid input { height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; outline: none; background: #fff; }
.form-grid input:focus { border-color: var(--maroon); }
.form-grid button { height: 38px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--maroon); color: #fff; font-size: 12.5px; font-weight: 600; }

.transcript { display: flex; flex-direction: column; gap: 10px; max-height: 46vh; overflow-y: auto; padding-right: 4px; }
.t-msg { font-size: 13px; line-height: 1.75; padding: 9px 12px; border-radius: 9px; white-space: pre-wrap; }
.t-msg.user { background: #fbeef0; color: #5f1220; align-self: flex-end; max-width: 82%; }
.t-msg.assistant { background: #f7f5f1; color: #2a2f36; max-width: 88%; }
.t-msg .role { font-size: 10px; opacity: .55; display: block; margin-bottom: 2px; letter-spacing: .5px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .col-scroll { overflow: visible; }
  .chat-panel { height: 72vh; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-card .logo-mini {
    display: flex; align-items: center; gap: 10px; margin-bottom: 26px;
  }
  .login-card .logo-mini img { width: 42px; height: 42px; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .topbar { padding: 0 14px; }
  .brand .t2, .userbox .who small { display: none; }
  .layout { padding: 12px; gap: 12px; }
  .qcard { padding: 16px; }
  .qbody { font-size: 14px; }
  .msg .bubble { max-width: 88%; }
}
