/* ===== 全局变量与基础重置 ===== */
:root {
  --primary: #2563eb;
  --primaryDark: #1e40af;
  --primaryLight: #dbeafe;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --text: #1f2937;
  --textLight: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadowLg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radiusSm: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  /* 使用 clamp 实现字号对等缩放 */
  font-size: clamp(14px, 1.6vw, 16px);
  min-height: 100vh;
}

/* ===== 布局容器 ===== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(12px, 2vw, 24px);
}

/* ===== 顶部导航 ===== */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbarInner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(10px, 1.8vw, 16px) clamp(12px, 2vw, 24px);
}

.brand {
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brandMark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  font-size: 1rem;
}

.topbarActions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.4vw, 24px);
}

.cardTitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* ===== 表单 ===== */
.formGroup {
  margin-bottom: 16px;
}

.formLabel {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--textLight);
  font-weight: 500;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radiusSm);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primaryLight);
}

.textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radiusSm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btnPrimary {
  background: var(--primary);
  color: #fff;
}

.btnPrimary:hover {
  background: var(--primaryDark);
}

.btnDanger {
  background: var(--danger);
  color: #fff;
}

.btnDanger:hover {
  background: #b91c1c;
}

.btnSuccess {
  background: var(--success);
  color: #fff;
}

.btnGhost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btnGhost:hover {
  background: var(--bg);
}

.btnSm {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.btnBlock {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 表格 ===== */
.tableWrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radiusSm);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 480px;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

th {
  background: var(--bg);
  font-weight: 600;
  color: var(--textLight);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

/* ===== 标签 ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.tagBlue {
  background: var(--primaryLight);
  color: var(--primaryDark);
}

.tagGreen {
  background: #dcfce7;
  color: #166534;
}

.tagRed {
  background: #fee2e2;
  color: #991b1b;
}

.tagAmber {
  background: #fef3c7;
  color: #92400e;
}

.tagGray {
  background: #f3f4f6;
  color: #4b5563;
}

/* ===== 搜索结果卡片网格 ===== */
.resultGrid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.resultCard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 720px;
  transition: box-shadow 0.2s, transform 0.2s;
}

.resultCard:hover {
  box-shadow: var(--shadowLg);
  transform: translateY(-2px);
}

.resultHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.resultName {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text);
}

.resultHead .tag {
  font-size: 1rem;
  padding: 6px 16px;
}

.resultRow {
  display: flex;
  gap: 8px;
  font-size: 1.1rem;
  color: var(--textLight);
  flex-wrap: wrap;
}

.resultRow b {
  color: var(--text);
  font-weight: 600;
}

.resultDesc {
  font-size: 1.1rem;
  color: var(--textLight);
  line-height: 1.7;
}

/* 回复率进度条 */
.rateBar {
  height: 14px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.rateBarFill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.4s;
}

/* ===== 提示消息 ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radiusSm);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.alertError {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alertSuccess {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.alertInfo {
  background: var(--primaryLight);
  color: var(--primaryDark);
  border: 1px solid #bfdbfe;
}

/* ===== 模态框 ===== */
.modalMask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadowLg);
  display: flex;
  flex-direction: column;
}

.modalHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modalTitle {
  font-size: 1.1rem;
  font-weight: 600;
}

.modalBody {
  padding: 20px;
  flex: 1;
}

.modalFoot {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== 登录卡片居中 ===== */
.loginWrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
}

.loginCard {
  width: 100%;
  max-width: 400px;
}

.loginTitle {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.loginSub {
  text-align: center;
  color: var(--textLight);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

/* ===== 工具类 ===== */
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb16 { margin-bottom: 16px; }
.textCenter { text-align: center; }
.textMuted { color: var(--textLight); }
.hidden { display: none !important; }
.flex { display: flex; }
.flexBetween { display: flex; justify-content: space-between; align-items: center; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.wrap { flex-wrap: wrap; }
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--textLight);
}

/* ===== 响应式：平板/折叠屏适配 ===== */
@media (max-width: 768px) {
  .topbarInner {
    flex-direction: column;
    align-items: stretch;
  }
  .topbarActions {
    justify-content: flex-end;
  }
  th, td {
    padding: 10px 8px;
    font-size: 0.85rem;
  }
}

/* 折叠屏窄态 */
@media (max-width: 480px) {
  .btn {
    padding: 9px 12px;
    font-size: 0.9rem;
  }
  .resultGrid {
    grid-template-columns: 1fr;
  }
  .modal {
    max-width: 100%;
  }
}

/* 大屏（平板横屏及以上）放宽内容 */
@media (min-width: 1024px) {
  .container {
    padding: 24px 32px;
  }
}