/* Shared semantic palettes. Register new theme IDs in app/core/crm_themes.py. */
:root, [data-theme-preview="light"] {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #020817;
  --card: #ffffff;
  --card-foreground: #020817;
  --popover: #ffffff;
  --popover-foreground: #020817;
  --primary: #0f172a;
  --primary-foreground: #f8fafc;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f172a;
  --muted: #f8fafc;
  --muted-foreground: #64748b;
  --accent: #f1f5f9;
  --accent-foreground: #0f172a;
  --destructive: #ef4444;
  --destructive-foreground: #fef2f2;
  --border: #e2e8f0;
  --input: #e2e8f0;
  --ring: #94a3b8;
  --radius: 8px;
  --sidebar: #fbfdff;
  --badge: #facc15;
  --badge-foreground: #111827;
  --success: #15803d;
  --positive: #0f766e;
  --success-soft: #ecfdf5;
  --positive-foreground: #134e4a;
  --positive-hover: #d1fae5;
  --success-background: #dcfce7;
  --success-foreground: #166534;
  --neutral-background: #e5e7eb;
  --neutral-foreground: #4b5563;
  --info-background: #dbeafe;
  --info-foreground: #1e40af;
  --warning-background: #fef3c7;
  --warning-foreground: #92400e;
  --danger: #b91c1c;
  --positive-background: #f0fdfa;
  --success-indicator: #16a34a;
  --neutral-indicator: #94a3b8;
  --border-strong: #cbd5e1;
  --avatar-background: #e0f2fe;
  --avatar-foreground: #075985;
  --success-border: #bbf7d0;
  --notice-border: #fed7aa;
  --notice-background: #fff7ed;
  --notice-foreground: #9a3412;
  --status-neutral-background: #eef1f4;
  --status-neutral-foreground: #39424e;
  --status-new-background: #fff0a6;
  --status-new-foreground: #332900;
  --status-progress-background: #dcecff;
  --status-progress-foreground: #123b68;
  --status-ready-background: #d9f7df;
  --status-ready-foreground: #185b2a;
  --status-complete-background: #dce9e1;
  --status-complete-foreground: #254b33;
  --status-lost-background: #ffe2e2;
  --status-lost-foreground: #7b2222;
  --message-background: #f5f6f7;
  --planned: #b45309;
  --negative: #be123c;
  --planned-chart: #d97706;
  --primary-hover: #1e293b;
  --danger-border: #fecaca;
  --danger-border-hover: #fca5a5;
  --warning-border: #fde68a;
  --warning-soft: #fffbeb;
  --warning-text: #78350f;
  --search-highlight: #fef08a;
  --danger-soft: #fef2f2;
  --switch-thumb: #fff;
  --icon-filter: none;
  --shadow-soft: rgba(15, 23, 42, 0.06);
  --shadow-faint: rgba(15, 23, 42, 0.04);
  --outline-soft: rgba(15, 23, 42, .18);
  --focus-shadow: rgba(148, 163, 184, 0.22);
  --shadow-thumb: rgba(15, 23, 42, .28);
  --shadow-dialog: rgba(15, 23, 42, 0.22);
  --backdrop: rgba(15, 23, 42, 0.42);
  --shadow-popup: rgba(15, 23, 42, .14);
  --shadow-menu: #0f172a1a;
}

:root[data-theme="dark"], [data-theme-preview="dark"] {
  color-scheme: dark;
  --background: #0b1220;
  --foreground: #e5eaf2;
  --card: #111b2e;
  --card-foreground: #e5eaf2;
  --popover: #172235;
  --popover-foreground: #e5eaf2;
  --primary: #e2e8f0;
  --primary-foreground: #111827;
  --secondary: #233047;
  --secondary-foreground: #e2e8f0;
  --muted: #162136;
  --muted-foreground: #a3b2c7;
  --accent: #26364e;
  --accent-foreground: #f1f5f9;
  --destructive: #fca5a5;
  --destructive-foreground: #3b2027;
  --border: #314057;
  --input: #40516a;
  --ring: #93c5fd;
  --sidebar: #0e1727;
  --badge: #facc15;
  --badge-foreground: #111827;
  --success: #86efac;
  --positive: #5eead4;
  --success-soft: #113229;
  --positive-foreground: #99f6e4;
  --positive-hover: #174237;
  --success-background: #143323;
  --success-foreground: #bbf7d0;
  --neutral-background: #273448;
  --neutral-foreground: #cbd5e1;
  --info-background: #172e4e;
  --info-foreground: #bfdbfe;
  --warning-background: #3b3016;
  --warning-foreground: #fde68a;
  --danger: #fca5a5;
  --positive-background: #12332f;
  --success-indicator: #4ade80;
  --neutral-indicator: #a3b2c7;
  --border-strong: #475569;
  --avatar-background: #123348;
  --avatar-foreground: #bae6fd;
  --success-border: #226143;
  --notice-border: #8a5021;
  --notice-background: #362619;
  --notice-foreground: #fed7aa;
  --status-neutral-background: #263447;
  --status-neutral-foreground: #d3dce8;
  --status-new-background: #42351b;
  --status-new-foreground: #fff0a6;
  --status-progress-background: #1c3556;
  --status-progress-foreground: #bfdbfe;
  --status-ready-background: #1a3c2b;
  --status-ready-foreground: #bbf7d0;
  --status-complete-background: #273d35;
  --status-complete-foreground: #c7e7d2;
  --status-lost-background: #41252a;
  --status-lost-foreground: #fecaca;
  --message-background: #1c2738;
  --planned: #fbbf24;
  --negative: #fda4af;
  --planned-chart: #fbbf24;
  --primary-hover: #cbd5e1;
  --danger-border: #7f333b;
  --danger-border-hover: #c4646d;
  --warning-border: #785d24;
  --warning-soft: #332b1b;
  --warning-text: #fde68a;
  --search-highlight: #55451b;
  --danger-soft: #3b2027;
  --icon-filter: invert(1);
  --shadow-soft: rgba(0, 0, 0, .2);
  --shadow-faint: rgba(0, 0, 0, .18);
  --outline-soft: rgba(255, 255, 255, .2);
  --focus-shadow: rgba(147, 197, 253, .25);
  --shadow-thumb: rgba(0, 0, 0, .4);
  --shadow-dialog: rgba(0, 0, 0, .5);
  --backdrop: rgba(0, 0, 0, .65);
  --shadow-popup: rgba(0, 0, 0, .4);
  --shadow-menu: rgba(0, 0, 0, .4);
}

/* NAMODE's website and apps share #fff343 and a neutral black/graphite base. */
:root[data-theme="namode"], [data-theme-preview="namode"] {
  color-scheme: dark;
  --background: #070707;
  --foreground: #f7f7f2;
  --card: #151515;
  --card-foreground: #f7f7f2;
  --popover: #1b1b1b;
  --popover-foreground: #f7f7f2;
  --primary: #fff343;
  --primary-foreground: #070707;
  --secondary: #292719;
  --secondary-foreground: #fff343;
  --muted: #1b1b1b;
  --muted-foreground: #b8b8ae;
  --accent: #292929;
  --accent-foreground: #f7f7f2;
  --destructive: #ff6b6b;
  --destructive-foreground: #351b1b;
  --border: #353535;
  --input: #55554f;
  --ring: #fff343;
  --radius: 8px;
  --sidebar: #111111;
  --badge: #fff343;
  --badge-foreground: #070707;
  --success: #72d49b;
  --positive: #73d7e8;
  --success-soft: #172c22;
  --positive-foreground: #a8ebf4;
  --positive-hover: #1d393c;
  --success-background: #193023;
  --success-foreground: #a0e9ba;
  --neutral-background: #292929;
  --neutral-foreground: #d5d5cb;
  --info-background: #183438;
  --info-foreground: #a8ebf4;
  --warning-background: #37321a;
  --warning-foreground: #fff18b;
  --danger: #ff9393;
  --positive-background: #152e31;
  --success-indicator: #72d49b;
  --neutral-indicator: #a8a8a0;
  --border-strong: #606059;
  --avatar-background: #183438;
  --avatar-foreground: #73d7e8;
  --success-border: #36684b;
  --notice-border: #77552b;
  --notice-background: #332718;
  --notice-foreground: #f8cd8b;
  --status-neutral-background: #292929;
  --status-neutral-foreground: #d5d5cb;
  --status-new-background: #3b3617;
  --status-new-foreground: #fff343;
  --status-progress-background: #183438;
  --status-progress-foreground: #a8ebf4;
  --status-ready-background: #193023;
  --status-ready-foreground: #a0e9ba;
  --status-complete-background: #26372d;
  --status-complete-foreground: #c4dfcc;
  --status-lost-background: #3b2020;
  --status-lost-foreground: #ffb1b1;
  --message-background: #202020;
  --planned: #fff343;
  --negative: #ff9393;
  --planned-chart: #fff343;
  --primary-hover: #e8dc36;
  --danger-border: #794242;
  --danger-border-hover: #b25b5b;
  --warning-border: #73682e;
  --warning-soft: #2d2918;
  --warning-text: #fff18b;
  --search-highlight: #4b4417;
  --danger-soft: #351b1b;
  --switch-thumb: #070707;
  --icon-filter: invert(1);
  --shadow-soft: rgba(0, 0, 0, .2);
  --shadow-faint: rgba(0, 0, 0, .18);
  --outline-soft: rgba(255, 243, 67, .25);
  --focus-shadow: rgba(255, 243, 67, .2);
  --shadow-thumb: rgba(0, 0, 0, .4);
  --shadow-dialog: rgba(0, 0, 0, .5);
  --backdrop: rgba(0, 0, 0, .7);
  --shadow-popup: rgba(0, 0, 0, .4);
  --shadow-menu: rgba(0, 0, 0, .4);
}

/* ELEO SPACE: graphite and turquoise from https://eleo.space/. */
:root[data-theme="eleo"], [data-theme-preview="eleo"] {
  color-scheme: dark;
  --background: #101010;
  --foreground: #f6f5f2;
  --card: #1b1b1b;
  --card-foreground: #f6f5f2;
  --popover: #262626;
  --popover-foreground: #f6f5f2;
  --primary: #5faca6;
  --primary-foreground: #101010;
  --secondary: #223a37;
  --secondary-foreground: #a1d8d1;
  --muted: #262626;
  --muted-foreground: #b4b4b1;
  --accent: #263936;
  --accent-foreground: #f6f5f2;
  --destructive: #ff6b6b;
  --destructive-foreground: #351b1b;
  --border: #3c4441;
  --input: #626f6a;
  --ring: #7acbc2;
  --radius: 8px;
  --sidebar: #1b1b1b;
  --badge: #7acbc2;
  --badge-foreground: #101010;
  --success: #72d49b;
  --positive: #8cd4c2;
  --success-soft: #172c22;
  --positive-foreground: #b0e6db;
  --positive-hover: #23463f;
  --success-background: #193023;
  --success-foreground: #a0e9ba;
  --neutral-background: #292929;
  --neutral-foreground: #d5d5cb;
  --info-background: #20363e;
  --info-foreground: #b2d8e4;
  --warning-background: #37321a;
  --warning-foreground: #fff18b;
  --danger: #ff9393;
  --positive-background: #1e3831;
  --success-indicator: #72d49b;
  --neutral-indicator: #a8a8a0;
  --border-strong: #697871;
  --avatar-background: #223a37;
  --avatar-foreground: #7acbc2;
  --success-border: #36684b;
  --notice-border: #77552b;
  --notice-background: #332718;
  --notice-foreground: #f8cd8b;
  --status-neutral-background: #2d3330;
  --status-neutral-foreground: #d5d5cb;
  --status-new-background: #3b3617;
  --status-new-foreground: #f3d888;
  --status-progress-background: #20363e;
  --status-progress-foreground: #b2d8e4;
  --status-ready-background: #193023;
  --status-ready-foreground: #a0e9ba;
  --status-complete-background: #26372d;
  --status-complete-foreground: #c4dfcc;
  --status-lost-background: #3b2020;
  --status-lost-foreground: #ffb1b1;
  --message-background: #292e2b;
  --planned: #e5c47e;
  --negative: #ff9393;
  --planned-chart: #e5c47e;
  --primary-hover: #7acbc2;
  --danger-border: #794242;
  --danger-border-hover: #b25b5b;
  --warning-border: #73682e;
  --warning-soft: #2d2918;
  --warning-text: #fff18b;
  --search-highlight: #4b4417;
  --danger-soft: #351b1b;
  --switch-thumb: #101010;
  --icon-filter: invert(1);
  --shadow-soft: rgba(0, 0, 0, .2);
  --shadow-faint: rgba(0, 0, 0, .18);
  --outline-soft: rgba(95, 172, 166, .25);
  --focus-shadow: rgba(95, 172, 166, .22);
  --shadow-thumb: rgba(0, 0, 0, .4);
  --shadow-dialog: rgba(0, 0, 0, .5);
  --backdrop: rgba(0, 0, 0, .7);
  --shadow-popup: rgba(0, 0, 0, .4);
  --shadow-menu: rgba(0, 0, 0, .4);
}

:root[data-theme="namode"] .nav a.active,
:root[data-theme="namode"] .nav-group summary.active,
:root[data-theme="eleo"] .nav a.active,
:root[data-theme="eleo"] .nav-group summary.active { box-shadow: inset 3px 0 var(--primary); }
:root[data-theme="namode"] ::selection,
:root[data-theme="eleo"] ::selection { background: var(--primary); color: var(--primary-foreground); }

.theme-settings { max-width: 1060px; }
.theme-options { border: 0; margin: 24px 0 16px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.theme-legend { padding: 0; margin-bottom: 12px; font-weight: 600; }
.theme-option { position: relative; margin: 0; cursor: pointer; }
.theme-option > input { position: absolute; top: 16px; left: 16px; width: 18px; min-height: 18px; height: 18px; margin: 0; z-index: 1; accent-color: var(--primary); cursor: pointer; }
.theme-option-body { display: flex; flex-direction: column; gap: 12px; height: 100%; border: 2px solid var(--border); border-radius: 10px; padding: 12px; background: var(--card); }
.theme-option:hover .theme-option-body { border-color: var(--ring); }
.theme-option > input:checked + .theme-option-body { border-color: var(--primary); }
.theme-option > input:focus-visible + .theme-option-body { outline: 3px solid var(--ring); outline-offset: 3px; }
.theme-option-title { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 15px; font-weight: 700; }
.theme-check { visibility: hidden; }
.theme-option > input:checked + .theme-option-body .theme-check { visibility: visible; }
.theme-preview { display: grid; grid-template-columns: 24% 1fr; height: 138px; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--background); }
.theme-preview-sidebar { background: var(--sidebar); border-right: 1px solid var(--border); }
.theme-preview-main { padding: 18px 12px; display: grid; gap: 10px; align-content: start; }
.theme-preview-heading { width: 60%; height: 6px; border-radius: 3px; background: var(--foreground); }
.theme-preview-panel { padding: 9px; border: 1px solid var(--border); background: var(--card); display: grid; gap: 6px; border-radius: 4px; }
.theme-preview-panel > span { height: 5px; background: var(--secondary); border-radius: 2px; }
.theme-preview-button { width: 38%; height: 15px; background: var(--primary); border-radius: 3px; }
@media (max-width: 700px) { .theme-options { grid-template-columns: 1fr; } .theme-preview { height: 120px; } }

/* Network identity stays visible in every palette and sidebar mode. */
:root[data-crm-brand="eleo"] .brand-logo-full { width: 88px; height: 43px; }
:root[data-crm-brand="eleo"] .brand-logo-compact { object-fit: contain; border-radius: 0; }
