/* Dunkles Farbschema. Eingeschaltet über data-theme="dark" am <html>,
   gesetzt vom Knopf oben rechts oder, ohne eigene Wahl, vom System.
   Flächen und Schrift kommen überall aus den Variablen in style.css;
   hier stehen nur deren dunkle Werte und die wenigen Stellen, an denen
   dieselbe Variable hell als Fläche und dunkel als Schrift dient. */

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #12161e;
  --color-surface: #1b2029;
  --color-surface-2: #232936;
  --color-surface-3: #1f252f;
  --color-border: #2d3442;
  --color-border-strong: #4b5566;
  --color-fill-muted: #353d4c;
  --color-text: #e4e8ef;
  --color-text-muted: #9aa4b5;
  /* Primär ist Verweisfarbe und Füllung zugleich: hell genug zum Lesen,
     satt genug für weiße Schrift darauf */
  --color-primary: #5a8fd4;
  /* Hell ist das die dunkle Fläche hinter der Seitenleiste und die Schrift
     auf getönten Flächen. Dunkel braucht die Schrift einen hellen Wert,
     die Flächen bekommen unten eigene. */
  --color-primary-dark: #b3cbf0;
  --color-primary-soft: #1f2b3f;
  --color-primary-soft-2: #263756;
  --color-accent: #d8a84a;
  --color-danger: #f0867d;
  --color-danger-bg: #3b2020;
  --color-danger-border: #6e3330;
  --color-success: #6fcf97;
  --color-success-bg: #17311f;
  --color-success-border: #2f5c40;
  --color-success-text: #8fd9ac;
  --color-warning-bg: #3a2e13;
  --color-warning-text: #f0c36a;
  --color-warning-border: #6b5323;
}

/* Flächen, die hell über --color-primary-dark laufen */
:root[data-theme="dark"] .sidebar { background: #15213a; }
:root[data-theme="dark"] .btn-primary { background: #2f5d9e; border-color: #2f5d9e; }
:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .rund-plus:hover { background: #3a6bb0; }

/* Das blaue Logo wird auf dunklem Grund weiß; die Datei bleibt dieselbe */
:root[data-theme="dark"] .topbar-brand-logo img { filter: brightness(0) invert(1); opacity: 0.92; }

/* Intranet: die Leiste liegt als dunkle Pille auf dem Grund, das Blau wird als Schrift heller */
:root[data-theme="dark"] body.intranet {
  /* Das Intranet-Blau dient meist als Schrift (Kaestenkoepfe, aktive Reiter)
     und muss dunkel hell werden; Flaechen mit weisser Schrift stehen unten */
  --in-blau: #a39ee8;
  --color-primary: #a39ee8;
  --color-primary-dark: #c9c5f3;
  --in-linie: #2d3442;
  --in-hell: #232936;
  --in-grau: #8e8ea6;
}
:root[data-theme="dark"] .fb-ring,
:root[data-theme="dark"] .fb-plus,
:root[data-theme="dark"] .orga-firma,
:root[data-theme="dark"] .shop-tabelle th,
:root[data-theme="dark"] .orga-platzhalter { background: #5b56a8; }
:root[data-theme="dark"] .fb-dialog::backdrop { background: rgba(8, 11, 18, 0.75); }

/* Wohnwagen-Zeichnung: dunkle Konturen auf dunklem Grund sichtbar halten */
:root[data-theme="dark"] .ww-aufbau,
:root[data-theme="dark"] .ww-teil,
:root[data-theme="dark"] .ww-glas,
:root[data-theme="dark"] .ww-tuer { stroke: #9aa4b5; }

/* Der Schalter zeigt, wohin es geht: hell den Mond, dunkel die Sonne */
.farbschema-knopf .nur-hell,
.farbschema-knopf .nur-dunkel { display: inline-flex; align-items: center; }
.farbschema-knopf .nur-dunkel { display: none; }
:root[data-theme="dark"] .farbschema-knopf .nur-hell { display: none; }
:root[data-theme="dark"] .farbschema-knopf .nur-dunkel { display: inline-flex; }

/* Großer Chat: der Hintergrund dunkelt stärker ab, sonst hebt sich das Fenster kaum */
:root[data-theme="dark"] .chat-gross-hinter { background: rgba(4, 6, 10, 0.62); }
