/* 虎宝错题本 · 电脑版网页样式
   设计口径：浅色底 + 白色卡片 + 蓝色主色，橙色只做点缀，避免深色块。 */

:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e6eaf2;
  --line-soft: #f0f3f9;
  --text: #1c2333;
  --muted: #7b8496;
  --primary: #3b6ef6;
  --primary-dark: #2d5ae0;
  --primary-soft: #edf2ff;
  --orange: #ff8a3d;
  --orange-soft: #fff4ea;
  --green: #10a15a;
  --green-soft: #e9f8f0;
  --red: #e5484d;
  --red-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 30, 60, 0.04), 0 10px 28px -16px rgba(20, 30, 60, 0.16);
}

* { box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

/* ============ 登录 ============ */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    radial-gradient(900px 500px at 12% 8%, #e8f0ff 0%, rgba(232, 240, 255, 0) 60%),
    radial-gradient(700px 460px at 92% 92%, #fff1e4 0%, rgba(255, 241, 228, 0) 62%),
    var(--bg);
}

.login-panel {
  width: 920px;
  max-width: 100%;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: var(--card);
  border-radius: 22px;
  box-shadow: 0 24px 60px -28px rgba(25, 40, 80, 0.3);
  overflow: hidden;
}

.login-left {
  padding: 48px 44px;
  background: linear-gradient(160deg, #f2f6ff 0%, #ffffff 62%, #fff8f0 100%);
  border-right: 1px solid var(--line-soft);
}

.login-left .logo-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #4a7cff, #2f5fe0);
  box-shadow: 0 12px 24px -12px rgba(59, 110, 246, 0.9);
}

.login-left h1 { font-size: 26px; margin: 22px 0 10px; letter-spacing: 0.5px; }
.login-left p { color: var(--muted); margin: 0 0 26px; }

.login-points { display: grid; gap: 14px; }
.login-point { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; color: #43506b; }
.login-point i {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-style: normal;
  font-size: 12px;
  display: grid;
  place-items: center;
}

.login-form { padding: 48px 40px; display: flex; flex-direction: column; }
.login-form h2 { font-size: 20px; margin-bottom: 6px; }
.login-form .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }
.login-form .btn { width: 100%; justify-content: center; height: 44px; font-size: 15px; }
.login-foot { margin-top: auto; padding-top: 22px; font-size: 12px; color: var(--muted); }
.login-alt { margin-top: 16px; text-align: center; }
.login-alt button {
  border: 0;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
}
.login-error {
  margin-top: 14px;
  background: var(--red-soft);
  color: #b32a2f;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

/* 微信扫码登录 */
.qr-wrap {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.qr-box {
  position: relative;
  width: 232px;
  height: 232px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.qr-box.loading { background: var(--bg); border-style: dashed; }
.qr-box img { width: 100%; height: 100%; object-fit: contain; padding: 10px; display: block; }
.qr-loading { color: var(--muted); font-size: 13px; }
.qr-error { color: var(--red); font-size: 13px; }
.qr-tip {
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}
.qr-tip .bad { color: var(--red); }
.qr-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 13px;
  color: #43506b;
  text-align: center;
  padding: 16px;
}
.qr-overlay .btn { width: auto; height: 34px; font-size: 13px; padding: 0 16px; }
.qr-mock {
  display: grid;
  gap: 8px;
  padding: 20px 18px;
  text-align: center;
  justify-items: center;
}
.qr-mock-title { font-weight: 600; font-size: 14px; }
.qr-mock-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.qr-mock .btn { width: auto; height: 34px; font-size: 13px; padding: 0 16px; margin-top: 4px; }

/* 微信内自动授权跳转中的过渡页 */
.login-panel.wx-loading {
  width: 420px;
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 6px;
  padding: 44px 36px;
}
.login-panel.wx-loading .logo-lg {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #4a7cff, #2f5fe0);
  box-shadow: 0 12px 24px -12px rgba(59, 110, 246, 0.9);
}
.login-panel.wx-loading h1 { font-size: 20px; margin: 16px 0 6px; }
.login-panel.wx-loading p { color: var(--muted); font-size: 13px; margin: 0; }

/* 微信内授权卡片 */
.qr-box.wx-auth { border-style: solid; background: linear-gradient(160deg, #f2f6ff, #fff); }

/* ============ 主框架 ============ */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: 228px;
  flex: none;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
.brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  background: linear-gradient(140deg, #4a7cff, #2f5fe0);
  box-shadow: 0 8px 18px -10px rgba(59, 110, 246, 0.9);
}
.brand-text b { display: block; font-size: 15px; letter-spacing: 0.2px; }
.brand-text small { color: var(--muted); font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #4a5568;
  cursor: pointer;
  font-size: 14px;
  border: 0;
  background: none;
  text-align: left;
  width: 100%;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.75; }
.nav-item:hover { background: #f6f8fc; color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav-item.active svg { opacity: 1; }

.side-foot {
  margin-top: auto;
  padding: 14px 10px 0;
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 600;
  flex: none;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.side-foot .name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.side-foot .meta { font-size: 11px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: rgba(244, 246, 251, 0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.baby-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 8px 5px 12px;
  font-size: 13px;
  white-space: nowrap;
  min-width: 0;
}
.baby-switch span { color: var(--muted); font-size: 12px; }
.baby-switch b { font-weight: 600; }
.baby-switch.clickable {
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.baby-switch.clickable:hover {
  border-color: #c3d4fb;
  background: #fbfcff;
  box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.08);
}
.baby-switch.need b { color: var(--primary); }
.baby-switch.need { border-color: #cddcfd; background: var(--primary-soft); }
.baby-switch.need span { color: #6f83ab; }

.view { flex: 1; overflow-y: auto; padding: 22px 26px 40px; }
.view > * + * { margin-top: 16px; }

/* ============ 卡片与栅格 ============ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card.pad-0 { padding: 0; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; }
.card-head .hint { font-size: 12px; color: var(--muted); }
.card-head .head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 > .card, .grid-3 > .card, .grid-4 > .card { margin-top: 0; }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .login-panel { grid-template-columns: 1fr; }
  .login-left { display: none; }
}

/* ============ 统计卡 ============ */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.15; letter-spacing: -0.5px; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.stat-foot { font-size: 12px; color: var(--muted); }
.stat.tone-blue .stat-value { color: var(--primary-dark); }
.stat.tone-orange .stat-value { color: #d2691e; }
.stat.tone-green .stat-value { color: var(--green); }
.stat.tone-red .stat-value { color: var(--red); }

.bar-list { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6f97ff, var(--primary)); }
.bar-num { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--primary-dark); }
.btn.ghost { background: var(--card); border-color: var(--line); color: #3f4a60; }
.btn.ghost:hover { border-color: #c9d4ea; background: #f8faff; }
.btn.danger { background: var(--card); border-color: #f3c9cb; color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-link {
  border: 0;
  background: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 2px 4px;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--red); }

/* ============ 表单 ============ */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); min-width: 0; }
.field > span { font-size: 12px; }
.field input,
.field select,
.field textarea {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 11px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  outline: none;
  width: 100%;
}
.field textarea { height: auto; min-height: 88px; padding: 9px 11px; resize: vertical; line-height: 1.65; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: #a9c0f8; box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.12); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { width: 132px; }
.filters .field.grow { flex: 1; min-width: 180px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
/* 宝贝信息只有四个字段，太宽的卡片会把下拉框拉得很长 */
.form-grid.form-narrow { max-width: 660px; }

/* ============ 表格 ============ */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fbfcfe;
}
.table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: #fafcff; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .stem-cell { max-width: 520px; }
.table .stem-row { display: flex; gap: 10px; align-items: flex-start; }
.table .stem-thumb {
  flex: none;
  width: 58px;
  height: 40px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: zoom-in;
}
.table .stem {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
}
.table .ops { white-space: nowrap; text-align: right; }
.table .ops button + button { margin-left: 2px; }
.table .col-check { width: 40px; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  background: #f2f5fb;
  color: #5a6a85;
  font-size: 11px;
}
.badge {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.badge.blue { background: var(--primary-soft); color: var(--primary-dark); }
.badge.orange { background: var(--orange-soft); color: #c96a1c; }
.badge.green { background: var(--green-soft); color: #0b7a44; }
.badge.red { background: var(--red-soft); color: #b32a2f; }
.badge.gray { background: #f1f3f8; color: #6b7688; }

/* ============ 分页 / 批量条 ============ */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; font-size: 13px; color: var(--muted); }
.pager .pages { display: flex; gap: 6px; }
.pager button {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: #445;
}
.pager button:hover { border-color: #c9d4ea; }
.pager button.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button:disabled { opacity: 0.45; cursor: not-allowed; }

.batchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary-soft);
  border: 1px solid #dbe6ff;
  color: var(--primary-dark);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.batchbar .spacer { flex: 1; }

/* ============ 上传 / 擦除 ============ */
.dropzone {
  border: 2px dashed #d5deee;
  border-radius: 14px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fbfcff;
}
.dropzone:hover, .dropzone.drag { border-color: #9db8f5; background: #f6f9ff; }
.dropzone .dz-icon { margin-bottom: 10px; line-height: 0; }
.dropzone p { margin: 0 0 6px; font-size: 14px; }
.dropzone small { color: var(--muted); }

.progress { display: flex; align-items: center; gap: 12px; padding: 16px 4px 4px; color: var(--muted); font-size: 13px; }
.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d8e2f7;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.result-pane { min-height: 300px; display: flex; flex-direction: column; }
.result-pane.empty { align-items: center; justify-content: center; color: var(--muted); font-size: 13px; text-align: center; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare figure { margin: 0; }
.compare figcaption { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.compare img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: zoom-in;
  max-height: 420px;
  object-fit: contain;
}
.result-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

/* ============ 试卷（可打印） ============ */
.paper-sheet {
  background: #fff;
  border-radius: 12px;
  padding: 36px 44px;
  font-size: 14px;
  line-height: 1.85;
}
.paper-sheet h2 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.paper-meta { text-align: center; color: var(--muted); font-size: 12px; margin-bottom: 22px; }
.paper-q { margin-bottom: 16px; break-inside: avoid; }
.paper-q .no { font-weight: 600; margin-right: 4px; }
.paper-q .q-img { max-width: 60%; display: block; margin: 8px 0; border-radius: 6px; }
.answer-key { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 16px; font-size: 13px; color: #45506a; }
.answer-key li { margin-bottom: 4px; }

/* ============ 报告 ============ */
.report-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.score-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), #eef2f9 0);
  flex: none;
}
.score-ring > div {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  text-align: center;
}
.score-ring b { font-size: 22px; line-height: 1.1; }
.score-ring small { color: var(--muted); font-size: 11px; }

.dim-list { display: grid; gap: 10px; }
.dim-row { display: grid; grid-template-columns: 64px 1fr 56px; gap: 10px; align-items: center; font-size: 13px; }

.note-block { border-left: 3px solid #dfe7f6; padding: 2px 0 2px 14px; margin-bottom: 14px; font-size: 13px; }
.note-block .p-text { color: #36415a; }
.note-block ul { margin: 6px 0 0; padding-left: 18px; color: #7a8499; font-size: 12px; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ============ 空状态 / 提示 ============ */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty .ico { line-height: 0; margin-bottom: 10px; }
.field input[type="file"] { height: auto; padding: 7px 10px; background: #fbfcff; font-size: 12px; cursor: pointer; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.error-box { padding: 24px; border-radius: 12px; background: var(--red-soft); color: #a82a2e; font-size: 13px; }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-mask { position: absolute; inset: 0; background: rgba(24, 33, 55, 0.34); }
.modal-body {
  position: relative;
  width: 560px;
  max-width: 100%;
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 30px 70px -30px rgba(20, 30, 60, 0.45);
}
.modal-body.wide { width: 860px; }
.modal-body h3 { font-size: 16px; margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: none;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}

/* ============ 轻提示 ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 42px;
  transform: translate(-50%, 12px);
  background: #222c42;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 90;
  max-width: 70vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: #b32a2f; }

/* ============ 记录 / 时间线 ============ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  border: 0;
  background: none;
  padding: 9px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }

/* ============ 错题收集 ============ */
.collect-mark { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 16px; align-items: start; }
.collect-mark > .card, .collect-tag > .card { margin-top: 0; }
.cs-steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 13px; color: #43506b; }
.cs-steps b { color: var(--text); }

.cs-stage-wrap {
  position: relative;
  margin-top: 4px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f7f9fd;
  display: flex;
  justify-content: center;
  max-height: calc(100vh - 320px);
  overflow: auto;
}
.cs-stage { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.cs-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 360px);
  width: auto;
  height: auto;
  border-radius: 6px;
  user-select: none;
  -webkit-user-drag: none;
}
.cs-layer { position: absolute; inset: 0; cursor: crosshair; }

.cs-box {
  position: absolute;
  border: 1.5px solid rgba(59, 110, 246, 0.85);
  background: rgba(59, 110, 246, 0.1);
  border-radius: 4px;
  cursor: move;
}
.cs-box:hover, .cs-box.on { background: rgba(59, 110, 246, 0.16); }
.cs-box.on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.16); }
.cs-no {
  position: absolute;
  left: -1px;
  top: -19px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 6px 6px 6px 0;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.cs-del {
  position: absolute;
  right: -9px;
  top: -9px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: none;
}
.cs-box:hover .cs-del, .cs-box.on .cs-del { display: block; }
.cs-h {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--primary);
  border-radius: 2px;
  background: #fff;
  display: none;
}
.cs-box.on .cs-h { display: block; }
.cs-h.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.cs-h.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.cs-h.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.cs-h.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
body.cs-dragging { user-select: none; }

.cs-busy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 13px;
}
.cs-tip { margin: 12px 0 0; font-size: 12px; color: var(--muted); }

.cs-side .card-head { padding-bottom: 10px; }
.cs-form { display: grid; gap: 12px; }
.cs-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cs-list { display: grid; gap: 8px; max-height: 300px; overflow-y: auto; margin-top: 2px; }
.cs-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.cs-item:hover { border-color: #c9d4ea; }
.cs-item.on { border-color: #b9cdfa; background: var(--primary-soft); }
.cs-item img { height: 44px; max-width: 140px; object-fit: contain; border-radius: 6px; background: #f4f6fb; }
.cs-idx {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
}
.cs-item-del, .cs-item-del:hover {
  margin-left: auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
.cs-item-del:hover { background: var(--red-soft); color: var(--red); }
.cs-ph { flex: none; width: 64px; height: 44px; border-radius: 6px; background: #f0f3f9; }
.cs-empty { display: grid; gap: 4px; padding: 26px 10px; text-align: center; font-size: 12px; color: var(--muted); }
.cs-side-foot { margin-top: 14px; }
.cs-side-foot .btn, .cs-tag-foot .btn, .cs-rail-foot .btn { width: 100%; justify-content: center; }

.collect-tag { display: grid; grid-template-columns: 118px minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.cs-rail .card-head { padding-bottom: 10px; }
.cs-thumbs { display: grid; gap: 8px; max-height: calc(100vh - 320px); overflow-y: auto; }
.cs-thumb { position: relative; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.cs-thumb:hover { border-color: #c9d4ea; }
.cs-thumb.on { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.12); }
.cs-thumb img { display: block; width: 100%; max-height: 84px; object-fit: contain; border-radius: 6px; background: #f7f9fd; }
.cs-thumb-no {
  position: absolute;
  left: 9px;
  top: 9px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 5px;
  background: rgba(28, 35, 51, 0.62);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}
.cs-rail-foot { margin-top: 12px; }

.cs-shot-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  max-height: calc(100vh - 330px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f9fd;
  overflow: auto;
}
.cs-shot-wrap img { max-width: 100%; max-height: calc(100vh - 380px); border-radius: 6px; background: #fff; }
.cs-shot-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }

.cs-tags { display: flex; flex-direction: column; }
.cs-group { margin-bottom: 16px; }
.cs-label { margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  color: #4a5670;
  cursor: pointer;
}
.chip:hover { border-color: #c9d4ea; background: #f8faff; }
.chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.cs-tag-foot { margin-top: auto; padding-top: 16px; }

.cs-done { padding: 34px 20px 26px; text-align: center; }
.cs-done-ico { margin-bottom: 6px; line-height: 0; }
.cs-done-list { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0 22px; }
.cs-done-list figure { margin: 0; }
.cs-done-list img { height: 96px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.cs-done-list figcaption { margin-top: 4px; font-size: 11px; color: var(--muted); }
.cs-done-foot { display: flex; gap: 10px; justify-content: center; }

@media screen and (max-width: 1180px) {
  .collect-mark { grid-template-columns: minmax(0, 1fr); }
  .collect-tag { grid-template-columns: 96px minmax(0, 1fr) 290px; }
  .cs-list, .cs-thumbs { max-height: 240px; }
}

@media screen and (max-width: 900px) {
  .collect-tag { grid-template-columns: minmax(0, 1fr); }
  .cs-rail { order: 3; }
  .cs-thumbs { display: flex; gap: 8px; max-height: none; overflow-x: auto; }
  .cs-thumb { flex: none; width: 84px; }
  .cs-stage-wrap { padding: 8px; max-height: none; }
  .cs-stage img { max-height: 60vh; }
  .cs-shot-wrap { max-height: none; }
  .cs-shot-wrap img { max-height: 50vh; }
}

/* ============ 打印 ============ */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .card-head, .tabs, .pager, .batchbar, .result-actions, .no-print { display: none !important; }
  .app { display: block; height: auto; overflow: visible; }
  .view { overflow: visible; padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .paper-sheet { padding: 0; }
  .answer-key { break-before: auto; }
  @page { size: A4; margin: 16mm; }
}

/* ============ 移动端（服务号内打开网页） ============ */
@media screen and (max-width: 900px) {
  .app { flex-direction: column; height: 100dvh; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand { padding: 0; flex: none; }
  .brand-text { display: none; }
  .brand .logo { width: 32px; height: 32px; border-radius: 10px; font-size: 15px; }
  .nav {
    flex-direction: row;
    gap: 4px;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 10px; font-size: 13px; }
  .nav-item svg { width: 16px; height: 16px; }
  .side-foot { margin: 0; padding: 0; border: 0; flex: none; }
  .side-foot .name, .side-foot .meta { display: none; }
  .main { min-height: 0; }
  .topbar { height: 56px; padding: 0 14px; gap: 10px; }
  .topbar h1 { font-size: 16px; flex: none; white-space: nowrap; }
  .topbar-right { gap: 8px; min-width: 0; }
  .baby-switch { max-width: 46vw; overflow: hidden; }
  .baby-switch span { overflow: hidden; text-overflow: ellipsis; }
  .baby-switch select { max-width: 30vw; }
  .view { padding: 14px 14px 32px; }
  .login { padding: 18px; }
  .login-panel { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-form { padding: 30px 22px; }
  .modal-body { width: calc(100% - 24px); max-height: 88vh; overflow-y: auto; }
}
