/* WiMA 0.3.1.0.14.7 – globale visuelle Vereinheitlichung
   Ziel: dieselbe kontrastreiche Grau/Blau-Basis wie im neuen Berichte-Wizard.
   Grün bleibt ausschließlich Akzent für aktive/positive Zustände. */

:root{
    --wima-bg:#171d20;
    --wima-bg-deep:#11181c;
    --wima-surface:#1f292e;
    --wima-surface-2:#243138;
    --wima-surface-3:#2a3941;
    --wima-surface-4:#31434c;
    --wima-border:#40515a;
    --wima-border-soft:#33434b;
    --wima-border-strong:#596d77;
    --wima-text:#f4f7f8;
    --wima-text-2:#d7e0e4;
    --wima-muted:#aebbc2;
    --wima-green:#79e85c;
    --wima-green-2:#9bf27d;
    --wima-green-bg:#203d26;
    --wima-green-bg-2:#274b2f;
    --wima-blue:#6dc1ff;
    --wima-blue-bg:#183447;
    --wima-amber:#e4b45d;
    --wima-red:#ff8d8d;
    --wima-shadow:0 12px 32px rgba(0,0,0,.23);

    /* Controlling-Shell nutzt diese Namen direkt. */
    --bg:var(--wima-bg);
    --surface:var(--wima-surface);
    --surface-2:var(--wima-surface-2);
    --surface-3:var(--wima-surface-3);
    --border:var(--wima-border);
    --border-soft:var(--wima-border-soft);
    --text:var(--wima-text);
    --muted:var(--wima-muted);
    --sidebar:var(--wima-bg-deep);
    --sidebar-border:var(--wima-border-soft);
    --primary:var(--wima-green);
    --primary-dark:#63d348;
    --primary-soft:rgba(121,232,92,.13);
    --green:var(--wima-green);
    --blue:var(--wima-blue);
    --amber:var(--wima-amber);
    --red:var(--wima-red);
    --shadow:var(--wima-shadow);
}

html{background:var(--wima-bg)}

/* --------------------------------------------------------------------------
   Zentrale WiMA Theme-Tokens
   -------------------------------------------------------------------------- */
body.wima-control-layout[data-theme="dark"]{
    --theme-bg:var(--wima-bg)!important;
    --theme-bg-strong:var(--wima-bg-deep)!important;
    --theme-surface:var(--wima-surface)!important;
    --theme-surface-2:var(--wima-surface-2)!important;
    --theme-surface-3:var(--wima-surface-3)!important;
    --theme-text:var(--wima-text)!important;
    --theme-text-2:var(--wima-text-2)!important;
    --theme-muted:var(--wima-muted)!important;
    --theme-border:var(--wima-border)!important;
    --theme-border-strong:var(--wima-border-strong)!important;
    --theme-green:var(--wima-green)!important;
    --theme-green-hover:var(--wima-green-2)!important;
    --theme-green-dark:var(--wima-green-2)!important;
    --theme-green-soft:var(--wima-green-bg)!important;
    --theme-green-soft-2:var(--wima-green-bg-2)!important;
    --theme-blue:var(--wima-blue)!important;
    --theme-orange:var(--wima-amber)!important;
    --theme-red:var(--wima-red)!important;
    --theme-shadow:var(--wima-shadow)!important;
    --bg:var(--wima-bg)!important;
    --surface:var(--wima-surface)!important;
    --surface-soft:var(--wima-surface-2)!important;
    --ink:var(--wima-text)!important;
    --muted:var(--wima-muted)!important;
    --line:var(--wima-border)!important;
    --green:var(--wima-green)!important;
    --green-dark:var(--wima-green-2)!important;
    --green-soft:var(--wima-green-bg)!important;
    --blue:var(--wima-blue)!important;
    --panel:var(--wima-surface)!important;
    --text:var(--wima-text)!important;
    --border:var(--wima-border)!important;
    background:var(--wima-bg)!important;
    color:var(--wima-text)!important;
}

/* Heller Modus bleibt hell, nutzt aber dieselbe blau-graue Farbfamilie. */
body.wima-control-layout[data-theme="light"]{
    --theme-bg:#e7edf0!important;
    --theme-bg-strong:#dce5e9!important;
    --theme-surface:#f8fbfc!important;
    --theme-surface-2:#eef4f6!important;
    --theme-surface-3:#e4ecef!important;
    --theme-text:#172329!important;
    --theme-text-2:#34454d!important;
    --theme-muted:#60717a!important;
    --theme-border:#b8c7ce!important;
    --theme-border-strong:#94a8b1!important;
    --theme-green:#5f9f45!important;
    --theme-green-hover:#4d8b36!important;
    --theme-green-dark:#3c7728!important;
    --theme-green-soft:#dcebd7!important;
    --theme-green-soft-2:#cee4c7!important;
    --theme-blue:#2479b2!important;
    --theme-shadow:0 10px 28px rgba(26,48,59,.10)!important;
    --bg:var(--theme-bg)!important;
    --surface:var(--theme-surface)!important;
    --surface-soft:var(--theme-surface-2)!important;
    --ink:var(--theme-text)!important;
    --muted:var(--theme-muted)!important;
    --line:var(--theme-border)!important;
    --green:var(--theme-green)!important;
    --green-dark:var(--theme-green-dark)!important;
    --green-soft:var(--theme-green-soft)!important;
    --blue:var(--theme-blue)!important;
    --panel:var(--theme-surface)!important;
    --text:var(--theme-text)!important;
    --border:var(--theme-border)!important;
}

/* --------------------------------------------------------------------------
   Shell / Navigation
   -------------------------------------------------------------------------- */
body[data-theme="dark"] .wima-sidebar{background:#11191d!important;border-right:1px solid var(--wima-border-soft)!important}
body[data-theme="dark"] .wima-topbar{background:#172126!important;border-bottom:1px solid var(--wima-border)!important}
body[data-theme="dark"] .wima-main-area,
body[data-theme="dark"] .wima-content{background:var(--wima-bg)!important}
body[data-theme="dark"] .wima-shell-brand{background:#121b20!important;border-bottom-color:var(--wima-border-soft)!important}
body[data-theme="dark"] .wima-shell-brand img{background:#1c282e!important;border:1px solid #31444d}
body[data-theme="dark"] .wima-side-nav a,
body[data-theme="dark"] .wima-nav-direct,
body[data-theme="dark"] .wima-nav-group>summary{color:#dce5e8!important}
body[data-theme="dark"] .wima-side-nav a:hover,
body[data-theme="dark"] .wima-nav-direct:hover,
body[data-theme="dark"] .wima-nav-group>summary:hover{background:#202d33!important;color:#fff!important}
body[data-theme="dark"] .wima-nav-group[open]>summary,
body[data-theme="dark"] .wima-nav-direct.active,
body[data-theme="dark"] .wima-side-nav a.active,
body[data-theme="dark"] .wima-nav-submenu a.active{background:#203d26!important;color:var(--wima-green-2)!important;border-left-color:var(--wima-green)!important}
body[data-theme="dark"] .wima-nav-submenu{background:#141e23!important;border-color:#2f4149!important}
body[data-theme="dark"] .wisag-native-menu-group>summary:hover,
body[data-theme="dark"] .wisag-native-menu-group>div>a:hover{background:#223038!important}
body[data-theme="dark"] .wisag-native-menu-group>div>a{color:#b9c5ca!important}
body[data-theme="dark"] .wima-avatar{background:#2b3c45!important;border-color:#4d626d!important}

/* --------------------------------------------------------------------------
   Gemeinsame Flächen, Karten und Gruppen
   -------------------------------------------------------------------------- */
body[data-theme="dark"] .panel,
body[data-theme="dark"] .metric-card,
body[data-theme="dark"] .job-card,
body[data-theme="dark"] .entity-card,
body[data-theme="dark"] .incident-card,
body[data-theme="dark"] .report-block,
body[data-theme="dark"] .builder-block,
body[data-theme="dark"] .module-launch-card,
body[data-theme="dark"] .settings-sidebar,
body[data-theme="dark"] .system-info-card,
body[data-theme="dark"] .admin-launch-grid a,
body[data-theme="dark"] .wisag-management-summary article,
body[data-theme="dark"] .wisag-module-card,
body[data-theme="dark"] .wisag-module-menu-card{
    background:var(--wima-surface)!important;
    color:var(--wima-text)!important;
    border-color:var(--wima-border)!important;
    box-shadow:var(--wima-shadow)!important;
}
body[data-theme="dark"] .panel-header,
body[data-theme="dark"] .project-chart-header{border-color:var(--wima-border-soft)!important;background:#202c32!important}
body[data-theme="dark"] .metric-card.accent{background:#23352e!important}
body[data-theme="dark"] .metric-card:hover,
body[data-theme="dark"] .job-card:hover,
body[data-theme="dark"] .entity-card:hover{border-color:#5b707a!important;background:#25333a!important}
body[data-theme="dark"] .empty-state,
body[data-theme="dark"] .module-placeholder,
body[data-theme="dark"] .wisag-empty-section{background:#192328!important;border-color:#33454e!important;color:#a9b7bd!important}
body[data-theme="dark"] .map-canvas{background:#131c20!important;border-color:#33464f!important}
body[data-theme="dark"] .count-pill{background:#203d26!important;color:var(--wima-green-2)!important;border:1px solid #3e7046!important}
body[data-theme="dark"] .type-chip,
body[data-theme="dark"] .label-chip{background:#25343b!important;color:#dce5e8!important;border-color:#455962!important}

/* --------------------------------------------------------------------------
   Formulare / Buttons
   -------------------------------------------------------------------------- */
body[data-theme="dark"] input:not([type="color"]),
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .button,
body[data-theme="dark"] .settings-sidebar a,
body[data-theme="dark"] .wisag-native-form input,
body[data-theme="dark"] .wisag-native-form select,
body[data-theme="dark"] .wisag-native-form textarea,
body[data-theme="dark"] .wisag-native-search input,
body[data-theme="dark"] .wisag-calendar-toolbar input,
body[data-theme="dark"] .wa-field input,
body[data-theme="dark"] .wa-field select,
body[data-theme="dark"] .wa-field textarea,
body[data-theme="dark"] .wa-cycle-head select{
    background:#202c32!important;
    color:#f0f5f7!important;
    border-color:#465b65!important;
}
body[data-theme="dark"] input:focus,
body[data-theme="dark"] select:focus,
body[data-theme="dark"] textarea:focus{border-color:#6dc1ff!important;box-shadow:0 0 0 3px rgba(109,193,255,.14)!important}
body[data-theme="dark"] .button:hover{background:#2c3a42!important;border-color:#617681!important}
body[data-theme="dark"] .button.primary,
body[data-theme="dark"] button.primary{background:linear-gradient(180deg,#91ef74,#70dd57)!important;border-color:#8af06d!important;color:#102213!important;font-weight:800}
body[data-theme="dark"] .button.primary:hover,
body[data-theme="dark"] button.primary:hover{filter:brightness(1.05);background:linear-gradient(180deg,#9bf683,#78e35e)!important}

/* --------------------------------------------------------------------------
   Tabellen
   -------------------------------------------------------------------------- */
body[data-theme="dark"] table{color:#eaf0f2!important}
body[data-theme="dark"] th,
body[data-theme="dark"] thead th{background:#202c32!important;color:#b8c6cc!important;border-color:#354850!important}
body[data-theme="dark"] td{border-color:#31434b!important}
body[data-theme="dark"] tbody tr:hover{background:#223139!important}
body[data-theme="dark"] tfoot th,
body[data-theme="dark"] tfoot td{background:#25343b!important;border-color:#4a5f69!important}

/* --------------------------------------------------------------------------
   WISAG Native / Kalender / To-Do / Org / Vertrieb
   -------------------------------------------------------------------------- */
body[data-theme="dark"] .wisag-native-tabs a{background:#202c32!important;border-color:#425660!important;color:#cbd5d9!important}
body[data-theme="dark"] .wisag-native-tabs a:hover{background:#293840!important;border-color:#617681!important}
body[data-theme="dark"] .wisag-native-tabs a.active{background:#203d26!important;border-color:var(--wima-green)!important;color:var(--wima-green-2)!important}
body[data-theme="dark"] .wisag-native-files{border-color:#40515a!important}
body[data-theme="dark"] .wisag-calendar-grid{border-color:#40515a!important}
body[data-theme="dark"] .wisag-calendar-day{background:#202b31!important;border-color:#3b4e57!important}
body[data-theme="dark"] .wisag-calendar-day.today{background:#203d26!important;box-shadow:inset 0 0 0 1px #5dbd4a!important}
body[data-theme="dark"] .wisag-calendar-event{background:#2a3941!important;color:#f0f5f7!important}
body[data-theme="dark"] .wisag-todo-card,
body[data-theme="dark"] .wisag-org-grid article{background:#223037!important;border-color:#40535c!important}
body[data-theme="dark"] .priority{background:#354851!important}
body[data-theme="dark"] .priority.low{background:#20405a!important}
body[data-theme="dark"] .permission-row{border-color:#354750!important}

body[data-theme="dark"] .sales-filter-panel,
body[data-theme="dark"] .sales-list-panel,
body[data-theme="dark"] .sales-timeline-card,
body[data-theme="dark"] .sales-edit-panel{background:var(--wima-surface)!important;border-color:var(--wima-border)!important}
body[data-theme="dark"] .sales-metric-grid>.panel{background:linear-gradient(180deg,#243138,#202b30)!important}
body[data-theme="dark"] .sales-dashboard-choice{background:#1c262b!important;border-color:#3b4e57!important}
body[data-theme="dark"] .sales-timeline-track{background:repeating-linear-gradient(to top,transparent 0,transparent 24.5%,#35464f 25%,transparent 25.5%)!important;border-color:#50616a!important}
body[data-theme="dark"] .sales-duration-overview{overflow:hidden}
body[data-theme="dark"] .sales-duration-overview .panel-header{align-items:center}
body[data-theme="dark"] .sales-duration-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;padding:14px 16px 16px}
body[data-theme="dark"] .sales-duration-card{padding:15px;border:1px solid #40535c;border-radius:7px;background:#223139}
body[data-theme="dark"] .sales-duration-card span,
body[data-theme="dark"] .sales-duration-card strong,
body[data-theme="dark"] .sales-duration-card small{display:block}
body[data-theme="dark"] .sales-duration-card span{color:#aebbc2;font-size:11px;font-weight:750}
body[data-theme="dark"] .sales-duration-card strong{margin:6px 0 4px;color:#f5f8f9;font-size:21px}
body[data-theme="dark"] .sales-duration-card small{color:#94a5ad;font-size:10px}

/* --------------------------------------------------------------------------
   Wartung & Service – inklusive Wartungs-Suite
   -------------------------------------------------------------------------- */
body[data-theme="dark"] .wa-card{background:var(--wima-surface)!important;border-color:var(--wima-border)!important;box-shadow:var(--wima-shadow)}
body[data-theme="dark"] .wa-field>span,
body[data-theme="dark"] .wa-cycle-head label>span{color:#d4dde1!important}
body[data-theme="dark"] .wa-btn-outline-secondary{border-color:#5b6e78!important;color:#c6d2d7!important}
body[data-theme="dark"] .wa-btn-primary{background:#2f7db1!important;border-color:#4098d1!important;color:#fff!important}
body[data-theme="dark"] .wa-btn-outline-primary{border-color:#4da3dc!important;color:#87caf4!important}
body[data-theme="dark"] .wa-btn-outline-primary:hover{background:#2f7db1!important;color:#fff!important}
body[data-theme="dark"] .wa-table th{background:#202c32!important}
body[data-theme="dark"] .wa-summary-card,
body[data-theme="dark"] .wa-stat-card{background:#223139!important;border-color:#40535c!important}

/* --------------------------------------------------------------------------
   Zeiterfassung
   -------------------------------------------------------------------------- */
body[data-theme="dark"] .time92-toolbar,
body[data-theme="dark"] .time92-calendar-card,
body[data-theme="dark"] .time92-table-card,
body[data-theme="dark"] .time92-modal{background:var(--wima-surface)!important;border-color:var(--wima-border)!important;box-shadow:var(--wima-shadow)!important}
body[data-theme="dark"] .time92-display-switch,
body[data-theme="dark"] .time92-view-switch,
body[data-theme="dark"] .time92-btn,
body[data-theme="dark"] .time92-icon-btn{background:#202c32!important;border-color:#455a64!important;color:#edf4f6!important}
body[data-theme="dark"] .time92-day-cell,
body[data-theme="dark"] .time92-week-day{background:#1d282d!important;border-color:#354750!important}
body[data-theme="dark"] .time92-day-cell:hover,
body[data-theme="dark"] .time92-week-day:hover{background:#25343b!important}
body[data-theme="dark"] .time92-month-weekdays,
body[data-theme="dark"] .time92-kw{background:#202c32!important;border-color:#354750!important;color:#aebbc2!important}
body[data-theme="dark"] .month-event,
body[data-theme="dark"] .week-event,
body[data-theme="dark"] .day-event{background:#2a3941!important;color:#f1f5f7!important}
body[data-theme="dark"] .time92-context-menu{background:#223139!important;border-color:#50616a!important}

/* --------------------------------------------------------------------------
   Stammdaten / Projekte / Settings
   -------------------------------------------------------------------------- */
body[data-theme="dark"] .project-definition-list div,
body[data-theme="dark"] .project-kpi-grid>div,
body[data-theme="dark"] .project-budget-year-card,
body[data-theme="dark"] .user-team-card{background:#223139!important;border-color:#40535c!important}
body[data-theme="dark"] .project-chart-panel{background:var(--wima-surface)!important;border-color:var(--wima-border)!important}
body[data-theme="dark"] .budget-track,
body[data-theme="dark"] .project-bar-track{background-color:#2a3941!important;border-color:#40515a!important}

/* --------------------------------------------------------------------------
   Berichte-Wizard – bleibt Referenzdesign, nur Shell-Übergänge angleichen
   -------------------------------------------------------------------------- */
body[data-theme="dark"] .wima-report-wizard{--rw-bg:var(--wima-bg);--rw-panel:var(--wima-surface);--rw-panel-2:var(--wima-surface-2);--rw-panel-3:var(--wima-surface-3);--rw-border:var(--wima-border);--rw-border-soft:var(--wima-border-soft);--rw-text:var(--wima-text);--rw-muted:var(--wima-muted);--rw-green:var(--wima-green);--rw-green-2:var(--wima-green-2);--rw-green-bg:var(--wima-green-bg);--rw-blue:var(--wima-blue);--rw-blue-bg:var(--wima-blue-bg)}

/* --------------------------------------------------------------------------
   Eigenständiges Controlling – gleiche Farbwelt wie das normale WiMA
   -------------------------------------------------------------------------- */
body:has(.app-shell){background:var(--wima-bg)!important;color:var(--wima-text)!important}
.app-shell .sidebar{background:#11191d!important;border-color:var(--wima-border-soft)!important}
.app-shell .brand{border-color:var(--wima-border-soft)!important}
.app-shell .brand-logo{background:#1b272d!important}
.app-shell .brand-copy span,.app-shell .sidebar-footer{color:var(--wima-muted)!important}
.app-shell .nav a:hover{background:#202d33!important}
.app-shell .nav a.active{background:#203d26!important;border-left-color:var(--wima-green)!important;color:var(--wima-green-2)!important}
.app-shell .nav-group-title{color:#758791!important}
.app-shell .main-area,.app-shell .content{background:var(--wima-bg)!important}
.app-shell .topbar{background:#172126!important;border-color:var(--wima-border)!important}
.app-shell .card,
.app-shell .kpi-card,
.app-shell .dashboard-tile{background:var(--wima-surface)!important;border-color:var(--wima-border)!important;box-shadow:var(--wima-shadow)!important}
.app-shell .card-header{background:#202c32!important;border-color:var(--wima-border-soft)!important}
.app-shell .dashboard-tile:hover{background:#25343b!important;border-color:#617681!important}
.app-shell .dashboard-tile>span{color:var(--wima-green-2)!important}
.app-shell .tile-icon{background:var(--wima-green-bg)!important;color:var(--wima-green-2)!important}
.app-shell .kpi-card.accent::before{background:var(--wima-green)!important}
.app-shell input,.app-shell select{background:#202c32!important;border-color:#465b65!important;color:#f1f6f7!important}
.app-shell thead th{background:#202c32!important;color:#b8c6cc!important;border-color:#354850!important}
.app-shell td{border-color:#31434b!important}
.app-shell tbody tr:hover{background:#223139!important}
.app-shell tfoot th,.app-shell tfoot td{background:#25343b!important}
.app-shell .btn-primary{background:linear-gradient(180deg,#91ef74,#70dd57)!important;border-color:#8af06d!important;color:#102213!important}
.app-shell .btn-secondary{background:#243138!important;color:#eef4f6!important;border-color:#50616a!important}
.app-shell .status-pill.neutral,.app-shell .code-badge{background:#26353c!important;color:#c6d0d4!important;border-color:#455a64!important}
.app-shell .data-state{background:#1b252a!important;border-color:#40515a!important;color:#b7c2c7!important}
.app-shell .bar-track,.app-shell .hbar,.app-shell .rank-track,.app-shell .distribution-track{background:#2a3941!important}
.app-shell .detail-panel{background:#223139!important;border-color:#50616a!important}

/* --------------------------------------------------------------------------
   Login / Setup
   -------------------------------------------------------------------------- */
.auth-page{background:radial-gradient(circle at 20% 10%,#22333b 0,#171d20 38%,#11181c 100%)!important;color:var(--wima-text)!important}
.auth-page .auth-card{background:linear-gradient(180deg,#202b30,#1b2428)!important;border:1px solid var(--wima-border)!important;box-shadow:0 24px 70px rgba(0,0,0,.35)!important;color:var(--wima-text)!important}
.auth-page .auth-card p,.auth-page .auth-card small,.auth-page .muted{color:var(--wima-muted)!important}
.auth-page input{background:#202c32!important;color:#f1f6f7!important;border-color:#465b65!important}
.auth-page .button.primary{background:linear-gradient(180deg,#91ef74,#70dd57)!important;border-color:#8af06d!important;color:#102213!important}

/* --------------------------------------------------------------------------
   Responsive Ergänzungen
   -------------------------------------------------------------------------- */
@media(max-width:900px){
    body[data-theme="dark"] .sales-duration-grid{grid-template-columns:1fr}
}
body[data-theme="dark"] .sales-heading-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
@media(max-width:720px){body[data-theme="dark"] .sales-heading-actions{width:100%;justify-content:flex-start}}
