:root {
  --bg: #f4f5f7;
  --card-bg: #ffffff;
  --primary: #1f6feb;
  --success: #17823c;
  --warning: #d97706;
  --danger: #dc3545;
  --text: #1f2933;
  --muted: #6c7a89;
  --border: rgba(15, 23, 42, 0.08);
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
}

/* --- Power & Voltage Visualization (added 2025-11) --- */
.power-visuals {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  grid-column: 1 / -1; /* volle Breite innerhalb hero-card */
  align-items: stretch;
}

.power-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
}

/* Länge begrenzen, um Überbreite zu vermeiden */
.power-card { min-width: 320px; }
.udc-card { min-width: 220px; max-width: 380px; }

.power-header, .udc-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .6rem;
}
.power-title-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .35rem;
  min-width: 0;
}
.power-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.power-context-note {
  font-size: .72rem;
  color: var(--muted);
  letter-spacing: .01em;
  white-space: nowrap;
}
.power-value, .udc-value {
  font-weight: 600;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.power-bar-wrapper, .udc-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.power-bar-bg, .udc-bar-bg {
  position: relative;
  height: 26px;
  background: rgba(15,23,42,0.06);
  border-radius: 12px;
  overflow: hidden;
}
.power-bar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg,
    #17823c 0%,
    #17823c 38%,
    #d97706 55%,
    #ff7b22 75%,
    #dc3545 90%,
    #dc3545 100%);
  transition: width .5s cubic-bezier(.4,.01,.25,1);
}
.udc-bar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg,#1f6feb 0%,#1f6feb 70%,#d97706 85%,#dc3545 97%);
  transition: width .5s cubic-bezier(.4,.01,.25,1);
}
.power-bar-marker, .udc-bar-marker {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(0,0,0,0.15);
}
.power-bar-marker::after, .udc-bar-marker::after {
  content: attr(data-val);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, .3rem);
  font-size: .55rem;
  color: var(--muted);
}
.power-scale, .udc-scale {
  display: flex;
  justify-content: space-between;
  font-size: .55rem;
  letter-spacing: .5px;
  color: var(--muted);
  padding: 0 2px;
}
.power-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  font-size: .65rem;
  color: var(--muted);
}
#powerDelta.delta-pill {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(15,23,42,0.08);
  font-weight: 600;
  letter-spacing: .5px;
}
#powerDelta.delta-up { background: rgba(23,130,60,0.18); color: var(--success); }
#powerDelta.delta-down { background: rgba(220,53,69,0.18); color: var(--danger); }
#powerDelta.delta-flat { background: rgba(31,111,235,0.14); color: var(--primary); }
#powerSpark {
  width: 100%;
  height: 44px; /* kompakte Sparkline-Höhe */
  display: block;
  background: rgba(31,111,235,0.04);
  border-radius: 8px;
}
.power-spark-meta {
  margin-top: .2rem;
  font-size: .64rem;
  color: var(--muted);
  opacity: .88;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

/* Zone outline styles */
.power-card.zone-ok { box-shadow: 0 0 0 2px rgba(23,130,60,.35) inset; }
.power-card.zone-mid { box-shadow: 0 0 0 2px rgba(217,119,6,.45) inset; }
.power-card.zone-high { box-shadow: 0 0 0 2px rgba(255,123,34,.55) inset; }
.power-card.zone-crit { box-shadow: 0 0 0 2px rgba(220,53,69,.65) inset; }

.udc-card.udc-ok { box-shadow: 0 0 0 2px rgba(31,111,235,.35) inset; }
.udc-card.udc-mid { box-shadow: 0 0 0 2px rgba(31,111,235,.55) inset; }
.udc-card.udc-high { box-shadow: 0 0 0 2px rgba(217,119,6,.55) inset; }
.udc-card.udc-crit { box-shadow: 0 0 0 2px rgba(220,53,69,.6) inset; }

/* --- Wind Card Styles (2025-11) --- */
.wind-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
  min-width: 280px;
  flex: 1;
}

.wind-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.wind-title-group {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}

.wind-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.wind-context-note {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.wind-value {
  font-weight: 700;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.wind-bar-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wind-bar-bg {
  position: relative;
  height: 24px;
  background: rgba(15,23,42,0.06);
  border-radius: 10px;
  overflow: hidden;
}

.wind-bar-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg,
    #10b981 0%,
    #10b981 25%,
    #f59e0b 50%,
    #ef4444 75%,
    #ef4444 100%);
  transition: width 0.5s cubic-bezier(0.4, 0.01, 0.25, 1);
}

.wind-beaufort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.wind-beaufort-icon {
  font-size: 1.1rem;
}

.wind-meta {
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

#windSpark {
  width: 100%;
  height: 38px;
  display: block;
  background: rgba(16, 185, 129, 0.05);
  border-radius: 8px;
}

.wind-spark-meta {
  margin-top: 0.1rem;
  font-size: 0.64rem;
  color: var(--muted);
  opacity: 0.88;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* --- RPM Gauge Styles (2025-11) --- */
.rpm-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
  min-width: 200px;
  flex: 1;
  align-items: center;
  justify-content: center;
}

.rpm-header {
  width: 100%;
  margin-bottom: 0.5rem;
}

.rpm-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.rpm-gauge-container {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rpm-gauge-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

.rpm-gauge-value {
  position: absolute;
  font-weight: 700;
  font-size: 1.3rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: center;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.rpm-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.3rem;
}

/* --- Energy Card Styles (2025-11) --- */
.energy-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  position: relative;
  box-shadow: 0 10px 22px rgba(15,23,42,0.06);
  min-width: 260px;
  flex: 1;
}

.energy-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.energy-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.energy-value {
  font-weight: 700;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.energy-summary {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.energy-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.energy-summary-label {
  font-weight: 500;
  color: var(--muted);
}

.energy-summary-value {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.energy-summary-value--trend {
  color: var(--primary);
}

.energy-summary-value--up {
  color: var(--success);
}

.energy-summary-value--down {
  color: #f59e0b;
}

.energy-summary-value--neutral {
  color: var(--primary);
}

@media (max-width: 860px) {
  .power-visuals {
    grid-template-columns: 1fr !important;
  }
  .wind-card, .rpm-card, .energy-card, .power-card {
    min-width: unset;
  }
}
@media (max-width: 600px) {
  #powerSpark { height: 36px; }
}
@media (max-width: 600px) {
  .power-bar-bg, .udc-bar-bg { height: 22px; }
  .power-value, .udc-value { font-size: 0.95rem; }
  .power-meta { font-size: .6rem; }
  .chart-button,
  .range-button {
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem 1.1rem;
  }
  .chart-button--icon {
    min-width: 50px;
  }
  #combinedPanLeft,
  #combinedPanRight {
    display: none;
  }
  .chart-export-group {
    width: 100%;
    justify-content: stretch;
  }
  .chart-export-group .chart-button {
    flex: 1;
  }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card-bg: #1d242b;
    --text: #e2e6ea;
    --border: rgba(255,255,255,0.08);
    --muted: #8b96a1;
  }
  .power-bar-bg, .udc-bar-bg { background: rgba(255,255,255,0.08); }
  .power-bar-marker, .udc-bar-marker { background: rgba(255,255,255,0.22); }
  #powerSpark { background: rgba(255,255,255,0.06); }
  .wind-bar-bg { background: rgba(255,255,255,0.08); }
  .energy-summary { border-top-color: rgba(255,255,255,0.08); }
  .chart-toolbar--sticky {
    background: rgba(29, 36, 43, 0.98);
  }
  .tool-group {
    background: rgba(255, 255, 255, 0.04);
  }
  .status-note {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
  }
  .status-note--ok {
    background: rgba(23, 130, 60, 0.25);
    color: #86efac;
  }
  .status-note--warn {
    background: rgba(217, 119, 6, 0.25);
    color: #fdba74;
  }
  .status-note--bad {
    background: rgba(220, 53, 69, 0.24);
    color: #fca5a5;
  }
  .technical-panel {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .technical-panel__summary {
    color: #cbd5e1;
  }
  .chart-stats-panel {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
  }
  .chart-stats-panel__summary {
    color: #cbd5e1;
  }
  .hero-insight {
    background: rgba(23, 32, 45, 0.88);
    border-color: rgba(23, 130, 60, 0.3);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.5);
  }
  .hero-insight--subtle {
    background: linear-gradient(135deg, rgba(23, 130, 60, 0.16) 0%, rgba(31, 111, 235, 0.14) 100%);
    border-color: rgba(23, 130, 60, 0.38);
  }
  .hero-insight--wide {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.18) 0%, rgba(148, 163, 184, 0.12) 100%);
    border-color: rgba(217, 119, 6, 0.32);
  }
  .hero-insight__value-highlight--muted {
    background: rgba(31, 111, 235, 0.28);
    color: #cfe0ff;
  }
  .device-switch-shell {
    border-color: rgba(255, 255, 255, 0.08);
    background:
      linear-gradient(135deg, rgba(23, 130, 60, 0.12), rgba(31, 111, 235, 0.1)),
      rgba(29, 36, 43, 0.96);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.34);
  }
  .device-switch-kicker {
    color: #7dd3fc;
  }
  .device-switch-count {
    color: #94a3b8;
  }
  .device-switch-label {
    color: #cbd5e1;
  }
  .device-switch {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(17, 24, 31, 0.92);
    color: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    color-scheme: dark;
  }
  .device-switch:hover {
    border-color: rgba(125, 211, 252, 0.3);
  }
  .device-switch:focus {
    border-color: rgba(125, 211, 252, 0.42);
    box-shadow: 0 0 0 0.22rem rgba(56, 189, 248, 0.14);
  }
  .bins-mini-bar__segment--active {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.58);
  }
}

.noscript-warning {
  background: var(--danger);
  color: #fff;
  padding: 0.75rem;
  text-align: center;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

.range-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: -0.2rem;
  margin-bottom: 0.3rem;
}

/* When range switcher is used inside a chart card, adjust spacing */
.chart-card .range-switcher {
  margin-top: 0.2rem;
  margin-bottom: 0.6rem;
}

.custom-range-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  width: 100%;
  flex-basis: 100%;
  padding: 0.6rem 0.9rem;
  background: rgba(15, 23, 42, 0.03);
  border: 1px dashed var(--border);
  border-radius: 14px;
  max-height: 520px;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.custom-range-block.is-collapsed {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-color: transparent !important;
  pointer-events: none;
  margin: 0;
}

.custom-range-block.is-expanded {
  opacity: 1;
}

.custom-range-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.custom-range-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.date-input, .date-input-range {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  font-size: 0.85rem;
  min-width: 155px;
  font-family: inherit;
}

.date-input-range {
  min-width: 140px;
}

.range-separator {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0 0.3rem;
}

.apply-button-small {
  border: 1px solid rgba(31, 111, 235, 0.24);
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.apply-button-small:hover {
  background: #1554b1;
  transform: translateY(-1px);
}

.apply-button-small:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.clear-button-small {
  background: transparent;
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: var(--danger);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.clear-button-small:hover {
  background: rgba(220, 53, 69, 0.12);
}

.custom-range-toggle {
  border: 1px dashed rgba(31, 111, 235, 0.4);
  background: transparent;
  color: var(--primary);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.custom-range-toggle:hover {
  background: rgba(31, 111, 235, 0.08);
}

.custom-range-toggle[aria-expanded="true"] {
  background: rgba(31, 111, 235, 0.12);
  border-style: solid;
}

.custom-range-toggle__chevron {
  font-size: 0.85rem;
}

.range-button {
  border: 1px solid rgba(31, 111, 235, 0.24);
  background: rgba(31, 111, 235, 0.08);
  color: var(--primary);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.range-button:hover {
  background: rgba(31, 111, 235, 0.16);
  transform: translateY(-1px);
}

.range-button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(31, 111, 235, 0.25);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.top-bar-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.device-switch-shell {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 320px;
  padding: 0.7rem 0.8rem;
  border-radius: 18px;
  border: 1px solid rgba(31, 111, 235, 0.14);
  background:
    linear-gradient(135deg, rgba(31, 111, 235, 0.08), rgba(23, 130, 60, 0.05)),
    rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.device-switch-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.device-switch-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

.device-switch-count {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.device-switch-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.7rem;
}

.user-session-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(23, 130, 60, 0.12);
  color: var(--success);
  font-weight: 600;
  font-size: 0.82rem;
}

.device-switch-label {
  font-size: 0.74rem;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.device-switch {
  min-width: 220px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: rgba(255, 255, 255, 0.95);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  padding: 0.58rem 2.3rem 0.58rem 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.device-switch:hover {
  border-color: rgba(31, 111, 235, 0.32);
}

.device-switch:focus {
  border-color: rgba(31, 111, 235, 0.45);
  box-shadow: 0 0 0 0.22rem rgba(31, 111, 235, 0.12);
  transform: translateY(-1px);
}

.user-access-panel {
  border-radius: 18px;
  border: 1px solid rgba(31, 111, 235, 0.18);
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.06), rgba(23, 130, 60, 0.05));
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.06);
  padding: 1.1rem 1.2rem;
}

.user-access-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.user-access-card h2 {
  margin: 0;
  font-size: 1.2rem;
}

.user-access-card p {
  margin: 0;
  color: var(--muted);
}

.user-login-form {
  display: grid;
  gap: 0.65rem;
  max-width: 420px;
}

.user-login-form .btn {
  width: fit-content;
}

.user-access-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.page--locked .dashboard-wrapper {
  opacity: 0.55;
  pointer-events: none;
  filter: saturate(0.8);
}

.top-bar h1 {
  font-size: clamp(1.6rem, 2vw, 2.1rem);
  margin: 0;
  font-weight: 600;
}

.developer-fab {
  position: fixed;
  right: 1.8rem;
  bottom: 1.6rem;
  z-index: 900;
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 14px 28px rgba(31, 111, 235, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.developer-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(31, 111, 235, 0.28);
}

.state-info-link {
  display: inline-flex;
  margin-top: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.92rem;
}

.state-info-link:hover {
  text-decoration: underline;
}

.state-code-label {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.dashboard-wrapper {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 1.5rem;
}

.hero-card {
  grid-column: span 12;
  background: var(--card-bg);
  border-radius: 18px;
  padding: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

/* Ensure the headline spans the full width so it doesn't wrap awkwardly */
.hero-highlight {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.92rem;
  background: rgba(31, 111, 235, 0.1);
  color: var(--primary);
}

.status-pill.online {
  background: rgba(23, 130, 60, 0.12);
  color: var(--success);
}

.status-pill.stale {
  background: rgba(217, 119, 6, 0.14);
  color: var(--warning);
}

.status-pill.offline {
  background: rgba(220, 53, 69, 0.12);
  color: var(--danger);
}

.status-pill.fault {
  background: rgba(248, 215, 218, 0.7);
  color: #842029;
  border: 1px solid rgba(245, 194, 199, 0.9);
}

.hero-highlight h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: 600;
  line-height: 1.1;
}

/* Keep “WendyMonitor – Heute” on one line on wide screens */
#statusHeadline {
  white-space: nowrap;
}

#statusMessage {
  max-width: 62ch;
  font-size: 1rem;
  line-height: 1.45;
}

@media (max-width: 540px) {
  /* Allow wrapping again on very small screens */
  #statusHeadline {
    white-space: normal;
  }
}

.hero-highlight p {
  margin: 0;
  color: var(--muted);
}

.range-summary {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.82rem;
  opacity: 0.9;
}

.customer-status-row {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
  align-items: start;
}

.status-note {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.38rem 0.72rem;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.25;
  background: rgba(15, 23, 42, 0.06);
  color: var(--text);
  border: 1px solid transparent;
}

.status-note--primary {
  font-size: 0.8rem;
}

.status-note--secondary {
  font-size: 0.75rem;
  font-weight: 500;
}

.status-note--secondary.status-note--ok {
  background: rgba(15, 23, 42, 0.04);
  color: var(--muted);
  border-color: rgba(15, 23, 42, 0.06);
}

.status-note--ok {
  background: rgba(23, 130, 60, 0.14);
  color: var(--success);
}

.status-note--warn {
  background: rgba(217, 119, 6, 0.16);
  color: var(--warning);
}

.status-note--bad {
  background: rgba(220, 53, 69, 0.16);
  color: var(--danger);
}

.hero-primary-row {
  grid-template-columns: minmax(0, 1fr);
}

.hero-secondary-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.2rem;
}

@media (max-width: 900px) {
  .dashboard-wrapper {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .hero-card {
    grid-template-columns: 1fr;
    padding: 1.1rem;
    gap: 1rem;
  }
  .power-visuals {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  .power-card,
  .wind-card,
  .rpm-card,
  .energy-card {
    min-width: unset;
    width: 100%;
  }
  .chart-card,
  .chart-card--wide {
    padding: 1rem;
  }
  .chart-wrapper {
    overflow-x: auto;
  }
  .chart-wrapper canvas,
  .chart-wrapper .chartjs-render-monitor {
    width: 100% !important;
    max-width: 100%;
  }
  .chart-toolbar__row {
    flex-wrap: wrap;
  }
  .tool-group {
    width: 100%;
  }
  .customer-status-row {
    grid-template-columns: 1fr;
  }
  .hero-secondary-row {
    grid-template-columns: 1fr;
    margin-top: 0;
  }
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  /* Volle Breite innerhalb der hero-card, damit die Boxen nebeneinander statt untereinander erscheinen */
  grid-column: 1 / -1;
}

.metric-card {
  background: rgba(31, 111, 235, 0.06);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.metric-card span.label {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-card span.value {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 600;
}

.chart-card {
  grid-column: span 12;
  background: var(--card-bg);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.chart-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.chart-card__header h2 {
  margin: 0;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chart-export-group {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.chart-button {
  border: 1px solid rgba(31, 111, 235, 0.18);
  background: rgba(31, 111, 235, 0.08);
  color: var(--primary);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.chart-button:hover:enabled {
  background: rgba(31, 111, 235, 0.16);
  transform: translateY(-1px);
}

.chart-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.chart-button--ghost {
  background: transparent;
}

.chart-button--ghost:hover:enabled {
  background: rgba(31, 111, 235, 0.12);
}

.chart-button--toggle {
  background: rgba(249, 115, 22, 0.1);
  border-color: rgba(249, 115, 22, 0.4);
  color: #b45309;
}

.chart-button--toggle.is-active {
  background: rgba(249, 115, 22, 0.2);
  color: #9a3412;
}

.chart-button--icon {
  padding-inline: 0.65rem;
}

/* Toolbar layout for grouped controls */
.chart-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.chart-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.tool-group__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 0.35rem;
}

#rangeChipsContainer {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.chart-toolbar--sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card-bg);
  padding: 0.6rem;
  margin: -0.6rem -0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

@media (min-width: 741px) {
  .chart-toolbar--sticky {
    position: static;
    box-shadow: none;
    border-bottom: none;
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 740px) {
  .chart-toolbar__row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .tool-group {
    width: 100%;
    justify-content: flex-start;
  }
}

.chart-helper-text {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 0.7rem;
}

#combinedChart {
  touch-action: pan-y pinch-zoom;
}

.chart-stats-panel {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.02);
}

.chart-stats-panel__summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.65rem 0.9rem;
}

.chart-stats-panel__summary::-webkit-details-marker {
  display: none;
}

.chart-stats-panel__summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.chart-stats-panel[open] .chart-stats-panel__summary::before {
  transform: rotate(90deg);
}

.chart-stats-panel:not([open]) .chart-stats {
  display: none;
}

.chart-stats-panel .chart-stats {
  margin: 0;
  padding: 0 0.8rem 0.85rem;
}

.chart-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin: 1rem 0 0;
}

.chart-stats--energy {
  margin-top: 1rem;
}

.chart-stat {
  flex: 1 1 220px;
  min-width: 200px;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.02);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.chart-stat--pac {
  border-color: rgba(31, 111, 235, 0.25);
  background: rgba(31, 111, 235, 0.08);
}

.chart-stat--wind {
  border-color: rgba(23, 130, 60, 0.25);
  background: rgba(23, 130, 60, 0.08);
}

.chart-stat--rpm {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.08);
}

.chart-stat--udc {
  border-color: rgba(249, 115, 22, 0.35);
  background: rgba(249, 115, 22, 0.08);
}

.chart-stat__label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.chart-stat__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.15rem;
  gap: 0.4rem;
}

.chart-stat__row--corr {
  align-items: center;
}

.chart-stat__caption {
  font-size: 0.85rem;
  color: var(--muted);
}

.chart-stat__value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.chart-stat__hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.chart-stat__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
}

.chart-stat__badge--pos {
  background: rgba(23, 130, 60, 0.18);
  color: var(--success);
}

.chart-stat__badge--neg {
  background: rgba(220, 53, 69, 0.15);
  color: var(--danger);
}

.chart-stat__badge--weak {
  background: rgba(31, 111, 235, 0.12);
  color: var(--primary);
}

.chart-stat--energy {
  min-width: 220px;
}

.chart-stat--energy .chart-stat__value {
  font-size: 1.05rem;
}

.analysis-summary {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.2rem;
  margin-bottom: 1rem;
  background: rgba(15, 23, 42, 0.02);
}

.analysis-summary__header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.analysis-summary__body {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hero-insight {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.hero-insight--subtle {
  background: linear-gradient(135deg, rgba(23, 130, 60, 0.14) 0%, rgba(31, 111, 235, 0.08) 100%);
  border-color: rgba(23, 130, 60, 0.24);
  box-shadow: 0 16px 32px rgba(23, 130, 60, 0.15);
}

.hero-insight--wide {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.12) 0%, rgba(148, 163, 184, 0.12) 100%);
  border-color: rgba(217, 119, 6, 0.24);
}

.hero-insight__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

.hero-insight__value {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.3rem;
  line-height: 1.2;
}

.hero-insight__subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.hero-insight__note {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.hero-insight__value-highlight {
  color: var(--success);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hero-insight__value-highlight--muted {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(31, 111, 235, 0.14);
  color: var(--primary);
  font-weight: 700;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.summary-row__label {
  color: var(--muted);
  font-weight: 500;
}

.summary-row__value {
  font-weight: 600;
  color: var(--text);
}

.analysis-empty-block {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 0.9rem;
  text-align: center;
  color: var(--muted);
}

.bins-mini-bar {
  display: flex;
  gap: 0.2rem;
  height: 32px;
  margin-top: 0.8rem;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
}

.bins-mini-bar__segment {
  flex: 0 0 auto;
  background: var(--success);
  position: relative;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.bins-mini-bar__segment:hover {
  transform: scaleY(1.15);
  filter: brightness(1.08);
  z-index: 1;
}

.bins-mini-bar__segment::after {
  content: attr(data-pct);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -4px);
  background: rgba(17, 20, 24, 0.9);
  color: #fff;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.bins-mini-bar__segment:hover::after {
  opacity: 1;
}

.bins-mini-bar__segment--low {
  background: #94a3b8;
}

.bins-mini-bar__segment--medium {
  background: #10b981;
}

.bins-mini-bar__segment--high {
  background: #f59e0b;
}

.bins-mini-bar__segment--very-high {
  background: #dc2626;
}

.bins-mini-bar__segment--active {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
  filter: brightness(1.12);
}

.info-chip {
  border: 1px solid rgba(15, 23, 42, 0.2);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  width: 1.6rem;
  height: 1.6rem;
  font-size: 0.85rem;
  cursor: help;
}

.info-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.wind-bands {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wind-band {
  display: grid;
  grid-template-columns: 70px 1fr 48px;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.wind-band__bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.wind-band__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6 0%, #22d3ee 100%);
  transition: width 0.25s ease;
}

.wind-band__pct {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chart-wrapper {
  position: relative;
  min-height: 260px;
  max-height: 420px;
}

.chart-card--wide .chart-wrapper {
  min-height: 320px;
  max-height: 520px;
}

.chart-wrapper--tall {
  min-height: 320px;
  max-height: 520px;
}

.analysis-panel {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.02);
  overflow: hidden;
}

.analysis-toggle {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
}

.analysis-toggle__chevron {
  font-size: 1rem;
}

.analysis-content {
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.2s ease;
  padding: 0 1.2rem;
}

.analysis-content.is-open {
  opacity: 1;
  padding: 1.2rem 1.2rem 1.4rem;
}

.analysis-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
  justify-content: flex-end;
  margin-bottom: 0.8rem;
}

.analysis-header h3 {
  margin: 0;
  font-size: 1rem;
}

.analysis-subtitle {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.analysis-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.analysis-control-group {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.analysis-chip {
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.analysis-chip.is-active {
  background: rgba(31, 111, 235, 0.15);
  border-color: rgba(31, 111, 235, 0.4);
  color: var(--primary);
}

.analysis-chip--ghost {
  border-style: dashed;
}

.scatter-canvas-wrapper {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0;
  min-height: 340px;
}

.scatter-canvas {
  width: 100%;
  height: 340px;
  display: block;
  border-radius: 16px;
}

.analysis-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 16px;
}

.analysis-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.4rem 0 0.2rem;
  line-height: 1.35;
}

.scatter-section {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scatter-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.scatter-title-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scatter-legend {
  font-size: 0.74rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.scatter-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.detail-grid {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.technical-panel {
  grid-column: span 12;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.03);
  padding: 0.6rem 0.8rem 0.9rem;
}

.technical-panel__summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.25rem 0.2rem 0.45rem;
}

.technical-panel__summary::-webkit-details-marker {
  display: none;
}

.technical-panel__summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.4rem;
  transition: transform 0.15s ease;
}

.technical-panel[open] .technical-panel__summary::before {
  transform: rotate(90deg);
}

.technical-panel:not([open]) {
  padding-bottom: 0.55rem;
}

.technical-panel:not([open]) .detail-grid {
  display: none;
}

.detail-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.detail-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.detail-list {
  display: grid;
  gap: 0.5rem;
}

.detail-list--grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.detail-card--diag .detail-list {
  gap: 0.85rem;
}

.diag-value {
  font-variant-numeric: tabular-nums;
}

.diag-updated {
  display: block;
  margin-top: 0.85rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.diag-ok {
  color: var(--success);
}

.diag-warn {
  color: var(--warning);
}

.diag-bad {
  color: var(--danger);
}

.detail-card.is-muted {
  opacity: 0.65;
}

.detail-card.is-stale {
  box-shadow: 0 0 0 1px rgba(217, 119, 6, 0.35), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.detail-list span.label {
  font-size: 0.85rem;
  color: var(--muted);
}

.detail-list span.value {
  font-size: 1.05rem;
  font-weight: 500;
}

footer {
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  padding: 1rem;
}

.floating-action {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: none;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.25);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  display: none;
  z-index: 50;
}

.floating-action--primary {
  right: 1rem;
  bottom: calc(3.4rem + env(safe-area-inset-bottom, 0px));
  background: var(--primary);
  color: #fff;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 999;
}

.modal-backdrop.show {
  display: flex;
}

.modal-panel {
  background: #fff;
  border-radius: 18px;
  padding: 1.8rem;
  width: min(420px, 100%);
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.modal-panel h2 {
  margin: 0;
  font-size: 1.4rem;
}

.modal-panel .form-control {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0.65rem 0.85rem;
}

.modal-panel .btn-primary {
  background: var(--primary);
  border: none;
  border-radius: 12px;
  padding: 0.65rem 1.1rem;
  font-weight: 600;
}

.error-text {
  color: var(--danger);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .page {
    padding: 1rem;
  }
  .top-bar-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .device-switch-shell {
    width: 100%;
    min-width: 0;
  }
  .device-switch-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }
  .device-switch-control {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
  .device-switch {
    width: 100%;
    min-width: 0;
  }
  .user-session-badge {
    width: 100%;
    justify-content: center;
  }
  .range-switcher {
    gap: 0.4rem;
  }
  .range-button {
    flex: 1 0 calc(50% - 0.4rem);
    text-align: center;
  }
  .hero-card {
    padding: 1.2rem;
  }
  .chart-wrapper {
    min-height: 220px;
  }
  .developer-fab {
    right: 1rem;
    bottom: 1rem;
    width: calc(100% - 2rem);
    text-align: center;
  }
  .floating-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
  }
}
.detail-card .value.text-danger {
  color: #842029;
  font-weight: 600;
}

/* --- UI polish: date inputs and tagline visibility --- */
/* Add smooth transitions for light mode too */
.date-input, .date-input-range {
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

/* Ensure the small credit/tagline remains readable */
.top-bar .text-muted {
  color: var(--muted) !important;
  opacity: 0.95;
}

/* Dark theme: make date/Zeitraum inputs match the dark surface */
@media (prefers-color-scheme: dark) {
  .date-input, .date-input-range {
    background: #141b22;
    color: var(--text);
    border-color: rgba(255,255,255,0.12);
  }
  .date-input:focus, .date-input-range:focus {
    outline: none;
    border-color: rgba(31,111,235,0.55);
    box-shadow: 0 0 0 2px rgba(31,111,235,0.25);
  }
  .date-input::placeholder, .date-input-range::placeholder {
    color: var(--muted);
    opacity: 0.9;
  }
  /* Make the calendar icon visible on dark backgrounds */
  input[type="date"].date-input::-webkit-calendar-picker-indicator,
  input[type="date"].date-input-range::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.1);
  }
  .custom-range-block {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
  }
  .analysis-panel {
    background: rgba(255,255,255,0.02);
  }
  .analysis-chip {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.12);
    color: var(--text);
  }
  .analysis-chip.is-active {
    background: rgba(31,111,235,0.25);
    color: #cfe0ff;
  }
  .scatter-canvas-wrapper {
    background: #141b22;
    border-color: rgba(255,255,255,0.08);
  }
  .analysis-empty {
    background: rgba(17,20,24,0.9);
  }
  .floating-action {
    background: rgba(17,20,24,0.95);
    color: #fff;
  }
  .device-switch-shell {
    border-color: rgba(255, 255, 255, 0.08);
    background:
      linear-gradient(135deg, rgba(23, 130, 60, 0.12), rgba(31, 111, 235, 0.1)),
      rgba(29, 36, 43, 0.96);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.34);
  }
  .device-switch-kicker {
    color: #7dd3fc;
  }
  .device-switch-count {
    color: #94a3b8;
  }
  .device-switch-label {
    color: #cbd5e1;
  }
  .device-switch {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(17, 24, 31, 0.92);
    color: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    color-scheme: dark;
  }
  .device-switch:hover {
    border-color: rgba(125, 211, 252, 0.3);
  }
  .device-switch:focus {
    border-color: rgba(125, 211, 252, 0.42);
    box-shadow: 0 0 0 0.22rem rgba(56, 189, 248, 0.14);
  }
}
.scatter-canvas {
  width: 100%;
  height: 340px;
  display: block;
  border-radius: 16px;
}

@media (max-width: 1024px) {
  .scatter-canvas {
    height: 300px;
  }
}

@media (max-width: 768px) {
  .scatter-canvas {
    height: 260px;
  }
}

@media (max-width: 480px) {
  .scatter-canvas {
    height: 220px;
  }
}
