/* ============================================================
 * AI速测宝 · 后台管理系统样式（浅色主题 / 快手橙主色）
 * ============================================================ */
:root {
  --primary: #FF4900;
  --primary-hover: #E63F00;
  --primary-active: #CC3700;
  --primary-light: #FFF0E8;
  --primary-border: #FFD4BF;

  --ai: #7A5AF8;
  --ai-light: #F1EEFE;
  --ai-border: #D9D2FD;

  --bg: #F4F5F8;
  --card: #FFFFFF;
  --border: #E8EAEF;
  --border-strong: #D6DAE1;

  --text: #1B1F26;
  --text-2: #5A6270;
  --text-3: #98A0AE;

  --green: #0FA958;
  --green-bg: #E6F7EE;
  --red: #E5484D;
  --red-bg: #FDECEC;
  --amber: #D9870B;
  --amber-bg: #FCF3E2;
  --blue: #2E90FA;
  --blue-bg: #EBF5FF;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, .16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; outline: none; }
::selection { background: var(--primary-light); }

/* ---------------- 布局 ---------------- */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid var(--border); }
.logo-mark {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #FF7A33, #FF4900 60%, #F0DB1A 140%);
  color: #fff; font-weight: 800; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(255, 73, 0, .28);
}
.logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.logo-text strong { font-size: 15px; }
.logo-text span { font-size: 11px; color: var(--text-3); }

#nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14px; cursor: pointer;
  transition: all .15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: #F3F4F6; color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; border-radius: 99px; padding: 0 7px; line-height: 18px;
}
.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--border); }
.sidebar-foot p { font-size: 11px; color: var(--text-3); margin-top: 6px; line-height: 1.5; }
.ks-tag {
  display: inline-block; font-size: 11px; color: var(--primary);
  background: var(--primary-light); border: 1px solid var(--primary-border);
  padding: 2px 8px; border-radius: 99px;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.mode-badge {
  font-size: 12px; padding: 3px 10px; border-radius: 99px;
  background: #F3F4F6; color: var(--text-2); border: 1px solid var(--border);
}
.mode-badge.ok { background: var(--green-bg); color: var(--green); border-color: #BDE8D1; }
.mode-badge.warn { background: var(--amber-bg); color: var(--amber); border-color: #F5DCA8; }
.content { padding: 24px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------------- 通用组件 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
  font-size: 13px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-ai {
  background: linear-gradient(135deg, #8B6FF7, #6C47F5); border: none; color: #fff; font-weight: 600;
}
.btn-ai:hover { filter: brightness(1.08); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #D13336; border-color: #D13336; color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #F3F4F6; color: var(--text); border-color: transparent; }
.btn-ghost.btn-danger-text { color: var(--red); }
.btn-ghost.btn-danger-text:hover { background: var(--red-bg); color: var(--red); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-block { width: 100%; }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); transition: border .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 76px; padding: 8px 12px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 73, 0, .12);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { cursor: pointer; 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='%2398A0AE' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; }
.page-head .muted { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.flex-spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }

.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 12px; height: 36px; background: #fff;
}
.search-box svg { width: 15px; height: 15px; color: var(--text-3); flex-shrink: 0; }
.search-box input { border: none; flex: 1; height: 100%; background: transparent; }

/* ---------------- 表格 ---------------- */
.table-card { overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: #FAFBFC;
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FAFBFC; }
.table .title-cell { max-width: 380px; }
.table .title-cell .t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .title-cell .s { font-size: 12px; color: var(--text-3); }
.op-cell { display: flex; gap: 4px; }
.checkbox { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* ---------------- 徽章 / 标签 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 2px 9px; border-radius: 99px; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-gray { background: #F3F4F6; color: var(--text-2); }
.badge-orange { background: var(--primary-light); color: var(--primary); }
.badge-purple { background: var(--ai-light); color: var(--ai); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.tag-chip {
  display: inline-block; font-size: 12px; color: var(--text-2);
  background: #F3F4F6; border-radius: 6px; padding: 1px 8px; margin: 1px 2px;
}

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 18px; display: flex; align-items: center; gap: 14px; }
.stat-icon {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.orange { background: var(--primary-light); color: var(--primary); }
.stat-icon.purple { background: var(--ai-light); color: var(--ai); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-info .num { font-size: 24px; font-weight: 800; line-height: 1.2; }
.stat-info .label { font-size: 12px; color: var(--text-2); }

/* ---------------- 试卷卡片 ---------------- */
.paper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.paper-card { overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.paper-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.paper-cover {
  height: 110px; display: flex; align-items: center; justify-content: center;
  font-size: 46px; position: relative;
}
.paper-cover .status-dot { position: absolute; top: 10px; right: 10px; }
.paper-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.paper-title { font-size: 15px; font-weight: 700; }
.paper-sub { font-size: 12px; color: var(--text-3); }
.paper-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.paper-ops { display: flex; gap: 4px; padding: 10px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(16, 24, 40, .5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 16px 4vh; z-index: 1000; overflow-y: auto;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 16px; width: 100%;
  box-shadow: var(--shadow-lg); animation: slideUp .18s ease;
  display: flex; flex-direction: column; max-height: 90vh;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  width: 30px; height: 30px; border: none; background: transparent; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-3);
}
.modal-close:hover { background: #F3F4F6; color: var(--text); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 22px; border-top: 1px solid var(--border); flex-shrink: 0;
}

/* ---------------- 表单 ---------------- */
.form-section { margin-bottom: 22px; }
.form-section > .fs-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.form-section > .fs-title::before {
  content: ''; width: 3px; height: 14px; border-radius: 2px; background: var(--primary);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.field label .req { color: var(--red); margin-left: 2px; }
.field .hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.option-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.option-key {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.option-row .input { flex: 1; min-width: 0; }
.option-row .opt-dim { width: 74px; flex: none; }
.option-row .opt-weight { width: 74px; flex: none; }
.opt-del {
  width: 28px; height: 28px; border: none; background: transparent; border-radius: 6px;
  color: var(--text-3); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.opt-del:hover { background: var(--red-bg); color: var(--red); }
.opt-del svg { width: 14px; height: 14px; }

/* ---------------- 合规自检 ---------------- */
.check-list { display: flex; flex-direction: column; gap: 8px; }
.check-item { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; padding: 8px 12px; border-radius: 8px; background: #FAFBFC; }
.check-item svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 3px; }
.check-item.pass { color: var(--text-2); }
.check-item.pass svg { color: var(--green); }
.check-item.warn { background: var(--amber-bg); color: #8A5A06; }
.check-item.warn svg { color: var(--amber); }

/* ---------------- 手机预览 ---------------- */
.phone-wrap { display: flex; justify-content: center; padding: 8px 0 4px; }
.phone {
  width: 300px; border-radius: 36px; background: #101828; padding: 10px;
  box-shadow: var(--shadow-lg);
}
.phone-screen {
  background: linear-gradient(180deg, #0B1E5B, #1D3FAA 55%, #5D8DF5);
  border-radius: 28px; min-height: 540px; overflow: hidden;
  display: flex; flex-direction: column; color: #fff; position: relative;
}
.phone-status { display: flex; justify-content: space-between; padding: 10px 18px 4px; font-size: 11px; opacity: .85; }
.phone-capsule { display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.16); border-radius: 99px; padding: 3px 10px; font-size: 11px; }
.phone-body { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.phone-hero { text-align: center; padding: 10px 0 4px; }
.phone-hero .emoji { font-size: 56px; }
.phone-hero .t { font-size: 19px; font-weight: 800; margin-top: 8px; }
.phone-hero .s { font-size: 12px; opacity: .8; margin-top: 4px; }
.phone-btn {
  background: linear-gradient(135deg, #FFD54D, #FF9F1A); color: #4A2B00;
  border: none; border-radius: 99px; height: 42px; font-weight: 800; font-size: 15px; cursor: pointer;
}
.phone-q { background: rgba(255,255,255,.14); border-radius: 14px; padding: 14px; }
.phone-q .qh { display: flex; justify-content: space-between; font-size: 12px; opacity: .85; margin-bottom: 8px; }
.phone-q .qt { font-size: 14px; font-weight: 600; line-height: 1.5; }
.phone-opt {
  background: rgba(255,255,255,.94); color: #1B1F26; border-radius: 12px;
  padding: 11px 14px; font-size: 13px; cursor: pointer; text-align: left; border: none; width: 100%;
}
.phone-opt:hover { background: #fff; }
.phone-opt.sel { background: #FFD54D; font-weight: 700; }
.phone-result { background: rgba(255,255,255,.96); color: #1B1F26; border-radius: 16px; padding: 16px; text-align: center; }
.phone-result .chip { display: inline-block; background: #2E5BFF; color: #fff; font-size: 11px; border-radius: 99px; padding: 2px 12px; }
.phone-result .rt { font-size: 18px; font-weight: 800; margin-top: 8px; }
.phone-result .rs { font-size: 12px; color: var(--text-2); margin-top: 6px; line-height: 1.6; text-align: left; }
.phone-bar { margin-top: 10px; text-align: left; }
.phone-bar .bl { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }
.phone-bar .track { height: 7px; background: #EEF1F5; border-radius: 99px; margin: 4px 0 8px; overflow: hidden; }
.phone-bar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FF7A33, #FF4900); }
.phone-tip { font-size: 10px; opacity: .75; text-align: center; line-height: 1.5; }

/* ---------------- 维度/结果编辑器 ---------------- */
.dim-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.dim-row .input { flex: 1; }
.dim-row .dim-key { max-width: 90px; }
.result-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: #FAFBFC; }
.result-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.result-card-head .emoji-input { width: 56px; text-align: center; flex: none; }
.result-card-head .input { flex: 1; }
.empty-box {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--text-3); font-size: 13px;
}
.bank-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 860px) { .bank-pick { grid-template-columns: 1fr; } }
.bank-col { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.bank-col-head { padding: 10px 12px; background: #FAFBFC; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.bank-list { max-height: 300px; overflow-y: auto; padding: 8px; }
.bank-item { display: flex; gap: 8px; padding: 8px; border-radius: 8px; cursor: pointer; align-items: flex-start; }
.bank-item:hover { background: #F3F4F6; }
.bank-item .bt { font-size: 13px; line-height: 1.45; }
.bank-item .bm { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.bank-item.checked { background: var(--primary-light); }
.sel-q { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 8px; background: #fff; border: 1px solid var(--border); margin-bottom: 6px; }
.sel-q .st { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-q .ops { display: flex; gap: 2px; }
.icon-btn {
  width: 26px; height: 26px; border: none; background: transparent; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-3);
}
.icon-btn:hover { background: #F3F4F6; color: var(--text); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }

/* ---------------- AI 助手 ---------------- */
.ai-layout { display: grid; grid-template-columns: 1fr 260px; gap: 14px; align-items: start; }
@media (max-width: 960px) { .ai-layout { grid-template-columns: 1fr; } }
.chat-card { display: flex; flex-direction: column; height: calc(100vh - 220px); min-height: 480px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 88%; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.msg.ai .msg-avatar { background: linear-gradient(135deg, #8B6FF7, #6C47F5); color: #fff; }
.msg.user .msg-avatar { background: var(--primary); color: #fff; }
.msg-bubble { padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.msg.ai .msg-bubble { background: #F6F7F9; border: 1px solid var(--border); border-top-left-radius: 4px; }
.msg.user .msg-bubble { background: var(--primary); color: #fff; border-top-right-radius: 4px; }
.msg-bubble pre {
  background: #101828; color: #E6EAF2; border-radius: 8px; padding: 10px 12px;
  font-size: 12px; overflow-x: auto; margin-top: 8px; white-space: pre;
}
.import-card { border: 1px solid var(--ai-border); background: var(--ai-light); border-radius: 12px; padding: 12px 14px; margin-top: 8px; }
.import-card h5 { font-size: 13px; color: var(--ai); margin-bottom: 6px; }
.import-card .kv { font-size: 12px; color: var(--text-2); line-height: 1.8; }
.import-card .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chat-input-bar { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-input-bar .textarea { min-height: 42px; max-height: 120px; }
.chat-modes { display: flex; gap: 6px; padding: 12px 14px 0; flex-wrap: wrap; }
.chat-mode-chip {
  border: 1px solid var(--border-strong); background: #fff; color: var(--text-2);
  border-radius: 99px; padding: 4px 12px; font-size: 12px; cursor: pointer;
}
.chat-mode-chip.active { background: var(--ai-light); border-color: var(--ai-border); color: var(--ai); font-weight: 600; }
.ai-side .card { margin-bottom: 14px; }
.ai-side h4 { font-size: 13px; padding: 14px 16px 0; }
.quick-prompt {
  display: block; width: 100%; text-align: left; border: none; background: transparent;
  padding: 10px 16px; font-size: 12.5px; color: var(--text-2); cursor: pointer; line-height: 1.5;
}
.quick-prompt:hover { background: #F8F9FB; color: var(--primary); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .25; } 30% { opacity: 1; } }

/* ---------------- 设置 ---------------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 960px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-grid h3 { font-size: 15px; margin-bottom: 4px; }
.settings-grid .desc { font-size: 12.5px; color: var(--text-2); margin-bottom: 14px; }
.preset-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------------- Toast ---------------- */
#toastRoot { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #101828; color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: 99px; box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease; display: flex; align-items: center; gap: 8px;
}
.toast svg { width: 14px; height: 14px; }
.toast.success svg { color: #4ADE80; }
.toast.error { background: #B42318; }
.toast.error svg { color: #FDA29B; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------- 杂项 ---------------- */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.kv-list { display: flex; flex-direction: column; gap: 10px; }
.kv-list .kv { display: flex; justify-content: space-between; font-size: 13px; }
.kv-list .kv .k { color: var(--text-2); }
.mini-bars { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mini-bar .bl { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 3px; }
.mini-bar .track { height: 8px; background: #EEF1F5; border-radius: 99px; overflow: hidden; }
.mini-bar .fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #FF7A33, #FF4900); transition: width .4s; }
.tips-card { border-left: 3px solid var(--amber); }
.tips-card h4 { font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.tips-card ul { padding-left: 18px; font-size: 12.5px; color: var(--text-2); line-height: 1.9; }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
.spinner.dark { border-color: rgba(0,0,0,.15); border-top-color: var(--text-2); }
@keyframes spin { to { transform: rotate(360deg); } }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-orange { color: var(--primary); }
.text-purple { color: var(--ai); }

/* ============================================================
 * 登录视图 / 用户管理 / 顶栏用户区（第二批新增）
 * ============================================================ */
.hidden { display: none !important; }

/* ---------------- 登录页 ---------------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #FFF6EF 0%, #F4F5F8 55%, #F1EEFE 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 36px 36px 28px;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-mark {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #FF7A2A, var(--primary));
  color: #fff; font-size: 26px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(255, 73, 0, .28);
}
.login-title { display: flex; flex-direction: column; }
.login-title strong { font-size: 19px; }
.login-title span { font-size: 12px; color: var(--text-3); }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.login-field input {
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  background: #FAFBFC;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: #fff;
}
.login-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #F5C6C7;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
}
.login-submit {
  height: 46px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #FF7A2A, var(--primary));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  margin-top: 4px;
}
.login-submit:hover { opacity: .92; }
.login-submit:active { transform: scale(.98); }
.login-submit:disabled { opacity: .6; cursor: not-allowed; }
.login-tip { margin-top: 22px; padding-top: 16px; border-top: 1px dashed var(--border); }
.login-tip p { font-size: 12px; color: var(--text-2); line-height: 1.8; }
.login-tip code {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* ---------------- 顶栏用户区 ---------------- */
.user-box { display: flex; align-items: center; gap: 10px; }
.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #FF7A2A, var(--primary));
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-name { font-size: 13px; font-weight: 600; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-ops { display: flex; gap: 6px; }
.role-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  border-radius: 99px;
  padding: 1px 8px;
  line-height: 1.6;
}
.role-admin { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.role-editor { background: var(--ai-light); color: var(--ai); border: 1px solid var(--ai-border); }

/* ---------------- 用户管理 ---------------- */
.search-input {
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  width: 200px;
  background: #fff;
}
.search-input:focus { border-color: var(--primary); }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.page-ops { display: flex; align-items: center; gap: 10px; }
.row-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.tag-me {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: var(--blue);
  background: var(--blue-bg);
  border-radius: 4px;
  padding: 0 5px;
}
.status-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 4px;
}
.status-on { color: var(--green); background: var(--green-bg); }
.status-off { color: var(--red); background: var(--red-bg); }
.status-warn { color: var(--amber); background: var(--amber-bg); }
.log-action { font-weight: 600; }
.form-tip { font-size: 12px; color: var(--text-3); line-height: 1.7; }
.table td .btn-sm { margin-right: 0; }

/* ============================================================
 * 用户分析（热度条 / 趋势图 / 选项分布 / 用户头像）
 * ============================================================ */
.ana-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

@media (max-width: 1100px) {
  .ana-grid { grid-template-columns: 1fr; }
}

/* 试卷热度条 */
.heat-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.heat-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #FFB021, var(--primary));
  transition: width .4s ease;
}

/* 近 7 天趋势柱状图 */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  padding-top: 8px;
}

.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  height: 100%;
}

.trend-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.trend-bar {
  width: 70%;
  max-width: 34px;
  min-height: 2px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #FFC65C, var(--primary));
  transition: height .4s ease;
}

.trend-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.trend-label {
  font-size: 11px;
  color: var(--text-3);
}

/* 选项偏好分布 */
.opt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.opt-name {
  width: 46%;
  font-size: 12px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.opt-bar {
  flex: 1;
  height: 10px;
  border-radius: 99px;
  background: var(--border);
  overflow: hidden;
}

.opt-bar > div {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--ai), var(--purple));
}

.opt-num {
  width: 36px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

/* 小程序用户头像 */
.ana-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--primary-light);
}

.ana-avatar-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
}
