/* ========================================
   Celebrity Monitor - Multi-Theme
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root, [data-theme="light"] {
  --primary: #6366F1;
  --primary-light: #818CF8;
  --primary-dark: #4F46E5;
  --secondary: #E879A8;
  --accent: #22BDD5;
  --gradient: linear-gradient(135deg, #6366F1 0%, #8B7CF6 40%, #C084FC 70%, #E879A8 100%);
  --gradient-light: linear-gradient(135deg, rgba(99,102,241,0.07) 0%, rgba(192,132,252,0.06) 50%, rgba(232,121,168,0.05) 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(192,132,252,0.03));

  --bg: #F7F8FC;
  --bg-white: #FFFFFF;
  --bg-gray: #F0F2F8;
  --bg-hover: #F4F5FB;

  --text: #1A1D2E;
  --text-secondary: #4A5068;
  --text-muted: #8B92A8;
  --text-light: #C4C9D8;

  --border: #E0E4F0;
  --border-light: #ECEEF6;

  --p0: #E03E3E;
  --p0-bg: #FEF2F2;
  --p0-border: #FECDD3;
  --p1: #E8720C;
  --p1-bg: #FFF8F0;
  --p1-border: #FED8AA;
  --p2: #3B7BF6;
  --p2-bg: #EEF4FF;
  --p2-border: #BDD4FE;
  --p3: #1AAF55;
  --p3-bg: #EEFDF4;
  --p3-border: #B8F5D0;

  --shadow-xs: 0 1px 2px rgba(99,102,241,0.04);
  --shadow-sm: 0 1px 3px rgba(99,102,241,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 8px -1px rgba(99,102,241,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 20px -4px rgba(99,102,241,0.10), 0 4px 8px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 30px -6px rgba(99,102,241,0.12), 0 10px 12px -4px rgba(0,0,0,0.03);
  --shadow-primary: 0 4px 16px rgba(99,102,241,0.22);
  --shadow-glow: 0 0 24px rgba(99,102,241,0.12);

  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

.btn:active { transform: scale(0.97); opacity: 0.85; }
.card:active { transform: scale(0.99); }
.stat-card.clickable:active { transform: scale(0.97); }

@media (pointer: coarse) {
  .btn { min-height: 44px; min-width: 44px; }
  .btn-icon { width: 44px; height: 44px; }
  .btn-sm { min-height: 40px; }
  .filter-select, .search-input { min-height: 44px; font-size: 16px; }
  .link-btn { min-height: 36px; padding: 6px 12px; font-size: 13px; }
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px;
}

/* 头部 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 20px 28px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  text-shadow: 0 0 20px rgba(0,212,170,0.15);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 16px; height: 16px; }
.icon-lg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: var(--shadow-primary);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--bg-gray);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.12);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: var(--bg-gray);
  color: var(--text);
}

.btn-danger {
  background: var(--p0-bg);
  color: var(--p0);
  border: 1px solid var(--p0-border);
}

.btn-danger:hover {
  background: rgba(255,71,87,0.18);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  transition: all 0.25s ease;
  position: relative;
  height: auto;
  min-height: 0;
}

.card:hover {
  box-shadow: 0 0 20px rgba(0,212,170,0.08);
  border-color: rgba(0,212,170,0.20);
  transform: translateY(-2px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-gray);
  color: var(--text-secondary);
}

.stat-badge.p0 { background: var(--p0-bg); color: var(--p0); }
.stat-badge.p1 { background: var(--p1-bg); color: var(--p1); }
.stat-badge.p2 { background: var(--p2-bg); color: var(--p2); }
.stat-badge.p3 { background: var(--p3-bg); color: var(--p3); }

.card-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.card-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s;
}

.card-link:hover {
  gap: 8px;
  color: var(--primary-light);
}

/* 添加卡片 */
.add-card {
  border: 2px dashed var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  cursor: pointer;
  box-shadow: none;
}

.add-card:hover {
  border-color: var(--primary);
  background: var(--gradient-light);
}

.add-card:hover .add-icon {
  transform: scale(1.1);
  color: var(--primary);
}

.add-icon {
  font-size: 40px;
  color: var(--text-muted);
  transition: all 0.2s;
}

.add-text {
  margin-top: 12px;
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 500;
}

/* 详情页头部 */
.page-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 16px;
  padding: 16px 24px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.back-link:hover {
  color: var(--primary);
  background: var(--gradient-light);
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.page-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
}

/* 统计概览 */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: transform 0.3s var(--ease-out-expo), box-shadow 0.3s var(--ease-out-expo), border-color 0.2s;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  text-shadow: 0 0 15px rgba(228,230,240,0.08);
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.stat-card.highlight {
  background: var(--gradient-light);
  border-color: rgba(0,212,170,0.15);
  box-shadow: 0 0 15px rgba(0,212,170,0.06);
}

.stat-card.highlight .stat-value {
  color: var(--primary);
  text-shadow: 0 0 20px rgba(0,212,170,0.20);
}

/* 筛选栏 */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
}

.search-input {
  flex: 2;
  min-width: 200px;
  padding: 10px 16px;
  height: 40px;
  background: var(--bg-gray);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s;
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  outline: none;
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.10);
}

.filter-select {
  flex: 1;
  padding: 10px 16px;
  height: 40px;
  background: var(--bg-gray);
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* 表格 */
.table-container {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.data-table th {
  background: var(--bg-gray);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.data-table th.sorted {
  color: var(--primary);
  background: rgba(0,212,170,0.06);
}

.data-table th .sort-icon { margin-left: 4px; opacity: 0.4; font-size: 10px; }
.data-table th.sorted .sort-icon { opacity: 1; }
.data-table th.sortable:hover .sort-icon { opacity: 0.7; }

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table tbody tr:nth-child(odd) td {
  background: var(--bg-gray);
}

.data-table tr:hover td {
  background: var(--gradient-light) !important;
}

.data-table tr:last-child td { border-bottom: none; }

.data-table a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.data-table a:hover { color: var(--primary); }

/* 平台图标 */
.platform-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
}

.platform-weibo { background: rgba(220,38,38,0.15); color: #FF6B6B; }
.platform-zhihu { background: rgba(37,99,235,0.15); color: #60A5FA; }
.platform-xhs { background: rgba(219,39,119,0.15); color: #F472B6; }
.platform-douyin { background: rgba(255,255,255,0.08); color: #E4E6F0; }
.platform-twitter { background: rgba(29,78,216,0.15); color: #60A5FA; }
.platform-news { background: rgba(217,119,6,0.15); color: #FBBF24; }
.platform-tieba { background: rgba(78,110,242,0.15); color: #7B93F7; }
.platform-bilibili { background: rgba(0,174,236,0.15); color: #4DC9F6; }
.platform-wechat { background: rgba(7,193,96,0.15); color: #4CD964; }
.platform-kuaishou { background: rgba(255,102,0,0.15); color: #FF9933; }
.platform-douban { background: rgba(0,120,42,0.15); color: #2ECC71; }

/* 优先级标签 */
.priority-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}

.priority-p0 { background: var(--p0-bg); color: var(--p0); }
.priority-p1 { background: var(--p1-bg); color: var(--p1); }
.priority-p2 { background: var(--p2-bg); color: var(--p2); }
.priority-p3 { background: var(--p3-bg); color: var(--p3); }

/* 互动数据 */
.engagement {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.engagement span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 消息类型 */
.msg-type {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.msg-type.positive { background: var(--p3-bg); color: var(--p3); }
.msg-type.negative { background: var(--p0-bg); color: var(--p0); }
.msg-type.neutral { background: rgba(255,255,255,0.06); color: var(--text-secondary); }

/* 作者信息 */
.author-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.author-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #FFFFFF;
  font-weight: 600;
}

.author-name {
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
}

.pagination button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--gradient-light);
}

.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

.pagination span {
  padding: 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 420px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal h2 {
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 14px;
}

.modal input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 12px;
  transition: all 0.2s;
}

.modal input::placeholder { color: var(--text-muted); }

.modal input:focus {
  outline: none;
  background: var(--bg);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,212,170,0.10);
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* 加载 */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  gap: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
  stroke: var(--text-muted);
}

/* 设置页面 */
.settings-section {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.setting-item:last-child { border-bottom: none; }

.setting-label {
  font-size: 14px;
  color: var(--text);
}

.setting-label small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.setting-input {
  width: 120px;
  padding: 8px 12px;
  background: var(--bg-gray);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  text-align: center;
}

.setting-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg);
}

/* 介绍页 */
.intro-hero {
  text-align: center;
  padding: 80px 40px;
  background: var(--gradient-light);
  border-radius: var(--radius);
  margin-bottom: 40px;
}

.intro-hero h1 {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 0 0 30px rgba(0,212,170,0.20);
  margin-bottom: 16px;
}

.intro-hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.intro-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.feature-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  transition: all 0.2s;
}

.feature-card:hover {
  box-shadow: 0 0 20px rgba(0,212,170,0.08);
  border-color: rgba(0,212,170,0.15);
  transform: translateY(-2px);
}

.feature-icon {
  width: 56px;
  height: 56px;
  background: var(--gradient-light);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 16px;
  color: var(--primary);
}

.feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── 深色主题 ── */
[data-theme="dark"] {
  --primary: #00D4AA;
  --primary-light: #33DFBB;
  --primary-dark: #00B894;
  --secondary: #E879A8;
  --accent: #22BDD5;
  --gradient: linear-gradient(135deg, #00D4AA 0%, #00B894 100%);
  --gradient-light: linear-gradient(135deg, rgba(0,212,170,0.08) 0%, rgba(0,184,148,0.05) 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(0,212,170,0.04), rgba(0,184,148,0.03));
  --bg: #0F1117;
  --bg-white: #1A1D2E;
  --bg-gray: #1E2235;
  --bg-hover: #252836;
  --text: #E4E6F0;
  --text-secondary: #8B92A8;
  --text-muted: #5A6180;
  --text-light: #4A5068;
  --border: rgba(255,255,255,0.06);
  --border-light: rgba(255,255,255,0.04);
  --p0: #FF4757;
  --p0-bg: rgba(255,71,87,0.10);
  --p0-border: rgba(255,71,87,0.25);
  --p1: #FF8C42;
  --p1-bg: rgba(255,140,66,0.10);
  --p1-border: rgba(255,140,66,0.25);
  --p2: #4ECDC4;
  --p2-bg: rgba(78,205,196,0.10);
  --p2-border: rgba(78,205,196,0.25);
  --p3: #45B7D1;
  --p3-bg: rgba(69,183,209,0.10);
  --p3-border: rgba(69,183,209,0.25);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow: 0 4px 8px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.2);
  --shadow-md: 0 10px 20px -4px rgba(0,0,0,0.5), 0 4px 8px -2px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 30px -6px rgba(0,0,0,0.6), 0 10px 12px -4px rgba(0,0,0,0.3);
  --shadow-primary: 0 4px 16px rgba(0,212,170,0.20);
  --shadow-glow: 0 0 24px rgba(0,212,170,0.10);
}

/* ── 赛博朋克主题 ── */
[data-theme="cyberpunk"] {
  --primary: #FF00FF;
  --primary-light: #FF66FF;
  --primary-dark: #CC00CC;
  --secondary: #00FFFF;
  --accent: #FFE600;
  --gradient: linear-gradient(135deg, #FF00FF 0%, #00FFFF 100%);
  --gradient-light: linear-gradient(135deg, rgba(255,0,255,0.08) 0%, rgba(0,255,255,0.05) 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(255,0,255,0.04), rgba(0,255,255,0.03));
  --bg: #0A0A1A;
  --bg-white: #12122A;
  --bg-gray: #1A1A3A;
  --bg-hover: #22224A;
  --text: #E0E0FF;
  --text-secondary: #9090CC;
  --text-muted: #6060AA;
  --text-light: #404088;
  --border: rgba(255,0,255,0.12);
  --border-light: rgba(255,0,255,0.06);
  --p0: #FF1744;
  --p0-bg: rgba(255,23,68,0.12);
  --p0-border: rgba(255,23,68,0.30);
  --p1: #FF9100;
  --p1-bg: rgba(255,145,0,0.12);
  --p1-border: rgba(255,145,0,0.30);
  --p2: #00E5FF;
  --p2-bg: rgba(0,229,255,0.12);
  --p2-border: rgba(0,229,255,0.30);
  --p3: #76FF03;
  --p3-bg: rgba(118,255,3,0.12);
  --p3-border: rgba(118,255,3,0.30);
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 8px -1px rgba(0,0,0,0.5), 0 2px 4px -1px rgba(0,0,0,0.3);
  --shadow-md: 0 10px 20px -4px rgba(0,0,0,0.6), 0 4px 8px -2px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 30px -6px rgba(0,0,0,0.7), 0 10px 12px -4px rgba(0,0,0,0.4);
  --shadow-primary: 0 4px 16px rgba(255,0,255,0.25);
  --shadow-glow: 0 0 24px rgba(255,0,255,0.15);
}

/* ── 护眼暖色主题 ── */
[data-theme="warm"] {
  --primary: #D4A574;
  --primary-light: #E0BB92;
  --primary-dark: #C08B56;
  --secondary: #C97B7B;
  --accent: #7BAF9E;
  --gradient: linear-gradient(135deg, #D4A574 0%, #C08B56 100%);
  --gradient-light: linear-gradient(135deg, rgba(212,165,116,0.08) 0%, rgba(192,139,86,0.05) 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(212,165,116,0.04), rgba(192,139,86,0.03));
  --bg: #FAF6F1;
  --bg-white: #FFFFFF;
  --bg-gray: #F5EDE4;
  --bg-hover: #F0E8DD;
  --text: #3D2E1E;
  --text-secondary: #6B5744;
  --text-muted: #9C8B7A;
  --text-light: #C4B8AB;
  --border: #E8DDD0;
  --border-light: #F0E8DD;
  --p0: #C0392B;
  --p0-bg: #FDF0EE;
  --p0-border: #F5C6C0;
  --p1: #D4770C;
  --p1-bg: #FDF5EC;
  --p1-border: #F5D8A8;
  --p2: #2E86AB;
  --p2-bg: #ECF5F9;
  --p2-border: #B8D8E8;
  --p3: #27AE60;
  --p3-bg: #ECF9F2;
  --p3-border: #B8E8CC;
  --shadow-xs: 0 1px 2px rgba(61,46,30,0.04);
  --shadow-sm: 0 1px 3px rgba(61,46,30,0.06), 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 4px 8px -1px rgba(61,46,30,0.08), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-md: 0 10px 20px -4px rgba(61,46,30,0.10), 0 4px 8px -2px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 30px -6px rgba(61,46,30,0.12), 0 10px 12px -4px rgba(0,0,0,0.03);
  --shadow-primary: 0 4px 16px rgba(212,165,116,0.22);
  --shadow-glow: 0 0 24px rgba(212,165,116,0.12);
}

/* ── 高对比度主题 ── */
[data-theme="contrast"] {
  --primary: #0066FF;
  --primary-light: #3388FF;
  --primary-dark: #0044CC;
  --secondary: #FF3366;
  --accent: #00CC66;
  --gradient: linear-gradient(135deg, #0066FF 0%, #0044CC 100%);
  --gradient-light: linear-gradient(135deg, rgba(0,102,255,0.08) 0%, rgba(0,68,204,0.05) 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(0,102,255,0.04), rgba(0,68,204,0.03));
  --bg: #FFFFFF;
  --bg-white: #FFFFFF;
  --bg-gray: #F0F0F0;
  --bg-hover: #E8E8E8;
  --text: #000000;
  --text-secondary: #333333;
  --text-muted: #666666;
  --text-light: #999999;
  --border: #CCCCCC;
  --border-light: #E0E0E0;
  --p0: #CC0000;
  --p0-bg: #FFE5E5;
  --p0-border: #FF9999;
  --p1: #CC6600;
  --p1-bg: #FFF2E5;
  --p1-border: #FFCC99;
  --p2: #0066CC;
  --p2-bg: #E5F0FF;
  --p2-border: #99CCFF;
  --p3: #008844;
  --p3-bg: #E5FFF0;
  --p3-border: #99FFCC;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow: 0 4px 8px -1px rgba(0,0,0,0.15), 0 2px 4px -1px rgba(0,0,0,0.08);
  --shadow-md: 0 10px 20px -4px rgba(0,0,0,0.18), 0 4px 8px -2px rgba(0,0,0,0.08);
  --shadow-lg: 0 20px 30px -6px rgba(0,0,0,0.20), 0 10px 12px -4px rgba(0,0,0,0.06);
  --shadow-primary: 0 4px 16px rgba(0,102,255,0.25);
  --shadow-glow: 0 0 24px rgba(0,102,255,0.15);
}

/* 响应式 */
@media (max-width: 768px) {
  .container { padding: 12px; }
  .header { flex-direction: column; gap: 12px; text-align: center; padding: 14px; }
  .header h1 { font-size: 22px; }
  .header-actions { width: 100%; justify-content: center; flex-wrap: wrap; gap: 8px; }
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .card { padding: 16px; }
  .card-title { font-size: 17px; }
  .filter-bar { flex-direction: column; padding: 12px; gap: 8px; }
  .page-header { flex-direction: column; gap: 10px; padding: 14px; }
  .page-title { font-size: 18px; }
  .page-actions { margin-left: 0; width: 100%; justify-content: center; }
  .stats-overview { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card { padding: 12px 8px; }
  .stat-card .stat-value { font-size: 22px; }
  .data-table th, .data-table td { padding: 10px 8px; }
  .table-container { border-radius: var(--radius-sm); position: relative; }
  .table-container::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 24px;
    background: linear-gradient(to right, transparent, var(--bg));
    pointer-events: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  }
  .intro-hero { padding: 32px 16px; }
  .intro-hero h1 { font-size: 28px; }
  .intro-hero p { font-size: 15px; }
  .intro-features { gap: 12px; }
  .feature-card { padding: 20px; }
  .modal { width: 94%; padding: 20px; }
  .modal h2 { font-size: 18px; }
  .setting-item { flex-direction: column; align-items: flex-start; gap: 8px; }
  .setting-input { width: 100% !important; }
  .pagination { padding: 14px 8px; gap: 4px; }
  .pagination button { padding: 8px 12px; font-size: 12px; }
}

@media (max-width: 480px) {
  .container { padding: 8px; }
  .header { padding: 12px; margin-bottom: 16px; border-radius: var(--radius-sm); }
  .header h1 { font-size: 20px; }
  .stats-overview { gap: 6px; grid-template-columns: repeat(2, 1fr); }
  .stat-card { padding: 10px 6px; border-radius: var(--radius-sm); }
  .stat-card .stat-value { font-size: 20px; }
  .stat-card .stat-label { font-size: 10px; }
  .page-title { font-size: 16px; }
  .card-grid { gap: 10px; }
  .card { padding: 14px; border-radius: var(--radius-sm); }
  .card-title { font-size: 16px; }
  .card-stats { gap: 6px; }
  .stat-badge { font-size: 11px; padding: 3px 8px; }
  .filter-bar { padding: 10px; border-radius: var(--radius-sm); }
  .btn { padding: 8px 14px; font-size: 13px; }
  .intro-hero { padding: 24px 12px; border-radius: var(--radius-sm); }
  .intro-hero h1 { font-size: 24px; }
  .settings-section { padding: 16px; border-radius: var(--radius-sm); }
}

/* 动画 */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card { animation: fadeIn 0.3s ease forwards; }
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.06s; }
.card:nth-child(4) { animation-delay: 0.08s; }
.card:nth-child(5) { animation-delay: 0.1s; }
.card:nth-child(6) { animation-delay: 0.12s; }

/* 警告标签 */
.alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--p0-bg);
  color: var(--p0);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

/* :active 触摸反馈 */
.btn:active { transform: scale(0.96); opacity: 0.85; transition: transform 0.05s, opacity 0.05s; }
.btn-primary:active { transform: scale(0.96); box-shadow: 0 2px 8px rgba(0,212,170,0.25); }
.card:active { transform: scale(0.98); box-shadow: var(--shadow-sm); }
.stat-card.clickable:active { transform: scale(0.95); }
.back-link:active { opacity: 0.7; }
.pagination button:active:not(:disabled) { transform: scale(0.95); background: var(--bg-gray); }
.data-table th:active { background: rgba(0,212,170,0.08); }
.feature-card:active { transform: scale(0.98); }
.card-link:active { opacity: 0.7; }

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .card:hover { transform: none; box-shadow: var(--shadow-xs); border-color: var(--border); }
  .btn-primary:hover { transform: none; }
  .feature-card:hover { transform: none; box-shadow: none; }
  .flow-card:hover { transform: none; box-shadow: none; }
  .chart-card:hover { transform: none; box-shadow: none; }
  .btn-icon { width: 44px; height: 44px; }
  .data-table th { padding: 14px 12px; min-height: 44px; }
  .pagination button { min-height: 44px; min-width: 44px; }
  .back-link { min-height: 44px; display: inline-flex; align-items: center; }
  .filter-select { min-height: 44px; }
  .search-input { min-height: 44px; }
  .modal input { min-height: 44px; }
  a, button, .clickable, [onclick], summary, label { -webkit-tap-highlight-color: transparent; }
}

/* 响应式表格包装 */
.table-responsive-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -1px;
}
