/*
 * Dunkler Modus (15.10.2026, Muster Vertriebsuebersicht). Greift nur mit <html data-farbmodus="dunkel">
 * (Schalter im Kopf, public/js/farbmodus.js, Cookie his_farbmodus gilt fuer alle *.hauswunsch24.de-Apps).
 * Prinzip: zuerst die shadcn-Farbvariablen umstellen (globals.css; die dark:-Varianten von shadcn greifen
 * ueber @custom-variant dark ebenfalls an diesem Attribut), danach die festen Tailwind-Farbklassen
 * (bg-white, bg-gray-50, text-gray-900 ...). Diese Datei ist unlayered und schlaegt damit die Tailwind-Utilities.
 * Der Kopf ist hell und wird im dunklen Modus mit dunkel; der Fuss ist schon dunkel.
 */
html[data-farbmodus="dunkel"] {
    color-scheme: dark;
    --background: #12161c;
    --foreground: #e2e8f0;
    --card: #1b2129;
    --card-foreground: #e2e8f0;
    --popover: #1b2129;
    --popover-foreground: #e2e8f0;
    --secondary: #222a34;
    --secondary-foreground: #e2e8f0;
    --muted: #222a34;
    --muted-foreground: #94a3b8;
    --accent: #2a333e;
    --accent-foreground: #ff6b7d;
    --border: #2d3540;
    --input: #2d3540;
    --sidebar: #1b2129;
    --sidebar-foreground: #e2e8f0;
    --sidebar-accent: #2a333e;
    --sidebar-border: #2d3540;
    --flaeche: #1b2129;
    --flaeche-2: #222a34;
    --eingabe: #11161c;
}
html[data-farbmodus="dunkel"] body { background: #12161c; color: #e2e8f0; }

/* Flaechen */
html[data-farbmodus="dunkel"] .bg-white { background-color: var(--flaeche); }
html[data-farbmodus="dunkel"] :is(.bg-gray-50, .bg-slate-100, .from-gray-50) { background-color: #12161c; }
html[data-farbmodus="dunkel"] .to-gray-100 { --tw-gradient-to: #161b22; }
html[data-farbmodus="dunkel"] .from-gray-50 { --tw-gradient-from: #12161c; }
html[data-farbmodus="dunkel"] :is(.bg-gray-100, .bg-gray-200) { background-color: var(--flaeche-2); }
html[data-farbmodus="dunkel"] .bg-gray-300 { background-color: #3d4856; }
html[data-farbmodus="dunkel"] :is(.hover\:bg-gray-50:hover, .hover\:bg-gray-100:hover, .hover\:bg-gray-200:hover) { background-color: #26303b; }
html[data-farbmodus="dunkel"] header.bg-white { background-color: #1b2129; border-color: var(--border); }
html[data-farbmodus="dunkel"] footer.bg-gray-800 { background-color: #0d1117; border-top: 1px solid var(--border); }

/* Texte */
html[data-farbmodus="dunkel"] :is(.text-black, .text-gray-950, .text-gray-900, .text-gray-800, .text-gray-700) { color: #e2e8f0; }
html[data-farbmodus="dunkel"] :is(.text-gray-600, .text-gray-500, .text-slate-500) { color: #94a3b8; }
html[data-farbmodus="dunkel"] .text-gray-400 { color: #7b8794; }
html[data-farbmodus="dunkel"] .hover\:text-gray-600:hover { color: #cbd5e1; }
html[data-farbmodus="dunkel"] :is(.border-gray-200, .border-gray-300) { border-color: var(--border); }
html[data-farbmodus="dunkel"] .text-\[\#E30613\] { color: #ff5a6e; }
html[data-farbmodus="dunkel"] :is(.text-red-500, .text-red-600, .text-red-700, .text-red-800) { color: #fca5a5; }
html[data-farbmodus="dunkel"] :is(.text-green-500, .text-green-600, .text-green-700, .text-green-800) { color: #86efac; }
html[data-farbmodus="dunkel"] :is(.text-blue-500, .text-blue-600, .text-blue-800) { color: #93c5fd; }
html[data-farbmodus="dunkel"] :is(.text-yellow-600, .text-yellow-700, .text-yellow-800, .text-amber-600, .text-amber-700, .text-amber-800, .text-orange-600) { color: #fcd34d; }

/* Farbige helle Flaechen (Status-Kennzeichen, Hinweise) */
html[data-farbmodus="dunkel"] :is(.bg-red-100, .hover\:bg-red-50:hover) { background-color: #3b1518; }
html[data-farbmodus="dunkel"] .bg-red-50 { background-color: rgba(226, 0, 26, 0.10); }
html[data-farbmodus="dunkel"] :is(.hover\:bg-red-100:hover, .hover\:bg-red-200:hover) { background-color: #4c1d22; }
html[data-farbmodus="dunkel"] :is(.bg-green-100, .hover\:bg-green-50:hover) { background-color: #12301f; }
html[data-farbmodus="dunkel"] .bg-green-50 { background-color: rgba(34, 197, 94, 0.08); }
html[data-farbmodus="dunkel"] :is(.hover\:bg-green-100:hover, .hover\:bg-green-200:hover) { background-color: #18402a; }
html[data-farbmodus="dunkel"] :is(.bg-blue-100, .hover\:bg-blue-50:hover) { background-color: #1c2a4a; }
html[data-farbmodus="dunkel"] .bg-blue-50 { background-color: rgba(59, 130, 246, 0.10); }
html[data-farbmodus="dunkel"] :is(.hover\:bg-blue-100:hover, .hover\:bg-blue-200:hover) { background-color: #233661; }
html[data-farbmodus="dunkel"] .bg-yellow-100 { background-color: #3a2d0c; }
html[data-farbmodus="dunkel"] :is(.bg-yellow-50, .bg-amber-50) { background-color: rgba(234, 179, 8, 0.09); }
html[data-farbmodus="dunkel"] :is(.border-red-200) { border-color: #9b2c35; }
html[data-farbmodus="dunkel"] :is(.border-green-200) { border-color: #2f7a4b; }
html[data-farbmodus="dunkel"] :is(.border-blue-200) { border-color: #3b5a9a; }
html[data-farbmodus="dunkel"] :is(.border-yellow-200, .border-amber-200) { border-color: #a16207; }
html[data-farbmodus="dunkel"] .bg-\[\#E30613\]\/10 { background-color: rgba(226, 0, 26, 0.16); }

/* Eingaben, Fenster, Tabellen (shadcn) */
html[data-farbmodus="dunkel"] :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="file"]) { background-color: var(--eingabe); color: #e2e8f0; border-color: var(--border); }
html[data-farbmodus="dunkel"] :is(input, textarea)::placeholder { color: #64748b; }
html[data-farbmodus="dunkel"] [data-slot="select-trigger"] { background-color: var(--eingabe); }
html[data-farbmodus="dunkel"] [data-slot="dialog-overlay"] { background: rgba(0, 0, 0, 0.65); }
html[data-farbmodus="dunkel"] [data-slot="table-row"]:hover { background-color: #26303b; }
html[data-farbmodus="dunkel"] ::-webkit-scrollbar-track { background: #161b22; }
html[data-farbmodus="dunkel"] ::-webkit-scrollbar-thumb { background: #3d4856; }

/* Diagramme (Recharts): SVG-Attribute per CSS ueberschreiben, Tooltip hat Inline-Stil */
html[data-farbmodus="dunkel"] .recharts-cartesian-grid :is(line, path) { stroke: rgba(255, 255, 255, 0.08); }
html[data-farbmodus="dunkel"] .recharts-cartesian-axis-tick-value, html[data-farbmodus="dunkel"] .recharts-cartesian-axis-tick-value tspan { fill: #a9b4c2; }
html[data-farbmodus="dunkel"] .recharts-cartesian-axis-line { stroke: #2d3540; }
html[data-farbmodus="dunkel"] .recharts-default-tooltip { background: #1b2129 !important; border-color: #2d3540 !important; color: #e2e8f0; }
html[data-farbmodus="dunkel"] .recharts-legend-item-text { color: #cbd5e1 !important; }
html[data-farbmodus="dunkel"] .recharts-pie-sector path, html[data-farbmodus="dunkel"] .recharts-sector { stroke: #1b2129; }
html[data-farbmodus="dunkel"] .recharts-tooltip-cursor { fill: rgba(255, 255, 255, 0.05); }

/* Schiebeschalter Sonne/Mond im Kopf. Kopf ist hell (heller Modus) bzw. dunkel (dunkler Modus). */
.farbschalter { position: relative; display: inline-flex; align-items: center; justify-content: space-between; flex: none;
    width: 52px; height: 28px; padding: 0 7px; border-radius: 999px; cursor: pointer;
    background: rgba(17, 24, 39, .05); border: 1px solid #d1d5db; color: #6b7280; }
.farbschalter:hover { background: rgba(17, 24, 39, .1); }
html[data-farbmodus="dunkel"] .farbschalter { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .18); color: #eef1f2; }
html[data-farbmodus="dunkel"] .farbschalter:hover { background: rgba(255, 255, 255, .16); }
.farbschalter:focus-visible { outline: 2px solid #71bf42; outline-offset: 2px; }
.farbschalter svg { position: relative; z-index: 1; transition: color .2s, opacity .2s; }
.farbschalter .fs-knopf { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #f5b70a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .22s ease, background .22s; }
.farbschalter .fs-sonne { color: #1e2530; }          /* Sonne liegt auf dem gelben Knopf */
.farbschalter .fs-mond { opacity: .55; }
html[data-farbmodus="dunkel"] .farbschalter .fs-knopf { transform: translateX(24px); background: #cbd5e1; }
html[data-farbmodus="dunkel"] .farbschalter .fs-sonne { color: #eef1f2; opacity: .55; }
html[data-farbmodus="dunkel"] .farbschalter .fs-mond { color: #1e2530; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .farbschalter .fs-knopf { transition: none; } }

/* Anleitung (/admin/anleitung, 15.10.2026): Flaechen, Texte und Markierung im dunklen Modus */
html[data-farbmodus="dunkel"] .anleitung { background: var(--flaeche); border-color: var(--border); color: #e2e8f0; box-shadow: none; }
html[data-farbmodus="dunkel"] .anleitung :is(h2, h3, strong) { color: #f1f5f9; }
html[data-farbmodus="dunkel"] .anleitung :is(h2, th, td, img) { border-color: var(--border); }
html[data-farbmodus="dunkel"] .anleitung :is(th, kbd, code) { background: var(--flaeche-2); color: #e2e8f0; border-color: var(--border); }
html[data-farbmodus="dunkel"] .anleitung a { color: #ff6b7d; }
html[data-farbmodus="dunkel"] .anleitung blockquote { background: rgba(234, 179, 8, 0.09); border-left-color: #a16207; }
html[data-farbmodus="dunkel"] .anleitung img { opacity: .92; }
html[data-farbmodus="dunkel"] .anleitung-inhalt a { color: #cbd5e1; }
html[data-farbmodus="dunkel"] :is(.anleitung-inhalt a:hover, .anleitung-inhalt a.aktiv) { background: rgba(226, 0, 26, 0.14); }
html[data-farbmodus="dunkel"] .anleitung-inhalt a.aktiv { color: #ff6b7d; }
html[data-farbmodus="dunkel"] .anleitung-zurueck { color: #94a3b8; }
