/* ==========================================================================
   Wärmepreisrechner – Stylesheet
   --------------------------------------------------------------------------
   Vereinfachte, kommentierte Fassung.

   Gliederung:
   1) Design-Variablen
   2) Basis / globale Elemente
   3) Seitenaufbau / Hauptcontainer / Panels
   4) Grid-Strukturen / allgemeine Karten
   5) Wärmebedarf-Einstieg / Schätzbereich
   6) Formulare / Feldstruktur / Beschriftungen
   7) Collapse- / Toggle-Elemente
   8) Input-Felder / Einheiten / Zustände
   9) Slider / Laufzeitsteuerung / Mini-Slider
   10) Systemkarten (gemeinsame Basis + Farbvarianten)
   11) Systeminterne Kennzahlen / Zwischenergebnisse
   12) Ergebnisbereich / Tabelle / Hinweise
   13) Hauptdiagramm
   14) Mini-Vergleich / gestapelte Kostenanteile
   15) Tooltips / Info-Icons
   16) Utilities / Sonderfälle
   17) Responsive Anpassungen
   ========================================================================== */


/* ==========================================================================
   1. Design-Variablen
   --------------------------------------------------------------------------
   Zentrale Farb-, Radius- und Schattenwerte. Zusätzlich sind hier einige
   häufig wiederkehrende Text- und Border-Töne semantisch gebündelt.
   ========================================================================== */

:root {
  --panel: linear-gradient(180deg, rgba(10, 20, 36, 0.98), rgba(7, 15, 29, 0.98));
  --panel-card: linear-gradient(180deg, rgba(19, 29, 48, 0.68), rgba(14, 22, 39, 0.84));
  --panel-card-strong: linear-gradient(180deg, rgba(36, 49, 74, 0.82), rgba(28, 40, 61, 0.94));

  --line: rgba(150, 169, 204, 0.14);
  --border-soft: rgba(155, 172, 206, 0.16);
  --border-faint: rgba(255, 255, 255, 0.06);

  --text: #f4f7fb;
  --text-soft: rgba(156, 171, 202, 0.78);
  --text-faint: rgba(200, 210, 230, 0.68);
  --text-weaker: rgba(178, 191, 218, 0.54);
  --text-soft-strong: rgba(214, 223, 240, 0.62);
  --text-muted-ui: rgba(220, 230, 247, 0.74);
  --text-muted-ui-strong: rgba(220, 230, 247, 0.78);

  --accent: #ff2c72;
  --green: #08d38b;
  --red: #ff2d73;
  --blue: #58a3ff;

  --slider-rest: rgba(255, 255, 255, 0.85);
  --slider-rest-strong: rgba(255, 255, 255, 0.88);
  --thumb: #f7f9fc;

  --soft-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);

  --radius: 22px;
}


/* ==========================================================================
   2. Basis / Reset / globale Textelemente
   ========================================================================== */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: #181c25;
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
}

body.is-embedded {
  min-height: auto;
}

h1 {
  margin: 0;
  font-size: clamp(2.3rem, 3.75vw, 3.45rem);
  line-height: 0.96;
  font-weight: 700;
  letter-spacing: -0.04em;
  max-width: 100%;
}


/* ==========================================================================
   3. Seitenaufbau / Hauptcontainer / Panels
   ========================================================================== */

.app-shell {
  width: min(1120px, calc(100vw - 56px));
  margin: 0 auto;
  padding: 56px 0;
}

body.is-embedded .app-shell {
  padding-top: 0;
}

body.is-embedded .hero {
  display: none;
}

.hero {
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.98rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.hero-sub {
  margin-top: 16px;
  max-width: 760px;
  font-size: 1.05rem;
  line-height: 1.5;
  color: rgb(192, 203, 225);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 22px;
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(8px);
}

.app-shell > section.panel + section.panel {
  margin-top: 12px;
}

.panel h2,
.mini-compare-section h2 {
  margin: 0 0 14px;
  font-size: 1.18rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: var(--text);
}

.mini-compare-section h2 {
  margin-bottom: 18px;
  text-align: center;
}


/* ==========================================================================
   4. Grid-Strukturen / allgemeine Karten
   ========================================================================== */

.systems-grid,
.results-grid,
.mini-compare-grid {
  display: grid;
  gap: 18px;
}

.systems-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
}

.results-grid {
  grid-template-columns: 1.02fr 1.38fr;
  align-items: start;
  margin-top: 12px;
}

.mini-compare-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  align-items: start;
  justify-items: center;
}

.system-card,
.winner-card,
.ranking-card,
.chart-wrap {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-card);
}

.system-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  position: relative;
  overflow: hidden;
}


/* ==========================================================================
   5. Wärmebedarf-Einstieg / Schätzbereich
   ========================================================================== */

.building-panel > h2 {
  margin-bottom: 8px;
}

.building-panel {
  display: grid;
  gap: 18px;
}

.step-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 0;
}

.step-choice-card {
  --step-choice-icon-row: 108px;
  --step-choice-title-gap: 1px;
  --step-choice-title-subline-gap: 8px;
  --step-choice-action-gap: 18px;
  --step-choice-action-height: 40px;
  --step-choice-footer-height: 18px;

  border-radius: 22px;
  border: 1px solid rgba(117, 145, 192, 0.18);
  background: linear-gradient(180deg, rgba(13, 26, 47, 0.96), rgba(7, 18, 36, 0.96));
  padding: 26px 26px 16px;
  min-height: 240px;
  display: grid;
  grid-template-rows:
    var(--step-choice-icon-row)
    auto
    auto
    var(--step-choice-action-gap)
    var(--step-choice-action-height)
    var(--step-choice-footer-height);
  justify-items: center;
  align-content: start;
  text-align: center;
  transition: opacity 0.22s ease, transform 0.22s ease, filter 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
}

.step-choice-card-manual {
  background: linear-gradient(180deg, rgba(9, 42, 39, 0.38), rgba(7, 18, 36, 0.96));
  justify-content: center;
}

.step-choice-card-estimate {
  background: linear-gradient(180deg, rgba(18, 42, 77, 0.48), rgba(7, 18, 36, 0.96));
}

.step-choice-card:hover {
  border-color: rgba(210, 224, 248, 0.28);
  background: linear-gradient(180deg, rgba(20, 38, 66, 0.98), rgba(10, 24, 46, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 14px 30px rgba(0, 0, 0, 0.14);
}

.step-choice-card-manual:hover {
  background: linear-gradient(180deg, rgba(12, 58, 51, 0.48), rgba(8, 24, 41, 0.98));
}

.step-choice-card-estimate:hover {
  background: linear-gradient(180deg, rgba(25, 58, 102, 0.58), rgba(8, 24, 46, 0.98));
}

.step-choice-card h3 {
  grid-column: 1 / -1;
  grid-row: 2;
  margin: var(--step-choice-title-gap) 0 var(--step-choice-title-subline-gap);
  font-size: clamp(1.25rem, 1.38vw, 1.6rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  max-width: none;
  white-space: nowrap;
}

.step-choice-icon {
  grid-column: 1 / -1;
  grid-row: 1;
  width: min(100%, 630px);
  height: var(--step-choice-icon-row);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.step-choice-icon img {
  display: block;
  width: auto;
  max-width: min(100%, 630px);
  max-height: 162px;
}

.step-choice-subline {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(219, 230, 247, 0.76);
  font-size: 0.92rem;
}

.step-choice-hint {
  grid-column: 1 / -1;
  grid-row: 6;
  margin-top: 6px;
  font-size: 0.68rem;
  line-height: 1.25;
  color: rgba(223, 232, 247, 0.72);
}

.step-choice-input-wrap {
  grid-column: 1 / -1;
  margin-top: 4px;
  width: min(100%, 380px);
}

.manual-heat-demand-control {
  grid-column: 1 / -1;
  grid-row: 5;
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(116px, 132px);
  align-items: stretch;
  justify-content: center;
  width: min(100%, 412px);
  height: var(--step-choice-action-height);
  margin-top: 0;
  border-radius: 999px;
  transition: box-shadow 0.18s ease;
}

.manual-heat-demand-control.highlight {
  box-shadow: 0 0 0 2px #ffffff, 0 0 22px rgba(255, 255, 255, 0.2);
}

.step-choice-card-manual .step-choice-input-wrap {
  grid-column: 1 / 2;
  align-self: stretch;
  width: 100%;
  min-width: 240px;
  height: 100%;
  margin-top: 0;
  border-right: 0;
  border-radius: 999px 0 0 999px;
  min-height: var(--step-choice-action-height);
}

.step-choice-card-manual .step-choice-hint {
  grid-column: 1 / -1;
  justify-self: start;
  width: 100%;
  text-align: left;
  padding-left: 10px;
}

.step-choice-input-wrap,
.step-choice-input-wrap.input-wrap,
.step-choice-input-wrap .unit {
  min-height: var(--step-choice-action-height);
}

.input-wrap.step-choice-input-wrap input {
  min-height: var(--step-choice-action-height);
  padding-top: 0;
  padding-bottom: 0;
  font-size: 0.96rem;
}

.input-wrap.step-choice-input-wrap .unit {
  min-width: 76px;
  min-height: var(--step-choice-action-height);
  justify-content: center;
  padding: 0 10px;
  border-radius: 0;
}

.step-choice-cta {
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 10px 24px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
}

.step-choice-cta span[aria-hidden="true"],
.hd-accept-btn span[aria-hidden="true"] {
  margin-left: 0.22em;
}

.step-choice-cta-manual {
  grid-column: 2 / 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: 100%;
  min-width: 116px;
  min-height: var(--step-choice-action-height);
  height: 100%;
  line-height: 1;
  margin-top: 0;
  padding: 0 16px;
  border-radius: 0 999px 999px 0;
  color: #f7fbff;
  background: linear-gradient(180deg, #16e39d, #0fd38b);
}

.step-choice-cta-manual:disabled {
  color: rgba(229, 236, 248, 0.48);
  background: linear-gradient(180deg, rgba(93, 107, 132, 0.58), rgba(66, 78, 101, 0.62));
  cursor: not-allowed;
}

.step-choice-cta-estimate {
  grid-column: 1 / -1;
  grid-row: 5;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 262px;
  min-height: var(--step-choice-action-height);
  height: var(--step-choice-action-height);
  margin-top: 0;
  color: #f3f8ff;
  background: linear-gradient(180deg, #67a9ff, #4f95f6);
}

.estimate-shell {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: max-height 0.72s cubic-bezier(0.22, 0.86, 0.24, 1), opacity 0.42s ease, transform 0.52s ease, margin-top 0.42s ease, border-color 1s ease, box-shadow 1s ease;
}

.estimate-shell-expanded {
  border-radius: 20px;
  border: 1px solid rgba(120, 150, 201, 0.16);
  background: linear-gradient(180deg, rgba(6, 18, 36, 0.98), rgba(6, 18, 34, 0.98));
  padding: 10px 18px 14px;
  margin-top: 0;
}

.estimate-shell-expanded.is-shell-highlight {
  border-color: rgba(245, 248, 252, 0.92);
  box-shadow: 0 0 0 1px rgba(245, 248, 252, 0.28);
}

.estimate-shell.is-open {
  max-height: 1700px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  margin-top: 12px;
}

.estimate-mode-tabs {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 16px;
}

.estimate-mode-tab {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  min-width: 186px;
  background: rgba(23, 40, 72, 0.92);
  color: rgba(223, 232, 247, 0.55);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.estimate-mode-tab.is-active {
  background: linear-gradient(180deg, rgba(78, 124, 204, 0.92), rgba(65, 104, 178, 0.92));
  color: #f7fbff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16);
}

.estimate-consumption-placeholder {
  min-height: 340px;
  border-radius: 16px;
  border: 1px dashed rgba(179, 196, 226, 0.34);
  padding: 26px;
  color: rgba(223, 232, 247, 0.82);
}

.hd-field-more {
  margin-top: 6px;
}

.hd-more-toggle {
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(214, 223, 240, 0.78);
  font: inherit;
  font-size: 0.92rem;
  text-align: left;
  cursor: pointer;
}

.hd-more-panel {
  margin-top: 12px;
}

.hd-accept-btn,
.hd-back-btn {
  border: 0;
  border-radius: 14px;
  font: inherit;
  cursor: pointer;
}

.hd-accept-btn {
  justify-self: center;
  width: min(100%, 262px);
  min-height: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5f9df4, #4e84d4);
  color: #f7fbff;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1;
}

.hd-accept-btn:disabled {
  cursor: not-allowed;
  color: rgba(223, 232, 247, 0.54);
  background: rgba(93, 109, 137, 0.54);
}

.hd-back-btn {
  padding: 6px 10px;
  background: transparent;
  color: rgba(223, 232, 247, 0.74);
  font-size: 0.82rem;
}

body.is-estimating .step-choice-card {
  opacity: 0.46;
  filter: saturate(0.56);
}

body.is-estimating .estimate-shell-expanded {
  box-shadow: 0 0 0 1px rgba(120, 150, 201, 0.12);
}

.heating-step-panel.is-dimmed {
  opacity: 0.44;
  filter: saturate(0.48);
  transition: opacity 0.22s ease, filter 0.22s ease;
}

.heating-step-panel.is-step-highlight {
  box-shadow: var(--soft-shadow), 0 0 0 2px rgba(8, 211, 139, 0.64), 0 0 28px rgba(8, 211, 139, 0.2);
  transition: box-shadow 0.2s ease;
}


/* ==========================================================================
   6. Formulare / Feldstruktur / Beschriftungen
   ========================================================================== */

.field-row {
  display: flex;
  flex-direction: column;
}

.field-row label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 22px;
  margin-bottom: 9px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted-ui-strong);
  letter-spacing: 0.01em;
}

.slider-field-row {
  min-height: 80px;
}

.slider-field-row {
  padding-top: 2px;
}

.optional-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.optional-row.optional-row-costs {
  margin-top: 2px;
  margin-bottom: 12px;
}

.optional-toggle-row {
  min-height: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 10px;
  padding: 2px 2px 2px 0;
  transition: background 0.16s ease;
  cursor: pointer;
}

.optional-toggle-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

.optional-label-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted-ui);
  letter-spacing: 0.01em;
}

.optional-hint {
  margin-left: 6px;
  font-size: 0.68rem;
  color: rgba(200, 210, 230, 0.48);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.optional-panel {
  padding-top: 2px;
}

.optional-panel[hidden] {
  display: none !important;
}

.optional-panel-stacked {
  display: grid;
  gap: 6px;
}

.optional-panel-stacked .field-row {
  gap: 0;
}

.optional-panel-stacked .field-row label {
  min-height: 0;
  margin-bottom: 6px;
  font-size: 0.82rem;
  color: rgba(210, 221, 241, 0.72);
}

.optional-panel-financing {
  display: grid;
  gap: 7px;
}

.financing-slider-label {
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 600;
}

.financing-note {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.62rem;
  line-height: 1.35;
}


/* ==========================================================================
   7. Collapse- / Toggle-Elemente
   ========================================================================== */

.collapse-toggle {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  padding: 0;
  background: transparent;
  color: rgba(235, 242, 252, 0.82);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.16s ease, transform 0.16s ease;
}

.collapse-toggle:hover {
  color: rgba(255, 255, 255, 0.98);
}

.collapse-toggle:focus-visible {
  outline: 2px solid rgba(201, 215, 243, 0.56);
  outline-offset: 2px;
  border-radius: 4px;
}

.collapse-toggle-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.18s ease;
}

.collapse-toggle[aria-expanded="true"] .collapse-toggle-icon {
  transform: rotate(-135deg) translate(-1px, -1px);
}


/* ==========================================================================
   8. Input-Felder / Einheiten / Zustände
   ========================================================================== */

.input-wrap {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(149, 170, 207, 0.18);
  background: linear-gradient(180deg, rgba(28, 39, 63, 0.64), rgba(22, 31, 52, 0.78));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  transition: border-color 0.24s ease, box-shadow 0.24s ease;
}

.input-wrap.is-guided,
.hd-accept-btn.is-guided {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.hd-accept-btn.is-guided {
  outline: 2px solid #fff;
  outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.14);
}

.input-wrap.compact {
  min-height: 38px;
}

.input-wrap:focus-within {
  border-color: rgba(201, 215, 243, 0.42);
  box-shadow: 0 0 0 3px rgba(91, 129, 201, 0.12);
}

input[type="text"],
input[type="number"],
input:not([type]),
.input-wrap input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
}

.input-wrap input::placeholder {
  color: rgba(244, 247, 251, 0.18);
}

.input-wrap .unit {
  flex: 0 0 auto;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-left: 1px solid rgba(119, 137, 172, 0.22);
  border-top-right-radius: 13px;
  border-bottom-right-radius: 13px;
  background: rgba(67, 85, 120, 0.26);
  color: rgba(220, 229, 247, 0.72);
  font-size: 0.92rem;
  font-weight: 500;
}

.input-wrap select {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 500;
  min-height: 38px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.input-wrap select option {
  color: #111;
}

.input-wrap select.is-placeholder-muted {
  color: rgba(244, 247, 251, 0.18);
}

.input-wrap.compact input,
.input-wrap.compact select {
  min-height: 38px;
  padding: 0 14px;
  font-size: 0.98rem;
  font-weight: 600;
}

.input-wrap.compact .unit {
  min-height: 38px;
  padding: 0 14px;
}


/* ==========================================================================
   9. Slider / Laufzeitsteuerung / Mini-Slider
   ========================================================================== */

.duration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  border: none;
  background: transparent;
  padding: 8px 0;
}

.duration-label-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.slider-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 56%;
}

.slider-wrap input[type="range"] {
  flex: 1;
}

.slider-value {
  min-width: 118px;
  text-align: right;
  font-size: 1.15rem;
  font-weight: 500;
}

.inline-slider-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  align-items: center;
  gap: 12px;
  min-height: 38px;
}

.system-boiler .inline-slider-wrap {
  grid-template-columns: minmax(0, 1fr) 78px;
}

.mini-slider-value {
  min-width: 0;
  display: inline-flex;
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  white-space: nowrap;
  font-size: 1.65rem;
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.mini-slider-value::after {
  content: attr(data-suffix);
  margin-left: 2px;
}

.funding-slider-value,
.rate-slider-value {
  align-items: center;
  font-size: 1rem;
  letter-spacing: 0;
  color: var(--text-soft-strong);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) 50%,
    var(--slider-rest-strong) 50%,
    var(--slider-rest-strong) 100%
  );
  outline: none;
}

.mini-slider {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.82) 100%);
}

.system-card .mini-slider {
  background: linear-gradient(
    90deg,
    var(--system-color, rgba(255, 255, 255, 0.82)) 0%,
    var(--system-color, rgba(255, 255, 255, 0.82)) 50%,
    var(--slider-rest) 50%,
    var(--slider-rest) 100%
  );
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 0;
  background: var(--thumb);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 0;
  background: var(--thumb);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}


/* ==========================================================================
   10. Systemkarten (gemeinsame Basis + Farbvarianten)
   --------------------------------------------------------------------------
   Die Farbvarianten setzen nur System-Variablen. Alle gemeinsamen Regeln
   greifen dann generisch auf diese Variablen zu.
   ========================================================================== */

.system-wp {
  order: 1;
  --system-color: var(--green);
  --system-border: rgba(8, 211, 139, 0.65);
  --system-glow: rgba(8, 211, 139, 0.26);
}

.system-boiler {
  order: 3;
  --system-color: var(--blue);
  --system-border: rgba(88, 163, 255, 0.56);
  --system-glow: rgba(88, 163, 255, 0.22);
}

.system-network {
  order: 2;
  --system-color: var(--red);
  --system-border: rgba(255, 45, 115, 0.56);
  --system-glow: rgba(255, 45, 115, 0.22);
}

.system-card {
  border-color: var(--system-border, var(--line));
}

.system-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0.14;
  background: linear-gradient(180deg, var(--system-glow, transparent), transparent 45%);
}

.system-header,
.system-fields,
.metrics-card {
  position: relative;
  z-index: 1;
}

.system-header {
  margin-bottom: 12px;
}

.system-header h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--system-color, var(--text));
}

.system-fields {
  display: grid;
  gap: 14px;
  flex: 1 1 auto;
  align-content: start;
}

.metrics-card {
  margin-top: auto;
  padding: 14px 14px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: var(--panel-card-strong);
  border-top: 1px solid var(--border-faint);
}

.metrics-card.is-inactive {
  opacity: 0.52;
}

.metric-value {
  margin-top: 6px;
  font-size: 1.95rem;
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.metrics-card > .metric:first-child {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.metric-stack {
  display: grid;
  align-content: start;
  gap: 10px;
}

.metric-breakdown {
  display: grid;
  gap: 5px;
  padding-top: 8px;
  border-top: 1px solid var(--border-faint);
  color: var(--text-soft);
  font-size: 0.64rem;
  line-height: 1.25;
}

.metric-breakdown div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.metric-breakdown div[hidden] {
  display: none !important;
}

.metric-breakdown strong {
  color: inherit;
  font-weight: inherit;
  white-space: nowrap;
}

.metric-compact .metric-value {
  margin-top: 3px;
  font-size: 1.02rem;
}

.metric-compact .metric-label {
  min-height: 0;
  font-size: 0.66rem;
}

.metric-compact .metric-unit {
  margin-top: 2px;
  font-size: 0.68rem;
}

.metric-label {
  min-height: 28px;
  font-size: 0.74rem;
}

.metric-unit {
  margin-top: 4px;
  font-size: 0.82rem;
}


/* ==========================================================================
   11. Systeminterne Kennzahlen / Zwischenergebnisse
   ========================================================================== */

.net-invest-output,
.derived-costs-block,
.section-intro,
.hint-box,
.metric-unit,
.metric-label,
.empty-row,
.chart-empty,
.winner-kicker {
  color: var(--text-soft);
}

.net-invest-output,
.derived-costs-block {
  font-size: 0.65rem;
  line-height: 1.35;
}

.net-invest-output {
  margin-top: 4px;
}

.net-invest-output strong,
.derived-label {
  color: var(--text-faint);
  font-weight: 500;
}

.derived-costs-block {
  display: none;
  gap: 1px;
  margin-top: -10px;
  margin-bottom: -2px;
  opacity: 0.72;
}

.derived-costs-line {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 6px;
  font-size: 0.62rem;
  line-height: 1.28;
}

.derived-label {
  color: var(--text-weaker);
}

.derived-costs-line span:last-child {
  color: var(--text-soft-strong);
}


/* ==========================================================================
   12. Ergebnisbereich / Tabelle / Hinweise
   ========================================================================== */

.section-intro {
  margin: -4px 0 12px;
  font-size: 0.93rem;
  line-height: 1.35;
}

.winner-card {
  margin-bottom: 14px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(15, 77, 79, 0.24), rgba(16, 32, 49, 0.68));
}

.winner-name {
  margin-top: 4px;
  font-size: clamp(1.9rem, 3vw, 2.6rem);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.05em;
}

.winner-text {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 6px;
  color: rgba(231, 240, 252, 0.88);
  font-size: 0.95rem;
}

.winner-kicker {
  font-size: 0.85rem;
  line-height: 1.3;
  font-weight: 400;
}

.winner-system {
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(244, 247, 251, 0.95);
}

.ranking-card {
  padding: 12px 14px;
}

.table,
table {
  width: 100%;
}

table {
  border-collapse: collapse;
}

th {
  text-align: left;
  color: rgba(220, 230, 247, 0.66);
  font-size: 0.79rem;
  font-weight: 500;
  padding: 0 0 8px;
}

td {
  font-size: 0.93rem;
  border-top: 1px solid rgba(133, 152, 189, 0.18);
  padding: 9px 0;
}

.empty-row {
  text-align: left;
  padding: 12px 0 4px;
}

.hint-box {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  border-top-color: rgba(255, 255, 255, 0.05);
  background: rgba(20, 28, 44, 0.72);
  font-size: 0.83rem;
  line-height: 1.45;
}


/* ==========================================================================
   13. Hauptdiagramm
   ========================================================================== */

.chart-wrap {
  position: relative;
  min-height: 400px;
  background: linear-gradient(180deg, rgba(18, 27, 45, 0.7), rgba(15, 23, 40, 0.92));
}

#costChart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px;
  font-size: 0.95rem;
  line-height: 1.4;
  background: rgba(8, 17, 31, 0.72);
  border-radius: inherit;
}

.chart-empty.visible {
  display: flex;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 12px 6px 2px;
  color: rgba(235, 241, 251, 0.88);
  font-size: 0.9rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-line {
  width: 24px;
  height: 0;
  border-top: 3px solid currentColor;
  border-radius: 999px;
}

.legend-line.wp {
  color: var(--green);
}

.legend-line.boiler {
  color: var(--blue);
}

.legend-line.network {
  color: var(--red);
}


/* ==========================================================================
   14. Mini-Vergleich / gestapelte Kostenanteile
   --------------------------------------------------------------------------
   Die Systemklassen (.wp/.boiler/.network) setzen hier nur Variablen für die
   drei Kostenarten. Die eigentlichen Hintergründe werden dann generisch
   vergeben.
   ========================================================================== */

.mini-compare-section {
  margin-top: 18px;
  margin-bottom: 22px;
}

.mini-compare-card {
  width: 100%;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.mini-compare-card-wp {
  order: 1;
}

.mini-compare-card-network {
  order: 2;
}

.mini-compare-card-boiler {
  order: 3;
}

.share-chart.compact {
  width: auto;
  max-width: 100%;
  margin-top: 0;
  padding: 4px 0 0;
  border-top: 0;
  background: transparent;
  display: block;
}

.share-chart.compact .share-stack-wrap.single {
  display: grid;
  grid-template-columns: 104px 170px;
  column-gap: 18px;
  row-gap: 0;
  align-items: center;
  justify-content: center;
  width: auto;
}

.share-stack-head {
  grid-column: 1 / 2;
  margin: 0 0 8px;
  text-align: center;
}

.share-total {
  display: inline-block;
  white-space: nowrap;
  line-height: 1.1;
  font-size: 0.86rem;
  font-weight: 700;
  color: rgba(244, 247, 251, 0.94);
}

.share-chart.compact .share-stack-track.wide {
  grid-column: 1 / 2;
  width: 104px;
  height: 144px;
  justify-self: center;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.025);
}

.share-chart.compact .share-rows.compact {
  grid-column: 2 / 3;
  display: grid;
  width: 170px;
  min-width: 170px;
  max-width: 170px;
  gap: 7px;
  align-self: center;
}

.share-chart.compact .share-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.share-chart.compact .share-row[hidden] {
  display: none !important;
}

.share-row-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.share-row-label {
  min-width: 0;
  font-size: 0.68rem;
  line-height: 1.15;
  color: rgba(200, 210, 230, 0.78);
}

.share-row-sub {
  font-size: 0.6rem;
  line-height: 1.1;
  color: rgba(200, 210, 230, 0.62);
}

.share-row-value {
  display: none;
}

.share-stack-segment {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2px 4px;
  text-align: center;
  word-break: break-word;
  font-size: 0.62rem;
  line-height: 1.05;
  font-weight: 600;
  color: rgba(250, 252, 255, 0.92);
  transition: height 0.2s ease, bottom 0.2s ease;
}

.share-stack-segment.tiny-text {
  justify-content: center;
  font-size: 0.5rem;
  padding: 1px 3px;
}

.share-stack-segment[style*="height: 0%"] {
  opacity: 0;
}

.wp {
  --share-invest: rgba(8, 211, 139, 0.35);
  --share-energy: rgba(8, 211, 139, 0.9);
  --share-other: rgba(8, 211, 139, 0.55);
}

.boiler {
  --share-invest: rgba(88, 163, 255, 0.28);
  --share-energy: rgba(88, 163, 255, 0.9);
  --share-other: rgba(88, 163, 255, 0.42);
}

.network {
  --share-invest: rgba(255, 45, 115, 0.28);
  --share-energy: rgba(255, 45, 115, 0.88);
  --share-fixed: rgba(255, 45, 115, 0.62);
  --share-other: rgba(255, 45, 115, 0.45);
}

.share-stack-segment.invest,
.share-row-swatch.invest {
  background: var(--share-invest);
}

.share-stack-segment.energy,
.share-row-swatch.energy {
  background: var(--share-energy);
}

.share-stack-segment.fixed,
.share-row-swatch.fixed {
  background: var(--share-fixed);
}

.share-stack-segment.other,
.share-row-swatch.other {
  background: var(--share-other);
}


/* ==========================================================================
   15. Tooltips / Info-Icons
   ========================================================================== */

.info-dot {
  position: relative;
  width: 16px;
  height: 16px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(158, 176, 210, 0.22);
  background: rgba(47, 60, 85, 0.28);
  color: rgba(235, 242, 252, 0.62);
  font-size: 0.68rem;
  line-height: 1;
  cursor: default;
}

.tooltip {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(170, 187, 219, 0.16);
  background: rgba(10, 18, 32, 0.96);
  color: rgba(238, 243, 251, 0.9);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}


/* ==========================================================================
   16. Utilities / Sonderfälle
   --------------------------------------------------------------------------
   Erst allgemeine Zustände, danach die wenigen bewusst verbleibenden
   Komponenten-Sonderfälle.
   ========================================================================== */

.dimmed {
  opacity: 0.58;
  transition: opacity 0.2s ease;
}

/* Einzelner Wert mit etwas stärkerer Betonung. */
#boiler-chimney {
  font-weight: 600;
}


/* ==========================================================================
   17. Responsive Regeln
   ========================================================================== */

@media (max-width: 1200px) {
  .app-shell {
    width: min(1120px, calc(100vw - 32px));
  }

  .mini-compare-grid {
    grid-template-columns: 1fr;
  }

  .share-chart.compact .share-stack-wrap.single {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .share-stack-head,
  .share-chart.compact .share-stack-track.wide,
  .share-chart.compact .share-rows.compact {
    grid-column: auto;
  }

  .share-chart.compact .share-rows.compact {
    width: 220px;
    min-width: 0;
    max-width: 220px;
  }
}

@media (max-width: 980px) {
  .step-choice-grid {
    grid-template-columns: 1fr;
  }

  .estimate-mode-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .estimate-mode-tab {
    min-width: 0;
  }
}

@media (max-width: 680px) {
  .manual-heat-demand-control {
    grid-template-columns: 1fr;
    width: min(100%, 380px);
  }

  .step-choice-card-manual .step-choice-input-wrap {
    min-width: 0;
    border-radius: 999px;
  }

  .step-choice-card-manual .step-choice-hint {
    justify-self: center;
    text-align: center;
  }

  .step-choice-cta-manual {
    justify-self: center;
    width: auto;
    margin-top: 10px;
    border-radius: 999px;
  }
}
