/* 亚马逊关键词搜索量监控 · 视觉系统 v3
 * 设计原则：清晰、克制、专业，带有 subtle 的质感与动效
 * 不依赖外部字体（国内访问稳定性），改用高质量系统字体栈
 */

:root {
  /* 基础色板 — light */
  --bg: #f6f8fb;
  --bg-elevated: #ffffff;
  --fg: #0f172a;
  --fg-strong: #020617;
  --muted: #64748b;
  --border: #e6ebf2;
  --border-subtle: #f1f5f9;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-fg: #ffffff;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --up: #dc2626;
  --up-soft: rgba(220, 38, 38, 0.08);
  --down: #16a34a;
  --down-soft: rgba(22, 163, 74, 0.08);
  --warning: #d97706;
  --warning-soft: rgba(217, 119, 6, 0.10);

  /* 环境渐变（premium 背景层次） */
  --ambient-1: rgba(37, 99, 235, 0.10);
  --ambient-2: rgba(99, 102, 241, 0.08);
  --ambient-3: rgba(14, 165, 233, 0.06);
  --row-alt: rgba(15, 23, 42, 0.018);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 160ms var(--ease);
  --transition-slow: 280ms var(--ease);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

body[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #0f172a;
  --fg: #e2e8f0;
  --fg-strong: #f8fafc;
  --muted: #94a3b8;
  --border: #1e293b;
  --border-subtle: #162032;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-fg: #0f172a;
  --accent-soft: rgba(96, 165, 250, 0.12);
  --up: #f87171;
  --up-soft: rgba(248, 113, 113, 0.12);
  --down: #4ade80;
  --down-soft: rgba(74, 222, 128, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --ambient-1: rgba(56, 120, 255, 0.14);
  --ambient-2: rgba(99, 102, 241, 0.12);
  --ambient-3: rgba(14, 165, 233, 0.08);
  --row-alt: rgba(255, 255, 255, 0.022);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 8% -10%, var(--ambient-1), transparent 60%),
    radial-gradient(820px 520px at 100% -4%, var(--ambient-2), transparent 55%),
    radial-gradient(720px 620px at 50% 118%, var(--ambient-3), transparent 60%);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-slow), color var(--transition-slow);
}

/* ===== 通用 ===== */
.glass {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), var(--shadow-sm);
}

body[data-theme="dark"] .glass {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), var(--shadow-sm);
}

/* ===== 顶部栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
}

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  transition: transform var(--transition), box-shadow var(--transition);
}

.logo:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28); }
body[data-theme="dark"] .logo:hover { box-shadow: 0 6px 18px rgba(96, 165, 250, 0.3); }

.logo svg { width: 23px; height: 23px; }

.title-block h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
}

.subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.subtitle .live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--down);
  font-weight: 600;
}

.subtitle .live .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--down);
  animation: pulse 2s ease-in-out infinite;
}

.subtitle .sep { opacity: 0.5; }

@keyframes pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.4;
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
  user-select: none;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border);
}

.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: transparent;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

body[data-theme="dark"] .btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(96, 165, 250, 0.25);
}

.btn-ghost { background: transparent; border-color: transparent; }

.btn-ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: transparent;
}

.btn-icon { padding: 8px; border-radius: var(--radius-md); }
.btn-icon svg { width: 18px; height: 18px; }

/* ===== 侧边栏 ===== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: 240px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 16px 14px;
}

body[data-theme="dark"] .sidebar {
  background: color-mix(in srgb, var(--bg-elevated) 98%, #000);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 7px;
}

.sidebar-brand .logo {
  width: 30px; height: 30px;
  flex-shrink: 0;
  border-radius: 9px;
}

.brand-text h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
}

.brand-text .subtitle {
  margin-top: 1px;
  font-size: 10px;
  color: var(--muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-nav .tab {
  width: 100%;
  text-align: left;
  border-radius: 9px;
  padding: 6px 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all .18s var(--ease);
}

.sidebar-nav .tab::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .5;
  flex-shrink: 0;
  transition: opacity .18s;
}

.sidebar-nav .tab:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: translateX(2px);
}

.sidebar-nav .tab:hover::before { opacity: .85; }

.sidebar-nav .tab.active {
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, #000));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px -8px var(--accent);
}

.sidebar-nav .tab.active::before { opacity: 1; background: #fff; }

.sidebar-footer {
  padding-top: 7px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

.mobile-header,
.sidebar-overlay { display: none; }
/* 通用隐藏（视图切换 / 弹窗 / 面板依赖此规则） */
.hidden { display: none !important; }

/* ===== 主内容区 ===== */
main {
  margin-left: 240px;
  padding: 22px;
  max-width: none;
  min-height: 100vh;
}

@media (max-width: 640px) {
  main { padding: 16px; }
}

/* ===== KPI 卡片 ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
  align-items: start;
}

@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }

.stat-card {
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.55;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-card .label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}

.stat-icon svg { width: 17px; height: 17px; }

.stat-card .value {
  font-size: 26px;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.stat-card .value .chip { font-size: 22px; font-weight: 700; }
.stat-card .value .chip.up { color: var(--up); }
.stat-card .value .chip.down { color: var(--down); }

.stat-card .sub {
  margin-top: 7px;
  font-size: 12px;
  color: var(--muted);
}

/* ===== 控制面板 ===== */
.controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.controls label.search { flex: 1; min-width: 180px; }
.controls label.model-search { min-width: 220px; }

select, input, textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

select:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-elevated);
}

.search-input-wrap { position: relative; display: flex; align-items: center; }

.search-input-wrap svg {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search-input-wrap input { padding-left: 32px; width: 100%; }

.spacer { flex: 1; }

/* ===== 添加面板 ===== */
.add-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
  animation: fadeDown 260ms var(--ease) both;
}

.add-panel.hidden { display: none; }

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 860px) { .add-panel { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition), border-color var(--transition);
}

.card:hover { box-shadow: var(--shadow-sm); border-color: var(--border); }

.card h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-strong);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h3 svg { width: 16px; height: 16px; color: var(--accent); }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row input, .row select { flex: 1; min-width: 140px; }

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0 0 12px;
  line-height: 1.5;
}

code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid var(--border-subtle);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 100px;
  margin-bottom: 10px;
  line-height: 1.6;
}

/* ===== 消息提示 ===== */
.msg {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeDown 260ms var(--ease) both;
  border: 1px solid transparent;
}

.msg.hidden { display: none; }

.msg-ok { background: var(--down-soft); color: var(--down); border-color: rgba(22, 163, 74, 0.2); }
.msg-err { background: var(--up-soft); color: var(--up); border-color: rgba(220, 38, 38, 0.2); }
.msg svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ===== 表格 ===== */
.table-wrap {
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}

.table-wrap:hover { box-shadow: var(--shadow-sm); }

.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 720px;
}

th, td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}

th {
  background: var(--bg);
  position: sticky;
  top: 0;
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

tbody tr { transition: background var(--transition); }

tbody tr:hover td { background: var(--accent-soft); }

tbody tr:last-child td { border-bottom: none; }

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.model-cell {
  font-weight: 700;
  color: var(--fg-strong);
  background: var(--bg);
  border-right: 1px solid var(--border);
  vertical-align: top;
}

.kw {
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: color var(--transition);
}

.kw:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.kw svg { width: 13px; height: 13px; opacity: 0.7; }

.latest-cell { font-weight: 700; color: var(--fg-strong); }

/* 可排序表头 */
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent-hover); }

/* 头部词徽标 */
.head-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #7c2d12;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  vertical-align: middle;
}

td.wow-cell { text-align: right; vertical-align: middle; }

.wow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 12px;
  vertical-align: middle;
}

.wow svg { width: 12px; height: 12px; flex-shrink: 0; }
.wow.up { color: var(--up); }
.wow.down { color: var(--down); }
.wow.none { color: var(--muted); font-weight: 500; }

/* 操作列 + 删除按钮 */
td.op { width: 46px; text-align: center; vertical-align: middle; padding-left: 6px; padding-right: 6px; }
th.op { text-align: center; }
.del-btn { color: var(--muted); transition: color var(--transition), background var(--transition); }
.del-btn:hover:not(:disabled) { color: #ef4444; background: rgba(239, 68, 68, 0.12); }
.del-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.group-sep td { border-top: 2px solid var(--border); }

.empty-cell {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.empty-cell svg { width: 40px; height: 40px; color: var(--border); margin-bottom: 12px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border-subtle) 25%, var(--border) 50%, var(--border-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-row td { padding: 14px; border-bottom: 1px solid var(--border); }
.skeleton-line { height: 12px; }

/* ===== 趋势弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
  opacity: 0;
  animation: modalIn 220ms var(--ease) forwards;
}

.modal.hidden { display: none; }

@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  width: min(800px, 96vw);
  max-height: 92vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px) scale(0.98);
  animation: cardIn 260ms var(--ease) 40ms forwards;
}

@keyframes cardIn { to { transform: translateY(0) scale(1); } }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--fg-strong);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-head h3 svg { width: 18px; height: 18px; color: var(--accent); }

#trendChart {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#trendChart svg { width: 100%; height: auto; max-height: 360px; }

#trendChart .chart-empty {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 40px 0;
}

/* ===== 页脚 ===== */
.footer {
  margin-top: 24px;
  padding: 16px 4px 8px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  border-top: 1px solid var(--border);
}

.footer .dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border);
}

.footer b { color: var(--fg); font-weight: 600; }

/* ===== 响应式 ===== */
@media (max-width: 760px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s var(--ease);
    width: 260px;
    padding: 18px 16px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(2px);
    z-index: 35;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s var(--ease);
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .mobile-header {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    align-items: center;
    gap: 12px;
  }
  .mobile-title {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: var(--fg-strong);
    text-align: center;
  }
  main { margin-left: 0; padding: 16px; min-height: auto; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls label { width: 100%; }
  .controls label.search { min-width: auto; }
  .spacer { display: none; }
  .title-block h1 { font-size: 16px; }
  .logo { width: 38px; height: 38px; }
  .logo svg { width: 21px; height: 21px; }
  .modal-card { padding: 16px; width: 100%; border-radius: var(--radius-lg); }
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== 榜单卡片（排名上升榜 / 整体下降榜单） ===== */
.stat-icon.up { background: var(--down-soft); color: var(--down); }
.stat-icon.down { background: var(--up-soft); color: var(--up); }

.board-card { display: flex; flex-direction: column; max-height: 280px; }
.board-card .lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; overflow-y: auto; flex: 1; }

.lb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}

.lb-item:hover { background: var(--accent-soft); transform: translateX(2px); }

.lb-no {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--bg);
  border-radius: 6px;
}

.lb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.lb-kw {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-meta { font-size: 11px; color: var(--muted); }

.lb-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.lb-delta svg { width: 13px; height: 13px; }
.lb-delta.good { color: var(--down); }
.lb-delta.bad { color: var(--up); }
.lb-delta .lb-pct { font-size: 11px; font-weight: 600; opacity: 0.85; font-style: normal; }

.lb-empty { padding: 18px 8px; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 860px) {
  .lb-meta { display: none; }
}

/* ============ 提醒设置视图 ============ */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.empty-hint { color: var(--muted); font-size: 13px; padding: 14px 4px; line-height: 1.6; }
.chk-group { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--fg); cursor: pointer; }
.chk input { width: 14px; height: 14px; accent-color: var(--accent); }

/* 渠道列表 */
.channel-list { display: flex; flex-direction: column; gap: 10px; }
.channel-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card-2); transition: border-color var(--transition), opacity var(--transition); }
.channel-item.off { opacity: 0.55; }
.channel-item.off .ci-name { text-decoration: line-through; }
.ci-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ci-type { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: rgba(59,130,246,0.16); color: #3b82f6; }
.ci-type.type-dingtalk { background: rgba(34,197,94,0.16); color: #22c55e; }
.ci-name { font-weight: 600; color: var(--fg-strong); }
.ci-meta { font-size: 12px; color: var(--muted); }
.ci-actions { display: flex; gap: 4px; }

/* 规则列表 */
.rule-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.rule-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card-2); transition: border-color var(--transition), opacity var(--transition); }
.rule-item.off { opacity: 0.55; }
.ri-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.ri-scope { font-weight: 700; color: var(--accent); background: rgba(99,102,241,0.14); padding: 2px 8px; border-radius: 999px; }
.ri-event { font-weight: 600; color: var(--fg-strong); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ri-cond { color: var(--muted); }
.ri-ch { color: var(--muted); }
.ri-th { color: var(--muted); font-size: 12px; }
.ri-actions { display: flex; gap: 4px; }

/* 发送记录 */
.alert-log { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.log-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 8px 10px; border-radius: 8px; background: var(--card-2); }
.log-item.fail { background: rgba(239,68,68,0.10); }
.log-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; flex: none; }
.log-item.fail .log-dot { background: #ef4444; }
.log-scope { font-weight: 600; color: var(--accent); }
.log-event { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg-strong); }
.log-status { color: var(--muted); }
.log-err { color: #ef4444; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.log-time { margin-left: auto; color: var(--muted); font-size: 11.5px; }
