/* Theme tokens — always set readable --ink on --page-bg / --card */

html[data-theme="light"] {
  --page-bg: radial-gradient(circle at top, #f7fbff 0, #eaf4ff 34%, #f8fbff 100%);
  --ink: #0f172a;
  --muted: #64748b;
  --blue: #2463ff;
  --card: #ffffff;
  --border: rgba(15, 23, 42, 0.1);
  --header-bg: rgba(239, 247, 255, 0.92);
  --nav-bg: rgba(255, 255, 255, 0.96);
  --nav-link: #64748b;
  --nav-link-hover-bg: #eff6ff;
  --input-bg: #ffffff;
  --input-text: #0f172a;
  --badge-bg: #dbeafe;
  --badge-text: #1d4ed8;
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

html[data-theme="ocean"] {
  --page-bg: radial-gradient(circle at 20% 0%, #e0f2fe 0, #bae6fd 40%, #f0f9ff 100%);
  --ink: #0c4a6e;
  --muted: #0369a1;
  --blue: #0284c7;
  --card: #ffffff;
  --border: rgba(3, 105, 161, 0.15);
  --header-bg: rgba(224, 242, 254, 0.95);
  --nav-bg: rgba(255, 255, 255, 0.97);
  --nav-link: #075985;
  --nav-link-hover-bg: #e0f2fe;
  --input-bg: #ffffff;
  --input-text: #0c4a6e;
  --badge-bg: #bae6fd;
  --badge-text: #0c4a6e;
  --shadow: 0 16px 40px rgba(3, 105, 161, 0.15);
}

html[data-theme="emerald"] {
  --page-bg: radial-gradient(circle at top, #ecfdf5 0, #d1fae5 45%, #f0fdf4 100%);
  --ink: #064e3b;
  --muted: #047857;
  --blue: #059669;
  --card: #ffffff;
  --border: rgba(4, 120, 87, 0.14);
  --header-bg: rgba(236, 253, 245, 0.95);
  --nav-bg: rgba(255, 255, 255, 0.97);
  --nav-link: #065f46;
  --nav-link-hover-bg: #d1fae5;
  --input-bg: #ffffff;
  --input-text: #064e3b;
  --badge-bg: #a7f3d0;
  --badge-text: #065f46;
  --shadow: 0 16px 40px rgba(4, 120, 87, 0.14);
}

html[data-theme="sunset"] {
  --page-bg: radial-gradient(circle at top, #fff7ed 0, #ffedd5 42%, #fffbeb 100%);
  --ink: #7c2d12;
  --muted: #c2410c;
  --blue: #ea580c;
  --card: #ffffff;
  --border: rgba(194, 65, 12, 0.14);
  --header-bg: rgba(255, 247, 237, 0.95);
  --nav-bg: rgba(255, 255, 255, 0.97);
  --nav-link: #9a3412;
  --nav-link-hover-bg: #ffedd5;
  --input-bg: #ffffff;
  --input-text: #7c2d12;
  --badge-bg: #fed7aa;
  --badge-text: #9a3412;
  --shadow: 0 16px 40px rgba(194, 65, 12, 0.12);
}

html[data-theme="dark"] {
  --page-bg: radial-gradient(circle at top, #1e293b 0, #0f172a 55%, #020617 100%);
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --blue: #60a5fa;
  --card: #1e293b;
  --border: rgba(148, 163, 184, 0.22);
  --header-bg: rgba(15, 23, 42, 0.92);
  --nav-bg: rgba(30, 41, 59, 0.96);
  --nav-link: #cbd5e1;
  --nav-link-hover-bg: rgba(96, 165, 250, 0.18);
  --input-bg: #334155;
  --input-text: #f8fafc;
  --badge-bg: rgba(96, 165, 250, 0.25);
  --badge-text: #e0f2fe;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .btn-light,
html[data-theme="dark"] .btn-outline-primary {
  color: var(--ink);
}

html[data-theme="dark"] .alert-success {
  background: #14532d;
  color: #dcfce7;
  border-color: #166534;
}

html[data-theme="dark"] .alert-danger {
  background: #7f1d1d;
  color: #fecaca;
  border-color: #991b1b;
}

html[data-theme="dark"] .alert-info {
  background: #1e3a5f;
  color: #e0f2fe;
}

.theme-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

@media (min-width: 560px) {
  .theme-picker-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.theme-picker-card {
  padding: 1rem;
  border-radius: 1.25rem;
  border: 2px solid var(--border);
  background: var(--card);
  color: var(--ink);
}

.theme-picker-card.is-active {
  border-color: var(--blue);
  box-shadow: var(--shadow-soft);
}

.theme-preview-swatch {
  height: 56px;
  border-radius: 0.75rem;
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
}

.theme-swatch-light { background: linear-gradient(135deg, #f7fbff, #2463ff); }
.theme-swatch-ocean { background: linear-gradient(135deg, #e0f2fe, #0284c7); }
.theme-swatch-emerald { background: linear-gradient(135deg, #ecfdf5, #059669); }
.theme-swatch-sunset { background: linear-gradient(135deg, #fff7ed, #ea580c); }
.theme-swatch-dark { background: linear-gradient(135deg, #334155, #0f172a); }
