:root {
  --primary: #00d4ff;
  --primary-dark: #0099cc;
  --secondary: #7c3aed;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg-dark: #0a0e1a;
  --bg-card: #111827;
  --bg-hover: #1f2937;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: rgba(0, 212, 255, 0.2);
  --glow: 0 0 20px rgba(0, 212, 255, 0.3);
  --glow-success: 0 0 20px rgba(16, 185, 129, 0.3);
  --glow-danger: 0 0 20px rgba(239, 68, 68, 0.3);
  --surface-header: linear-gradient(135deg, rgba(17, 24, 39, 0.95) 0%, rgba(31, 41, 55, 0.95) 100%);
  --surface-nav: rgba(17, 24, 39, 0.72);
  --surface-soft: rgba(15, 23, 42, 0.35);
}

html[data-theme="light"] {
  color-scheme: light;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #a855f7;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --bg-dark: #f3f7fd;
  --bg-card: #ffffff;
  --bg-hover: #eef4ff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border: rgba(37, 99, 235, 0.16);
  --glow: 0 0 20px rgba(37, 99, 235, 0.16);
  --glow-success: 0 0 20px rgba(5, 150, 105, 0.18);
  --glow-danger: 0 0 20px rgba(220, 38, 38, 0.16);
  --surface-header: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(248,250,252,0.98) 100%);
  --surface-nav: rgba(255,255,255,0.92);
  --surface-soft: rgba(37, 99, 235, 0.06);
}

html[data-theme="dark"] {
  color-scheme: dark;
}

.theme-switch {
  position: relative;
  width: 56px;
  height: 30px;
  flex: 0 0 auto;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.theme-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0,212,255,.2), rgba(124,58,237,.26));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}

html[data-theme="light"] .theme-switch-slider {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.theme-switch-slider::before {
  content: '🌙';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  background: #0f172a;
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0,0,0,.18);
  transform: translateX(0);
}

html[data-theme="light"] .theme-switch-slider::before {
  content: '☀️';
  background: #ffffff;
  transform: translateX(26px);
}

.theme-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}

html[data-theme="light"] body {
  background: var(--bg-dark);
  color: var(--text-primary);
}

html[data-theme="light"] body::before,
html[data-theme="light"] body::after {
  opacity: .55;
}

html[data-theme="light"] .card,
html[data-theme="light"] .page-card,
html[data-theme="light"] .panel,
html[data-theme="light"] .modal-content,
html[data-theme="light"] #copyLinkModalContent,
html[data-theme="light"] #cleanupPreviewModalContent,
html[data-theme="light"] #detailModalContent,
html[data-theme="light"] .login-box,
html[data-theme="light"] table,
html[data-theme="light"] .pagination-bar {
  background: var(--bg-card) !important;
  color: var(--text-primary);
  box-shadow: 0 14px 36px rgba(37, 99, 235, 0.08) !important;
}

html[data-theme="light"] input,
html[data-theme="light"] textarea,
html[data-theme="light"] select,
html[data-theme="light"] .page-input,
html[data-theme="light"] #copyLinkTextarea {
  background: #f8fbff !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

html[data-theme="light"] th {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%) !important;
  color: var(--primary) !important;
}

html[data-theme="light"] td,
html[data-theme="light"] .tiny,
html[data-theme="light"] .status-tip,
html[data-theme="light"] .qrcode-text,
html[data-theme="light"] .preview-tip,
html[data-theme="light"] .remark-toggle-tip,
html[data-theme="light"] .product-subinfo,
html[data-theme="light"] .subtitle {
  color: var(--text-secondary) !important;
}

html[data-theme="light"] tr:hover td {
  background: rgba(37, 99, 235, 0.05) !important;
  color: var(--text-primary) !important;
}

html[data-theme="light"] .header h2 {
  background: none !important;
  -webkit-text-fill-color: var(--text-primary) !important;
  color: var(--text-primary) !important;
}

html[data-theme="light"] .header span,
html[data-theme="light"] .nav a,
html[data-theme="light"] .nav a.active {
  color: var(--text-primary) !important;
}

html[data-theme="light"] .header a,
html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .nav a.active {
  color: var(--primary) !important;
}

html[data-theme="light"] .nav a {
  background: rgba(37, 99, 235, 0.05) !important;
  border-color: rgba(37, 99, 235, 0.12) !important;
}

html[data-theme="light"] .nav a.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.10)) !important;
  border-color: rgba(37, 99, 235, 0.18) !important;
}

html[data-theme="light"] .btn,
html[data-theme="light"] button,
html[data-theme="light"] .back,
html[data-theme="light"] .nav a,
html[data-theme="light"] .header a {
  box-shadow: none;
}

html[data-theme="light"] .btn:hover,
html[data-theme="light"] button:hover,
html[data-theme="light"] .back:hover,
html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .header a:hover {
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12) !important;
}

html[data-theme="light"] .badge,
html[data-theme="light"] .keyword-chip,
html[data-theme="light"] code,
html[data-theme="light"] td code {
  background: rgba(37, 99, 235, 0.08) !important;
  color: var(--primary) !important;
  border-color: rgba(37, 99, 235, 0.14) !important;
}

html[data-theme="light"] .badge.down,
html[data-theme="light"] .btn-danger,
html[data-theme="light"] .btn-del {
  color: #b91c1c !important;
}

html[data-theme="light"] .empty,
html[data-theme="light"] .pagination-info,
html[data-theme="light"] .meta,
html[data-theme="light"] .confirm-message {
  color: var(--text-secondary) !important;
}

html[data-theme="light"] .title,
html[data-theme="light"] .page-head h2,
html[data-theme="light"] h1,
html[data-theme="light"] h3,
html[data-theme="light"] h4 {
  color: var(--text-primary);
}

html[data-theme="light"] .content,
html[data-theme="light"] .remark-summary {
  color: var(--text-primary) !important;
}

html[data-theme="light"] .content a,
html[data-theme="light"] .back,
html[data-theme="light"] .header a,
html[data-theme="light"] .nav a:hover,
html[data-theme="light"] .nav a.active {
  color: var(--primary) !important;
}

html[data-theme="light"] .query-section,
html[data-theme="light"] .chart-card,
html[data-theme="light"] .map-card,
html[data-theme="light"] .summary-card,
html[data-theme="light"] .stat-card,
html[data-theme="light"] .settings-box,
html[data-theme="light"] .info-box,
html[data-theme="light"] .status-box,
html[data-theme="light"] .meta-box,
html[data-theme="light"] .meta-item,
html[data-theme="light"] .preview-box,
html[data-theme="light"] .mode-note,
html[data-theme="light"] .manage-shell,
html[data-theme="light"] .detail-main,
html[data-theme="light"] .detail-raw pre,
html[data-theme="light"] .modal-card,
html[data-theme="light"] .modal-content,
html[data-theme="light"] .captcha-box,
html[data-theme="light"] .pagination-bar {
  background: #ffffff !important;
  border-color: rgba(37, 99, 235, 0.12) !important;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.06) !important;
}

html[data-theme="light"] .segmented,
html[data-theme="light"] .view-switch {
  background: #f8fbff !important;
  border-color: rgba(37, 99, 235, 0.12) !important;
}

html[data-theme="light"] .segmented .active,
html[data-theme="light"] .view-switch button.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(139, 92, 246, 0.12)) !important;
  color: #2563eb !important;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.10) !important;
}

html[data-theme="light"] .detail-raw summary,
html[data-theme="light"] .preview-box h1,
html[data-theme="light"] .preview-box h2,
html[data-theme="light"] .preview-box h3,
html[data-theme="light"] .manage-shell-head h3,
html[data-theme="light"] .target-name,
html[data-theme="light"] .summary-line strong {
  color: #1d4ed8 !important;
}

html[data-theme="light"] .action-badge,
html[data-theme="light"] .risk-badge,
html[data-theme="light"] .status-pill,
html[data-theme="light"] .status-default {
  box-shadow: none !important;
}
