/* ============================================================
   QB · 组件：按钮 · 表单 · 搜索 · 卡片 · 表格 · 徽章 · 开关
   全站无位移动画：悬停只变颜色/边框/阴影
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 17px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  background: var(--surface-3);
  color: var(--text-1);
  transition: background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn svg { flex: 0 0 16px; width: 16px; height: 16px; }

.btn-primary {
  background: var(--brand-500);
  border-color: rgba(0,0,0,.05);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 8px 16px -8px rgba(37, 99, 235, .6);
}
.btn-primary:hover { background: var(--brand-600); color: #fff; border-color: rgba(0,0,0,.05); }
.btn-primary:active { background: var(--brand-700); }

.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text-2); box-shadow: var(--shadow-1); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-1); }
.btn-danger { background: var(--surface); border-color: var(--err-line); color: var(--err-500); }
.btn-danger:hover { background: var(--err-bg); border-color: var(--err-500); }
.btn-sm { height: 33px; padding: 0 13px; font-size: 12.5px; border-radius: 10px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 14.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 33px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-2); margin-bottom: 7px; }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

.input, .textarea, .select {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-1);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  outline: none;
}
.textarea { height: auto; min-height: 76px; padding: 10px 13px; resize: vertical; line-height: 1.6; }
.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='%238b98b3' 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 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.input:hover, .textarea:hover, .select:hover { border-color: #aebdD6; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand-500); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input.invalid { border-color: var(--err-500); box-shadow: 0 0 0 4px rgba(220,38,38,.1); }

/* 搜索框 */
.search-box { position: relative; width: 100%; }
.search-box > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; width: 16px; height: 16px; }
.search-box .input { height: 40px; padding-left: 36px; padding-right: 44px; background: var(--surface-2); border-radius: var(--r-full); border-color: var(--line); }
.search-box .input:focus { background: var(--surface); border-color: var(--brand-500); }
.search-box .kbd { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); }
.kbd {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  font-family: var(--mono); font-size: 11px; color: var(--text-2);
}
.search-pop {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  z-index: 60;
}
.search-pop-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  border: 0; background: transparent; color: var(--text-1);
  font-size: 13px; cursor: pointer; text-align: left;
}
.search-pop-item:hover { background: var(--brand-50); }
.search-pop-item .muted { margin-left: auto; font-size: 11.5px; }
.search-pop-empty { padding: 14px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 20px;
  transition: box-shadow var(--t-med), border-color var(--t-med);
}
.card.hoverable { cursor: pointer; }
.card.hoverable:hover { box-shadow: var(--shadow-2); border-color: var(--brand-200); }
.card-title { font-size: 14.5px; font-weight: 750; letter-spacing: -0.015em; margin-bottom: 2px; }
.card-sub { font-size: 12.5px; color: var(--text-3); }

/* 统计卡：彩色图标砖 + 大数字 */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px 15px;
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--t-med), border-color var(--t-med);
}
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { box-shadow: var(--shadow-2); border-color: var(--brand-200); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 12px; font-weight: 700; color: var(--text-2); letter-spacing: .01em; }
.stat-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--tile-blue-bg); color: var(--tile-blue-fg); }
.stat-ico svg { width: 18px; height: 18px; }
.stat:nth-child(2) .stat-ico { background: var(--tile-amber-bg); color: var(--tile-amber-fg); }
.stat:nth-child(3) .stat-ico { background: var(--tile-teal-bg); color: var(--tile-teal-fg); }
.stat:nth-child(4) .stat-ico { background: var(--tile-violet-bg); color: var(--tile-violet-fg); }
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-1); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 750; color: var(--text-3);
  letter-spacing: .07em; text-transform: uppercase;
  padding: 11px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }
.table tr.clickable { cursor: pointer; }

.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--surface-2); }
.list-row-main { flex: 1; min-width: 0; }
.list-row-title { font-weight: 700; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 徽章：静态圆点，无脉冲 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 700; line-height: 1.7;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok-500); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-bg); color: var(--warn-500); border-color: var(--warn-line); }
.badge-err { background: var(--err-bg); color: var(--err-500); border-color: var(--err-line); }
.badge-info { background: var(--info-bg); color: var(--info-500); border-color: var(--info-line); }
.badge-mute { background: var(--surface-3); color: var(--text-2); border-color: var(--line); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: 0 0 6px; }

/* ---------- 空态 / 加载（骨架静态，无扫光） ---------- */
.empty { text-align: center; padding: 52px 20px; color: var(--text-3); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty svg { width: 30px; height: 30px; opacity: .45; margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.empty-desc { font-size: 12.5px; margin-bottom: 14px; }

.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; vertical-align: -3px;
}
.btn-ghost .spinner, .btn:not(.btn-primary) .spinner { border-color: var(--line-strong); border-top-color: var(--brand-500); }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: var(--surface-3); border-radius: var(--r-sm); border: 1px solid var(--line); }
.loading-block { padding: 4px 0; display: grid; gap: 10px; }

/* ---------- Toast（仅淡入淡出） ---------- */
.toast-zone { position: fixed; top: 18px; right: 18px; z-index: 200; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-3);
  font-size: 13px; line-height: 1.55;
  animation: toast-fade .18s ease;
}
.toast.leaving { opacity: 0; transition: opacity .2s ease; }
@keyframes toast-fade { from { opacity: 0; } to { opacity: 1; } }
.toast.ok { border-left: 3px solid var(--ok-500); }
.toast.err { border-left: 3px solid var(--err-500); }
.toast.info { border-left: 3px solid var(--info-500); }
.toast svg { flex: 0 0 17px; width: 17px; height: 17px; margin-top: 1px; }
.toast.ok svg { color: var(--ok-500); }
.toast.err svg { color: var(--err-500); }
.toast.info svg { color: var(--info-500); }

/* ---------- Modal（仅淡入） ---------- */
.modal-scrim {
  position: fixed; inset: 0;
  background: rgba(22, 33, 58, .45);
  backdrop-filter: blur(6px);
  z-index: 150; display: grid; place-items: center;
  padding: 20px; animation: fade-in .18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(480px, 100%); max-height: min(84vh, 760px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); box-shadow: var(--shadow-3);
  animation: fade-in .18s ease;
  overflow: hidden;
}
.modal-lg { width: min(700px, 100%); }
.modal-head { padding: 18px 20px 14px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); }
.modal-head > svg { width: 32px; height: 32px; padding: 7px; border-radius: 10px; background: var(--tile-blue-bg); color: var(--tile-blue-fg); flex: 0 0 32px; }
.modal-title { font-size: 15.5px; font-weight: 800; letter-spacing: -0.02em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-x { border: 0; background: transparent; color: var(--text-3); cursor: pointer; padding: 6px; border-radius: 8px; display: inline-flex; }
.modal-x:hover { background: var(--surface-3); color: var(--text-1); }
.modal-x svg { width: 16px; height: 16px; }
.modal-body { padding: 16px 20px; color: var(--text-2); font-size: 13.5px; overflow-y: auto; }
.modal-foot { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 14px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------- 工具条 / 筛选 ---------- */
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 12px 14px;
}
.toolbar .search-box { flex: 1 1 220px; }
.toolbar .select, .toolbar .input { height: 38px; font-size: 13px; }
.toolbar .field { margin-bottom: 0; }
.toolbar-group { display: flex; gap: 8px; align-items: center; }
.filter-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 14px 16px; }
.filter-bar .field { margin-bottom: 0; min-width: 130px; }
.filter-bar .input, .filter-bar .select { height: 38px; font-size: 13px; background: var(--surface-2); }
.filter-bar .input:focus, .filter-bar .select:focus { background: var(--surface); }

.seg { display: inline-flex; background: var(--surface-3); border: 1px solid var(--line); border-radius: 13px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; min-width: 68px; justify-content: center; font-size: 13px; font-weight: 650; color: var(--text-2); border-radius: 10px; cursor: pointer; transition: background var(--t-fast), color var(--t-fast); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
/* 2026-09-14：悬停提亮门控在 (hover:hover)——触屏 tap 会粘住 :hover，
 * 使"已取消/未选中"的 seg 按钮仍显亮（掌握度标记"取消后一直显示着"的另一半原因）。 */
@media (hover: hover) { .seg button:hover { color: var(--text-1); } }
.seg button.on { background: var(--surface); color: var(--text-1); font-weight: 750; box-shadow: var(--shadow-1); }

/* ---------- 进度条（宽度平滑填充，非抖动） ---------- */
.progress { height: 8px; border-radius: var(--r-full); background: var(--surface-3); border: 1px solid var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--brand-500); transition: width .3s ease; min-width: 6px; }

/* ---------- 条形图 ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 96px; padding: 12px 4px 0; }
.bars .bar { flex: 1; min-width: 0; border-radius: 7px 7px 3px 3px; background: var(--brand-400); opacity: .9; min-height: 4px; }
.bars .bar:nth-child(2n) { background: var(--tile-cyan-fg); }
.bars .bar:nth-child(3n) { background: #34d399; }

/* ---------- 答题导航 ---------- */
.qnav { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.qnav button {
  height: 36px; border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text-2);
  font-family: var(--mono); font-size: 12.5px; font-weight: 700;
  cursor: pointer; transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.qnav button:hover { border-color: var(--brand-400); color: var(--brand-600); }
.qnav button.done { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-600); }
.qnav button.current { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }

/* ---------- 工具类 ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 6px; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
