/* ============================================================
   DARK MODE  (html[data-bs-theme="dark"])
   ------------------------------------------------------------
   Wird als LETZTES Stylesheet geladen (nach app.css und dem
   Design "Modern") und gilt fuer BEIDE Designs. Rein additiv:
   ohne das Attribut am <html> greift hier nichts.

   Schalter + Regler: app/Views/partials/theme_head.php (setzt
   data-bs-theme und --dm-level VOR dem ersten Zeichnen) und
   assets/js/theme-mode.js (Menue). Einstellung je Benutzer
   (users.theme_mode / theme_darkness), geteilte Logins je Geraet.

   --dm-level (0-100) = wie dunkel: 0 Anthrazit, 100 fast Schwarz.
   ALLE Flaechen leiten ihre Helligkeit daraus ab - neue Regeln
   deshalb NUR mit den --dm-*-Variablen bauen, nie mit festen
   dunklen Farbwerten.

   Immer hell bleiben: Druck (theme_head.php schaltet vor dem
   Drucken auf hell), Beleg-PDF (beleg-pdf.js) und "Papier"-
   Bereiche mit data-bs-theme="light" (Beleg-Ansicht).

   Feste Farben in app.css/termine.css/toasts.css und in den
   Views stehen als var(--dm-bg-<hex>, #<hex>) (bg/fg/bd): hell
   gilt der Fallback = alter Wert, dunkel die Tabelle unten.
   Neue feste Farbe => genauso schreiben + hier eintragen
   (Waechter: tests/test_dark_mode.php).
   ============================================================ */

[data-bs-theme="dark"] {
    --dm-l:          calc(30% - var(--dm-level, 50) * 0.26%);   /* Seitengrund 30% (gedimmt) bis 4% (schwarz) */
    --dm-bg:         hsl(225 8% var(--dm-l));                 /* Seitengrund */
    --dm-surface:    hsl(225 8% calc(var(--dm-l) + 5%));      /* Karten, Tabellen, Modals */
    --dm-surface-2:  hsl(225 8% calc(var(--dm-l) + 9%));      /* Felder, Koepfe, Menues */
    --dm-surface-3:  hsl(225 8% calc(var(--dm-l) + 13%));     /* Hover, aktive Reiter */
    --dm-border:     hsl(225 8% calc(var(--dm-l) + 19%));
    --dm-border-soft:hsl(225 8% calc(var(--dm-l) + 12%));
    --dm-text:       #e6e7eb;
    --dm-text-2:     #d6d8de;
    --dm-muted:      hsl(222 7% calc(84% - var(--dm-level, 50) * 0.18%));
    --dm-faint:      hsl(222 6% calc(74% - var(--dm-level, 50) * 0.22%));
    --dm-hover:      rgba(255, 255, 255, .07);
    /* Farbige SCHRIFT hellt mit dem Grund auf (gedimmt = helles Grau braucht hellere Schrift).
       Farbige FLAECHEN mit weisser Schrift (btn-primary usw.) bleiben dagegen fest - siehe Buttons. */
    --dm-lift:       calc(62% - var(--dm-level, 50) * 0.42%);
    --dm-tx-primary: color-mix(in srgb, #0a84ff, #fff var(--dm-lift));
    --dm-tx-success: color-mix(in srgb, #30d158, #fff var(--dm-lift));
    --dm-tx-danger:  color-mix(in srgb, #ff5a50, #fff var(--dm-lift));
    --dm-tx-info:    color-mix(in srgb, #40c8e0, #fff var(--dm-lift));
    --dm-tx-warning: color-mix(in srgb, #ffb020, #fff var(--dm-lift));
    --dm-fill-primary: #0a7cf0;

    /* Bootstrap-Grundwerte */
    --bs-body-bg:                  var(--dm-surface);
    --bs-body-color:               var(--dm-text);
    --bs-body-color-rgb:           230, 231, 235;
    --bs-emphasis-color:           #fff;
    --bs-emphasis-color-rgb:       255, 255, 255;
    --bs-secondary-color:          var(--dm-muted);
    --bs-secondary-bg:             var(--dm-surface-3);
    --bs-tertiary-color:           var(--dm-faint);
    --bs-tertiary-bg:              var(--dm-surface-2);
    --bs-border-color:             var(--dm-border);
    --bs-border-color-translucent: rgba(255, 255, 255, .13);
    --bs-heading-color:            var(--dm-text);
    --bs-primary:                  #0a84ff;
    --bs-primary-rgb:              10, 132, 255;
    --bs-link-color:               var(--dm-tx-primary);
    --bs-link-color-rgb:           108, 178, 255;
    --bs-link-hover-color:         color-mix(in srgb, var(--dm-tx-primary), #fff 30%);
    --bs-link-hover-color-rgb:     154, 202, 255;

    /* Design "Modern": Systemfarben in der Dunkel-Variante */
    --apple-blue:        var(--dm-tx-primary);
    --apple-blue-deep:   color-mix(in srgb, var(--dm-tx-primary), #fff 25%);
    --apple-green:       var(--dm-tx-success);
    --apple-red:         var(--dm-tx-danger);
    --apple-red-deep:    color-mix(in srgb, var(--dm-tx-danger), #fff 25%);
    --apple-orange:      var(--dm-tx-warning);
    --apple-teal:        var(--dm-tx-info);
    --app-accent-text:   color-mix(in srgb, #4caf78, #fff var(--dm-lift));
    --apple-ink:         var(--dm-text);
    --apple-ink-2:       var(--dm-text-2);
    --apple-gray:        var(--dm-muted);
    --apple-hairline:    rgba(255, 255, 255, .12);
    --apple-separator:   var(--dm-border-soft);
    --apple-bg:          var(--dm-bg);
    --apple-surface:     var(--dm-surface);
    --apple-shadow-card: 0 1px 2px rgba(0, 0, 0, .30), 0 6px 20px rgba(0, 0, 0, .22);

    /* Feste Farben der App (siehe Kopf) */
    --dm-bd-7aa7de: var(--bs-primary-border-subtle);
    --dm-bd-9ec5fe: var(--bs-primary-border-subtle);
    --dm-bd-9eeaf9: var(--bs-info-border-subtle);
    --dm-bd-a3cfbb: var(--bs-success-border-subtle);
    --dm-bd-cccccc: var(--bs-border-color);
    --dm-bd-ced4da: var(--bs-border-color);
    --dm-bd-dee2e6: var(--bs-border-color);
    --dm-bd-e9ecef: var(--bs-border-color);
    --dm-bd-eef0f2: var(--bs-border-color);
    --dm-bd-f0f0f0: var(--bs-border-color);
    --dm-bd-f1f3f5: var(--bs-border-color);
    --dm-bd-f5c2c7: var(--bs-danger-border-subtle);
    --dm-bd-ffe69c: var(--bs-warning-border-subtle);
    --dm-bg-cfe2ff: var(--bs-primary-bg-subtle);
    --dm-bg-cff4fc: var(--bs-info-bg-subtle);
    --dm-bg-d1e7dd: var(--bs-success-bg-subtle);
    --dm-bg-d3e3d8: var(--bs-success-bg-subtle);
    --dm-bg-dbe7f6: var(--bs-primary-bg-subtle);
    --dm-bg-dee2e6: var(--bs-secondary-bg);
    --dm-bg-e6f4ea: var(--bs-success-bg-subtle);
    --dm-bg-e7f1ff: var(--bs-primary-bg-subtle);
    --dm-bg-e8f0ec: var(--bs-success-bg-subtle);
    --dm-bg-e9ecef: var(--bs-secondary-bg);
    --dm-bg-eaf6ef: var(--bs-success-bg-subtle);
    --dm-bg-eceef0: var(--bs-secondary-bg);
    --dm-bg-eef1f4: var(--bs-secondary-bg);
    --dm-bg-f0f0f0: var(--bs-secondary-bg);
    --dm-bg-f0f5f1: var(--bs-success-bg-subtle);
    --dm-bg-f1f3f5: var(--bs-tertiary-bg);
    --dm-bg-f4f5f7: var(--bs-tertiary-bg);
    --dm-bg-f4f6f8: var(--bs-tertiary-bg);
    --dm-bg-f6f7f8: var(--bs-tertiary-bg);
    --dm-bg-f8d7da: var(--bs-danger-bg-subtle);
    --dm-bg-f8f9fa: var(--bs-tertiary-bg);
    --dm-bg-fafafa: var(--bs-tertiary-bg);
    --dm-bg-fafbfc: var(--bs-tertiary-bg);
    --dm-bg-fcfcfd: var(--bs-tertiary-bg);
    --dm-bg-fde2e4: var(--bs-danger-bg-subtle);
    --dm-bg-ffe69c: var(--bs-warning-border-subtle);
    --dm-bg-fff1f0: var(--bs-danger-bg-subtle);
    --dm-bg-fff1e6: var(--bs-warning-bg-subtle);
    --dm-bg-fff3cd: var(--bs-warning-bg-subtle);
    --dm-bg-fff8dc: var(--bs-warning-bg-subtle);
    --dm-bg-fff8e1: var(--bs-warning-bg-subtle);
    --dm-bg-fffef3: var(--bs-warning-bg-subtle);
    --dm-bg-fffef8: var(--bs-warning-bg-subtle);
    --dm-bg-ffffff: var(--bs-body-bg);
    --dm-fg-052c65: var(--bs-primary-text-emphasis);
    --dm-fg-055160: var(--bs-info-text-emphasis);
    --dm-fg-084298: var(--bs-primary-text-emphasis);
    --dm-fg-0a3622: var(--bs-success-text-emphasis);
    --dm-fg-0b3d91: var(--bs-primary-text-emphasis);
    --dm-fg-0b5ed7: var(--dm-tx-primary);
    --dm-fg-0d6efd: var(--dm-tx-primary);
    --dm-fg-198754: var(--dm-tx-success);
    --dm-fg-1a4d2e: var(--app-accent-text);
    --dm-fg-1c1c1c: var(--bs-body-color);
    --dm-fg-212529: var(--bs-body-color);
    --dm-fg-333333: var(--bs-body-color);
    --dm-fg-343a40: var(--bs-body-color);
    --dm-fg-495057: var(--bs-secondary-color);
    --dm-fg-555555: var(--bs-secondary-color);
    --dm-fg-58151c: var(--bs-danger-text-emphasis);
    --dm-fg-5c4a0e: var(--bs-warning-text-emphasis);
    --dm-fg-663c00: var(--bs-warning-text-emphasis);
    --dm-fg-664d03: var(--bs-warning-text-emphasis);
    --dm-fg-666666: var(--bs-secondary-color);
    --dm-fg-6c757d: var(--bs-secondary-color);
    --dm-fg-777777: var(--bs-secondary-color);
    --dm-fg-842029: var(--bs-danger-text-emphasis);
    --dm-fg-999999: var(--bs-tertiary-color);
    --dm-fg-adb5bd: var(--bs-tertiary-color);
}

/* "Papier" und andere bewusst helle Bereiche innerhalb der dunklen Seite */
[data-bs-theme="dark"] [data-bs-theme="light"] {
    color: #1a1a1a;
    --app-accent-text: initial;
    --apple-ink: #1d1d1f; --apple-ink-2: #494949; --apple-gray: #6e6e73;
    --apple-blue: #0071e3; --apple-blue-deep: #0060c9; --apple-green: #248a3d; --apple-red: #e0301e; --apple-red-deep: #c62b1a; --apple-orange: #c93400; --apple-teal: #0071a4;
    --apple-separator: #e8e8ed; --apple-surface: #fff; --apple-bg: #eceef2;
    --dm-surface: #fff; --dm-surface-2: #fff; --dm-surface-3: #f1f3f5;
    --dm-border: #ced4da; --dm-border-soft: #e8e8ed;
    --dm-tx-primary: #0d6efd; --dm-tx-success: #198754; --dm-tx-danger: #dc3545; --dm-tx-info: #0dcaf0; --dm-tx-warning: #c93400;
    --dm-faint: #adb5bd;
    --dm-text: #1a1a1a; --dm-text-2: #494949; --dm-muted: #6c757d; --dm-hover: rgba(0, 0, 0, .05);
    --dm-bd-7aa7de: initial;
    --dm-bd-9ec5fe: initial;
    --dm-bd-9eeaf9: initial;
    --dm-bd-a3cfbb: initial;
    --dm-bd-cccccc: initial;
    --dm-bd-ced4da: initial;
    --dm-bd-dee2e6: initial;
    --dm-bd-e9ecef: initial;
    --dm-bd-eef0f2: initial;
    --dm-bd-f0f0f0: initial;
    --dm-bd-f1f3f5: initial;
    --dm-bd-f5c2c7: initial;
    --dm-bd-ffe69c: initial;
    --dm-bg-cfe2ff: initial;
    --dm-bg-cff4fc: initial;
    --dm-bg-d1e7dd: initial;
    --dm-bg-d3e3d8: initial;
    --dm-bg-dbe7f6: initial;
    --dm-bg-dee2e6: initial;
    --dm-bg-e6f4ea: initial;
    --dm-bg-e7f1ff: initial;
    --dm-bg-e8f0ec: initial;
    --dm-bg-e9ecef: initial;
    --dm-bg-eaf6ef: initial;
    --dm-bg-eceef0: initial;
    --dm-bg-eef1f4: initial;
    --dm-bg-f0f0f0: initial;
    --dm-bg-f0f5f1: initial;
    --dm-bg-f1f3f5: initial;
    --dm-bg-f4f5f7: initial;
    --dm-bg-f4f6f8: initial;
    --dm-bg-f6f7f8: initial;
    --dm-bg-f8d7da: initial;
    --dm-bg-f8f9fa: initial;
    --dm-bg-fafafa: initial;
    --dm-bg-fafbfc: initial;
    --dm-bg-fcfcfd: initial;
    --dm-bg-fde2e4: initial;
    --dm-bg-ffe69c: initial;
    --dm-bg-fff1f0: initial;
    --dm-bg-fff1e6: initial;
    --dm-bg-fff3cd: initial;
    --dm-bg-fff8dc: initial;
    --dm-bg-fff8e1: initial;
    --dm-bg-fffef3: initial;
    --dm-bg-fffef8: initial;
    --dm-bg-ffffff: initial;
    --dm-fg-052c65: initial;
    --dm-fg-055160: initial;
    --dm-fg-084298: initial;
    --dm-fg-0a3622: initial;
    --dm-fg-0b3d91: initial;
    --dm-fg-0b5ed7: initial;
    --dm-fg-0d6efd: initial;
    --dm-fg-198754: initial;
    --dm-fg-1a4d2e: initial;
    --dm-fg-1c1c1c: initial;
    --dm-fg-212529: initial;
    --dm-fg-333333: initial;
    --dm-fg-343a40: initial;
    --dm-fg-495057: initial;
    --dm-fg-555555: initial;
    --dm-fg-58151c: initial;
    --dm-fg-5c4a0e: initial;
    --dm-fg-663c00: initial;
    --dm-fg-664d03: initial;
    --dm-fg-666666: initial;
    --dm-fg-6c757d: initial;
    --dm-fg-777777: initial;
    --dm-fg-842029: initial;
    --dm-fg-999999: initial;
    --dm-fg-adb5bd: initial;
}

/* ---------- Seite ---------- */
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] body.bg-light { background: var(--dm-bg) !important; color: var(--dm-text); }
[data-bs-theme="dark"] .bg-body { background-color: var(--dm-bg) !important; }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb { background-color: rgba(255, 255, 255, .22); }
[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .36); }
[data-bs-theme="dark"] ::selection { background: rgba(10, 132, 255, .40); }

/* ---------- Navbar + Menues ---------- */
[data-bs-theme="dark"] .navbar.bg-dark {
    background-color: color-mix(in srgb, var(--dm-surface) 92%, transparent) !important;
    border-bottom: 1px solid var(--apple-hairline);
}
[data-bs-theme="dark"] .navbar.navbar-dark {
    --bs-navbar-color:                rgba(255, 255, 255, .72);
    --bs-navbar-hover-color:          rgba(255, 255, 255, .95);
    --bs-navbar-active-color:         #fff;
    --bs-navbar-brand-color:          #fff;
    --bs-navbar-brand-hover-color:    #fff;
    --bs-navbar-disabled-color:       rgba(255, 255, 255, .35);
    --bs-navbar-toggler-border-color: rgba(255, 255, 255, .18);
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
[data-bs-theme="dark"] .navbar .nav-link:hover { background: var(--dm-hover); }
[data-bs-theme="dark"] .navbar.bg-dark .nav-link.active { background: rgba(255, 255, 255, .13); }
[data-bs-theme="dark"] .navbar .navbar-text { color: rgba(255, 255, 255, .65); }
[data-bs-theme="dark"] .navbar .badge.bg-secondary,
[data-bs-theme="dark"] .navbar .badge.bg-light {
    background: rgba(255, 255, 255, .13) !important;
    color: var(--dm-text-2) !important;
}
[data-bs-theme="dark"] .navbar .btn-outline-light {
    --bs-btn-color: var(--dm-text-2);
    --bs-btn-border-color: rgba(255, 255, 255, .22);
    --bs-btn-hover-bg: rgba(255, 255, 255, .10);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: rgba(255, 255, 255, .32);
    --bs-btn-active-bg: rgba(255, 255, 255, .15);
    --bs-btn-active-color: #fff;
}
[data-bs-theme="dark"] .dropdown-menu {
    --bs-dropdown-bg: var(--dm-surface-2);
    --bs-dropdown-border-color: rgba(255, 255, 255, .10);
    --bs-dropdown-link-hover-bg: rgba(255, 255, 255, .08);
    --bs-dropdown-link-hover-color: #fff;
    --bs-dropdown-header-color: var(--dm-muted);
    background: var(--dm-surface-2);
}
[data-bs-theme="dark"] .admin-menu .dropdown-header { color: var(--app-accent-text) !important; }

/* ---------- Hilfsklassen, die "hell" fest verdrahten ---------- */
[data-bs-theme="dark"] .bg-white { background-color: var(--dm-surface) !important; }
[data-bs-theme="dark"] .bg-light { background-color: var(--dm-surface-2) !important; }
[data-bs-theme="dark"] .text-dark:not(.bg-warning):not(.bg-info):not(.btn-warning):not(.btn-info),
[data-bs-theme="dark"] .text-black,
[data-bs-theme="dark"] .link-dark { color: var(--dm-text) !important; }
[data-bs-theme="dark"] .bg-warning .text-dark,
[data-bs-theme="dark"] .bg-info .text-dark { color: #1a1a1a !important; }
[data-bs-theme="dark"] .text-black-50 { color: rgba(255, 255, 255, .55) !important; }
[data-bs-theme="dark"] .text-muted { color: var(--dm-muted) !important; }
[data-bs-theme="dark"] .text-bg-light { background-color: var(--dm-surface-3) !important; color: var(--dm-text) !important; }
[data-bs-theme="dark"] .border-light { border-color: var(--dm-border) !important; }
[data-bs-theme="dark"] .text-primary { color: var(--dm-tx-primary) !important; }
[data-bs-theme="dark"] .text-success { color: var(--dm-tx-success) !important; }
[data-bs-theme="dark"] .text-danger  { color: var(--dm-tx-danger) !important; }
[data-bs-theme="dark"] .text-info    { color: var(--dm-tx-info) !important; }
[data-bs-theme="dark"] .text-secondary { color: var(--dm-muted) !important; }
[data-bs-theme="dark"] .text-body-secondary { color: var(--dm-muted) !important; }
[data-bs-theme="dark"] .link-primary { color: var(--dm-tx-primary) !important; }
[data-bs-theme="dark"] .link-secondary { color: var(--dm-muted) !important; }
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6 { color: inherit; }

/* ---------- Formulare ---------- */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--dm-surface-2);
    border-color: var(--dm-border);
    color: var(--dm-text);
}
[data-bs-theme="dark"] .form-control:hover:not(:focus),
[data-bs-theme="dark"] .form-select:hover:not(:focus) { border-color: hsl(225 8% calc(var(--dm-l) + 30%)); }
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus { background-color: var(--dm-surface-2); color: var(--dm-text); border-color: var(--apple-blue); }
[data-bs-theme="dark"] .form-control:disabled,
[data-bs-theme="dark"] .form-control[readonly],
[data-bs-theme="dark"] .form-select:disabled { background-color: var(--dm-bg); color: var(--dm-muted); }
[data-bs-theme="dark"] .form-control::placeholder { color: var(--dm-faint); }
[data-bs-theme="dark"] .form-label { color: var(--dm-text-2); }
[data-bs-theme="dark"] .input-group-text { background: var(--dm-surface-3); border-color: var(--dm-border); color: var(--dm-muted); }
[data-bs-theme="dark"] .form-check-input:not(:checked) { background-color: var(--dm-surface-2); border-color: hsl(225 8% calc(var(--dm-l) + 34%)); }
[data-bs-theme="dark"] .form-range::-webkit-slider-runnable-track { background-color: var(--dm-surface-3); }
[data-bs-theme="dark"] .form-range::-moz-range-track { background-color: var(--dm-surface-3); }

/* ---------- Tabellen ---------- */
[data-bs-theme="dark"] .table {
    --bs-table-color: var(--dm-text);
    --bs-table-border-color: var(--dm-border-soft);
    --bs-table-striped-bg: rgba(255, 255, 255, .03);
    --bs-table-striped-color: var(--dm-text);
    --bs-table-hover-bg: rgba(10, 132, 255, .10);
    --bs-table-hover-color: var(--dm-text);
    --bs-table-active-bg: rgba(255, 255, 255, .07);
    --bs-table-active-color: var(--dm-text);
}
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] thead.table-light tr,
[data-bs-theme="dark"] .table > thead.table-light th {
    --bs-table-color: var(--dm-muted);
    --bs-table-bg: var(--dm-surface-2);
    --bs-table-border-color: var(--dm-border-soft);
    color: var(--dm-muted) !important;
}
/* Farb-Zeilen (table-warning usw.): getoent statt Pastell mit schwarzer Schrift */
[data-bs-theme="dark"] .table-warning   { --bs-table-bg: rgba(255, 193, 7, .16);  --bs-table-color: var(--dm-text); --bs-table-border-color: rgba(255, 193, 7, .25);  --bs-table-hover-bg: rgba(255, 193, 7, .24);  --bs-table-hover-color: #fff; --bs-table-striped-bg: rgba(255, 193, 7, .20); --bs-table-striped-color: var(--dm-text); }
[data-bs-theme="dark"] .table-danger    { --bs-table-bg: rgba(255, 69, 58, .17);  --bs-table-color: var(--dm-text); --bs-table-border-color: rgba(255, 69, 58, .28);  --bs-table-hover-bg: rgba(255, 69, 58, .25);  --bs-table-hover-color: #fff; --bs-table-striped-bg: rgba(255, 69, 58, .21); --bs-table-striped-color: var(--dm-text); }
[data-bs-theme="dark"] .table-success   { --bs-table-bg: rgba(48, 209, 88, .14);  --bs-table-color: var(--dm-text); --bs-table-border-color: rgba(48, 209, 88, .25);  --bs-table-hover-bg: rgba(48, 209, 88, .22);  --bs-table-hover-color: #fff; --bs-table-striped-bg: rgba(48, 209, 88, .18); --bs-table-striped-color: var(--dm-text); }
[data-bs-theme="dark"] .table-info      { --bs-table-bg: rgba(64, 200, 224, .14); --bs-table-color: var(--dm-text); --bs-table-border-color: rgba(64, 200, 224, .25); --bs-table-hover-bg: rgba(64, 200, 224, .22); --bs-table-hover-color: #fff; --bs-table-striped-bg: rgba(64, 200, 224, .18); --bs-table-striped-color: var(--dm-text); }
[data-bs-theme="dark"] .table-primary   { --bs-table-bg: rgba(10, 132, 255, .16); --bs-table-color: var(--dm-text); --bs-table-border-color: rgba(10, 132, 255, .28); --bs-table-hover-bg: rgba(10, 132, 255, .24); --bs-table-hover-color: #fff; --bs-table-striped-bg: rgba(10, 132, 255, .20); --bs-table-striped-color: var(--dm-text); }
[data-bs-theme="dark"] .table-secondary,
[data-bs-theme="dark"] .table-active    { --bs-table-bg: var(--dm-surface-3); --bs-table-color: var(--dm-text); --bs-table-border-color: var(--dm-border); --bs-table-hover-bg: var(--dm-border-soft); --bs-table-hover-color: #fff; --bs-table-striped-bg: var(--dm-surface-3); --bs-table-striped-color: var(--dm-text); }
/* Auftrags-Markierfarben (OrderHighlight::tableRowStyle setzt --bs-table-bg inline):
   die eingestellte Pastellfarbe bleibt als Toenung der dunklen Zeile erkennbar */
[data-bs-theme="dark"] tr[style*="--bs-table-bg"] > * {
    background-color: color-mix(in srgb, var(--bs-table-bg) 24%, var(--dm-surface));
    color: var(--dm-text);
}

/* ---------- Buttons ---------- */
/* Flaechen mit weisser Schrift: feste, satte Farbe (die Schrift-Varianten oben waeren zu hell) */
[data-bs-theme="dark"] .btn-primary {
    --bs-btn-bg: var(--dm-fill-primary); --bs-btn-border-color: var(--dm-fill-primary);
    --bs-btn-hover-bg: #2b8ff5; --bs-btn-hover-border-color: #2b8ff5;
    --bs-btn-active-bg: #0a6ad0; --bs-btn-active-border-color: #0a6ad0;
    --bs-btn-disabled-bg: #35567d; --bs-btn-disabled-border-color: #35567d;
}
[data-bs-theme="dark"] .btn-outline-primary   { --bs-btn-disabled-color: color-mix(in srgb, var(--dm-tx-primary) 55%, transparent); --bs-btn-color: var(--dm-tx-primary); --bs-btn-border-color: color-mix(in srgb, var(--dm-tx-primary) 55%, transparent); --bs-btn-active-bg: var(--dm-fill-primary); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(10, 132, 255, .35); }
[data-bs-theme="dark"] .btn-outline-success   { --bs-btn-disabled-color: color-mix(in srgb, var(--dm-tx-success) 55%, transparent); --bs-btn-color: var(--dm-tx-success); --bs-btn-border-color: color-mix(in srgb, var(--dm-tx-success) 55%, transparent); --bs-btn-active-bg: #248a3d; --bs-btn-hover-bg: rgba(48, 209, 88, .30); }
[data-bs-theme="dark"] .btn-outline-danger    { --bs-btn-disabled-color: color-mix(in srgb, var(--dm-tx-danger) 55%, transparent); --bs-btn-color: var(--dm-tx-danger);  --bs-btn-border-color: color-mix(in srgb, var(--dm-tx-danger) 55%, transparent);  --bs-btn-active-bg: #d93a2b; --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255, 69, 58, .35); }
[data-bs-theme="dark"] .btn-outline-warning   { --bs-btn-disabled-color: color-mix(in srgb, var(--dm-tx-warning) 55%, transparent); --bs-btn-color: var(--dm-tx-warning); --bs-btn-border-color: color-mix(in srgb, var(--dm-tx-warning) 55%, transparent); --bs-btn-hover-bg: rgba(255, 159, 10, .30); }
[data-bs-theme="dark"] .btn-outline-info      { --bs-btn-disabled-color: color-mix(in srgb, var(--dm-tx-info) 55%, transparent); --bs-btn-color: var(--dm-tx-info);    --bs-btn-border-color: color-mix(in srgb, var(--dm-tx-info) 55%, transparent);    --bs-btn-hover-bg: rgba(64, 200, 224, .30); }
[data-bs-theme="dark"] .btn-link { --bs-btn-color: var(--dm-tx-primary); --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-check:checked + .btn-outline-primary { background: var(--dm-fill-primary); color: #fff; }
[data-bs-theme="dark"] .btn-check:checked + .btn-outline-success { background: #248a3d; color: #fff; }
[data-bs-theme="dark"] .btn-check:checked + .btn-outline-danger  { background: #d93a2b; color: #fff; }
[data-bs-theme="dark"] .form-check-input:checked { background-color: var(--dm-fill-primary); border-color: var(--dm-fill-primary); }
[data-bs-theme="dark"] .form-switch .form-check-input:checked { background-color: #2fb350; border-color: #2fb350; }
[data-bs-theme="dark"] .pagination { --bs-pagination-active-bg: var(--dm-fill-primary); --bs-pagination-active-border-color: var(--dm-fill-primary); --bs-pagination-color: var(--dm-text-2); }
[data-bs-theme="dark"] .nav-pills { --bs-nav-pills-link-active-bg: var(--dm-fill-primary); }
[data-bs-theme="dark"] .dropdown-menu { --bs-dropdown-link-active-bg: var(--dm-fill-primary); }
[data-bs-theme="dark"] .list-group { --bs-list-group-active-bg: var(--dm-fill-primary); --bs-list-group-active-border-color: var(--dm-fill-primary); }
[data-bs-theme="dark"] .bg-primary { background-color: var(--dm-fill-primary) !important; }
[data-bs-theme="dark"] .btn-success { --bs-btn-bg: #248a3d; --bs-btn-border-color: #248a3d; }
[data-bs-theme="dark"] .btn-danger  { --bs-btn-bg: #d93a2b; --bs-btn-border-color: #d93a2b; --bs-btn-hover-bg: #c62b1a; --bs-btn-hover-border-color: #c62b1a; }
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: var(--dm-text-2);
    --bs-btn-border-color: var(--dm-border);
    --bs-btn-hover-bg: rgba(255, 255, 255, .12);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: var(--dm-border);
    --bs-btn-active-bg: rgba(255, 255, 255, .18);
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: var(--dm-faint);
    --bs-btn-disabled-border-color: var(--dm-border-soft);
}
[data-bs-theme="dark"] .btn-outline-dark {
    --bs-btn-color: var(--dm-text);
    --bs-btn-bg: rgba(255, 255, 255, .06);
    --bs-btn-border-color: var(--dm-border);
    --bs-btn-hover-bg: rgba(255, 255, 255, .13);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-border-color: var(--dm-border);
    --bs-btn-active-bg: rgba(255, 255, 255, .18);
    --bs-btn-active-color: #fff;
}
[data-bs-theme="dark"] .btn-light {
    --bs-btn-color: var(--dm-text);
    --bs-btn-bg: var(--dm-surface-3);
    --bs-btn-border-color: var(--dm-border);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--dm-border);
    --bs-btn-hover-border-color: var(--dm-border);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--dm-border);
    --bs-btn-active-border-color: var(--dm-border);
}
[data-bs-theme="dark"] .btn-group > .btn + .btn { border-left-color: rgba(255, 255, 255, .10); }
[data-bs-theme="dark"] .show-img-wrap .show-img-star .btn-outline-secondary,
[data-bs-theme="dark"] .article-file-card .article-file-star .btn-outline-secondary {
    --bs-btn-bg: var(--dm-surface-3);
    --bs-btn-hover-bg: var(--dm-border);
}

/* ---------- Karten, Fenster, Hinweise ---------- */
[data-bs-theme="dark"] .card { --bs-card-border-color: rgba(255, 255, 255, .07); }
[data-bs-theme="dark"] .card.border-0 { border-color: rgba(255, 255, 255, .07) !important; }
[data-bs-theme="dark"] .modal-content { background-color: var(--dm-surface); }
[data-bs-theme="dark"] .modal-backdrop { --bs-backdrop-bg: #000; --bs-backdrop-opacity: .55; }
[data-bs-theme="dark"] .toast { background: color-mix(in srgb, var(--dm-surface-3) 92%, transparent); color: var(--dm-text); }
[data-bs-theme="dark"] .alert-success   { background: rgba(48, 209, 88, .15);  color: #8be3a3; border-color: rgba(48, 209, 88, .30); }
[data-bs-theme="dark"] .alert-danger    { background: rgba(255, 69, 58, .16);  color: #ffaaa4; border-color: rgba(255, 69, 58, .32); }
[data-bs-theme="dark"] .alert-warning   { background: rgba(255, 159, 10, .16); color: #ffd083; border-color: rgba(255, 159, 10, .32); }
[data-bs-theme="dark"] .alert-info      { background: rgba(10, 132, 255, .15); color: #9ccbff; border-color: rgba(10, 132, 255, .32); }
[data-bs-theme="dark"] .alert-secondary,
[data-bs-theme="dark"] .alert-light     { background: var(--dm-surface-2); color: var(--dm-text-2); border-color: var(--dm-border-soft); }
[data-bs-theme="dark"] .alert .alert-link { color: inherit; }
[data-bs-theme="dark"] .nav-tabs { --bs-nav-tabs-link-active-bg: var(--dm-surface-3); --bs-nav-tabs-link-active-color: #fff; --bs-nav-tabs-border-color: var(--dm-border); }
[data-bs-theme="dark"] .nav-tabs .nav-link.active { box-shadow: 0 1px 4px rgba(0, 0, 0, .45); }
[data-bs-theme="dark"] .list-group { --bs-list-group-bg: var(--dm-surface); --bs-list-group-color: var(--dm-text); --bs-list-group-action-hover-bg: var(--dm-surface-2); --bs-list-group-action-hover-color: #fff; }
[data-bs-theme="dark"] .article-search-dropdown,
[data-bs-theme="dark"] .customer-search-dropdown { --bs-list-group-bg: var(--dm-surface-2); }
[data-bs-theme="dark"] body .quick-edit .option-grid label { border-color: var(--dm-border); }
[data-bs-theme="dark"] .form-actions-sticky.is-dirty > .card { color: var(--dm-text); }

/* ---------- Auftraege ---------- */
[data-bs-theme="dark"] .order-list-item {
    background: var(--dm-surface);
    color: var(--dm-text);
    border-color: rgba(255, 255, 255, .07);
}
[data-bs-theme="dark"] .order-list-item:hover { color: var(--dm-text); }
[data-bs-theme="dark"] .order-list-item .description-preview { color: var(--dm-text); border-color: var(--dm-border-soft); }
[data-bs-theme="dark"] body.font-size-xlarge .order-list-item .description-preview { color: var(--dm-text) !important; }
/* Markierfarbe (inline background-color) als Toenung: dunkler Schleier ueber der Pastellfarbe */
[data-bs-theme="dark"] .order-list-item[style*="background-color"] {
    background-image: linear-gradient(color-mix(in srgb, var(--dm-surface) 78%, transparent), color-mix(in srgb, var(--dm-surface) 78%, transparent));
}
/* Helle Prioritaetsfarbe (z.B. "Niedrig" #e3e3e3, Farbe aus den Stammdaten, inline):
   Termin-Block + Prioritaets-Badge der Kartenansicht folgen dem Regler (_list_card.php) */
[data-bs-theme="dark"] .order-list-item.prio-light .appointment-block,
[data-bs-theme="dark"] .order-list-item .badge.prio-light {
    background: var(--dm-surface-3) !important;
    color: var(--dm-text) !important;
}
[data-bs-theme="dark"] .dashboard-group-header { border-color: rgba(255, 255, 255, .08); }

/* ---------- Dashboard-Kacheln ---------- */
[data-bs-theme="dark"] .start-tile-head { color: var(--dm-tx-primary); background: rgba(10, 132, 255, .16); border-bottom-color: rgba(10, 132, 255, .26); }
[data-bs-theme="dark"] .start-tile-open { background: transparent; border-color: currentColor; }
[data-bs-theme="dark"] .start-tile-compact > .bi:first-child,
[data-bs-theme="dark"] .start-tile-link i { color: var(--dm-tx-primary); }
[data-bs-theme="dark"] .start-row { border-top-color: rgba(255, 255, 255, .08); }
[data-bs-theme="dark"] .start-tile-tools .btn { background: var(--dm-surface-3); }
[data-bs-theme="dark"] .start-color-menu { background: var(--dm-surface-2); border-color: var(--dm-border); }
[data-bs-theme="dark"] .start-color-swatch { border-color: var(--dm-surface-2); box-shadow: 0 0 0 1px rgba(255, 255, 255, .30); }
[data-bs-theme="dark"] .start-color-swatch.is-active { box-shadow: 0 0 0 2px #fff; }
[data-bs-theme="dark"] .start-tile[data-color] .start-tile-body { background: rgba(var(--tile-rgb), .13); }
/* Balken im Firmengruen (inline #1a4d2e) gehen auf dunklem Grund unter */
[data-bs-theme="dark"] .progress-bar[style*="#1a4d2e"] { background: #4caf78 !important; }
[data-bs-theme="dark"] .progress { --bs-progress-bg: var(--dm-surface-3); }
[data-bs-theme="dark"] .statistik-view-tile.active { background: rgba(127, 199, 154, .10); }

/* ---------- Terminplanung ---------- */
[data-bs-theme="dark"] .tp-lane { background-image:
        linear-gradient(to right, rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(to right, rgba(255, 255, 255, .13) 1px, transparent 1px); }
[data-bs-theme="dark"] .tp-closed { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .05) 0 6px, transparent 6px 14px); }
[data-bs-theme="dark"] .tp-mday-closed { background: repeating-linear-gradient(135deg, rgba(255, 255, 255, .04) 0 6px, transparent 6px 14px); }
[data-bs-theme="dark"] .tp-closed span { background: color-mix(in srgb, var(--dm-surface) 85%, transparent); }
[data-bs-theme="dark"] .tp-block { color: var(--dm-text); background: color-mix(in srgb, var(--tp-color, #0d6efd) 26%, var(--dm-surface)); }
[data-bs-theme="dark"] .tp-block.tp-status-no_show { background: color-mix(in srgb, #fd7e14 22%, var(--dm-surface)); }
[data-bs-theme="dark"] .tp-block.tp-status-done { background: color-mix(in srgb, #198754 22%, var(--dm-surface)); }
[data-bs-theme="dark"] .tp-block.tp-status-cancelled { background: var(--dm-surface-2); }
[data-bs-theme="dark"] .tp-block.tp-more { background: var(--dm-surface-2); border-color: var(--dm-border); }   /* Sammelblock „+N weitere" */
[data-bs-theme="dark"] .tp-label, [data-bs-theme="dark"] .tp-lane { border-bottom-color: var(--dm-border); }
/* Zeitachse: Halbstunden-Beschriftung war mit --dm-faint kaum lesbar → --dm-muted,
   volle Stunden heller (Rangfolge bleibt), Skalenstrich in Rahmenfarbe */
[data-bs-theme="dark"] .tp-axis-label { color: var(--dm-muted); }
[data-bs-theme="dark"] .tp-axis-label.tp-axis-hour { color: var(--dm-text); }
[data-bs-theme="dark"] .tp-axis-label::after { background: var(--dm-border); }

/* ---------- Hoher Kontrast im Dunkelmodus ----------
   (die hellen Kontrast-Regeln in app.css/apple-theme.css gelten nur ausserhalb
   des Dunkelmodus - Selektor html:not([data-bs-theme="dark"]) dort) */
[data-bs-theme="dark"]:has(body.high-contrast) {
    --dm-text: #fff;
    --dm-text-2: #f0f0f3;
    --dm-muted: #cfd2d8;
    --dm-faint: #a9adb6;
    --dm-border: hsl(225 8% calc(var(--dm-l) + 38%));
    --dm-border-soft: hsl(225 8% calc(var(--dm-l) + 26%));
}
[data-bs-theme="dark"] body.high-contrast .card,
[data-bs-theme="dark"] body.high-contrast .modal-content,
[data-bs-theme="dark"] body.high-contrast .order-list-item,
[data-bs-theme="dark"] body.high-contrast .dropdown-menu { border: 1px solid var(--dm-border) !important; box-shadow: none !important; }
[data-bs-theme="dark"] body.high-contrast .form-control,
[data-bs-theme="dark"] body.high-contrast .form-select { border-width: 1.5px; }
[data-bs-theme="dark"] body.high-contrast .form-label { font-weight: 600; color: #fff; }
[data-bs-theme="dark"] body.high-contrast .badge { border: 1px solid rgba(255, 255, 255, .30); }
[data-bs-theme="dark"] body.high-contrast a:hover { text-decoration: underline; }

/* ---------- Regler im Anzeige-Menue / Profil ---------- */
.theme-level-row { padding: .25rem .8rem .45rem; min-width: 15rem; }
.theme-level-row .form-range { display: block; }
.theme-level-row .theme-level-ends { display: flex; justify-content: space-between; font-size: .75rem; color: var(--bs-secondary-color); }
[data-theme-mode] .theme-check { visibility: hidden; }
[data-theme-mode].is-current .theme-check { visibility: visible; }

/* ---------- Durchsicht aller Seiten 2026-09 (tests/harness: Kontrast-Pruefer im Browser) ---------- */
[data-bs-theme="dark"] code { color: color-mix(in srgb, #ff7ab8, #fff var(--dm-lift)); }
[data-bs-theme="dark"] .badge.bg-info,
[data-bs-theme="dark"] .badge.bg-warning,
[data-bs-theme="dark"] .badge.text-bg-info,
[data-bs-theme="dark"] .badge.text-bg-warning { color: #10222a !important; }
/* Inline-Farben, die PHP zusammensetzt (der Umsteller fasst Bloecke mit <?php nicht an) */
[data-bs-theme="dark"] [style*="color:#6c757d"]:not([style*="background"]),
[data-bs-theme="dark"] [style*="color: #6c757d"]:not([style*="background"]),
[data-bs-theme="dark"] [style*="color:#495057"]:not([style*="background"]),
[data-bs-theme="dark"] [style*="color:#666"]:not([style*="background"]) { color: var(--dm-muted) !important; }
[data-bs-theme="dark"] [style*="color:#212529"]:not([style*="background"]),
[data-bs-theme="dark"] [style*="color:#333"]:not([style*="background"]) { color: var(--dm-text) !important; }
[data-bs-theme="dark"] [style*="color:#1a4d2e"]:not([style*="background"]) { color: var(--app-accent-text) !important; }
[data-bs-theme="dark"] [style*="color:#0d6efd"]:not([style*="background"]) { color: var(--dm-tx-primary) !important; }
[data-bs-theme="dark"] [style*="color:#dc3545"]:not([style*="background"]) { color: var(--dm-tx-danger) !important; }
[data-bs-theme="dark"] tr[style*="background:#fff1f0"] { background: var(--bs-danger-bg-subtle) !important; }
[data-bs-theme="dark"] tr[style*="background:#fff8e1"] { background: var(--bs-warning-bg-subtle) !important; }
/* PDF-Erkennung (Import): Lineal ist Bedienflaeche, kein Papier */
[data-bs-theme="dark"] .pdf-ruler { background: var(--dm-surface-3); border-bottom-color: var(--dm-border); }
/* Monteur-Board */
[data-bs-theme="dark"] .board-card-desc { color: var(--dm-text-2); }
[data-bs-theme="dark"] .board-col[style*="#fdf3e3"] { background: color-mix(in srgb, #fd7e14 16%, var(--dm-surface)) !important; }
/* Notdienst-Kalender + Geleistete Dienste */
[data-bs-theme="dark"] .oncall-calendar td.outside { background: var(--dm-bg); color: var(--dm-faint); }
[data-bs-theme="dark"] .oncall-calendar td.kw-cell { background: var(--dm-surface-2); }
[data-bs-theme="dark"] .oncall-calendar td.kw-cell:hover { background: var(--dm-surface-3); }
[data-bs-theme="dark"] .oncall-calendar td.kw-cell .kw-num,
[data-bs-theme="dark"] .oncall-calendar .day-number.today-num { color: var(--dm-tx-primary); }
[data-bs-theme="dark"] .oncall-calendar .day-number { text-shadow: 0 0 2px rgba(0, 0, 0, .7); }
[data-bs-theme="dark"] .oncall-cell-line { background: color-mix(in srgb, var(--dm-surface) 85%, transparent); }
[data-bs-theme="dark"] .perf-day .day-head { border-bottom-color: var(--dm-border); }
[data-bs-theme="dark"] .perf-day.weekend .day-head { background: var(--dm-border-soft); }
[data-bs-theme="dark"] .perf-day.outside .day-head { background: var(--dm-bg); color: var(--dm-faint); }
[data-bs-theme="dark"] .perf-day.today .day-head { background: var(--dm-fill-primary); color: #fff; }
[data-bs-theme="dark"] .perf-hours .hour-seg { background: var(--dm-surface-3); }
/* Urlaubsuebersicht (Admin) */
[data-bs-theme="dark"] .vac-today-bg { background-color: var(--dm-surface-3) !important; }
[data-bs-theme="dark"] .vac-today-head { color: var(--dm-tx-primary); }
/* Rechte-Matrix */
[data-bs-theme="dark"] .perm-matrix .effective-yes { color: var(--dm-tx-success); }
[data-bs-theme="dark"] .perm-matrix .effective-no  { color: var(--dm-tx-danger); }
[data-bs-theme="dark"] .perm-matrix th.role-shared { background: color-mix(in srgb, #a855f7 24%, var(--dm-surface)); }
/* Karte: Bedienfelder ueber der Karte */
[data-bs-theme="dark"] .count-badge { color: var(--dm-tx-primary); }
/* Lagerfaecher (Artikelkarte, Artikelmaske, Lager) */
[data-bs-theme="dark"] .rack-comp:hover { border-color: var(--dm-muted); }
[data-bs-theme="dark"] .rack-comp-article { color: var(--dm-tx-primary); }
[data-bs-theme="dark"] .rack-comp-article-current,
[data-bs-theme="dark"] .rack-comp-article-current:hover { color: #212529; }
[data-bs-theme="dark"] .rack-comp-active .rack-comp-code { color: var(--bs-warning-text-emphasis); }
[data-bs-theme="dark"] .picker-comp.occupied { background: color-mix(in srgb, #fd7e14 28%, var(--dm-surface)); }
[data-bs-theme="dark"] .picker-comp.occupied:hover { background: color-mix(in srgb, #fd7e14 42%, var(--dm-surface)); }
[data-bs-theme="dark"] .picker-comp.occupied .occupied-marker { color: var(--dm-tx-warning); }
[data-bs-theme="dark"] .picker-comp:hover { border-color: var(--app-accent-text); }
[data-bs-theme="dark"] .picker-comp.selected .comp-label { color: #fff; }
[data-bs-theme="dark"] .photo-shutter { color: var(--dm-tx-primary); }
/* ---------- Druckvorlagen-Designer (Bedienflaeche; die Vorschau rechts ist Papier und bleibt hell) ---------- */
[data-bs-theme="dark"] .bd-block { background: var(--dm-surface); border-color: var(--dm-border-soft); }
[data-bs-theme="dark"] .bd-block-head,
[data-bs-theme="dark"] .bd-preview-head { background: var(--dm-surface-2); border-bottom-color: var(--dm-border-soft); color: var(--dm-muted); }
[data-bs-theme="dark"] .bd-block-title,
[data-bs-theme="dark"] .bd-colpanel-title,
[data-bs-theme="dark"] .bd-var-pop .bd-var-grp,
[data-bs-theme="dark"] .bd-add-menu .bi { color: var(--app-accent-text); }
[data-bs-theme="dark"] .bd-colpanel { background: var(--dm-surface-2); border-color: var(--dm-border); }
[data-bs-theme="dark"] .bd-colcard { background: var(--dm-surface-2); border-color: var(--dm-border-soft); }
[data-bs-theme="dark"] .bd-subbox,
[data-bs-theme="dark"] .bd-empty { border-color: var(--dm-border); color: var(--dm-muted); }
[data-bs-theme="dark"] .bd-colpanel-empty,
[data-bs-theme="dark"] .bd-col-flabel,
[data-bs-theme="dark"] .bd-block-body .form-label { color: var(--dm-muted); }
[data-bs-theme="dark"] .bd-var-btn { background: var(--dm-surface-3); border-color: var(--dm-border); color: var(--app-accent-text); }
[data-bs-theme="dark"] .bd-var-btn:hover { background: var(--dm-border); }
[data-bs-theme="dark"] .bd-add-menu,
[data-bs-theme="dark"] .bd-var-pop { background: var(--dm-surface-2); border-color: var(--dm-border); }
[data-bs-theme="dark"] .bd-add-menu button,
[data-bs-theme="dark"] .bd-var-pop button { color: var(--dm-text); }
[data-bs-theme="dark"] .bd-add-menu button:hover,
[data-bs-theme="dark"] .bd-var-pop button.bd-var-opt:hover { background: var(--dm-surface-3); }
[data-bs-theme="dark"] .bd-var-pop button.bd-var-opt code { color: var(--dm-muted); }
[data-bs-theme="dark"] .bd-preview-card { background: var(--dm-surface); border-color: var(--dm-border-soft); }
/* ---------- Handy-Scan-Seiten (layout/scan): Karten erscheinen erst nach einem Scan ---------- */
[data-bs-theme="dark"] .pscan-last,
[data-bs-theme="dark"] .pscan-card { background: color-mix(in srgb, #30d158 13%, var(--dm-surface)); border-color: var(--app-accent-text); color: var(--dm-text); }
[data-bs-theme="dark"] .pscan-pick.active { background: color-mix(in srgb, #30d158 18%, var(--dm-surface)); border-color: var(--app-accent-text); box-shadow: inset 0 0 0 1px var(--app-accent-text); }
[data-bs-theme="dark"] .pscan-qty[readonly] { background: var(--dm-surface-2); color: var(--dm-text); }
[data-bs-theme="dark"] .pscan-pick { border-color: var(--dm-border); }
[data-bs-theme="dark"] .inv-scan-card { background: color-mix(in srgb, #30d158 13%, var(--dm-surface)); border-color: var(--app-accent-text) !important; }
[data-bs-theme="dark"] .scan-last[data-kind="ok"] .scan-last-icon   { color: var(--dm-tx-success); }
[data-bs-theme="dark"] .scan-last[data-kind="info"] .scan-last-icon { color: var(--dm-tx-primary); }
[data-bs-theme="dark"] .scan-last[data-kind="warn"] .scan-last-icon { color: var(--dm-tx-warning); }
[data-bs-theme="dark"] .scan-last[data-kind="err"] .scan-last-icon  { color: var(--dm-tx-danger); }
