/* Theme tokens — :root defaults to Light until a theme is chosen */
:root,
[data-theme="light"] {
  --forest-deep: #f4f6f8;
  --forest: #e8edf2;
  --forest-mid: #dfe5ec;
  --gold: #b45309;
  --gold-soft: rgba(180, 83, 9, 0.12);
  --poppy: #dc2626;
  --cream: #1a2332;
  --muted: #5c6b7a;
  --line: rgba(26, 35, 50, 0.12);
  --card: #ffffff;
  --btn-grey: #eef1f5;
  --btn-grey-hover: #e2e7ed;
  --surface-panel: rgba(255, 255, 255, 0.94);
  --surface-input: #ffffff;
  --surface-dialog: #ffffff;
  --surface-muted: rgba(255, 255, 255, 0.92);
  --banner-base: #eef1f5;
  --banner-overlay: rgba(244, 246, 248, 0.5);
  --banner-fade: rgba(244, 246, 248, 0.85);
  --header-top: rgba(255, 255, 255, 0.92);
  --header-bottom: rgba(255, 255, 255, 0.78);
  --glow-a: rgba(180, 83, 9, 0.06);
  --glow-b: rgba(37, 99, 235, 0.05);
  --theme-accent: #b45309;
  --theme-accent-2: #2563eb;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --on-gold: #ffffff;
}

[data-theme="neural"] {
  --forest-deep: #0b1b15;
  --forest: #1f4d3a;
  --forest-mid: #163329;
  --gold: #e6c35c;
  --gold-soft: rgba(230, 195, 92, 0.16);
  --poppy: #d4532b;
  --cream: #f7f1e8;
  --muted: #a8b8ae;
  --line: rgba(230, 195, 92, 0.18);
  --card: #12261f;
  --btn-grey: #2e3b36;
  --btn-grey-hover: #3a4842;
  --surface-panel: rgba(8, 20, 16, 0.92);
  --surface-input: #0c1a15;
  --surface-dialog: #10241c;
  --surface-muted: rgba(18, 38, 31, 0.72);
  --banner-base: #071018;
  --banner-overlay: rgba(7, 16, 24, 0.28);
  --banner-fade: rgba(7, 16, 24, 0.35);
  --header-top: rgba(7, 16, 24, 0.82);
  --header-bottom: rgba(7, 16, 24, 0.42);
  --glow-a: rgba(230, 195, 92, 0.07);
  --glow-b: rgba(45, 212, 191, 0.06);
  --theme-accent: #e6c35c;
  --theme-accent-2: #2dd4bf;
  --on-gold: #0b1b15;
}

[data-theme="quantum"] {
  --forest-deep: #060612;
  --forest: #12122e;
  --forest-mid: #0c0c22;
  --gold: #22d3ee;
  --gold-soft: rgba(34, 211, 238, 0.14);
  --poppy: #818cf8;
  --cream: #eefcff;
  --muted: #94a3b8;
  --line: rgba(34, 211, 238, 0.2);
  --card: #10102a;
  --btn-grey: #1a1a3a;
  --btn-grey-hover: #252550;
  --surface-panel: rgba(6, 6, 18, 0.94);
  --surface-input: #0a0a20;
  --surface-dialog: #0e0e28;
  --surface-muted: rgba(16, 16, 42, 0.82);
  --banner-base: #04040e;
  --banner-overlay: rgba(6, 6, 18, 0.45);
  --banner-fade: rgba(6, 6, 18, 0.55);
  --header-top: rgba(6, 6, 18, 0.88);
  --header-bottom: rgba(6, 6, 18, 0.5);
  --glow-a: rgba(34, 211, 238, 0.12);
  --glow-b: rgba(129, 140, 248, 0.14);
  --theme-accent: #22d3ee;
  --theme-accent-2: #818cf8;
}

[data-theme="aurora"] {
  --forest-deep: #080c18;
  --forest: #141c38;
  --forest-mid: #0f1528;
  --gold: #67e8f9;
  --gold-soft: rgba(103, 232, 249, 0.14);
  --poppy: #f472b6;
  --cream: #f0f9ff;
  --muted: #94a3b8;
  --line: rgba(167, 139, 250, 0.22);
  --card: #121a34;
  --btn-grey: #1a2440;
  --btn-grey-hover: #243052;
  --surface-panel: rgba(8, 12, 24, 0.94);
  --surface-input: #0c1224;
  --surface-dialog: #101830;
  --surface-muted: rgba(18, 26, 52, 0.82);
  --banner-base: #060a14;
  --banner-overlay: rgba(8, 12, 24, 0.4);
  --banner-fade: rgba(8, 12, 24, 0.52);
  --header-top: rgba(8, 12, 24, 0.88);
  --header-bottom: rgba(8, 12, 24, 0.48);
  --glow-a: rgba(244, 114, 182, 0.11);
  --glow-b: rgba(103, 232, 249, 0.1);
  --theme-accent: #a78bfa;
  --theme-accent-2: #f472b6;
}

[data-theme="matrix"] {
  --forest-deep: #020804;
  --forest: #0a1a0e;
  --forest-mid: #061208;
  --gold: #39ff14;
  --gold-soft: rgba(57, 255, 20, 0.12);
  --poppy: #00ff88;
  --cream: #eaffea;
  --muted: #6b8f6b;
  --line: rgba(57, 255, 20, 0.18);
  --card: #081408;
  --btn-grey: #0f1f12;
  --btn-grey-hover: #152818;
  --surface-panel: rgba(2, 8, 4, 0.96);
  --surface-input: #040e06;
  --surface-dialog: #061008;
  --surface-muted: rgba(8, 20, 8, 0.85);
  --banner-base: #010502;
  --banner-overlay: rgba(2, 8, 4, 0.5);
  --banner-fade: rgba(2, 8, 4, 0.62);
  --header-top: rgba(2, 8, 4, 0.92);
  --header-bottom: rgba(2, 8, 4, 0.55);
  --glow-a: rgba(57, 255, 20, 0.08);
  --glow-b: rgba(0, 255, 136, 0.06);
  --theme-accent: #39ff14;
  --theme-accent-2: #00ff88;
}

[data-theme="prism"] {
  --forest-deep: #0c1018;
  --forest: #1a2438;
  --forest-mid: #141c2c;
  --gold: #818cf8;
  --gold-soft: rgba(129, 140, 248, 0.16);
  --poppy: #38bdf8;
  --cream: #f1f5f9;
  --muted: #94a3b8;
  --line: rgba(129, 140, 248, 0.22);
  --card: #1a2433;
  --btn-grey: #243044;
  --btn-grey-hover: #2e3c54;
  --surface-panel: rgba(12, 16, 24, 0.88);
  --surface-input: #111827;
  --surface-dialog: #151d2b;
  --surface-muted: rgba(26, 36, 51, 0.78);
  --banner-base: #0a0e16;
  --banner-overlay: rgba(12, 16, 24, 0.35);
  --banner-fade: rgba(12, 16, 24, 0.48);
  --header-top: rgba(12, 16, 24, 0.78);
  --header-bottom: rgba(12, 16, 24, 0.42);
  --glow-a: rgba(129, 140, 248, 0.1);
  --glow-b: rgba(56, 189, 248, 0.09);
  --theme-accent: #818cf8;
  --theme-accent-2: #38bdf8;
}

[data-theme="dark"] {
  --forest-deep: #0a0a0f;
  --forest: #14141f;
  --forest-mid: #0f0f18;
  --gold: #e6c35c;
  --gold-soft: rgba(230, 195, 92, 0.14);
  --poppy: #f87171;
  --cream: #ececf1;
  --muted: #9ca3af;
  --line: rgba(255, 255, 255, 0.1);
  --card: #16161f;
  --btn-grey: #22222e;
  --btn-grey-hover: #2c2c3a;
  --surface-panel: rgba(10, 10, 15, 0.96);
  --surface-input: #12121a;
  --surface-dialog: #16161f;
  --surface-muted: rgba(22, 22, 31, 0.88);
  --banner-base: #08080c;
  --banner-overlay: rgba(10, 10, 15, 0.45);
  --banner-fade: rgba(10, 10, 15, 0.62);
  --header-top: rgba(10, 10, 15, 0.92);
  --header-bottom: rgba(10, 10, 15, 0.55);
  --glow-a: rgba(230, 195, 92, 0.06);
  --glow-b: rgba(255, 255, 255, 0.03);
  --theme-accent: #e6c35c;
  --theme-accent-2: #a78bfa;
  --on-gold: #0a0a0f;
}

body {
  background:
    radial-gradient(ellipse 85% 55% at 12% -8%, var(--glow-a), transparent 58%),
    radial-gradient(ellipse 75% 50% at 88% 108%, var(--glow-b), transparent 52%),
    var(--forest-deep);
}

[data-theme="aurora"] body {
  background:
    radial-gradient(ellipse 70% 45% at 20% 0%, rgba(244, 114, 182, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(167, 139, 250, 0.1), transparent 50%),
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(103, 232, 249, 0.08), transparent 55%),
    var(--forest-deep);
}

[data-theme="prism"] .side-panel,
[data-theme="prism"] .form-card,
[data-theme="prism"] .quick-add-dialog {
  backdrop-filter: blur(12px);
}

[data-theme="light"] .side-add-btn {
  color: var(--on-gold) !important;
}
[data-theme="light"] .form-card,
[data-theme="light"] .app-card,
[data-theme="light"] .side-link {
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

[data-theme="light"] .theme-swatch-name {
  color: rgba(26, 35, 50, 0.85);
  background: linear-gradient(transparent, rgba(255, 255, 255, 0.85));
}

.theme-picker {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.theme-picker-label {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.theme-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.theme-swatch {
  appearance: none;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 0;
  width: 100%;
  aspect-ratio: 1;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-swatch:hover {
  transform: translateY(-2px);
}

.theme-swatch[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-soft), 0 0 16px var(--gold-soft);
}

.theme-swatch-inner {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 9px;
}

.theme-swatch-neural .theme-swatch-inner {
  background: linear-gradient(135deg, #0b1b15 40%, #e6c35c);
}

.theme-swatch-quantum .theme-swatch-inner {
  background: linear-gradient(135deg, #060612 35%, #22d3ee 70%, #818cf8);
}

.theme-swatch-aurora .theme-swatch-inner {
  background: linear-gradient(135deg, #080c18 30%, #a78bfa 55%, #f472b6 80%, #67e8f9);
}

.theme-swatch-matrix .theme-swatch-inner {
  background: linear-gradient(135deg, #020804 40%, #39ff14);
}

.theme-swatch-prism .theme-swatch-inner {
  background: linear-gradient(135deg, #0c1018 35%, #818cf8 65%, #38bdf8);
}

.theme-swatch-light .theme-swatch-inner {
  background: linear-gradient(135deg, #ffffff 45%, #b45309 85%, #2563eb);
}

.theme-swatch-dark .theme-swatch-inner {
  background: linear-gradient(135deg, #0a0a0f 50%, #e6c35c);
}

.theme-swatch-name {
  position: absolute;
  inset: auto 0 0;
  padding: 2px 0 3px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  text-align: center;
  line-height: 1.1;
}

@media (max-width: 900px) {
  .theme-swatches {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .theme-swatch-name {
    font-size: 13px;
  }
}
