:root {
    --ui-bg: #0a0a0a;
    --ui-bg-soft: #111318;
    --ui-surface: #181818;
    --ui-surface-2: #252525;
    --ui-surface-3: #101010;
    --ui-border: #343434;
    --ui-text: #ffffff;
    --ui-muted: #aaaaaa;
    --ui-accent: #ff0033;
    --ui-accent-dark: #cc0029;
    --ui-success: #45d16d;
    --ui-warning: #f2bd4f;
    --ui-danger: #ff5577;
    --ui-info: #60a5fa;
    --ui-shadow: 0 18px 45px rgba(0,0,0,.45);
    color-scheme: dark;
}

html[data-theme="light"] {
    --ui-bg: #f3f5f8;
    --ui-bg-soft: #e9edf3;
    --ui-surface: #ffffff;
    --ui-surface-2: #f8fafc;
    --ui-surface-3: #eef2f7;
    --ui-border: #d6dce5;
    --ui-text: #172033;
    --ui-muted: #657086;
    --ui-accent: #d0002b;
    --ui-accent-dark: #a80022;
    --ui-success: #18864b;
    --ui-warning: #a96800;
    --ui-danger: #c5284d;
    --ui-info: #2563c7;
    --ui-shadow: 0 16px 40px rgba(26,39,64,.14);
    color-scheme: light;
}

html[data-theme="light"],
html[data-theme="light"] body {
    background: var(--ui-bg) !important;
    color: var(--ui-text) !important;
}

html[data-theme="light"] body {
    background-image: radial-gradient(circle at 50% -20%, rgba(208,0,43,.08), transparent 38%) !important;
}

html[data-theme="light"] .container,
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] .dashboard-card,
html[data-theme="light"] .login-box,
html[data-theme="light"] .auth-card,
html[data-theme="light"] .settings-card,
html[data-theme="light"] .filter-box,
html[data-theme="light"] .filter-form,
html[data-theme="light"] .form-card,
html[data-theme="light"] .info-card,
html[data-theme="light"] .actions-card,
html[data-theme="light"] .notification-dropdown,
html[data-theme="light"] .dropdown-content {
    background: var(--ui-surface) !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-text) !important;
    box-shadow: var(--ui-shadow) !important;
}

html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] strong,
html[data-theme="light"] td,
html[data-theme="light"] label,
html[data-theme="light"] .dashboard-title,
html[data-theme="light"] .user-menu,
html[data-theme="light"] .notification-menu {
    color: var(--ui-text) !important;
}

html[data-theme="light"] p,
html[data-theme="light"] small,
html[data-theme="light"] .muted,
html[data-theme="light"] .dashboard-desc,
html[data-theme="light"] .field-help {
    color: var(--ui-muted) !important;
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea,
html[data-theme="light"] .readonly-field {
    background: #fff !important;
    color: var(--ui-text) !important;
    border-color: var(--ui-border) !important;
}

html[data-theme="light"] table,
html[data-theme="light"] table.responsive-table {
    background: #fff !important;
    border-color: var(--ui-border) !important;
    box-shadow: var(--ui-shadow) !important;
}

html[data-theme="light"] th {
    background: #eef2f7 !important;
    color: var(--ui-accent) !important;
    border-color: var(--ui-border) !important;
}

html[data-theme="light"] td {
    border-color: #e4e8ef !important;
}

html[data-theme="light"] tbody tr:hover {
    background: #f4f7fb !important;
}

html[data-theme="light"] .ui-modal-overlay {
    background: rgba(35,45,65,.45);
}

html[data-theme="light"] .ui-modal-dialog,
html[data-theme="light"] .ui-error-card {
    background: #fff !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-text) !important;
}

/* =====================================================
   V15 – Vollständiges helles Oberflächen-Theme

   Viele ältere Modul-Styles enthalten absichtlich weiterhin
   die bewährten dunklen Standardwerte. Diese light-only Regeln
   werden mit !important zentral darübergelegt, damit kein Modul
   im hellen Design dunkle, kaum lesbare Kästen zurücklässt.
===================================================== */

html[data-theme="light"] {
    /* Kompatibilität mit älteren Dashboard-/Finanz-Variablen */
    --macron-bg: var(--ui-bg);
    --macron-surface: #ffffff;
    --macron-surface-2: #f6f8fb;
    --macron-border: var(--ui-border);
    --macron-text: var(--ui-text);
    --macron-muted: var(--ui-muted);
    --macron-accent: var(--ui-accent);
    --macron-accent-dark: var(--ui-accent-dark);
    --macron-shadow: 0 14px 34px rgba(35, 49, 76, .12);

    --umsatz-bg: #ffffff;
    --umsatz-card: #ffffff;
    --umsatz-card-2: #f6f8fb;
    --umsatz-border: var(--ui-border);
    --umsatz-muted: var(--ui-muted);

    --bg: var(--ui-bg);
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --surface-start: #ffffff;
    --surface-end: #f6f8fb;
    --surface-hover: #edf1f6;
    --text: var(--ui-text);
    --muted: var(--ui-muted);
    --border: var(--ui-border);
}

/* Hauptflächen und Karten */
html[data-theme="light"] :is(
    .dashboard-card,
    .stat-card,
    .status-card,
    .section-box,
    .section-card,
    .expense-card,
    .metric,
    .toolbar,
    .filter-box-modern,
    .filter-form,
    .filter-box,
    .form-card,
    .info-card,
    .actions-card,
    .settings-card,
    .modal-panel,
    .note,
    .panel,
    .card
) {
    background: linear-gradient(145deg, #ffffff 0%, #f7f9fc 100%) !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-text) !important;
    box-shadow: 0 12px 30px rgba(35, 49, 76, .11) !important;
}

/* Kleine Unterflächen innerhalb von Karten */
html[data-theme="light"] :is(
    .kpi-inline > div,
    .meta > div,
    .logo-preview-frame,
    .readonly-field,
    .chat-sidebar,
    .chat-bubble,
    .live-toast-icon,
    .activity-item,
    .notice
) {
    background: #f1f4f8 !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-text) !important;
}

html[data-theme="light"] .dashboard-card:hover,
html[data-theme="light"] .stat-card:hover,
html[data-theme="light"] .expense-card summary:hover,
html[data-theme="light"] .activity-item:hover,
html[data-theme="light"] .chat-list-button:hover,
html[data-theme="light"] .chat-list-button.is-active {
    background: linear-gradient(145deg, #ffffff 0%, #eef2f7 100%) !important;
    border-color: color-mix(in srgb, var(--ui-accent) 55%, var(--ui-border)) !important;
}

/* Texte in Karten */
html[data-theme="light"] :is(
    .dashboard-title,
    .stat-value,
    .metric strong,
    .card-title,
    .status-card strong,
    .section-header h2,
    .section-header h3
) {
    color: var(--ui-text) !important;
}

html[data-theme="light"] :is(
    .dashboard-desc,
    .stat-title,
    .stat-note,
    .page-subtitle,
    .card-description,
    .card small,
    .status-card small,
    .meta,
    .field label
) {
    color: var(--ui-muted) !important;
}

/* Tabellen – einschließlich älterer Finanz- und Mobilansichten */
html[data-theme="light"] :is(table, table.responsive-table, table.dashboard-responsive) {
    background: #ffffff !important;
    border-color: var(--ui-border) !important;
    box-shadow: 0 10px 26px rgba(35, 49, 76, .10) !important;
}

html[data-theme="light"] :is(table, table.responsive-table, table.dashboard-responsive) th {
    background: #edf1f6 !important;
    color: var(--ui-accent) !important;
    border-color: var(--ui-border) !important;
}

html[data-theme="light"] :is(table, table.responsive-table, table.dashboard-responsive) td {
    background: #ffffff !important;
    color: var(--ui-text) !important;
    border-color: #e1e6ed !important;
}

html[data-theme="light"] :is(table, table.responsive-table, table.dashboard-responsive) tbody tr:hover td {
    background: #f5f7fa !important;
}

html[data-theme="light"] .child-row,
html[data-theme="light"] .child-row td {
    background: #f1f4f8 !important;
}

/* Eingabebereiche */
html[data-theme="light"] :is(input, select, textarea) {
    background: #ffffff !important;
    color: var(--ui-text) !important;
    border-color: #cfd6e1 !important;
    box-shadow: none;
}

html[data-theme="light"] :is(input, select, textarea):focus {
    border-color: var(--ui-accent) !important;
    box-shadow: 0 0 0 3px rgba(208, 0, 43, .11) !important;
}

/* Sekundäre Bedienelemente */
html[data-theme="light"] :is(
    .button-secondary,
    .btn-secondary,
    .btn-small,
    .tabs a,
    .pagination a,
    .pagination span,
    .badge-muted
) {
    background: #e9edf3 !important;
    border-color: #cfd6e1 !important;
    color: var(--ui-text) !important;
}

html[data-theme="light"] :is(
    .button-secondary,
    .btn-secondary,
    .btn-small,
    .tabs a,
    .pagination a
):hover {
    background: #dfe5ed !important;
}

/* Hinweise bleiben farblich unterscheidbar, aber hell und lesbar */
html[data-theme="light"] .info-box {
    background: #edf5ff !important;
    border-color: #a9c9ef !important;
    color: #174b82 !important;
}
html[data-theme="light"] .success-box,
html[data-theme="light"] .success,
html[data-theme="light"] .erfolgreich {
    background: #edf9f1 !important;
    border-color: #9ed8b1 !important;
    color: #176238 !important;
}
html[data-theme="light"] .warning-box,
html[data-theme="light"] .warning,
html[data-theme="light"] .notice {
    background: #fff8e7 !important;
    border-color: #e7c877 !important;
    color: #785000 !important;
}
html[data-theme="light"] .error-box,
html[data-theme="light"] .error,
html[data-theme="light"] .fehler {
    background: #fff0f3 !important;
    border-color: #e6a4b4 !important;
    color: #8f1f3a !important;
}

/* Dropdowns, Chat und Dialoge */
html[data-theme="light"] :is(
    .notification-dropdown,
    .dropdown-content,
    .activity-panel,
    .chat-window,
    .ui-modal-dialog,
    .ui-error-card
) {
    background: #ffffff !important;
    border-color: var(--ui-border) !important;
    color: var(--ui-text) !important;
    box-shadow: 0 18px 45px rgba(35, 49, 76, .18) !important;
}

html[data-theme="light"] .chat-list-button {
    color: var(--ui-text) !important;
}

/* Mobile Tabellenkarten waren in älteren Styles fest dunkel */
@media (max-width: 768px) {
    html[data-theme="light"] :is(table.responsive-table, table.dashboard-responsive) tr {
        background: #ffffff !important;
        border-color: var(--ui-border) !important;
        box-shadow: 0 8px 20px rgba(35, 49, 76, .08) !important;
    }
}


/* =========================================================
   V16: vollständige helle Oberflächen für ältere Seitenmodule
   Dunkle Regeln in Seiten-CSS werden hier gezielt überschrieben.
   ========================================================= */
[data-theme="light"] body.category-page,
[data-theme="light"] body.inventory-page,
[data-theme="light"] body.users-page,
[data-theme="light"] body.user-settings-page,
[data-theme="light"] body.time-tracking-page,
[data-theme="light"] body.time-admin-page,
[data-theme="light"] body.time-history-page,
[data-theme="light"] body.calendar-page,
[data-theme="light"] body.administration-page,
[data-theme="light"] body.customer-profile-page{background:var(--ui-bg)!important;color:var(--ui-text)!important}

[data-theme="light"] body.category-page :is(.create-card,.category-card,.set-config-card,.service-table-wrap,.category-count,.search-box),
[data-theme="light"] body.inventory-page :is(.tech-card,.edit-panel,.item-card,.category-box,.info-box,.inventory-card),
[data-theme="light"] body.users-page :is(.card,.permissions,.info,.user-card),
[data-theme="light"] body.user-settings-page :is(.settings-card,.card-icon,.push-registration,.feed-box,.device-item,.empty-state,.mail-domain),
[data-theme="light"] body.time-tracking-page :is(.tracking-card,.status-card,.stat-box,.nav-card,.pause-section,.empty-state),
[data-theme="light"] body.time-admin-page :is(.summary-card,.filter-card,.entry-card,.entry-stat,.payroll-table-wrap,.empty-state),
[data-theme="light"] body.time-history-page :is(.summary-card,.filter-card,.entry-card,.history-card,.empty-state),
[data-theme="light"] body.calendar-page :is(.filter-box,table.inventar,.kalender-kopf>div,.tag,.tag.leer),
[data-theme="light"] body.administration-page :is(.dashboard-card),
[data-theme="light"] body.customer-profile-page :is(.customer-hero,.customer-panel,.customer-stat,.customer-table-wrap,.customer-empty,.customer-note){
    background:var(--ui-surface)!important;
    background-image:none!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
    box-shadow:var(--ui-shadow)!important;
}

[data-theme="light"] body.category-page :is(.service-table,table),
[data-theme="light"] body.inventory-page table,
[data-theme="light"] body.users-page table,
[data-theme="light"] body.time-admin-page table,
[data-theme="light"] body.time-history-page table,
[data-theme="light"] body.calendar-page table.inventar,
[data-theme="light"] body.customer-profile-page table{background:var(--ui-surface)!important;color:var(--ui-text)!important}

[data-theme="light"] body.category-page :is(th,.service-table th),
[data-theme="light"] body.inventory-page th,
[data-theme="light"] body.users-page th,
[data-theme="light"] body.time-admin-page th,
[data-theme="light"] body.time-history-page th,
[data-theme="light"] body.calendar-page th,
[data-theme="light"] body.customer-profile-page th{background:var(--ui-surface-3)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}

[data-theme="light"] body.category-page :is(td,.service-table td),
[data-theme="light"] body.inventory-page td,
[data-theme="light"] body.users-page td,
[data-theme="light"] body.time-admin-page td,
[data-theme="light"] body.time-history-page td,
[data-theme="light"] body.calendar-page td,
[data-theme="light"] body.customer-profile-page td{background:var(--ui-surface)!important;color:var(--ui-text)!important;border-color:var(--ui-border)!important}

[data-theme="light"] body.category-page :is(input,select,textarea),
[data-theme="light"] body.inventory-page :is(input,select,textarea),
[data-theme="light"] body.users-page :is(input,select,textarea),
[data-theme="light"] body.user-settings-page :is(input,select,textarea,.form-input,.feed-input),
[data-theme="light"] body.time-tracking-page :is(input,select,textarea),
[data-theme="light"] body.time-admin-page :is(input,select,textarea),
[data-theme="light"] body.time-history-page :is(input,select,textarea),
[data-theme="light"] body.calendar-page :is(input,select,textarea),
[data-theme="light"] body.customer-profile-page :is(input,select,textarea){background:#fff!important;color:#18202b!important;border-color:#cbd5e1!important}

[data-theme="light"] body.user-settings-page :is(.btn-secondary,.mail-domain),
[data-theme="light"] body.category-page :is(.btn-config,.secondary-button),
[data-theme="light"] body.inventory-page :is(.secondary,.btn-secondary),
[data-theme="light"] body.time-tracking-page :is(.btn-secondary,.nav-card),
[data-theme="light"] body.time-admin-page :is(.btn-secondary),
[data-theme="light"] body.time-history-page :is(.btn-secondary),
[data-theme="light"] body.customer-profile-page :is(.btn-secondary,.customer-action.secondary){background:#eef2f7!important;color:#18202b!important;border-color:#cbd5e1!important}

[data-theme="light"] body.category-page :is(.page-description,.create-card-description,.muted,.empty-state),
[data-theme="light"] body.inventory-page :is(.muted,.tech-meta,.item-meta,.description),
[data-theme="light"] body.users-page :is(.muted,.info,.permission-description),
[data-theme="light"] body.user-settings-page :is(.settings-subtitle,.card-description,.form-help,.device-date,.device-meta,.empty-state,.mail-domain),
[data-theme="light"] body.time-tracking-page :is(.page-description,.muted,.status-note,.stat-label),
[data-theme="light"] body.time-admin-page :is(.page-description,.summary-label,.muted),
[data-theme="light"] body.time-history-page :is(.page-description,.summary-label,.summary-note,.muted),
[data-theme="light"] body.calendar-page :is(.muted,.tag small),
[data-theme="light"] body.customer-profile-page :is(.customer-muted,.customer-label,.customer-note-meta,.customer-empty){color:var(--ui-muted)!important}

[data-theme="light"] body.calendar-page .tag.leer{background:#f5f7fa!important}
[data-theme="light"] body.calendar-page .tag:not(.leer){background:#fff!important}
[data-theme="light"] body.calendar-page table.inventar tbody tr:hover td,
[data-theme="light"] body.customer-profile-page tbody tr:hover td{background:#f8fafc!important}
[data-theme="light"] body.administration-page .dashboard-card{color:var(--ui-text)!important}

/* V16: zusätzliche Modul-Unterflächen */
[data-theme="light"] body.category-page :is(.category-edit-form,.config-section,.config-field,.set-config-note,.category-main),
[data-theme="light"] body.inventory-page :is(.category-edit-grid,.category-edit-item,.edit-field,.tech-info,.empty-categories),
[data-theme="light"] body.users-page :is(.form-group,.user-meta),
[data-theme="light"] body.time-tracking-page :is(.form-control,.form-group,.action-grid,.link-grid),
[data-theme="light"] body.time-admin-page :is(.billing-section,.billing-grid,.pause-section,.pause-row,.form-control),
[data-theme="light"] body.time-history-page :is(.entry-section,.entry-stat,.form-control,.entries-header),
[data-theme="light"] body.calendar-page :is(.kopfleiste,.navigation,.kalender,.termin){
    background:var(--ui-surface-2)!important;
    color:var(--ui-text)!important;
    border-color:var(--ui-border)!important;
}
[data-theme="light"] body.inventory-page :is(.status-check,.status-ok),
[data-theme="light"] body.time-admin-page :is(.status-badge,.status-group),
[data-theme="light"] body.time-history-page :is(.status-badge,.status-group){color:inherit}
[data-theme="light"] body.category-page :is(.category-meta,.muted-small,.set-config-note),
[data-theme="light"] body.inventory-page :is(.tech-info,.empty-categories),
[data-theme="light"] body.time-admin-page :is(.entry-stat-label,.pause-empty),
[data-theme="light"] body.time-history-page :is(.entry-stat-label,.entry-section-label,.result-count){color:var(--ui-muted)!important}
