/* Energiemanager App: Grundlayout, Komponenten, Diagramme.
   Mobile-first. Farben als Tokens, helles Design mit abgestimmtem Dunkelmodus. */

:root {
  color-scheme: light;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --surface-3: #e3e9e6;
  --ink: #13201a;
  --ink-2: #3f4b45;
  --muted: #5f6b65;
  --line: #dbe2de;
  --line-strong: #b8c3bd;
  --accent: #16664f;
  --accent-hover: #10523f;
  --accent-ink: #ffffff;
  --accent-soft: #dfeee8;
  --focus: #2a78d6;
  --ok: #0a7d34;
  --ok-soft: #e1f3e6;
  --warn: #8f5300;
  --warn-soft: #fbefd6;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --info: #1f5fae;
  --info-soft: #e4eefb;
  --shadow-1: 0 1px 2px rgba(16, 32, 24, 0.06), 0 1px 1px rgba(16, 32, 24, 0.04);
  --shadow-2: 0 8px 28px rgba(16, 32, 24, 0.14);
  --radius: 14px;
  --radius-sm: 10px;

  /* Datenfarben (Referenzpalette, validiert) */
  --c-house: #2a78d6;
  --c-hp: #eb6834;
  --c-battery: #1baf7a;
  --c-pv: #eda100;
  --c-car: #d55181;
  --c-grid: #4a3aa7;
  --c-cheap: #0ca30c;
  --c-normal: #8f9a94;
  --c-expensive: #d03b3b;
  --chart-grid: #e6ebe8;
  --chart-axis: #5f6b65;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --nav-h: 64px;
  --top-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111513;
    --surface: #191e1b;
    --surface-2: #212824;
    --surface-3: #2a322d;
    --ink: #e8ece9;
    --ink-2: #bcc5c0;
    --muted: #97a19b;
    --line: #2c3430;
    --line-strong: #414b46;
    --accent: #4fbf98;
    --accent-hover: #6bd0ab;
    --accent-ink: #0b1712;
    --accent-soft: #1d3129;
    --focus: #7fb3f0;
    --ok: #5fcf85;
    --ok-soft: #1a3022;
    --warn: #e7b25c;
    --warn-soft: #33281a;
    --danger: #f08a80;
    --danger-soft: #3a1f1c;
    --info: #86b6ee;
    --info-soft: #1b2939;
    --shadow-1: none;
    --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.5);
    --c-house: #3987e5;
    --c-hp: #d95926;
    --c-battery: #199e70;
    --c-pv: #c98500;
    --c-car: #d55181;
    --c-grid: #9085e9;
    --chart-grid: #2a312d;
    --chart-axis: #97a19b;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.tnum, .kpi-value, table, .badge, time { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 0.8125rem; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--surface); padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ---------- Grundgerüst ---------- */
.app-shell { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; font-size: 0.95rem; }
.brand-site { font-size: 0.75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.brand { flex: 1 1 auto; overflow: hidden; }
.brand-name, .brand-site { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 479px) {
  .topbar .mock-flag .mock-flag-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .topbar .mock-flag { padding: 5px; }
  .hide-sm { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

.layout { display: block; }
.sidenav { display: none; }
.content {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head p { color: var(--muted); margin-top: 2px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.bottomnav a, .bottomnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 0.6875rem; font-weight: 500; color: var(--muted); text-decoration: none;
  background: none; border: 0; cursor: pointer; min-height: 44px;
}
.bottomnav [aria-current="page"] { color: var(--accent); }
.bottomnav svg { width: 22px; height: 22px; }

@media (min-width: 960px) {
  .bottomnav { display: none; }
  .layout { display: grid; grid-template-columns: 232px 1fr; }
  .sidenav {
    display: flex; flex-direction: column; gap: 2px;
    position: sticky; top: var(--top-h); height: calc(100dvh - var(--top-h));
    padding: 16px 12px; border-right: 1px solid var(--line); overflow-y: auto; overflow-x: hidden;
  }
  .sidenav .nav-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 14px 10px 4px; }
  .sidenav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
    color: var(--ink-2); text-decoration: none; font-weight: 500;
  }
  .sidenav a:hover { background: var(--surface-2); }
  .sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
  .sidenav svg { width: 19px; height: 19px; flex: none; }
  .content { padding: 24px 32px 48px; }
  .sidenav .phase-tag { white-space: nowrap; margin-left: auto; font-size: 0.65rem; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; }
}

/* ---------- Karten und Raster ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); font-size: 0.8125rem; }
.grid { display: grid; gap: 12px; }
.grid > .card + .card { margin-top: 0; }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .span-2 { grid-column: span 2; }
}
@media (min-width: 1100px) { .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 540px) and (max-width: 1099px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 22px 2px 8px; }

.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 0.8125rem; color: var(--muted); }
.kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.kpi-value small { font-size: 0.875rem; font-weight: 500; color: var(--muted); margin-left: 3px; }
.kpi-note { font-size: 0.8125rem; color: var(--ink-2); }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 11px;
  border: 1px solid transparent; font-weight: 600; font-size: 0.9375rem;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--surface); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 0.875rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.btn-oauth { min-height: 52px; font-size: 1rem; width: 100%; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .field-label { font-weight: 600; font-size: 0.875rem; color: var(--ink); }
.field .hint { font-size: 0.8125rem; color: var(--muted); }
.field .error { font-size: 0.8125rem; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.field .error svg { width: 16px; height: 16px; margin-top: 2px; flex: none; }
.input, .select, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface);
  font-size: 1rem;
}
.input:hover, .select:hover { border-color: var(--muted); }
.input:focus-visible, .select:focus-visible { outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[readonly] { background: var(--surface-2); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.input-group .addon {
  display: grid; place-items: center; padding: 0 12px; min-width: 52px;
  border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 10px 10px 0;
  background: var(--surface-2); color: var(--ink-2); font-size: 0.875rem; white-space: nowrap;
}
.input-group .addon-btn { cursor: pointer; }
.input-group .addon-btn svg { width: 18px; height: 18px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 44px; cursor: pointer; }
.switch-text { display: flex; flex-direction: column; }
.switch-text .hint { font-size: 0.8125rem; color: var(--muted); }
.switch input {
  appearance: none; flex: none; width: 46px; height: 28px; border-radius: 99px;
  background: var(--line-strong); position: relative; cursor: pointer; margin: 0;
  transition: background-color .15s ease;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s ease;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(18px); }
.switch input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.switch input:disabled { opacity: .5; cursor: not-allowed; }

.segmented {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 4px; padding: 4px;
  background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line);
}
.segmented label { flex: 1 1 auto; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 6px;
  border-radius: 9px; font-weight: 600; font-size: 0.875rem; color: var(--ink-2); text-align: center;
}
.segmented span svg { width: 16px; height: 16px; flex: none; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); outline: 1px solid var(--line); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); }
.segmented input:disabled + span { opacity: .45; }

.choice-list { display: grid; gap: 8px; }
.choice {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); cursor: pointer;
}
.choice:hover { border-color: var(--muted); }
.choice input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.choice-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.choice-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.choice-desc { font-size: 0.8125rem; color: var(--ink-2); }
.choice-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); flex: none; }
.choice-icon svg { width: 22px; height: 22px; }

.range-wrap { display: flex; flex-direction: column; gap: 6px; }
.range-value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; margin: 0; }
.range-scale { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; }
.array-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; background: var(--surface); }
.array-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.array-item-head legend { font-weight: 650; }
.form-grid { display: grid; gap: 0 12px; }
@media (min-width: 560px) { .form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Kompass ---------- */
.compass { display: grid; gap: 10px; }
@media (min-width: 560px) { .compass { grid-template-columns: 176px 1fr; align-items: center; } }
.compass-dial { width: 176px; height: 176px; margin: 0 auto; touch-action: none; cursor: pointer; border-radius: 50%; }
.compass-dial .ring { fill: var(--surface-2); stroke: var(--line-strong); }
.compass-dial .tick { stroke: var(--line-strong); }
.compass-dial .lbl { fill: var(--ink-2); font-size: 11px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.compass-dial .needle { fill: var(--accent); }
.compass-dial .hub { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.compass-dirs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.compass-dirs button { min-height: 38px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: 0.8125rem; cursor: pointer; }
.compass-dirs button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Badges, Hinweise ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
}
.badge svg { width: 13px; height: 13px; }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; flex: none; }

.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
  background: var(--info-soft); color: var(--ink); font-size: 0.875rem;
}
.notice > svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--info); }
.notice-warn { background: var(--warn-soft); }
.notice-warn > svg { color: var(--warn); }
.notice-danger { background: var(--danger-soft); }
.notice-danger > svg { color: var(--danger); }
.notice-ok { background: var(--ok-soft); }
.notice-ok > svg { color: var(--ok); }
.notice-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.notice strong { font-weight: 650; }

.mock-flag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--warn);
  background: var(--warn-soft); border-radius: 99px; padding: 2px 8px;
}
.mock-flag svg { width: 12px; height: 12px; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 14px;
  border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.banner > svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.banner .banner-text { flex: 1 1 200px; font-size: 0.9rem; }

.unavailable { position: relative; }
.unavailable > .unavailable-body { opacity: .45; pointer-events: none; filter: grayscale(.6); user-select: none; }
.unavailable-reason { display: flex; gap: 8px; align-items: flex-start; font-size: 0.8125rem; color: var(--ink-2); background: var(--surface-2); padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; }
.unavailable-reason svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--muted); }

/* ---------- Listen ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; padding-top: 2px; }
.list-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--ink-2); }
.list-icon svg { width: 19px; height: 19px; }
.list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-title { font-weight: 600; }
.list-meta { font-size: 0.8125rem; color: var(--muted); }
.list-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }

.feature-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.feature-row:first-child { border-top: 0; }
.feature-row > svg { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.feature-row.ok > svg { color: var(--ok); }
.feature-row.off > svg { color: var(--muted); }
.feature-row.off .feature-name { color: var(--muted); }

/* ---------- Dialoge und Hinweise ---------- */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(520px, calc(100vw - 24px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2);
}
dialog::backdrop { background: rgba(10, 20, 15, 0.45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 16px 0 20px; }
.dialog-body { padding: 12px 20px 8px; }
.dialog-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px 20px; }

.toast-region { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 960px) { .toast-region { bottom: 24px; } }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: var(--surface); box-shadow: var(--shadow-2); font-size: 0.9rem; pointer-events: auto; animation: toast-in .2s ease; }
.toast svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.spinner { width: 18px; height: 18px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; min-height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
table.data th, table.data td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data th { color: var(--muted); font-weight: 600; }
details.table-toggle summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.8125rem; margin-top: 8px; min-height: 32px; display: flex; align-items: center; }
details.table-toggle[open] .table-wrap { max-height: 320px; margin-top: 6px; overflow: auto; }

/* ---------- Diagramme ---------- */
.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; user-select: none; -webkit-user-select: none; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .axis-text { fill: var(--chart-axis); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .axis-title { fill: var(--muted); font-size: 11px; font-weight: 600; }
.chart .crosshair { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .now-line { stroke: var(--ink); stroke-width: 1.5; }
.chart .now-text { fill: var(--ink); font-size: 10px; font-weight: 700; }
.chart .hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.chart .hit:focus-visible { outline: none; }
.chart:has(.hit:focus-visible) { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 8px; }
.chart .lane-label { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.chart .lane-bg { fill: var(--surface-2); }
.chart-tooltip {
  position: absolute; top: 0; left: 0; z-index: 5; pointer-events: none;
  min-width: 150px; max-width: min(280px, 90%); padding: 9px 11px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-2);
  font-size: 0.8125rem; font-variant-numeric: tabular-nums;
}
.chart-tooltip .tt-head { font-weight: 650; margin-bottom: 4px; color: var(--ink); }
.chart-tooltip .tt-row { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; color: var(--muted); }
.chart-tooltip .tt-row > span { white-space: nowrap; flex: none; }
.chart-tooltip .tt-row b { color: var(--ink); font-weight: 650; text-align: right; }
.chart-tooltip .tt-key { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8125rem; color: var(--ink-2); margin: 4px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend i.line { height: 3px; border-radius: 2px; }

/* ---------- Energiefluss ---------- */
.flow { width: 100%; max-width: 560px; margin: 0 auto; }
.flow .node-bg { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.flow .node-ring { fill: none; stroke-width: 3; }
.flow .node-label { fill: var(--muted); font-size: 11px; font-weight: 600; }
.flow .node-value { fill: var(--ink); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.flow .node-sub { fill: var(--ink-2); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.flow .link { fill: none; stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
.flow .link-active { fill: none; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 9; animation: flow-dash 1.1s linear infinite; }
@keyframes flow-dash { to { stroke-dashoffset: -22; } }
.flow .soc-track { fill: var(--surface-3); }

.status-line { font-size: 1rem; line-height: 1.5; }
.status-icon { flex: none; margin-top: 3px; color: var(--accent); }
.age { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.age svg { width: 13px; height: 13px; }
.age.stale { color: var(--warn); font-weight: 600; }

.price-now { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-now .kpi-value { font-size: 2rem; }

.plan-lane-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8125rem; }

/* ---------- Assistent ---------- */
.wizard { max-width: 760px; margin: 0 auto; }
.wizard-progress { margin-bottom: 18px; }
.progress-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 8px 0 10px; }
.progress-bar > div { height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.steps { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; margin: 0; list-style: none; scrollbar-width: thin; }
.steps li { flex: none; }
.steps button {
  display: flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); font-size: 0.8125rem; font-weight: 600; color: var(--muted); cursor: pointer;
}
.steps button[disabled] { cursor: default; opacity: .6; }
.steps .num { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); font-size: 0.7rem; }
.steps .done .num { background: var(--ok); color: #fff; }
.steps .done .num svg { width: 12px; height: 12px; }
.steps [aria-current="step"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.steps [aria-current="step"] .num { background: var(--accent); color: var(--accent-ink); }
.wizard-foot {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 10;
  display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 0; background: linear-gradient(to top, var(--bg) 75%, transparent);
}
.wizard-foot .right { display: flex; gap: 8px; margin-left: auto; }
.wizard-foot > .row { flex-wrap: nowrap; gap: 2px; }
@media (max-width: 479px) {
  .wizard-foot .btn { padding: 0 12px; }
  .wizard-foot .btn-ghost { padding: 0 8px; }
}
body.no-nav .wizard-foot { bottom: 0; }
body.no-nav .content { padding-bottom: 24px; }
@media (min-width: 960px) { .wizard-foot { bottom: 0; } }
.test-result { margin-top: 12px; }
.detected { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 0.875rem; margin-top: 8px; }
.detected dt { color: var(--muted); }
.detected dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.help-box { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 0.875rem; color: var(--ink-2); }
.help-box ol, .help-box ul { margin: 6px 0 0; padding-left: 20px; }
.help-box summary { cursor: pointer; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; min-height: 32px; }
.help-box summary svg { width: 18px; height: 18px; }
.profile-diff { font-size: 0.8125rem; color: var(--ink-2); margin: 6px 0 0; padding-left: 18px; }

/* ---------- Anmeldung ---------- */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: min(420px, 100%); }
.auth-card .brand-mark { width: 48px; height: 48px; margin-bottom: 16px; }

/* ---------- Einstellungen ---------- */
.setting { display: grid; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting:first-of-type { border-top: 0; }
@media (min-width: 720px) { .setting { grid-template-columns: minmax(0, 1fr) 220px; gap: 4px 20px; align-items: start; } }
.setting-name { font-weight: 600; }
.setting-key { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.72rem; color: var(--muted); }
.setting-desc { font-size: 0.8125rem; color: var(--ink-2); }
.setting-default { font-size: 0.75rem; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.setting-changed .setting-name::after { content: "geändert"; margin-left: 8px; font-size: 0.68rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 99px; vertical-align: 2px; }
details.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; }
details.group > summary { list-style: none; cursor: pointer; padding: 14px 16px; display: flex; align-items: center; gap: 10px; font-weight: 650; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary .chev { margin-left: auto; transition: transform .15s ease; width: 18px; height: 18px; color: var(--muted); }
details.group[open] > summary .chev { transform: rotate(90deg); }
details.group > .group-body { padding: 0 16px 10px; }

.log-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.log-filters .select { width: auto; min-width: 160px; }
.log-values { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; font-size: 0.8125rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.log-day { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 16px 2px 6px; }

.more-grid { display: grid; gap: 10px; }
.more-grid a { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; font-weight: 600; min-height: 56px; }
.more-grid a svg { width: 20px; height: 20px; color: var(--ink-2); }
.more-grid a .chev { margin-left: auto; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .flow .link-active { animation: none; stroke-dasharray: none; }
  .spinner { animation: spin 2.5s linear infinite !important; animation-iteration-count: infinite !important; animation-duration: 2.5s !important; }
}

@media (forced-colors: active) {
  .switch input::after { background: CanvasText; }
  .btn-primary { border: 1px solid ButtonText; }
}

[data-page-title]:focus { outline: none; }
@media (max-width: 559px) {
  .list > li.list-actionable { flex-wrap: wrap; }
  .list > li.list-actionable .list-main { flex-basis: calc(100% - 48px); }
  .list > li.list-actionable .list-side { width: 100%; align-items: stretch; padding-left: 48px; }
}

/* Schema-Formulare: Hilfelinks und Erweitert */
.help-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; }
.help-link svg { flex: none; }
.schema-advanced > summary { color: var(--ink); }

/* ======================================================================
   Energiefluss (flow.js)
   ====================================================================== */
.flow-card { overflow: hidden; }
.flow-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 6px; }
.flow-kpi {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.flow-kpi-label { font-size: 0.72rem; color: var(--muted); font-weight: 600; line-height: 1.25; hyphens: manual; }
.flow-kpi-value { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.flow-kpi .badge { margin-top: 2px; align-self: flex-start; height: 20px; font-size: 0.68rem; padding: 0 7px; }
@media (max-width: 379px) { .flow-kpi { padding: 8px 9px; } .flow-kpi-value { font-size: 1rem; } }

.flow-wrap { width: 100%; max-width: 680px; margin: 0 auto; }
.flow-wrap svg.flow { width: 100%; height: auto; max-width: none; overflow: visible; }
.flow .flow-track { fill: none; stroke: var(--line); stroke-width: 7; stroke-linecap: round; opacity: .75; }
.flow .flow-track-off { stroke-dasharray: 2 8; stroke-width: 2; opacity: .6; }
.flow .flow-active { fill: none; stroke-width: 3; stroke-linecap: round; opacity: 0; transition: opacity .6s ease, stroke-width .6s ease; }
.flow .flow-active.is-on { opacity: .42; }
.flow .flow-dot { opacity: .95; }
.flow .flow-arrow { fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.flow .flow-node-bg { stroke: none; }
.flow .flow-node-ring { fill: none; stroke-width: 2; opacity: .55; }
.flow .flow-house .flow-node-ring { stroke-width: 2.5; opacity: .7; }
.flow .flow-house .flow-node-bg { filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--c-house) 22%, transparent)); }
.flow .flow-node-off { opacity: .42; }
.flow .flow-label { fill: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.flow .flow-value { fill: var(--ink); font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.flow .flow-value-lg { font-size: 20px; letter-spacing: -0.02em; }
.flow .flow-soc-text { font-size: 14px; }
.flow .flow-sub { fill: var(--ink-2); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.flow-wide .flow-label { font-size: 12px; }
.flow-wide .flow-value { font-size: 16px; }
.flow-wide .flow-value-lg { font-size: 23px; }
.flow-wide .flow-sub { font-size: 11.5px; }
.flow .flow-soc-track { fill: none; stroke: var(--surface-3); stroke-width: 5; }
.flow .flow-soc { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.7,.2,1); }
.flow .flow-rays line { stroke-width: 2.4; stroke-linecap: round; opacity: var(--sun, .5); transition: opacity .6s ease; }
.flow .flow-node-pv .flow-rays { transform-box: fill-box; transform-origin: center; animation: sun-breathe 5s ease-in-out infinite; }
@keyframes sun-breathe { 50% { opacity: .75; } }
.flow .flow-progress-track { fill: var(--surface-3); }
.flow .flow-progress-bar { transition: width .6s ease; }
.flow .flow-chip rect { fill: var(--surface-2); stroke: var(--line); }
.flow .flow-chip text { fill: var(--ink-2); font-size: 10.5px; font-weight: 650; }
.flow .flow-chip-arrow { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.flow .flow-chip-import { color: var(--warn); }
.flow .flow-chip-import rect { fill: var(--warn-soft); stroke: color-mix(in srgb, var(--warn) 35%, transparent); }
.flow .flow-chip-import text { fill: var(--warn); }
.flow .flow-chip-export { color: var(--ok); }
.flow .flow-chip-export rect { fill: var(--ok-soft); stroke: color-mix(in srgb, var(--ok) 35%, transparent); }
.flow .flow-chip-export text { fill: var(--ok); }
.flow .flow-chip-boost rect { fill: color-mix(in srgb, var(--c-hp) 16%, var(--surface)); stroke: color-mix(in srgb, var(--c-hp) 45%, transparent); }
.flow .flow-chip-boost text { fill: var(--ink); }
.flow .flow-chip-block rect { fill: var(--danger-soft); stroke: color-mix(in srgb, var(--danger) 35%, transparent); }
.flow .flow-chip-block text { fill: var(--danger); }
.flow .flow-chip-auto rect { fill: var(--info-soft); stroke: color-mix(in srgb, var(--info) 30%, transparent); }
.flow .flow-chip-auto text { fill: var(--info); }
.flow-status {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 4px; padding: 12px 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 40%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.flow-status-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1); }
.flow-status-text { font-size: 0.95rem; line-height: 1.5; color: var(--ink); font-weight: 500; }
@media (prefers-reduced-motion: reduce) {
  .flow .flow-node-pv .flow-rays { animation: none !important; }
}

/* ======================================================================
   Einrichtungsassistent (wizard.js, wizard-ui.js)
   ====================================================================== */
.wizard2 { max-width: 1080px; margin: 0 auto; }
.wizard2 .wizard-aside { display: none; }
.wizard-main { min-width: 0; }
@media (min-width: 960px) {
  .wizard2 { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 28px; align-items: start; }
  .wizard2 .wizard-aside { display: block; position: sticky; top: calc(var(--top-h) + 16px); }
  .wizard2 .wizard-mobilebar { display: none; }
}
.wizard-aside-head { padding: 4px 6px 14px; }
.wizard-aside-title { font-weight: 700; font-size: 1.05rem; }
.wizard-aside .progress-bar { margin: 10px 0 6px; }

.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.stepper li { position: relative; }
.stepper li + li::before { content: ""; position: absolute; left: 20px; top: -6px; height: 10px; width: 2px; background: var(--line); border-radius: 2px; }
.stepper-item {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%;
  padding: 8px 8px 8px 6px; border: 0; border-radius: 12px; background: transparent; text-align: left; cursor: pointer; color: var(--ink);
  transition: background-color .15s ease;
}
.stepper-item:hover:not([disabled]) { background: var(--surface-2); }
.stepper-item[disabled] { cursor: default; opacity: .55; }
.stepper-item.is-current { background: var(--accent-soft); }
.stepper-dot {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: .8rem; font-weight: 700;
  background: var(--surface); border: 2px solid var(--line-strong); color: var(--muted); font-variant-numeric: tabular-nums;
}
.stepper-item.is-done .stepper-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.stepper-item.is-current .stepper-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.stepper-text { display: flex; flex-direction: column; min-width: 0; }
.stepper-title { font-weight: 650; font-size: .9rem; line-height: 1.25; }
.stepper-sub { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper-state { font-size: .68rem; font-weight: 650; color: var(--muted); }
.stepper-state.is-done { color: var(--ok); }
.stepper-state.is-current { color: var(--accent); }

.wizard-mobilebar {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top)); z-index: 12; margin: -16px -16px 12px; padding: 10px 16px 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.wizard-mobilebar .progress-bar { margin: 8px -16px 0; height: 4px; border-radius: 0; }
.wizard-mobile-count { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; font-size: .92rem; }
.wizard-mobile-count strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wizard-mobile-count .muted { font-size: .74rem; }
.wizard-mobile-steps { position: relative; flex: none; }
.wizard-mobile-steps > summary {
  list-style: none; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: .85rem; cursor: pointer;
}
.wizard-mobile-steps > summary::-webkit-details-marker { display: none; }
.wizard-mobile-menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: min(320px, calc(100vw - 32px)); max-height: 70vh; overflow: auto;
  padding: 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2);
}

.step-hero { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: center; margin: 4px 0 16px; }
@media (min-width: 640px) { .step-hero { grid-template-columns: 150px minmax(0, 1fr); gap: 22px; margin-bottom: 20px; } }
.step-hero-art { border-radius: 20px; background: linear-gradient(160deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 30%, var(--surface))); border: 1px solid color-mix(in srgb, var(--accent) 16%, transparent); }
.step-eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.step-hero h1 { font-size: 1.3rem; margin: 2px 0 4px; }
@media (min-width: 640px) { .step-hero h1 { font-size: 1.75rem; } }
.step-why { color: var(--ink-2); font-size: .9rem; line-height: 1.45; }
.step-duration { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: .75rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); }
.step-skip { display: inline-flex; align-items: center; gap: 2px; height: 24px; padding: 0 8px; border: 0; background: none; color: var(--accent); font-weight: 650; font-size: .8rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 479px) { .step-hero .step-why { font-size: .84rem; } }

/* Motive */
.motif { width: 100%; height: auto; display: block; }
.motif .m-halo { fill: color-mix(in srgb, var(--surface) 60%, transparent); }
.motif .m-card { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.motif .m-screen { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.5; }
.motif .m-line { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }
.motif .m-line-fill { fill: var(--line-strong); }
.motif .m-accent-fill { fill: var(--accent); }
.motif .m-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 3; }
.motif .m-step { fill: none; stroke: var(--c-house); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.motif .m-sun { fill: var(--c-pv); }
.motif .m-sun-rays { fill: none; stroke: var(--c-pv); stroke-width: 2.5; stroke-linecap: round; }
.motif .m-panel { fill: color-mix(in srgb, var(--c-house) 70%, var(--surface)); stroke: var(--c-house); stroke-width: 1.5; stroke-linejoin: round; }
.motif .m-cable { fill: none; stroke: var(--ink-2); stroke-width: 2.5; stroke-linecap: round; }
.motif .m-wheel { fill: var(--ink-2); }
.motif .m-wave { fill: none; stroke: var(--c-hp); stroke-width: 2.5; stroke-linecap: round; opacity: .8; }
.motif .m-track { fill: none; stroke: var(--surface-3); stroke-width: 10; stroke-linecap: round; }
.motif .m-arc { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; }
.motif .m-needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.motif .m-check { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.motif .m-ink { stroke: var(--ink-2); }
.motif .m-accent { stroke: var(--accent); }
.motif .m-on-accent { stroke: var(--accent-ink); }
.motif .m-muted { stroke: var(--muted); }

/* Schrittwechsel */
.wizard-body.step-in-fwd { animation: step-in-fwd .28s cubic-bezier(.2,.7,.2,1); }
.wizard-body.step-in-back { animation: step-in-back .28s cubic-bezier(.2,.7,.2,1); }
@keyframes step-in-fwd { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }
@keyframes step-in-back { from { opacity: 0; transform: translate3d(0, -10px, 0); } to { opacity: 1; transform: none; } }
.wizard2 .card { padding: 18px; }
@media (min-width: 640px) { .wizard2 .card { padding: 22px; } }
.wizard2 .wizard-foot { margin-top: 18px; padding: 12px 0 14px; }
@media (min-width: 960px) {
  .wizard2 .wizard-foot { padding: 12px 16px; bottom: 12px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow-2); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
}
.section-label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); margin: 16px 0 8px; padding: 0; }
.tile-fieldset > .section-label { margin-top: 0; }
.card-title { font-size: 1.05rem; margin-bottom: 12px; }

/* Kacheln */
.tile-fieldset { margin-bottom: 6px; }
.tile-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.tile-grid-lg { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.tile-grid-wish { margin-top: 10px; }
.tile {
  position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink); font: inherit; min-height: 76px; width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.tile:hover:not(.is-disabled) { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.tile-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.tile:has(.tile-input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.tile:has(.tile-input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.tile.is-disabled { cursor: not-allowed; opacity: .55; }
.tile-check { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); opacity: 0; transform: scale(.6); transition: opacity .15s ease, transform .15s ease; }
.tile:has(.tile-input:checked) .tile-check { opacity: 1; transform: none; }
.tile-mono {
  flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px;
  font-weight: 800; font-size: .95rem; letter-spacing: -.02em; color: var(--ink);
  background: color-mix(in srgb, var(--tone) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--tone) 35%, transparent);
}
.tile-mono svg { color: var(--tone); }
.tone-accent { --tone: var(--accent); } .tone-grid { --tone: var(--c-grid); } .tone-pv { --tone: var(--c-pv); } .tone-car { --tone: var(--c-car); }
.tone-hp { --tone: var(--c-hp); } .tone-house { --tone: var(--c-house); } .tone-battery { --tone: var(--c-battery); } .tone-neutral { --tone: var(--muted); }
.tile-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding-right: 22px; }
.tile-title { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tile-desc { font-size: .8rem; color: var(--ink-2); line-height: 1.4; }
.tile-dashed { border-style: dashed; background: transparent; }
.tile-dashed:hover { background: var(--surface-2); }
.tile-art { flex: none; width: 108px; }
.tile-grid-lg .tile { flex-direction: column; }
.tile-grid-lg .tile-art { width: 100%; max-width: 170px; padding: 4px 0; }
.choice-art { width: 100%; height: auto; display: block; }
.choice-art .m-card { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1.5; }
.choice-art .m-screen { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.choice-art .m-line { fill: none; stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }
.choice-art .tone-hp-fill { fill: var(--c-hp); }
.choice-art .tone-block-fill { fill: var(--danger); }
.choice-art .m-arrow { fill: none; stroke: var(--c-hp); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.choice-art .m-lock { fill: none; stroke: var(--danger); stroke-width: 4; stroke-linecap: round; }

/* Anmeldekarte */
.oauth-card {
  display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent-soft) 85%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.oauth-card.is-connected { background: linear-gradient(145deg, var(--ok-soft), var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.oauth-head { display: flex; gap: 12px; align-items: flex-start; }
.oauth-badge { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; flex: none; background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1); }
.oauth-card.is-connected .oauth-badge { color: var(--ok); }
.oauth-title { font-weight: 700; font-size: 1.02rem; }
.oauth-sub { font-size: .85rem; color: var(--ink-2); }
.oauth-scopes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .85rem; }
.oauth-scopes li { display: flex; gap: 8px; align-items: center; }
.oauth-scopes svg { color: var(--accent); flex: none; }
.oauth-secure { display: flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--muted); }
.oauth-secure svg { flex: none; }
.oauth-or { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.oauth-or::before, .oauth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Formulare im Assistenten */
.wizard2 .schema-form { display: grid; gap: 2px; padding: 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.wizard2 .schema-form .schema-form { padding: 0; background: none; border: 0; }
.wizard2 .schema-form:empty { display: none; }
.wizard2 .schema-form .field { margin-bottom: 12px; }
.wizard2 .schema-form .hint { color: var(--muted); font-size: .78rem; }
.wizard2 .schema-advanced { background: var(--surface); margin: 4px 0 0; }
.wizard2 .array-item { background: var(--surface); border-radius: 16px; padding: 16px; }
.pv-card .array-item-head { gap: 10px; }
.pv-card-visual { margin-left: auto; margin-right: 4px; width: 96px; flex: none; }
.roof-sketch { width: 96px; height: 56px; display: block; }
.roof-sketch .roof-ground { stroke: var(--line-strong); stroke-width: 2; stroke-linecap: round; }
.roof-sketch .roof-wall { fill: color-mix(in srgb, var(--c-house) 10%, var(--surface)); stroke: var(--line-strong); stroke-width: 1.5; stroke-linejoin: round; }
.roof-sketch .roof-panel { stroke: var(--c-house); stroke-width: 5; stroke-linecap: round; }
.roof-sketch .roof-arc { fill: none; stroke: var(--c-pv); stroke-width: 2; }
.roof-sketch .roof-label { fill: var(--ink-2); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Verbindungstest */
.test-card { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.test-card.is-ok { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.test-card.is-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.test-card.is-error { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.test-head { display: flex; gap: 12px; align-items: flex-start; }
.test-head-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; background: var(--surface-2); color: var(--muted); }
.test-card.is-ok .test-head-icon { background: var(--ok-soft); color: var(--ok); }
.test-card.is-warn .test-head-icon { background: var(--warn-soft); color: var(--warn); }
.test-card.is-error .test-head-icon { background: var(--danger-soft); color: var(--danger); }
.test-card.is-running .test-head-icon { background: var(--accent-soft); color: var(--accent); }
.test-title { font-weight: 700; }
.test-sub { font-size: .85rem; color: var(--ink-2); }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; padding: 7px 8px; border-radius: 10px; transition: background-color .2s ease; }
.check-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; border: 2px solid var(--line-strong); color: #fff; margin-top: 1px; transition: background-color .2s ease, border-color .2s ease; }
.check-mark .spinner { width: 14px; height: 14px; color: var(--accent); }
.check-body { display: flex; flex-direction: column; min-width: 0; }
.check-label { font-weight: 600; font-size: .9rem; }
.check-note { font-size: .82rem; line-height: 1.4; }
.check-row.is-pending .check-label, .check-row.is-skipped .check-label { color: var(--muted); font-weight: 500; }
.check-row.is-skipped .check-mark { border-style: dashed; }
.check-row.is-active .check-mark { border-color: var(--accent); }
.check-row.is-done .check-mark { background: var(--ok); border-color: var(--ok); animation: check-pop .25s ease; }
.check-row.is-warn { background: var(--warn-soft); }
.check-row.is-warn .check-mark { background: var(--warn); border-color: var(--warn); }
.check-row.is-warn .check-note, .check-row.is-error .check-note { color: var(--ink); }
.check-row.is-error { background: var(--danger-soft); }
.check-row.is-error .check-mark { background: var(--danger); border-color: var(--danger); }
@keyframes check-pop { from { transform: scale(.6); } to { transform: none; } }
.test-extra { border-top: 1px solid var(--line); padding-top: 10px; }
.fact-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.fact-chip { display: inline-flex; flex-direction: column; padding: 6px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.fact-key { font-size: .68rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fact-val { font-size: .88rem; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Gerätekarten, Funktions-Chips */
.device-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.device-card { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.device-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, var(--surface)); }
.device-text { min-width: 0; }
.device-model { font-weight: 700; }
.device-meta { font-size: .8rem; color: var(--ink-2); }
.device-serial { font-size: .72rem; color: var(--muted); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.device-online { position: absolute; top: 12px; right: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.device-online.is-on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.device-online.is-off { background: var(--danger); }
.feature-chips { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); }
.feature-chip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.feature-chip > span { display: flex; flex-direction: column; min-width: 0; }
.feature-chip svg { flex: none; margin-top: 2px; }
.feature-chip.is-ok { background: color-mix(in srgb, var(--ok-soft) 70%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.feature-chip.is-ok svg { color: var(--ok); }
.feature-chip.is-off svg { color: var(--muted); }
.feature-chip-name { font-weight: 650; font-size: .88rem; }
.feature-chip-state { font-size: .76rem; color: var(--ink-2); }

/* Nacht-Preisdiagramm */
.nights-chart-wrap { margin-top: 6px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.nights-chart { width: 100%; height: auto; display: block; }
.nights-chart .night-bar { fill: var(--line-strong); transition: fill .2s ease; }
.nights-chart .night-bar.is-ok { fill: var(--c-cheap); }
.nights-chart .night-label { fill: var(--muted); font-size: 11px; }
.nights-chart .night-threshold { stroke: var(--c-car); stroke-width: 2; stroke-dasharray: 5 4; }
.nights-chart .night-threshold-label { fill: var(--ink-2); font-size: 11px; font-weight: 650; }

/* Zusammenfassung */
.schema { display: flex; flex-direction: column; align-items: center; }
.schema-hub {
  display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-radius: 16px; position: relative;
  background: color-mix(in srgb, var(--c-house) 12%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--c-house) 40%, transparent);
}
.schema-hub > span:last-child { display: flex; flex-direction: column; line-height: 1.2; }
.schema-hub-icon { color: var(--c-house); display: grid; }
.schema-hub::after { content: ""; position: absolute; left: 50%; top: 100%; width: 2px; height: 18px; background: var(--line-strong); }
.schema-grid { list-style: none; margin: 18px 0 0; padding: 18px 0 0; width: 100%; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); border-top: 2px solid var(--line-strong); }
.schema-node { position: relative; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line); }
.schema-node::before { content: ""; position: absolute; left: 50%; bottom: 100%; width: 2px; height: 11px; background: var(--line-strong); }
.schema-node.is-ok { border-color: color-mix(in srgb, var(--tone) 45%, var(--line)); }
.schema-node-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, var(--surface)); }
.schema-node-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.schema-label { font-weight: 650; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.schema-sub { font-size: .74rem; color: var(--muted); }
.schema-state { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; }
.schema-state.is-ok { background: var(--ok); color: #fff; }
.schema-state.is-open { background: var(--warn-soft); color: var(--warn); }
.schema-state.is-none { background: var(--surface-2); color: var(--muted); }
.start-card { background: linear-gradient(150deg, var(--accent-soft), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.start-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); }
.btn-start { min-height: 58px !important; font-size: 1.05rem !important; border-radius: 14px; box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 35%, transparent); }

@media (prefers-reduced-motion: reduce) {
  .wizard-body.step-in-fwd, .wizard-body.step-in-back { animation: none !important; }
  .check-row.is-done .check-mark { animation: none !important; }
}
.step-hero-text { min-width: 0; }
.step-hero-text .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 959px) { .step-eyebrow { display: none; } }
.nights-chart { max-width: 460px; margin: 0 auto; }
