/* v2.14.1: Darkmode-Audit + visuelle Statistik */
:root{
  --surface-card:#fff;
  --surface-soft:#faf8f7;
  --surface-raised:#fff;
  --surface-accent:#f7eeee;
  --text-strong:#242222;
  --text-soft:#716b69;
  --border-soft:#ded8d6;
  --stat-revenue:#660000;
  --stat-cost:#9b5c2e;
  --stat-margin:#2f7d52;
  --stat-orders:#5c4f9d;
  --stat-track:#eee8e6;
}
:root[data-theme="DARK"]{
  --surface-card:#242222;
  --surface-soft:#2c2928;
  --surface-raised:#302d2c;
  --surface-accent:#382526;
  --text-strong:#f5f1ef;
  --text-soft:#b9b0ad;
  --border-soft:#514a48;
  --stat-revenue:#d56c6c;
  --stat-cost:#d59a62;
  --stat-margin:#6cc69a;
  --stat-orders:#a99ce5;
  --stat-track:#3a3634;
  color-scheme:dark;
}

/* Neue und bestehende Info-/Formflächen konsequent themefähig */
.order-grouping-info,
.vehicle-duration-details,
.customer-special-prices,
.special-price-row,
.document-link-card,
.statistics-kpi,
.statistics-chart-card{
  color:var(--text-strong);
  border-color:var(--border-soft);
  background:var(--surface-card);
}
.order-grouping-info{background:var(--surface-accent);border-left-color:var(--red)}
.vehicle-duration-details,.customer-special-prices{background:var(--surface-soft)}
.vehicle-duration-details summary{color:var(--text-strong)}
.vehicle-duration-grid label{color:var(--text-strong);border-color:var(--border-soft);background:var(--surface-raised)}
.vehicle-duration-grid label:focus-within{border-color:#9b5555;box-shadow:0 0 0 2px #66000026}
.special-price-row{background:var(--surface-raised)}
.special-price-row:hover{border-color:#9b5555}
.special-price-row strong,.special-price-head>div>strong{color:var(--text-strong)}
.special-price-row small,.special-price-head small,.bulletin-documents-head p:last-child{color:var(--text-soft)}
.document-link-card{position:relative;min-height:92px;padding:1rem 1.1rem 1rem 3.7rem;transition:transform .16s ease,border-color .16s ease,background .16s ease}
.document-link-card::before{content:"↗";position:absolute;left:1rem;top:1rem;display:grid;place-items:center;width:2rem;height:2rem;border-radius:9px;color:var(--red);background:#66000012;font-size:1rem;font-weight:900}
.document-link-card:hover{transform:translateY(-1px);border-color:#9b5555;background:var(--surface-soft)}
.document-link-card>a{color:var(--red);font-size:.96rem}
.document-link-card>small{color:var(--text-soft)}

:root[data-theme="DARK"] .document-link-card::before{color:#ff9d9d;background:#662f2f66}
:root[data-theme="DARK"] .document-link-card>a{color:#ff9d9d}
:root[data-theme="DARK"] .order-grouping-info{color:#f5e9e9;background:#382526}
:root[data-theme="DARK"] .vehicle-duration-details summary{color:#fff}
:root[data-theme="DARK"] .vehicle-duration-grid input::placeholder,
:root[data-theme="DARK"] .special-price-head input::placeholder{color:#958b88}

/* Darkmode-Fallbacks fuer wiederkehrende helle Komponenten */
:root[data-theme="DARK"] .warning{color:#f1d28a;background:#3d321d}
:root[data-theme="DARK"] .secret-box{color:#f1eeee;border-color:#514a48;background:#302d2c}
:root[data-theme="DARK"] .search-with-filter select,
:root[data-theme="DARK"] .statistics-filter input{color:#f3eeee;border-color:#5a514e;background:#302d2c}
:root[data-theme="DARK"] .status-picker{color:#f1eeee;border-color:#5a514e;background:#302d2c}
:root[data-theme="DARK"] .status-picker select{color:#f1eeee}
:root[data-theme="DARK"] .account-popover{color:#f1eeee;border-color:#514a48;background:#242222}
:root[data-theme="DARK"] .account-popover button{color:#f1eeee}
:root[data-theme="DARK"] .account-popover button:hover{background:#352f2e}
:root[data-theme="DARK"] .icon-button:hover{color:#ff9d9d;background:#352f2e}
:root[data-theme="DARK"] .module-card.locked{color:#9f9693;background:#211f1f}
:root[data-theme="DARK"] .status-chip.open{color:#f0c77d;background:#45361c}
:root[data-theme="DARK"] .status-chip.completed{color:#a8e0be;background:#20382b}
:root[data-theme="DARK"] .overdue-row td{color:#efb0b0!important;background:#402626!important}
:root[data-theme="DARK"] .birthday-banner{color:#f3dfaa!important;border-color:#7b6936!important;background:#39321f!important}
:root[data-theme="DARK"] .meeting-no{color:#efb0b0;background:#402626}
:root[data-theme="DARK"] .meeting-yes{color:#a8e0be;background:#20382b}
:root[data-theme="DARK"] .quick-customer-button{color:#ff9d9d;border-color:#5a514e;background:#302d2c}
:root[data-theme="DARK"] .quick-customer-button:hover{border-color:#914141;background:#3a3231}

/* Statistik: grosse Kennzahlen + Diagramme, wenig Tabellen/Text */
.statistics-filter{align-items:flex-end}
.statistics-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.9rem;margin-bottom:1rem}
.statistics-kpi{display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto;align-items:center;gap:.2rem .75rem;min-height:96px;padding:1rem 1.1rem;border:1px solid var(--border-soft);border-radius:16px;box-shadow:0 8px 24px #28151208}
.statistics-kpi-icon{grid-row:1/3;display:grid;place-items:center;width:2.75rem;height:2.75rem;border-radius:12px;background:#66000010;font-size:1.25rem}
.statistics-kpi strong{font-size:1.55rem;line-height:1.05;color:var(--text-strong)}
.statistics-kpi span:not(.statistics-kpi-icon),.statistics-kpi small{color:var(--text-soft);font-size:.78rem;font-weight:750}
.statistics-dashboard-grid{display:grid;grid-template-columns:minmax(280px,.8fr) minmax(0,1.35fr);gap:1rem}
.statistics-chart-card{min-width:0;padding:1.1rem 1.15rem;border:1px solid var(--border-soft);border-radius:18px;box-shadow:0 8px 24px #28151208}
.statistics-chart-card.wide{grid-column:2;grid-row:1/3}
.statistics-card-head{display:flex;align-items:center;justify-content:space-between;gap:1rem;margin-bottom:1rem}
.statistics-card-head strong{font-size:.96rem}.statistics-card-head span{color:var(--text-soft);font-size:.75rem;font-weight:800;text-transform:uppercase;letter-spacing:.08em}
.statistics-finance{display:grid;place-items:center;gap:1rem;padding:.3rem}
.statistics-donut{position:relative;display:grid;place-items:center;width:min(210px,65vw);aspect-ratio:1;border-radius:50%;background:conic-gradient(var(--stat-cost) 0 var(--cost-angle,0deg),var(--stat-margin) var(--cost-angle,0deg) 360deg);box-shadow:inset 0 0 0 1px #00000010}
.statistics-donut::after{content:"";position:absolute;width:66%;aspect-ratio:1;border-radius:50%;background:var(--surface-card);box-shadow:0 0 0 1px var(--border-soft)}
.statistics-donut-center{position:relative;z-index:1;display:grid;gap:.15rem;text-align:center}.statistics-donut-center small{color:var(--text-soft);font-size:.72rem;text-transform:uppercase;font-weight:800}.statistics-donut-center strong{font-size:1.35rem;color:var(--text-strong)}
.statistics-legend{display:flex;justify-content:center;gap:1.2rem;flex-wrap:wrap}.statistics-legend span{display:flex;align-items:center;gap:.4rem;color:var(--text-soft);font-size:.78rem;font-weight:700}.statistics-legend i{width:.7rem;height:.7rem;border-radius:50%}.statistics-legend .cost{background:var(--stat-cost)}.statistics-legend .margin{background:var(--stat-margin)}
.statistics-bars{display:grid;gap:.8rem;max-height:440px;overflow:auto;padding-right:.3rem}
.statistics-bar-row{display:grid;grid-template-columns:minmax(110px,180px) minmax(120px,1fr) auto;align-items:center;gap:.75rem}
.statistics-bar-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.82rem;font-weight:750;color:var(--text-strong)}
.statistics-bar-track{height:.78rem;overflow:hidden;border-radius:999px;background:var(--stat-track)}
.statistics-bar-fill{display:block;height:100%;min-width:3px;border-radius:inherit;background:linear-gradient(90deg,var(--stat-revenue),#9b4b4b);transition:width .25s ease}
.statistics-bars.orders .statistics-bar-fill{background:linear-gradient(90deg,var(--stat-orders),#7c70bc)}
.statistics-bar-value{min-width:72px;text-align:right;color:var(--text-soft);font-size:.78rem;font-weight:800}
.statistics-empty{padding:2rem;text-align:center;color:var(--text-soft)}

:root[data-theme="DARK"] .statistics-kpi-icon{background:#662f2f66}
:root[data-theme="DARK"] .statistics-kpi,
:root[data-theme="DARK"] .statistics-chart-card{box-shadow:0 8px 24px #0003}

@media(max-width:1000px){.statistics-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.statistics-dashboard-grid{grid-template-columns:1fr}.statistics-chart-card.wide{grid-column:auto;grid-row:auto}}
@media(max-width:650px){.statistics-kpis{grid-template-columns:1fr}.statistics-bar-row{grid-template-columns:1fr auto}.statistics-bar-track{grid-column:1/-1;grid-row:2}.document-link-card{padding-left:3.4rem}}
