/* ============================================================
   TTan题库 · 管理后台样式
   ============================================================ */
:root {
  --bg: #f3f5fb;
  --bg-glow: rgba(99, 102, 241, 0.10);
  --panel: #ffffff;
  --panel-subtle: #f8f9fd;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e7ebf3;
  --border-strong: #d5dbe8;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-text: #4f46e5;
  --primary-soft: #eef0ff;
  --success: #10b981;
  --success-soft: #e7f8f2;
  --warn: #f59e0b;
  --warn-soft: #fff7e6;
  --danger: #ef4444;
  --danger-soft: #fdeeee;
  --cyan: #0891b2;
  --cyan-soft: #e6f7fb;
  --sidebar: #0b1020;
  --sidebar-2: #141a33;
  --sidebar-text: #aab3ca;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.03), 0 12px 28px -12px rgba(15, 23, 42, 0.16);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, 0.28);
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar-w: 252px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #080c18;
  --bg-glow: rgba(99, 102, 241, 0.16);
  --panel: #101728;
  --panel-subtle: #0c1322;
  --text: #e8ecf7;
  --text-soft: #c3cbe0;
  --muted: #9aa5bf;
  --muted-2: #7c88a3;
  --border: #1c2740;
  --border-strong: #2a3752;
  --primary-soft: rgba(99, 102, 241, 0.16);
  --success-soft: rgba(16, 185, 129, 0.12);
  --warn-soft: rgba(245, 158, 11, 0.12);
  --danger-soft: rgba(239, 68, 68, 0.12);
  --cyan-soft: rgba(8, 145, 178, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.2), 0 12px 28px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

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

html, body {
  touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
svg { display: block; }

::selection { background: rgba(99, 102, 241, 0.22); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

[hidden] { display: none !important; }

/* ---------------- 通用组件 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease,
    border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  user-select: none;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 8px 20px -8px rgba(99, 102, 241, 0.7);
}
.btn-primary:hover { box-shadow: 0 12px 26px -8px rgba(99, 102, 241, 0.8); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--panel-subtle); border-color: var(--border); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 26%, var(--border)); background: var(--danger-soft); }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.btn-link {
  border: 0; background: none; color: var(--primary-text); padding: 0;
  font-weight: 600; cursor: pointer; font-size: 13px;
}
.btn-link:hover { text-decoration: underline; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-subtle); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.card-sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.card-body { padding: 20px 22px 22px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.b-single { color: #4f46e5; background: var(--primary-soft); }
.b-multiple { color: #7c3aed; background: color-mix(in srgb, #8b5cf6 14%, var(--panel)); }
.b-judgement { color: #b45309; background: var(--warn-soft); }
.b-completion { color: #0e7490; background: var(--cyan-soft); }
.b-exact { color: #047857; background: var(--success-soft); }
.b-fuzzy { color: #0e7490; background: var(--cyan-soft); }
.b-llm { color: #4f46e5; background: var(--primary-soft); }
.b-miss, .b-llm_error { color: #b91c1c; background: var(--danger-soft); }
.b-blocked { color: var(--muted); background: var(--panel-subtle); border: 1px solid var(--border); }
.b-manual { color: #b45309; background: var(--warn-soft); }
.b-import { color: var(--muted); background: var(--panel-subtle); border: 1px solid var(--border); }
.b-verified { color: #047857; background: var(--success-soft); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* 输入 */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span, .field-label {
  font-size: 12.5px; font-weight: 650; color: var(--text-soft);
}
.field .hint { font-size: 11.5px; color: var(--muted); margin: 0; }
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap > svg {
  position: absolute; left: 13px; width: 16px; height: 16px;
  color: var(--muted-2); pointer-events: none;
}
.input-wrap > input { padding-left: 38px; }

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
select, textarea {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
textarea { height: auto; padding: 11px 13px; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
  cursor: pointer;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* 开关 */
.switch { display: inline-flex; align-items: center; cursor: pointer; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 46px; height: 26px; border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 28%, var(--panel));
  border: 1px solid var(--border-strong);
  position: relative;
  transition: background 0.22s ease, border-color 0.22s ease;
}
.switch .thumb {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.switch input:checked + .track {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
}
.switch input:checked + .track .thumb { transform: translateX(20px); }
.switch input:focus-visible + .track {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* 分段选择 */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: 11px;
  background: var(--panel-subtle);
  border: 1px solid var(--border);
}
.segmented button {
  height: 30px;
  padding: 0 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.18s ease;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: var(--panel);
  color: var(--primary-text);
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .segmented button.active { color: #c7d2fe; }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel-subtle);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr { transition: background 0.15s ease; }
table.data tbody tr:hover { background: var(--panel-subtle); }
table.data tbody tr:last-child td { border-bottom: 0; }
.cell-question {
  max-width: 520px;
  min-width: 260px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 550;
  line-height: 1.5;
}
.cell-sub { margin-top: 4px; color: var(--muted); font-size: 11.5px; }
.answer-code {
  display: inline-block;
  max-width: 260px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary-text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.pager-info { color: var(--muted); font-size: 12.5px; }
.pager-btns { display: flex; gap: 6px; align-items: center; }
.pager-btns button {
  min-width: 32px; height: 32px; padding: 0 9px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text-soft);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease;
}
.pager-btns button:hover:not(:disabled) { border-color: var(--border-strong); background: var(--panel-subtle); }
.pager-btns button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager-btns button:disabled { opacity: 0.4; cursor: not-allowed; }

/* 空状态 / 骨架 */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .empty-icon {
  width: 54px; height: 54px; margin: 0 auto 14px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--panel-subtle);
  border: 1px dashed var(--border-strong);
  color: var(--muted-2);
}
.empty .empty-icon svg { width: 24px; height: 24px; }
.empty strong { display: block; color: var(--text-soft); font-size: 14px; margin-bottom: 4px; }
.empty p { margin: 0; font-size: 12.5px; }

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--panel-subtle) 25%, var(--border) 37%, var(--panel-subtle) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ---------------- 登录页 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  background: var(--bg);
}
.login-visual {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(99, 102, 241, 0.55), transparent 60%),
    radial-gradient(700px 500px at 85% 85%, rgba(6, 182, 212, 0.35), transparent 60%),
    linear-gradient(145deg, #0b1020 0%, #151b3b 55%, #1b1240 100%);
  color: #eef1ff;
  display: flex;
  align-items: center;
  padding: 64px;
}
.login-visual::after {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 40% 40%, #000 30%, transparent 75%);
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: float 14s ease-in-out infinite;
}
.orb-1 { width: 340px; height: 340px; background: #6366f1; top: -80px; right: -40px; }
.orb-2 { width: 280px; height: 280px; background: #06b6d4; bottom: -60px; left: 10%; animation-delay: -5s; }
.orb-3 { width: 220px; height: 220px; background: #a855f7; top: 45%; right: 22%; animation-delay: -9s; }
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -18px, 0) scale(1.05); }
}
.visual-inner { position: relative; z-index: 2; max-width: 520px; }
.visual-brand {
  display: flex; align-items: center; gap: 12px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  margin-bottom: 46px; color: #dfe4ff;
}
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.7);
  flex: 0 0 auto;
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-mark.lg { width: 44px; height: 44px; border-radius: 14px; }
.brand-mark.lg svg { width: 25px; height: 25px; }
.login-visual h1 {
  font-size: clamp(32px, 3.4vw, 46px);
  line-height: 1.18;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  font-weight: 750;
}
.visual-sub { color: #a9b3d6; font-size: 15px; margin: 0 0 44px; }
.visual-points { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 22px; }
.visual-points li { display: flex; gap: 16px; align-items: flex-start; }
.visual-points i {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: #c7d2fe;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.visual-points strong { display: block; font-size: 14px; color: #eef1ff; margin-bottom: 2px; }
.visual-points span { color: #9aa5c9; font-size: 12.5px; }
.visual-foot {
  margin-top: 56px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6f7ba3;
}
.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: var(--bg);
  position: relative;
}
.login-panel::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 400px at 80% 0%, var(--bg-glow), transparent 70%);
  pointer-events: none;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 38px 34px 30px;
  box-shadow: var(--shadow-lg);
  animation: cardIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.login-heading h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.login-heading p { margin: 0 0 26px; color: var(--muted); font-size: 13px; }
.login-card .field { margin-bottom: 18px; }
.login-card .btn { height: 44px; margin-top: 4px; }
.login-card .btn svg { width: 17px; height: 17px; }
.login-error {
  min-height: 18px;
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--danger);
  text-align: center;
}
.login-hint { margin: 16px 0 0; font-size: 11.5px; color: var(--muted-2); text-align: center; }
.login-hint code {
  font-family: var(--mono); background: var(--panel-subtle);
  padding: 1px 5px; border-radius: 5px; border: 1px solid var(--border);
}
.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-3px); }
}

/* ---------------- 布局 ---------------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background:
    radial-gradient(500px 300px at 20% 0%, rgba(99, 102, 241, 0.18), transparent 70%),
    linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  z-index: 40;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 8px 24px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: #f1f3ff; font-size: 15px; letter-spacing: 0.01em; }
.brand-text small { color: #6f7ba3; font-size: 9.5px; letter-spacing: 0.18em; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 12px;
  border-radius: 11px;
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 550;
  position: relative;
  transition: color 0.18s ease, background 0.18s ease;
}
.nav a svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: 0.9; }
.nav a:hover { color: #e8ecff; background: rgba(255, 255, 255, 0.055); }
.nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.28), rgba(139, 92, 246, 0.12));
  box-shadow: inset 0 0 0 1px rgba(129, 140, 248, 0.22);
}
.nav a.active::before {
  content: "";
  position: absolute; left: -16px; top: 12px; bottom: 12px;
  width: 3px; border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #818cf8, #c084fc);
}
.sidebar-foot { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; }
.sidebar-cache {
  display: flex; gap: 10px; align-items: center;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: background 0.18s ease;
}
.sidebar-cache:hover { background: rgba(255, 255, 255, 0.075); }
.sidebar-cache .dot {
  width: 8px; height: 8px; flex: 0 0 auto;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}
.sidebar-cache.on .dot {
  color: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0.05); }
}
.sidebar-cache div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sidebar-cache strong { color: #dfe4ff; font-size: 12px; font-weight: 650; }
.sidebar-cache small { color: #6f7ba3; font-size: 10.5px; margin-top: 2px; }
.logout-btn {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px;
  border: 0; border-radius: 10px;
  background: transparent; color: #7b86ab;
  font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: all 0.18s ease;
}
.logout-btn svg { width: 17px; height: 17px; }
.logout-btn:hover { background: rgba(255, 255, 255, 0.06); color: #e8ecff; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 18px 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.page-head h1 { margin: 0; font-size: 21px; letter-spacing: -0.025em; font-weight: 720; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.cache-pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.cache-pill .dot { color: var(--muted-2); }
.cache-pill.on { color: #047857; background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 24%, var(--border)); }
.cache-pill.on .dot { color: var(--success); animation: pulse 2s ease infinite; }

.content {
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
  padding: 26px 32px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.grid { display: grid; gap: 20px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.85fr); }

/* 统计卡 */
.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: fadeUp 0.45s ease both;
}
.stat-card::after {
  content: "";
  position: absolute; right: -30px; top: -40px; z-index: 0;
  width: 130px; height: 130px; border-radius: 50%;
  background: var(--tone-soft, var(--primary-soft));
  opacity: 0.7;
  pointer-events: none;
}
.stat-card > * { position: relative; z-index: 1; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tone-soft, var(--primary-soft));
  color: var(--tone, var(--primary));
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat-value {
  font-size: 30px;
  font-weight: 730;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat-foot { margin-top: 8px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tone-indigo { --tone: #6366f1; --tone-soft: #eef0ff; }
.tone-emerald { --tone: #059669; --tone-soft: #e7f8f2; }
.tone-amber { --tone: #d97706; --tone-soft: #fff7e6; }
.tone-cyan { --tone: #0891b2; --tone-soft: #e6f7fb; }
[data-theme="dark"] .tone-indigo { --tone-soft: rgba(99,102,241,.16); }
[data-theme="dark"] .tone-emerald { --tone-soft: rgba(16,185,129,.14); }
[data-theme="dark"] .tone-amber { --tone-soft: rgba(245,158,11,.14); }
[data-theme="dark"] .tone-cyan { --tone-soft: rgba(8,145,178,.16); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* 图表 */
.chart-head { display: flex; align-items: center; gap: 18px; }
.legend { display: flex; align-items: center; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.chart-box { margin-top: 12px; width: 100%; }
.chart-box svg { width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-area { fill: url(#areaGrad); }
.chart-line { fill: none; stroke: url(#lineGrad); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: var(--panel); stroke: #818cf8; stroke-width: 2.2; }
.chart-label { fill: var(--muted); font-size: 10px; font-family: var(--font); }
.chart-value { fill: var(--text); font-size: 10.5px; font-weight: 700; font-family: var(--font); }

/* 缓存 hero */
.cache-hero {
  position: relative;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
  background:
    radial-gradient(420px 240px at 100% 0%, rgba(139, 92, 246, 0.18), transparent 70%),
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 7%, var(--panel)), var(--panel));
  overflow: hidden;
}
.cache-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.cache-hero h3 { margin: 0 0 4px; font-size: 16px; letter-spacing: -0.01em; }
.cache-hero p { margin: 0; color: var(--muted); font-size: 12.5px; max-width: 420px; }
.cache-status {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 16px; padding: 7px 11px;
  border-radius: 9px; font-size: 12px; font-weight: 650;
  background: var(--panel-subtle); border: 1px solid var(--border); color: var(--muted);
}
.cache-status.on { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, var(--border)); color: #047857; }
.model-meta { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; font-size: 12px; }
.model-meta div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.model-meta span { color: var(--muted); }
.model-meta strong { font-weight: 600; color: var(--text-soft); max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 排行 / 最近列表 */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.list-row:last-child { border-bottom: 0; padding-bottom: 0; }
.list-row:first-child { padding-top: 0; }
.rank {
  width: 24px; height: 24px; flex: 0 0 auto;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  color: var(--muted); background: var(--panel-subtle); border: 1px solid var(--border);
}
.rank.top { color: #b45309; background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, var(--border)); }
.list-main { min-width: 0; flex: 1; }
.list-main strong {
  display: block; font-size: 12.5px; font-weight: 550; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.list-main small { color: var(--muted); font-size: 11px; }
.list-side { text-align: right; flex: 0 0 auto; font-size: 11.5px; color: var(--muted); }
.list-side strong { display: block; color: var(--text-soft); font-size: 12px; font-variant-numeric: tabular-nums; }

/* 工具栏 */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  flex-wrap: wrap;
}
.toolbar .search-box { position: relative; flex: 1 1 260px; min-width: 200px; }
.toolbar .search-box svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted-2); pointer-events: none;
}
.toolbar .search-box input { padding-left: 38px; }
.toolbar select { width: auto; min-width: 116px; }
.toolbar .spacer { flex: 1; }

/* 设置 */
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr); gap: 20px; align-items: start; }
.settings-stack { display: flex; flex-direction: column; gap: 20px; }
.section-head { margin: 0 0 4px; font-size: 14.5px; font-weight: 700; }
.section-desc { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; }
.divider { height: 1px; background: var(--border); margin: 20px 0; border: 0; }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: 0; padding-bottom: 0; }
.toggle-row:first-child { padding-top: 0; }
.toggle-row .t-label { font-size: 13px; font-weight: 650; }
.toggle-row .t-desc { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; max-width: 520px; }
.cost-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border-radius: 7px;
  background: var(--panel-subtle); border: 1px solid var(--border);
  font-size: 11px; color: var(--muted); font-family: var(--mono);
}
.thinking-box {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel-subtle);
  border: 1px solid var(--border);
}
.thinking-box.disabled { opacity: 0.6; }
.thinking-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.thinking-row > div:first-child { flex: 1 1 0; min-width: 0; }
.thinking-row .switch { flex: 0 0 auto; }
.thinking-row + .thinking-row { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }
.test-result { margin-top: 16px; }
.test-result .result-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; font-weight: 650; }
.test-result .result-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.test-result .result-cell {
  background: var(--panel-subtle); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 11px;
}
.test-result .result-cell span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.test-result .result-cell strong { font-size: 13px; font-variant-numeric: tabular-nums; }
.answer-preview {
  margin-top: 10px; padding: 12px 14px;
  border-radius: 12px; background: var(--primary-soft);
  color: var(--primary-text); font-size: 14px; font-weight: 650;
  word-break: break-word;
}

/* 代码块 */
.code-block {
  position: relative;
  background: #0c1222;
  color: #c9d4f2;
  border-radius: 12px;
  padding: 16px 18px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  border: 1px solid #1b2540;
}
.code-block pre { margin: 0; white-space: pre-wrap; word-break: break-word; }
.copy-btn {
  position: absolute; top: 9px; right: 9px;
  height: 26px; padding: 0 9px;
  border-radius: 7px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06); color: #aab6d8;
  font-size: 10.5px; font-weight: 600; cursor: pointer;
  transition: all 0.15s ease;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* 步骤 */
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; gap: 16px; padding: 16px 0; border-bottom: 1px dashed var(--border); }
.step:last-child { border-bottom: 0; padding-bottom: 0; }
.step:first-child { padding-top: 0; }
.step-no {
  width: 28px; height: 28px; flex: 0 0 auto;
  border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-text);
  font-size: 12px; font-weight: 700; font-family: var(--mono);
}
.step-body { min-width: 0; flex: 1; }
.step-body h4 { margin: 2px 0 6px; font-size: 13.5px; }
.step-body p { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }
.step-body .code-block { margin-top: 8px; }

/* 端点表 */
.endpoint { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.endpoint:last-child { border-bottom: 0; }
.method {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 5px; letter-spacing: 0.04em;
}
.method.get { color: #047857; background: var(--success-soft); }
.method.post { color: #4f46e5; background: var(--primary-soft); }
.endpoint code { font-family: var(--mono); font-size: 12px; color: var(--text-soft); }
.endpoint span { color: var(--muted); font-size: 11.5px; margin-left: auto; }

/* Token */
.token-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-subtle);
  margin-bottom: 10px;
}
.token-row:last-child { margin-bottom: 0; }
.token-main { flex: 1; min-width: 0; }
.token-main strong { display: block; font-size: 12.5px; }
.token-main code {
  display: inline-block; max-width: 100%;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.token-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.token-stat { font-size: 11px; color: var(--muted); text-align: right; flex: 0 0 auto; }

/* 拖拽上传 */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 16px;
  padding: 30px 20px;
  text-align: center;
  background: var(--panel-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone svg { width: 30px; height: 30px; margin: 0 auto 10px; color: var(--muted-2); }
.dropzone strong { display: block; font-size: 13px; margin-bottom: 3px; }
.dropzone span { color: var(--muted); font-size: 11.5px; }

.import-result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 24%, var(--border));
  font-size: 12.5px;
  color: var(--text-soft);
}
.import-result.error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 24%, var(--border)); }
.import-result ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }

/* 弹窗 */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 12, 24, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(720px, 100%);
  max-height: min(86vh, 900px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 22px 14px;
}
.modal-head h3 { margin: 0; font-size: 16.5px; letter-spacing: -0.01em; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 8px 22px 20px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 15px 22px;
  border-top: 1px solid var(--border);
  background: var(--panel-subtle);
  border-radius: 0 0 22px 22px;
}
.modal-foot .spacer { flex: 1; }

/* Toast */
.toast-root {
  position: fixed; top: 20px; right: 22px; z-index: 200;
  display: flex; flex-direction: column; gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 220px; max-width: 360px;
  padding: 12px 15px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  font-size: 12.5px; font-weight: 550;
  animation: toastIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  pointer-events: auto;
}
.toast .toast-icon {
  width: 22px; height: 22px; border-radius: 7px; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.toast.success .toast-icon { background: var(--success-soft); color: #047857; }
.toast.error .toast-icon { background: var(--danger-soft); color: #b91c1c; }
.toast.info .toast-icon { background: var(--primary-soft); color: var(--primary-text); }
.toast.hide { animation: toastOut 0.24s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(18px); } }

/* tooltip 小标签 */
.kbd {
  font-family: var(--mono); font-size: 10px;
  padding: 1px 5px; border-radius: 4px;
  background: var(--panel-subtle); border: 1px solid var(--border); color: var(--muted);
}

/* 响应式 */
@media (max-width: 1180px) {
  :root { --sidebar-w: 84px; }
  .brand-text, .nav a span, .sidebar-cache div, .logout-btn span { display: none; }
  .brand { justify-content: center; padding: 4px 0 24px; }
  .nav a { justify-content: center; padding: 0; }
  .nav a.active::before { left: -16px; }
  .sidebar-cache { justify-content: center; }
  .logout-btn { justify-content: center; }
  .grid.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side, .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .form-grid, .field-row { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 24px; }
  .topbar { padding: 14px 18px; }
  .content { padding: 18px 16px 96px; }
  .page-head p { display: none; }
}
@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }
  .sidebar {
    inset: auto 0 0 0;
    width: 100%; height: 64px;
    flex-direction: row; align-items: center; gap: 4px;
    padding: 8px 10px;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; gap: 4px; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 3px; height: 48px; flex: 1; min-width: 48px; padding: 0; border-radius: 9px; }
  .nav a span { display: block; font-size: 9.5px; }
  .nav a svg { width: 18px; height: 18px; }
  .nav a.active::before { display: none; }
  .main { margin-left: 0; }
  .grid.stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 15px; border-radius: 16px; }
  .stat-value { font-size: 23px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stat-icon svg { width: 17px; height: 17px; }
  .content { padding: 14px 12px 88px; gap: 14px; }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 16px; }
  .toolbar { padding: 12px 14px; }
  .toolbar select { flex: 1; }
  .cell-actions { flex-direction: column; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 20px; }
  .toast-root { top: 12px; right: 12px; left: 12px; }
  .toast { max-width: none; }
  .pager { padding: 12px 14px; }
  .login-card { padding: 30px 24px 24px; }
  .cache-hero { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* 主题切换图标显隐 */
.icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }

/* range & details 补充 */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--primary);
  box-shadow: none;
  cursor: pointer;
}
input[type="range"]:focus { box-shadow: none; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  opacity: 0.9;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #6366f1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
}
[data-theme="dark"] input[type="range"]::-webkit-slider-thumb { background: #e8ecf7; }
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 99px; background: #6366f1;
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  border: 2px solid #6366f1;
}
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 7px;
  color: var(--muted-2);
  transition: transform 0.18s ease;
}
details[open] summary::before { content: "▾"; }

/* 卡片头部操作区 */
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  .head-actions { width: 100%; justify-content: flex-start; }
}

/* ============================================================
   移动端增强：卡片式列表、16px 输入防缩放、安全区
   ============================================================ */
.mobile-cards { display: none; }

@media (max-width: 720px) {
  .desktop-table { display: none; }
  .mobile-cards { display: flex; flex-direction: column; }

  /* 题库卡片 */
  .q-card { padding: 15px 16px; border-bottom: 1px solid var(--border); }
  .q-card:last-child { border-bottom: 0; }
  .q-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .q-card-question {
    flex: 1; min-width: 0;
    font-size: 13.5px; font-weight: 600; line-height: 1.55;
    word-break: break-word;
  }
  .q-card-top .answer-code { flex: 0 0 auto; max-width: 42%; }
  .q-card-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    margin-top: 9px;
  }
  .q-card-meta .muted { font-size: 11px; }
  .q-card-answer {
    margin-top: 8px; font-size: 12px; line-height: 1.55;
    color: var(--muted); word-break: break-word;
  }
  .q-card-actions { display: flex; gap: 6px; margin-top: 12px; }
  .q-card-actions .btn { flex: 1; height: 34px; }

  /* 日志卡片 */
  .log-card { padding: 15px 16px; border-bottom: 1px solid var(--border); }
  .log-card:last-child { border-bottom: 0; }
  .log-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .log-card-top .muted { font-size: 11px; }
  .log-card-q {
    margin-top: 7px; font-size: 13px; font-weight: 550; line-height: 1.55;
    word-break: break-word;
  }
  .log-card-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
    margin-top: 9px; font-size: 11px; color: var(--muted);
  }
  .log-card-meta .answer-code { max-width: 100%; }

  /* 输入框 16px，避免 iOS 聚焦自动放大 */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
  select, textarea { font-size: 16px; }

  /* 工具栏与分页 */
  .toolbar > .btn { width: 100%; }
  .toolbar .spacer { display: none; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
  .pager { flex-direction: column; align-items: stretch; gap: 10px; }
  .pager-btns { justify-content: center; }

  /* 卡片头在窄屏换行，避免按钮被挤出 */
  .card-head { flex-wrap: wrap; }
  .head-actions { width: 100%; justify-content: flex-start; }

  /* 长 Token / JSON 不撑破代码块 */
  .code-block pre { overflow-wrap: anywhere; }

  /* 刘海屏 / 底部手势区 */
  .sidebar {
    height: calc(64px + env(safe-area-inset-bottom));
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .content { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }
  .modal-foot { padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
  .toast-root { top: calc(12px + env(safe-area-inset-top)); }
  .login-panel { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

  /* 底部导航文字不换行 */
  .nav a span { white-space: nowrap; }
}

/* 防止长 Token/代码撑破网格列 */
.grid > *,
.settings-stack,
.card,
.card-head,
.card-body,
.code-block,
.code-block pre,
.steps,
.step,
.step-body { min-width: 0; }
.code-block, .code-block pre { max-width: 100%; }

/* 卡片标题区可收缩，徽标尽量留在同一行 */
.card-head > div:first-child { flex: 1 1 0; min-width: 0; }

/* 移动端交互细节 */
a, button, .switch, select, input[type="range"] { -webkit-tap-highlight-color: transparent; }
.btn, .nav a, .pager-btns button { touch-action: manipulation; }
@supports (height: 100dvh) {
  .login-wrap { min-height: 100dvh; }
  @media (max-width: 720px) {
    .modal { max-height: 92dvh; }
  }
}

/* 平板（721-900px）也使用卡片列表，避免表格操作列被截断 */
@media (max-width: 900px) and (min-width: 721px) {
  .desktop-table { display: none; }
  .mobile-cards { display: flex; flex-direction: column; }
  .q-card { padding: 15px 18px; border-bottom: 1px solid var(--border); }
  .q-card:last-child { border-bottom: 0; }
  .q-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
  .q-card-question { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.55; word-break: break-word; }
  .q-card-top .answer-code { flex: 0 0 auto; max-width: 42%; }
  .q-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
  .q-card-meta .muted { font-size: 11.5px; }
  .q-card-answer { margin-top: 8px; font-size: 12.5px; line-height: 1.55; color: var(--muted); word-break: break-word; }
  .q-card-actions { display: flex; gap: 6px; margin-top: 12px; }
  .q-card-actions .btn { flex: 1; height: 34px; }
  .log-card { padding: 15px 18px; border-bottom: 1px solid var(--border); }
  .log-card:last-child { border-bottom: 0; }
  .log-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .log-card-top .muted { font-size: 11.5px; }
  .log-card-q { margin-top: 7px; font-size: 13.5px; font-weight: 550; line-height: 1.55; word-break: break-word; }
  .log-card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 9px; font-size: 11.5px; color: var(--muted); }
  .log-card-meta .answer-code { max-width: 100%; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="hidden"]),
  select, textarea { font-size: 16px; }
}
