/* ============================================================
   PV Energie — Tesla-App Redesign
   Zwei Modi: Handy (Bottom-Nav, eine Spalte)
              Desktop ≥960px (Seitenleiste + Grid-Layout)
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #000000;
  --panel: #0f0f11;
  --panel-2: #17171a;
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.13);
  --text: #f5f5f7;
  --sub: #6e6e73;
  --sub-2: #aeaeb2;

  --solar: #f4d03f;
  --battery: #30d158;
  --grid: #aeaeb2;
  --home: #ffffff;
  --ev: #0a84ff;
  --red: #ff453a;

  --nav-h: 64px;
  --rail-w: 224px;
  --r-card: 20px;
  --ease: cubic-bezier(.22,.61,.36,1);
  --spring: cubic-bezier(.34,1.4,.44,1);
}

html, body {
  background: var(--bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  min-height: 100%;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body { overscroll-behavior-y: none; }
::selection { background: rgba(10,132,255,.35); }
canvas { display: block; }

/* Monochrome Linien-Icons */
.ic { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ── APP-SHELL ── */
.app {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  background: radial-gradient(120% 50% at 50% -8%, #121216 0%, #000 55%) fixed;
}
.views {
  position: relative;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 24px);
}

/* ── VIEWS + Übergänge (gestaffeltes Einblenden) ── */
.view { display: none; }
.view.active { display: block; }
.view.active > * { animation: rise .55s var(--ease) backwards; }
.view.active > *:nth-child(1) { animation-delay: .02s; }
.view.active > *:nth-child(2) { animation-delay: .07s; }
.view.active > *:nth-child(3) { animation-delay: .12s; }
.view.active > *:nth-child(4) { animation-delay: .17s; }
.view.active > *:nth-child(5) { animation-delay: .22s; }
.view.active > *:nth-child(6) { animation-delay: .27s; }
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* ── TOPBAR ── */
.topbar {
  padding: calc(env(safe-area-inset-top, 0px) + 22px) 20px 4px;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.topbar-title { font-size: 1.75rem; font-weight: 300; letter-spacing: -0.03em; line-height: 1; }
.topbar-sub { font-size: 0.72rem; color: var(--sub); margin-top: 7px; letter-spacing: .01em; }

.ampel-pill, .conn-pill {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
  background: rgba(23,23,26,.72); border: 1px solid var(--line-2); border-radius: 22px;
  padding: 8px 13px; font-size: 0.72rem; font-weight: 500; color: var(--sub-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); margin-top: 3px;
  transition: border-color .4s;
}
.ampel-dot, .conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sub); transition: background .4s, box-shadow .4s; }
.ampel-pill.is-green  .ampel-dot { background: var(--battery); box-shadow: 0 0 10px var(--battery); }
.ampel-pill.is-yellow .ampel-dot { background: var(--solar);   box-shadow: 0 0 10px var(--solar); }
.ampel-pill.is-red    .ampel-dot { background: var(--red);     box-shadow: 0 0 10px var(--red); }
.ampel-pill.is-blue   .ampel-dot { background: var(--ev);      box-shadow: 0 0 10px var(--ev); }
.ampel-pill.is-green  #ampelLabel, .ampel-pill.is-green  #evStatusLabel { color: var(--battery); }
.ampel-pill.is-yellow #ampelLabel, .ampel-pill.is-yellow #evStatusLabel { color: var(--solar); }
.ampel-pill.is-red    #ampelLabel, .ampel-pill.is-red    #evStatusLabel { color: var(--red); }
.ampel-pill.is-blue   #evStatusLabel { color: var(--ev); }

.conn-dot.live { background: var(--battery); box-shadow: 0 0 10px var(--battery); }
.conn-dot.err  { background: var(--red);     box-shadow: 0 0 10px var(--red); }
.conn-dot.demo { background: var(--solar);   box-shadow: 0 0 10px var(--solar); }

/* ── POWER RING ── */
.ring-section { padding: 20px 20px 0; display: flex; justify-content: center; }
.ring-wrap { position: relative; width: min(230px, 60vw); aspect-ratio: 1; }
.ring-wrap::before {
  content: ""; position: absolute; inset: 14%; border-radius: 50%;
  background: radial-gradient(circle, rgba(244,208,63,.07), transparent 68%);
  pointer-events: none;
}
.ring-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.ring-kw { font-size: clamp(2.3rem, 10vw, 2.8rem); font-weight: 200; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-unit { font-size: 0.6rem; color: var(--sub); margin-top: 7px; text-transform: uppercase; letter-spacing: 0.14em; }

/* ── FLOW DIAGRAM ── */
.flow-section { padding: 14px 14px 0; }
.flow-canvas-wrap { position: relative; width: 100%; height: 280px; }
#flowCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.fnode { position: absolute; display: flex; flex-direction: column; align-items: center; transform: translate(-50%,-50%); z-index: 2; }
.fnode-ring {
  width: 72px; height: 72px; border-radius: 50%;
  border: 1px solid var(--line-2);
  background: radial-gradient(circle at 50% 30%, #1b1b1f, #0b0b0d);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: box-shadow .5s var(--ease), border-color .5s var(--ease), transform .5s var(--ease);
}
.fnode-ring.big { width: 88px; height: 88px; }
.fnode-ring .ic { width: 21px; height: 21px; color: #e6e6ea; }
.fnode-ring.big .ic { width: 26px; height: 26px; }
.fnode-ring.glow-solar   { box-shadow: 0 0 26px -4px var(--solar);   border-color: rgba(244,208,63,.4); }
.fnode-ring.glow-battery { box-shadow: 0 0 26px -4px var(--battery); border-color: rgba(48,209,88,.4); }
.fnode-ring.glow-ev      { box-shadow: 0 0 26px -4px var(--ev);      border-color: rgba(10,132,255,.4); }
.fnode-ring.glow-red     { box-shadow: 0 0 26px -4px var(--red);     border-color: rgba(255,69,58,.4); }
.fnode-kw { font-size: 0.64rem; font-weight: 600; font-variant-numeric: tabular-nums; }
#fkw-solar { color: var(--solar); }
#fkw-home  { color: #fff; }
#fkw-bat   { color: var(--battery); }
#fkw-grid  { color: var(--sub-2); transition: color .4s; }
.fnode-ring.glow-red #fkw-grid { color: var(--red); }
#fkw-ev    { color: var(--ev); }
.fnode-name { font-size: 0.6rem; color: var(--sub); margin-top: 8px; letter-spacing: 0.05em; white-space: nowrap; text-transform: uppercase; }

/* ── KARTEN-GRUNDSTIL ── */
.seg, .stat-tile, .control-card, .history-card, .set-card, .today-items, .car-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

/* ── SEGMENT CARDS ── */
.segments { padding: 22px 16px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.seg { padding: 16px; transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.seg:active { transform: scale(.98); }
.seg-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.seg-icon { width: 19px; height: 19px; }
.seg--solar .seg-icon { color: var(--solar); }
.seg--bat   .seg-icon { color: var(--battery); }
.seg--home  .seg-icon { color: #e6e6ea; }
.seg--ev    .seg-icon { color: var(--ev); }
.seg-badge { font-size: 0.56rem; font-weight: 600; padding: 3px 9px; border-radius: 8px; letter-spacing: 0.04em; text-transform: uppercase; background: var(--panel-2); color: var(--sub-2); }
.seg--solar .seg-badge { background: rgba(244,208,63,.12); color: var(--solar); }
.seg--bat   .seg-badge { background: rgba(48,209,88,.12);  color: var(--battery); }
.seg--ev    .seg-badge { background: rgba(10,132,255,.12); color: var(--ev); }
.seg-val { font-size: 1.55rem; font-weight: 300; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.seg--solar .seg-val { color: var(--solar); }
.seg--bat   .seg-val { color: var(--battery); }
.seg--home  .seg-val { color: #fff; }
.seg--ev    .seg-val { color: var(--ev); }
.seg-unit { font-size: 0.62rem; color: var(--sub); margin-left: 4px; }
.seg-lbl { font-size: 0.62rem; color: var(--sub); margin-top: 6px; }
.seg-bar { height: 3px; border-radius: 2px; background: var(--panel-2); margin-top: 12px; overflow: hidden; }
.seg-fill { height: 100%; border-radius: 2px; transition: width 1.2s var(--ease); }
.seg--solar .seg-fill { background: var(--solar); }
.seg--bat   .seg-fill { background: var(--battery); }
.seg--home  .seg-fill { background: #fff; }
.seg--ev    .seg-fill { background: var(--ev); }

/* ── LADEMODUS ── */
.control-section { padding: 18px 16px 0; }
.control-card { padding: 16px; transition: border-color .3s; }
.control-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 13px; }
.control-title { font-size: 0.8rem; font-weight: 500; }
.control-now { font-size: 0.74rem; font-weight: 600; color: var(--ev); }
.segmented {
  position: relative; display: grid; grid-template-columns: repeat(4,1fr);
  background: #0a0a0b; border: 1px solid var(--line); border-radius: 13px; padding: 4px; user-select: none;
}
.seg-highlight {
  position: absolute; top: 4px; bottom: 4px; width: calc(25% - 8px); left: 4px;
  background: var(--ev); border-radius: 10px;
  box-shadow: 0 4px 16px -4px var(--ev);
  transition: left .38s var(--spring), background .25s, box-shadow .25s;
}
.segmented.m-off   .seg-highlight { background: #48484c; box-shadow: none; }
.segmented.m-pv    .seg-highlight { background: var(--battery); box-shadow: 0 4px 16px -4px var(--battery); }
.segmented.m-minpv .seg-highlight { background: var(--ev);      box-shadow: 0 4px 16px -4px var(--ev); }
.segmented.m-now   .seg-highlight { background: var(--solar);   box-shadow: 0 4px 16px -4px var(--solar); }
.segbtn {
  position: relative; z-index: 1; background: none; border: none; cursor: pointer;
  padding: 11px 4px; border-radius: 10px; font: inherit; font-size: 0.74rem; font-weight: 500;
  color: var(--sub-2); transition: color .25s;
}
.segbtn.active { color: #fff; }
.segmented.m-now .segbtn.active { color: #1a1400; }
.mode-hint { font-size: 0.66rem; color: var(--sub); margin-top: 12px; text-align: center; letter-spacing: .02em; }

/* ── FAHRZEUG ── */
.car-section { padding: 22px 16px 0; }
.car-card {
  position: relative; overflow: hidden;
  padding: 30px 22px 22px; text-align: center;
  border-radius: 24px;
}
.car-card::before {
  content: ""; position: absolute; left: -20%; right: -20%; top: -50%; height: 110%;
  background: radial-gradient(55% 55% at 50% 45%, rgba(10,132,255,.16), transparent 70%);
  opacity: 0; transition: opacity .9s var(--ease); pointer-events: none;
}
.car-card.charging::before { opacity: 1; }
.car-hero { width: min(230px, 68%); color: #e8e8ec; }
.car-hero path, .car-hero circle { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.car-bolt {
  position: absolute; top: 18px; right: 18px; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(10,132,255,.14); border: 1px solid rgba(10,132,255,.3);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.5); transition: opacity .4s, transform .45s var(--spring);
}
.car-bolt .ic { width: 15px; height: 15px; color: var(--ev); }
.car-card.charging .car-bolt { opacity: 1; transform: none; animation: boltPulse 2.2s infinite; }
@keyframes boltPulse {
  0%   { box-shadow: 0 0 0 0 rgba(10,132,255,.35); }
  70%  { box-shadow: 0 0 0 10px rgba(10,132,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(10,132,255,0); }
}
.car-soc { font-size: clamp(3rem, 12vw, 3.6rem); font-weight: 200; letter-spacing: -0.04em; line-height: 1; margin-top: 12px; font-variant-numeric: tabular-nums; }
.car-soc-unit { font-size: 1.3rem; color: var(--sub-2); margin-left: 4px; font-weight: 300; }
.car-range { font-size: 0.78rem; color: var(--sub-2); margin-top: 5px; }
.car-bar { position: relative; height: 10px; border-radius: 6px; background: var(--panel-2); margin-top: 20px; }
.car-bar-fill { position: relative; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #0a84ff, #4fabff); transition: width 1.2s var(--ease); overflow: hidden; }
.car-card.charging .car-bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  animation: shimmer 2.4s var(--ease) infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.car-bar-target { position: absolute; top: -3px; width: 2px; height: 16px; background: #fff; border-radius: 2px; box-shadow: 0 0 8px rgba(255,255,255,.6); transition: left 1.2s var(--ease); }
.car-bar-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.6rem; color: var(--sub); }
.car-bar-legend span:nth-child(2) { color: var(--sub-2); }

/* ── STAT GRID (Fahrzeug-Kacheln) ── */
.stat-grid { padding: 18px 16px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-tile { padding: 16px; transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
.stat-icon { width: 19px; height: 19px; color: var(--sub-2); }
.stat-val { font-size: 1.45rem; font-weight: 300; letter-spacing: -0.03em; margin-top: 10px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-val span { font-size: 0.62rem; color: var(--sub); margin-left: 4px; }
.stat-lbl { font-size: 0.62rem; color: var(--sub); margin-top: 7px; }

/* ── TODAY ── */
.today-row { padding: 20px 16px 0; }
.today-title { font-size: 0.68rem; color: var(--sub); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500; margin-bottom: 12px; padding-left: 4px; }
.today-items { display: flex; overflow: hidden; }
.today-item { flex: 1; padding: 17px 8px; border-right: 1px solid var(--line); text-align: center; }
.today-item:last-child { border-right: none; }
.today-item-val { font-size: 1.15rem; font-weight: 300; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.today--gen .today-item-val, .today--exp .today-item-val { color: var(--solar); }
.today--imp .today-item-val { color: var(--red); }
.today--ev  .today-item-val { color: var(--ev); }
.today-item-unit { font-size: 0.55rem; color: var(--sub); margin-left: 3px; }
.today-item-lbl { font-size: 0.56rem; color: var(--sub); margin-top: 5px; letter-spacing: 0.02em; }

/* ── HISTORY ── */
.history-section { padding: 18px 16px 0; }
.history-card { padding: 18px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.history-title { font-size: 0.8rem; font-weight: 500; }
.history-legend { display: flex; gap: 12px; }
.history-legend span { display: flex; align-items: center; gap: 5px; font-size: 0.58rem; color: var(--sub); }
.history-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
#histCanvas { width: 100%; height: 150px; display: block; }

.kpi-card { display: flex; align-items: center; padding: 18px 10px; }
.kpi { flex: 1; text-align: center; }
.kpi-val { font-size: 1.35rem; font-weight: 300; letter-spacing: -0.02em; color: var(--sub-2); font-variant-numeric: tabular-nums; }
.kpi-val--green { color: var(--battery); }
.kpi-lbl { font-size: 0.58rem; color: var(--sub); margin-top: 6px; }
.kpi-div { width: 1px; align-self: stretch; background: var(--line); margin: 4px 0; }

/* ── SETTINGS ── */
.set-section { padding: 20px 16px 0; }
.set-label { font-size: 0.68rem; color: var(--sub); text-transform: uppercase; letter-spacing: 0.12em; font-weight: 500; margin-bottom: 10px; padding-left: 4px; }
.set-card { padding: 6px 16px; }
.set-field { padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-field:last-child { border-bottom: none; }
.set-field label { display: block; font-size: 0.74rem; color: var(--sub-2); margin-bottom: 9px; font-weight: 500; }
.set-tag { font-size: 0.54rem; font-weight: 600; color: var(--ev); background: rgba(10,132,255,.14); padding: 2px 7px; border-radius: 6px; margin-left: 6px; letter-spacing: .03em; vertical-align: middle; }
.set-tag-g { color: var(--battery); background: rgba(48,209,88,.14); }
.set-field input {
  width: 100%; background: #0a0a0b; border: 1px solid var(--line-2); border-radius: 12px;
  padding: 12px 13px; color: #fff; font: inherit; font-size: 0.82rem; outline: none;
  transition: border-color .25s, box-shadow .25s;
}
.set-field input::placeholder { color: #56565c; }
.set-field input:focus { border-color: var(--ev); box-shadow: 0 0 0 3px rgba(10,132,255,.16); }
.set-hint { font-size: 0.62rem; color: var(--sub); margin-top: 8px; line-height: 1.4; }

.set-row { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: none; }
.set-row.segrow { padding: 14px 0; }
.set-name { font-size: 0.82rem; color: #fff; font-weight: 500; }
.set-name .set-sub, .set-sub { font-size: 0.64rem; color: var(--sub); font-weight: 400; margin-left: 6px; }

.segmented.mini { width: 168px; grid-template-columns: 1fr 1fr; }
.segmented.mini .segbtn { padding: 8px 4px; font-size: 0.72rem; }
.segmented.mini .seg-highlight { width: calc(50% - 8px); }
.segmented.mini.p-true  .seg-highlight { left: 4px; background: var(--battery); box-shadow: 0 4px 12px -4px var(--battery); }
.segmented.mini.p-false .seg-highlight { left: 50%; background: var(--ev); box-shadow: 0 4px 12px -4px var(--ev); }

/* Schalter */
.switch { position: relative; display: inline-block; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: #2c2c2e; border-radius: 16px; transition: background .3s var(--ease); }
.switch-track::before { content: ""; position: absolute; height: 26px; width: 26px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .32s var(--spring); box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.switch input:checked + .switch-track { background: var(--battery); }
.switch input:checked + .switch-track::before { transform: translateX(20px); }

.set-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.btn { padding: 14px; border-radius: 13px; border: none; font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer; transition: transform .18s var(--spring), opacity .2s, background .25s, box-shadow .25s; }
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--ev); color: #fff; box-shadow: 0 6px 20px -8px var(--ev); }
.btn-ghost { background: var(--panel-2); color: var(--sub-2); border: 1px solid var(--line-2); }
.btn.ok { background: var(--battery); color: #04210f; box-shadow: 0 6px 20px -8px var(--battery); }
.set-result { font-size: 0.72rem; color: var(--sub-2); margin-top: 12px; text-align: center; min-height: 1em; line-height: 1.5; transition: color .3s; }
.set-result.ok { color: var(--battery); }
.set-result.err { color: var(--red); }

.info-card { padding: 4px 16px; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 0.78rem; }
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--sub); }
.info-row b { font-weight: 500; color: #fff; text-align: right; }
.set-foot { text-align: center; font-size: 0.62rem; color: var(--sub); padding: 28px 0 8px; }

/* ── NAVIGATION (Handy: Bottom-Bar) ── */
.bnav {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 50;
  display: flex; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(8,8,10,.72);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-top: 1px solid var(--line);
}
.bnav-brand { display: none; }
.bnav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: none; border: none; cursor: pointer; color: var(--sub); padding: 0;
  transition: color .25s var(--ease);
}
.bnav-icon { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--spring); }
.bnav-lbl { font-size: 0.6rem; letter-spacing: 0.02em; font-weight: 500; }
.bnav-item.active { color: #fff; }
.bnav-item.active .bnav-icon { transform: translateY(-1px) scale(1.08); }
.bnav-item:active .bnav-icon { transform: scale(.88); }

/* ── Fokus-Zustände ── */
:focus-visible { outline: 2px solid rgba(10,132,255,.6); outline-offset: 2px; border-radius: 8px; }

/* ============================================================
   TABLET (600–959px): breitere Spalte, gleiche Struktur
   ============================================================ */
@media (min-width: 600px) and (max-width: 959px) {
  .app, .bnav { max-width: 560px; }
}

/* ============================================================
   DESKTOP (≥960px): Seitenleiste + Grid-Layout
   ============================================================ */
@media (min-width: 960px) {
  body { background: #000; }
  .app {
    max-width: none; margin: 0;
    padding-left: var(--rail-w);
    background: radial-gradient(70% 42% at 55% -8%, #111116 0%, #000 60%) fixed;
  }
  .views { max-width: 1200px; margin: 0 auto; padding: 4px 44px 52px; }

  /* Seitenleiste */
  .bnav {
    left: 0; top: 0; bottom: 0; transform: none;
    width: var(--rail-w); max-width: none; height: 100vh;
    flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 4px;
    padding: 22px 14px;
    border-top: none; border-right: 1px solid var(--line);
    background: rgba(6,6,8,.85);
  }
  .bnav-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px 26px; color: #fff;
    font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em;
  }
  .bnav-logo { width: 22px; height: 22px; fill: var(--solar); stroke: none; filter: drop-shadow(0 0 8px rgba(244,208,63,.5)); }
  .bnav-item {
    flex: 0 0 auto; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 12px 14px; border-radius: 12px;
    transition: color .25s, background .25s;
  }
  .bnav-item:hover { color: var(--sub-2); background: rgba(255,255,255,.04); }
  .bnav-item.active { background: rgba(255,255,255,.08); }
  .bnav-item.active .bnav-icon { transform: none; }
  .bnav-lbl { font-size: 0.84rem; font-weight: 500; }

  /* Grid-Grundgerüst */
  .view.active { display: grid; column-gap: 26px; align-content: start; }
  .view > * { padding-left: 0; padding-right: 0; }
  .topbar { grid-column: 1 / -1; padding-top: 34px; }
  .topbar-title { font-size: 2.1rem; }
  .topbar-sub { font-size: 0.78rem; }

  /* Energie: Fluss groß links, Ring + Lademodus rechts, Segmente unten */
  .view[data-view="energie"].active { grid-template-columns: minmax(0,1.35fr) minmax(0,1fr); }
  .view[data-view="energie"] .flow-section { grid-column: 1; grid-row: 2 / span 2; display: flex; }
  .view[data-view="energie"] .flow-canvas-wrap { height: 100%; min-height: 460px; }
  .view[data-view="energie"] .ring-section { grid-column: 2; grid-row: 2; align-items: center; }
  .view[data-view="energie"] .ring-wrap { width: 250px; }
  .view[data-view="energie"] .control-section { grid-column: 2; grid-row: 3; }
  .view[data-view="energie"] .segments { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
  .fnode-ring { width: 82px; height: 82px; }
  .fnode-ring.big { width: 100px; height: 100px; }
  .fnode-ring .ic { width: 24px; height: 24px; }
  .fnode-ring.big .ic { width: 30px; height: 30px; }
  .fnode-kw { font-size: 0.72rem; }
  .fnode-name { font-size: 0.64rem; }

  /* Fahrzeug: Auto links, Steuerung + Statistik rechts */
  .view[data-view="fahrzeug"].active { grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); }
  .view[data-view="fahrzeug"] .car-section { grid-column: 1; grid-row: 2 / span 2; display: flex; }
  .view[data-view="fahrzeug"] .car-card { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 36px; }
  .view[data-view="fahrzeug"] .car-hero { width: min(300px, 74%); margin: 0 auto; }
  .view[data-view="fahrzeug"] .control-section { grid-column: 2; grid-row: 2; }
  .view[data-view="fahrzeug"] .stat-grid { grid-column: 2; grid-row: 3; }

  /* Verlauf: Bilanz oben, Graph links, KPIs rechts */
  .view[data-view="verlauf"].active { grid-template-columns: minmax(0,1.5fr) minmax(0,1fr); }
  .view[data-view="verlauf"] .today-row { grid-column: 1 / -1; }
  .history-section--chart { grid-column: 1; grid-row: 3; }
  .history-section--kpi { grid-column: 2; grid-row: 3; }
  .history-section--chart .history-card { height: 100%; display: flex; flex-direction: column; }
  #histCanvas { height: 240px; flex: 1; }
  .history-section--kpi .history-card.kpi-card { height: 100%; flex-direction: column; align-items: stretch; justify-content: center; padding: 18px 22px; }
  .history-section--kpi .kpi { flex: 0 0 auto; padding: 16px 0; text-align: left; display: flex; align-items: baseline; justify-content: space-between; flex-direction: row-reverse; }
  .history-section--kpi .kpi-val { font-size: 1.5rem; }
  .history-section--kpi .kpi-lbl { font-size: 0.72rem; margin-top: 0; }
  .history-section--kpi .kpi-div { width: auto; height: 1px; margin: 0; align-self: auto; }

  /* Anlage: zwei Spalten */
  .view[data-view="anlage"].active { grid-template-columns: 1fr 1fr; align-items: start; }
  .set-section--conn { grid-column: 1; grid-row: 2; }
  .set-section--info { grid-column: 2; grid-row: 2; }
  .view[data-view="anlage"] .set-foot { grid-column: 1 / -1; }

  /* Hover-Effekte (nur echte Zeiger) */
  ::-webkit-scrollbar { width: 10px; }
  ::-webkit-scrollbar-thumb { background: #222226; border-radius: 5px; border: 2px solid #000; }
  ::-webkit-scrollbar-track { background: transparent; }
}

@media (hover: hover) and (pointer: fine) {
  .seg:hover, .stat-tile:hover, .control-card:hover, .history-card:hover, .car-card:hover {
    border-color: var(--line-2);
    transform: translateY(-2px);
    box-shadow: 0 14px 34px -18px rgba(0,0,0,.9);
  }
  .history-card, .car-card { transition: transform .3s var(--ease), border-color .3s, box-shadow .3s; }
  .segbtn:hover { color: #fff; }
  .btn-primary:hover { background: #2f96ff; }
  .btn-ghost:hover { color: #fff; border-color: rgba(255,255,255,.25); }
  .today-item { transition: background .25s; }
  .today-item:hover { background: rgba(255,255,255,.03); }
}

/* ── Reduzierte Bewegung ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
