/* ==========================================================================
   NR Technologies — Rechner
   Zweispaltiges Ledger: Regler links, Rechnung rechts.
   ========================================================================== */

/* --- Branchenwahl -------------------------------------------------------- */

.branch {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: clamp(28px, 4vw, 44px);
}

.branch-btn {
  font-family: "NRT Sans", sans-serif;
  font-size: 0.94rem;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.branch-btn:hover {
  color: var(--text);
  border-color: var(--line-hi);
}

.branch-btn[aria-pressed="true"] {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

/* --- Ledger-Raster ------------------------------------------------------- */

.ledger {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.2vw, 26px);
}

/* Regler und Rechnung bilden einen eigenen Kasten. Das ist nicht kosmetisch:
   `position: sticky` wird vom Elternkasten begrenzt — läge die Rechnung direkt
   in `.ledger`, dürfte sie bis zur Fußnote mitwandern und schöbe sich dabei
   über Balken und Fazit. */
.ledger-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  gap: clamp(16px, 2.2vw, 26px);
  align-items: start;
}

@media (max-width: 900px) {
  .ledger-cols {
    grid-template-columns: 1fr;
  }
}

/* Die Rechnung läuft beim Schieben der Regler mit — und hört auf, sobald der
   Reglerkasten endet. Bewusst über eine eigene Klasse statt über
   :nth-of-type: letzteres zählt alle div-Geschwister mit und trifft beim
   kleinsten Umbau das falsche Feld. */
@media (min-width: 901px) {
  .panel--result {
    position: sticky;
    top: 96px;
  }
}

/* --- Ergebnisleiste für kleine Bildschirme -------------------------------
   Ohne sie schiebt man auf dem Handy einen Regler und sieht die Wirkung
   erst mehrere Bildschirmhöhen weiter unten.
   ------------------------------------------------------------------------ */

.ledger-sticky {
  display: none;
}

@media (max-width: 900px) {
  .ledger-sticky {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 72px;
    z-index: 20;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 12px;
    padding: 13px 18px;
    margin-bottom: 4px;
  }

  .ledger-sticky-label {
    font-family: "NRT Mono", monospace;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-mute);
  }

  .ledger-sticky-value {
    font-family: "NRT Mono", monospace;
    font-variant-numeric: tabular-nums;
    font-size: 1.35rem;
    font-weight: 500;
    color: var(--good);
    white-space: nowrap;
  }

  .ledger-sticky-value.neg {
    color: var(--bad);
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 3vw, 34px);
}

.panel > h2 {
  font-family: "NRT Mono", monospace;
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 400;
  margin: 0 0 26px;
}

/* --- Regler -------------------------------------------------------------- */

.field + .field {
  margin-top: 26px;
}

.field-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}

.field-label {
  font-size: 0.95rem;
  color: var(--text);
}

.field-value {
  font-family: "NRT Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  font-size: 1rem;
  color: var(--accent);
  white-space: nowrap;
}

.field-hint {
  font-size: 0.82rem;
  color: var(--text-mute);
  line-height: 1.5;
  margin: 0 0 12px;
  max-width: 52ch;
}

.field-scale {
  display: flex;
  justify-content: space-between;
  font-family: "NRT Mono", monospace;
  font-size: 0.68rem;
  color: var(--text-mute);
  margin-top: 8px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 3px;
  margin: 0;
  border-radius: 2px;
  background: var(--surface-hi);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
  margin-top: -7.5px;
  transition: background 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-hi);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 2px;
  background: var(--surface-hi);
}

input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent);
}

input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 40%, transparent);
}

.assumption {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px dashed var(--line-hi);
  font-size: 0.84rem;
  color: var(--text-mute);
  line-height: 1.55;
}

.assumption b {
  color: var(--text-soft);
  font-weight: 500;
}

/* --- Rechnung ------------------------------------------------------------ */

.line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding-block: 15px;
  border-bottom: 1px solid var(--line);
}

.line:first-of-type {
  padding-top: 0;
}

.line-label {
  font-size: 0.95rem;
}

.line-sub {
  display: block;
  font-size: 0.79rem;
  color: var(--text-mute);
  margin-top: 3px;
  max-width: 34ch;
  line-height: 1.45;
}

.line-value {
  font-family: "NRT Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.02rem;
  white-space: nowrap;
}

.line-value.neg {
  color: var(--bad);
}

.line-value.pos {
  color: var(--good);
}

.total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 18px;
  padding-top: 22px;
}

.total-label {
  font-size: 0.95rem;
  font-weight: 500;
}

.total-value {
  font-family: "NRT Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.7rem, 3.2vw, 2.2rem);
  font-weight: 500;
  line-height: 1;
  color: var(--good);
}

.total-value.neg {
  color: var(--bad);
}

/* --- Balkenvergleich ----------------------------------------------------- */

.bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.2vw, 26px);
}

@media (max-width: 900px) {
  .bars {
    grid-template-columns: 1fr;
  }
}

.bar-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 2.6vw, 28px);
}

.bar-cap {
  font-family: "NRT Mono", monospace;
  font-size: var(--fs-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 16px;
}

.bar-track {
  height: 30px;
  border-radius: 4px;
  background: var(--surface-hi);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.4s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.bar-fill--loss {
  background: var(--bad);
}

.bar-fill--gain {
  background: var(--good);
}

.bar-num {
  font-family: "NRT Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.05rem;
  margin: 12px 0 0;
}

.bar-num.neg {
  color: var(--bad);
}

.bar-num.pos {
  color: var(--good);
}

/* --- Fazit --------------------------------------------------------------- */

.verdict {
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: var(--radius);
  background: linear-gradient(140deg, var(--accent-wash), transparent 62%),
    var(--surface);
  padding: clamp(28px, 4vw, 46px);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: clamp(22px, 3vw, 40px);
}

.verdict-headline {
  font-family: "Archivo", sans-serif;
  font-weight: 700;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  line-height: 1.28;
  margin: 0;
  max-width: 30ch;
  text-wrap: balance;
}

.verdict-headline .n {
  color: var(--accent);
}

.verdict-stat {
  text-align: right;
  flex: 0 0 auto;
}

.verdict-num {
  font-family: "NRT Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  line-height: 1;
  font-weight: 500;
  color: var(--accent);
}

.verdict-cap {
  font-family: "NRT Mono", monospace;
  font-size: var(--fs-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 10px;
}

@media (max-width: 620px) {
  .verdict-stat {
    text-align: left;
  }
}

.disclaimer {
  font-family: "NRT Mono", monospace;
  font-size: 0.72rem;
  color: var(--text-mute);
  line-height: 1.6;
  margin: 6px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill {
    transition: none;
  }
}
