:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #edf3f2;
  --surface-strong: #fbfcfb;
  --surface-glass: rgba(255, 255, 255, 0.78);
  --surface-menu: rgba(255, 255, 255, 0.94);
  --surface-control-strong: rgba(255,255,255,0.98);
  --surface-control-soft: rgba(242,247,246,0.96);
  --surface-tooltip: rgba(255, 255, 255, 0.98);
  --surface-formula: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(237,243,242,0.92));
  --surface-accent-soft: color-mix(in srgb, var(--accent-1) 10%, white);
  --surface-accent-softer: color-mix(in srgb, var(--accent-2) 9%, white);
  --surface-accent-strong: linear-gradient(135deg, color-mix(in srgb, var(--accent-1) 12%, white), color-mix(in srgb, var(--accent-2) 16%, white));
  --surface-readout-highlight: linear-gradient(180deg, rgba(37, 99, 235, 0.06), rgba(15, 118, 110, 0.08));
  --surface-readout-sheen: rgba(255, 255, 255, 0.45);
  --surface-doc-panel: rgba(255,255,255,0.96);
  --surface-doc-header: linear-gradient(180deg, rgba(244,247,246,0.98), rgba(255,255,255,0.96));
  --surface-iframe: white;
  --grid-line: #e6ecea;
  --range-separator: color-mix(in srgb, var(--line) 90%, white);
  --line: #d7dfdc;
  --text: #172120;
  --muted: #64706d;
  --blue: #2563eb;
  --teal: #0f766e;
  --green: #2c7a57;
  --olive: #8ea93a;
  --lime: #b2c95f;
  --brick: #b84a3a;
  --sand: #d28a59;
  --brown: #7f5927;
  --shadow: 0 20px 48px rgba(20, 38, 34, 0.08);
  --shadow-strong: 0 24px 48px rgba(22, 32, 31, 0.16);
  --shadow-medium: 0 18px 34px rgba(22, 32, 31, 0.14);
  --shadow-soft: 0 18px 34px rgba(22, 32, 31, 0.12);
  --overlay-backdrop: rgba(10, 16, 18, 0.56);
  --doc-button-bg: rgba(255,255,255,0.14);
  --doc-button-bg-hover: rgba(255,255,255,0.22);
  --doc-button-border: rgba(255,255,255,0.35);
  --doc-button-text: white;
  --hero-warning-border: color-mix(in srgb, var(--brick) 36%, white);
  --radius: 18px;
  --accent-1: var(--blue);
  --accent-2: var(--teal);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1416;
  --surface: rgba(18, 27, 30, 0.94);
  --surface-soft: #131d20;
  --surface-strong: #162124;
  --surface-glass: rgba(16, 24, 27, 0.86);
  --surface-menu: rgba(16, 24, 27, 0.96);
  --surface-control-strong: rgba(22, 33, 36, 0.98);
  --surface-control-soft: rgba(19, 29, 32, 0.96);
  --surface-tooltip: rgba(16, 24, 27, 0.98);
  --surface-formula: linear-gradient(180deg, rgba(20, 31, 34, 0.96), rgba(14, 22, 25, 0.94));
  --surface-accent-soft: color-mix(in srgb, var(--accent-1) 16%, #162124);
  --surface-accent-softer: color-mix(in srgb, var(--accent-2) 14%, #162124);
  --surface-accent-strong: linear-gradient(135deg, color-mix(in srgb, var(--accent-1) 18%, #162124), color-mix(in srgb, var(--accent-2) 20%, #162124));
  --surface-readout-highlight: linear-gradient(180deg, rgba(37, 99, 235, 0.16), rgba(15, 118, 110, 0.18));
  --surface-readout-sheen: rgba(255, 255, 255, 0.08);
  --surface-doc-panel: rgba(16, 24, 27, 0.98);
  --surface-doc-header: linear-gradient(180deg, rgba(22, 33, 36, 0.98), rgba(16, 24, 27, 0.96));
  --surface-iframe: #10181b;
  --grid-line: #233237;
  --range-separator: color-mix(in srgb, var(--line) 82%, #162124);
  --line: #2c3d42;
  --text: #eef6f4;
  --muted: #9db0ad;
  --shadow: 0 22px 56px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 28px 56px rgba(0, 0, 0, 0.36);
  --shadow-medium: 0 18px 36px rgba(0, 0, 0, 0.3);
  --shadow-soft: 0 16px 30px rgba(0, 0, 0, 0.24);
  --overlay-backdrop: rgba(4, 8, 10, 0.74);
  --doc-button-bg: rgba(10, 16, 18, 0.26);
  --doc-button-bg-hover: rgba(10, 16, 18, 0.38);
  --doc-button-border: rgba(255,255,255,0.18);
  --doc-button-text: #eef6f4;
  --hero-warning-border: color-mix(in srgb, var(--brick) 42%, #162124);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), transparent 36%),
    linear-gradient(220deg, rgba(15, 118, 110, 0.10), transparent 30%),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 "Inter", "Segoe UI", system-ui, sans-serif;
}

body[data-theme="dark"] {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), transparent 38%),
    linear-gradient(220deg, rgba(15, 118, 110, 0.18), transparent 32%),
    var(--bg);
}

body[data-active-tab="sparplan"] {
  --accent-1: #2563eb;
  --accent-2: #0f766e;
}

body[data-active-tab="entnahme"] {
  --accent-1: #1d4ed8;
  --accent-2: #0f766e;
}

body[data-active-tab="ziel"] {
  --accent-1: #3b6fb6;
  --accent-2: #5c8f8a;
}

body[data-active-tab="kest"] {
  --accent-1: #7b5ea7;
  --accent-2: #496a94;
}

body[data-active-tab="vorab"] {
  --accent-1: #2c7a57;
  --accent-2: #8ea93a;
}

body[data-active-tab="depot"] {
  --accent-1: #0f766e;
  --accent-2: #2563eb;
}

body[data-active-tab="inflation"] {
  --accent-1: #6a5acd;
  --accent-2: #2563eb;
}

body[data-active-tab="festgeld"] {
  --accent-1: #9a6a21;
  --accent-2: #cf8a2e;
}

button,
input,
select {
  font: inherit;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.shell {
  width: min(1640px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  margin-bottom: 20px;
}

.hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.hero-topline .eyebrow {
  margin: 0;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-glass);
  color: var(--text);
  box-shadow: var(--shadow);
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent-1) 24%, var(--line));
  box-shadow: var(--shadow-soft);
}

.theme-toggle__icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-1) 16%, transparent);
  color: var(--accent-1);
  font-size: 0.82rem;
  line-height: 1;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.3rem, 4.8vw, 4.4rem);
  line-height: 0.95;
}

#page-title {
  white-space: nowrap;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.2rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.lead {
  max-width: none;
  margin: 0;
  color: var(--muted);
}

.lead + .lead {
  margin-top: 10px;
}

.lead--secondary {
  max-width: none;
}

.hero-warning {
  padding: 18px 20px;
  border: 2px solid var(--hero-warning-border);
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(184, 74, 58, 0.12), rgba(210, 138, 89, 0.18));
  box-shadow: var(--shadow);
}

.hero-warning strong {
  display: block;
  margin-bottom: 8px;
  color: var(--brick);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-warning p {
  margin: 0;
  color: var(--text);
  font-weight: 700;
  line-height: 1.45;
}

.tab-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
  align-items: stretch;
}

.tab-group {
  position: relative;
  display: flex;
  flex: 1 1 240px;
  min-width: 220px;
  z-index: 10;
}

.tab-group--article {
  flex: 0 0 210px;
  min-width: 210px;
  margin-left: 6px;
  padding-left: 0;
}

.tab-group--article::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: color-mix(in srgb, var(--line) 82%, var(--accent-2) 18%);
}

.tab-group--article .tab-group__trigger {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-glass) 72%, white 28%), color-mix(in srgb, var(--surface-soft) 86%, white 14%));
  border-color: color-mix(in srgb, var(--accent-2) 16%, var(--line));
  box-shadow: 0 12px 22px rgba(20, 38, 34, 0.05);
}

.tab-group--article .tab-group__menu {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-menu) 76%, white 24%), color-mix(in srgb, var(--surface-soft) 88%, white 12%));
  border-color: color-mix(in srgb, var(--accent-2) 14%, var(--line));
}

.tab-group--article .tab-group__trigger strong {
  color: color-mix(in srgb, var(--text) 88%, var(--accent-2) 12%);
}

.tab-group--article .tab-group__trigger span {
  color: color-mix(in srgb, var(--muted) 82%, var(--accent-2) 18%);
}

body[data-theme="dark"] .tab-group--article .tab-group__trigger {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-glass) 88%, white 12%), color-mix(in srgb, var(--surface-soft) 90%, white 10%));
  border-color: color-mix(in srgb, var(--accent-2) 26%, var(--line));
}

body[data-theme="dark"] .tab-group--article .tab-group__menu {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-menu) 92%, white 8%), color-mix(in srgb, var(--surface-soft) 92%, white 8%));
}

.tab-group__trigger {
  appearance: none;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 4px;
  width: 100%;
  min-height: 84px;
  height: 100%;
  padding: 14px 44px 14px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  text-align: left;
  cursor: pointer;
  align-content: start;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.tab-group__trigger strong {
  color: var(--text);
  font-size: 0.98rem;
}

.tab-group__trigger span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.tab-group__trigger::after {
  content: "▾";
  position: absolute;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
  transition: transform 0.18s ease, color 0.18s ease;
}

.tab-group__menu {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  right: 0;
  z-index: 4100;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-menu);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.tab-group__menu--compact {
  left: auto;
  right: 0;
  width: min(290px, calc(100vw - 32px));
  min-width: 0;
}

body.has-hover-ui .tab-group:hover .tab-group__trigger,
.tab-group:focus-within .tab-group__trigger,
.tab-group.is-open .tab-group__trigger {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent-1) 24%, var(--line));
  box-shadow: var(--shadow-medium);
}

body.has-hover-ui .tab-group:hover,
.tab-group:focus-within,
.tab-group.is-open {
  z-index: 4000;
}

body.has-hover-ui .tab-group:hover .tab-group__trigger::after,
.tab-group:focus-within .tab-group__trigger::after,
.tab-group.is-open .tab-group__trigger::after {
  color: var(--accent-1);
  transform: translateY(-50%) rotate(180deg);
}

.tab-group.is-current .tab-group__trigger::after {
  color: var(--accent-1);
}

body.has-hover-ui .tab-group:hover .tab-group__menu,
.tab-group:focus-within .tab-group__menu,
.tab-group.is-open .tab-group__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

body.has-hover-ui .tab-group.is-locked-closed .tab-group__menu,
.tab-group.is-locked-closed:focus-within .tab-group__menu,
.tab-group.is-locked-closed .tab-group__menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  pointer-events: none;
  transition: none;
}

body.has-hover-ui .tab-group.is-locked-closed .tab-group__trigger,
.tab-group.is-locked-closed:focus-within .tab-group__trigger,
.tab-group.is-locked-closed .tab-group__trigger {
  transform: none;
  border-color: var(--line);
  box-shadow: var(--shadow);
}

body.has-hover-ui .tab-group.is-locked-closed .tab-group__trigger::after,
.tab-group.is-locked-closed:focus-within .tab-group__trigger::after,
.tab-group.is-locked-closed .tab-group__trigger::after {
  color: var(--muted);
  transform: translateY(-50%);
}

.tab-group.is-current .tab-group__trigger {
  border-color: color-mix(in srgb, var(--accent-1) 26%, var(--line));
  box-shadow: var(--shadow-soft);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.tabs--wide {
  grid-template-columns: 1fr;
}

.tab-button {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.tab-button:hover {
  background: var(--surface-accent-soft);
  color: var(--text);
}

.tab-button.is-active {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent-1) 24%, transparent);
}

.tab-placeholder {
  display: grid;
  gap: 4px;
  min-height: 84px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-accent-softer);
  color: var(--text);
}

.tab-placeholder strong {
  font-size: 0.98rem;
}

.tab-placeholder span {
  color: var(--muted);
  line-height: 1.45;
}

.tab-panel {
  display: none;
  min-height: var(--calculator-panels-min-height, auto);
}

.tab-panel.is-active {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(500px, 620px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.calculator,
.card,
.hero-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calculator,
.card {
  padding: 24px;
}

.hero-card {
  padding: 24px;
  position: relative;
}

.hero-card--gradient {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: white;
  border-color: transparent;
}

.hero-card span,
.hero-card small {
  display: block;
  color: rgba(255, 255, 255, 0.82);
}

.hero-card strong {
  display: block;
  margin: 6px 0 8px;
  font-size: clamp(2.2rem, 6vw, 4.3rem);
  line-height: 1;
}

.doc-button {
  position: absolute;
  top: 16px;
  right: 16px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--doc-button-border);
  border-radius: 999px;
  background: var(--doc-button-bg);
  color: var(--doc-button-text);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.doc-button:hover {
  background: var(--doc-button-bg-hover);
}

.tabs .doc-button {
  position: static;
  top: auto;
  right: auto;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  backdrop-filter: none;
}

.tabs .doc-button:hover {
  background: var(--surface-accent-soft);
  color: var(--text);
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading p,
.card-head span,
.notes,
.metric-card small,
.metric-card span,
.legend span,
.history-table th,
.legal-note {
  color: var(--muted);
}

.field-stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
  position: relative;
  z-index: 0;
}

[data-entnahme-mode][hidden] {
  display: none !important;
}

.field:hover,
.field:focus-within {
  z-index: 3000;
}

.field > span {
  display: block;
  font-weight: 700;
}

.field-label {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.money-input,
.percent-input,
.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--text);
}

.money-input,
.percent-input {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.money-input input,
.percent-input input {
  flex: 1;
  min-width: 0;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: inherit;
  outline: 0;
  font-weight: 500;
}

.money-input span,
.percent-input span {
  padding: 0 16px;
  color: var(--muted);
  font-weight: 700;
}

.field input,
.field select {
  padding: 0 16px;
  outline: 0;
  font-weight: 500;
}

.field 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% - 22px) calc(50% - 2px),
    calc(100% - 16px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}

.tooltip {
  position: relative;
  z-index: 2500;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-1) 12%, white);
  color: var(--accent-1);
  cursor: help;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
}

.tooltip-bubble {
  display: none;
}

.toggles {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.toggles label {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  font-weight: 700;
}

.toggles input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-1);
}

.scenario-picker {
  margin: 4px 0 20px;
}

.scenario-picker__label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scenario-dropdown {
  position: relative;
  max-width: 420px;
}

.scenario-dropdown__trigger {
  appearance: none;
  width: 100%;
  min-height: 48px;
  padding: 0 44px 0 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-control-strong), var(--surface-control-soft));
  color: var(--text);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

body.has-hover-ui .scenario-dropdown__trigger:hover,
.scenario-dropdown.is-open .scenario-dropdown__trigger {
  border-color: color-mix(in srgb, var(--accent-1) 24%, var(--line));
  box-shadow: var(--shadow-soft);
}

.scenario-dropdown__trigger::after {
  content: "▾";
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.9rem;
  transition: transform 0.18s ease;
}

.scenario-dropdown.is-open .scenario-dropdown__trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.scenario-dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-menu);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(14px);
}

.scenario-dropdown__menu[hidden] {
  display: none;
}

.scenario-dropdown__option {
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

body.has-hover-ui .scenario-dropdown__option:hover {
  background: var(--surface-accent-soft);
  color: var(--text);
}

.scenario-dropdown__option.is-active {
  background: var(--surface-accent-strong);
  color: var(--text);
}

.notes {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}

.notes--inline {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.notes--inline p + p {
  margin-top: 10px;
}

.notes h3 {
  color: var(--text);
  margin-bottom: 6px;
}

.formula-card {
  display: grid;
  gap: 14px;
  height: 100%;
  padding: 6px 2px 2px;
}

.formula-card__vars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.formula-card__vars > div {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.formula-card__block {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-formula);
}

.formula-card__block small {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.formula-card__latex {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.45;
}

.results {
  display: grid;
  gap: 18px;
  min-width: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.results > .hero-card,
.results > .card:not(.card--pie-half) {
  grid-column: 1 / -1;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 16px;
}

.card-head__value-group {
  display: grid;
  justify-items: end;
  gap: 2px;
  text-align: right;
}

.card-head__value-group strong {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.15;
}

.card-head__value-group small {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.2;
}

.stacked-bar {
  width: 100%;
  min-height: 330px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 14px;
}

.legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.legend i {
  width: 10px;
  height: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
}

.metric-card > span,
.metric-card > small {
  display: block;
}

.metric-card > span {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.metric-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 1.24rem;
  color: var(--text);
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.metric-card > small {
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.comparison-grid {
  display: grid;
  gap: 10px;
  width: 100%;
}

#depotYearChart + #depotProjection {
  margin-top: 20px;
}

.comparison-grid__head,
.comparison-grid__row {
  display: grid;
  grid-template-columns: minmax(190px, 1.15fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
}

.comparison-grid__head {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.comparison-grid__row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
}

.comparison-grid__label {
  font-weight: 700;
}

.comparison-grid__cell strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
}

.comparison-grid__mobile-head {
  display: none;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.comparison-grid__cell small {
  color: var(--muted);
}

.bar-chart {
  min-height: 280px;
}

.line-chart {
  min-height: 280px;
}

.line-chart__svg,
.bar-chart__svg,
.pie-chart__svg {
  width: 100%;
  height: auto;
  display: block;
}

.line-chart__axis,
.bar-chart__axis {
  stroke: var(--line);
  stroke-width: 1.5;
}

.line-chart__grid,
.bar-chart__grid {
  stroke: var(--grid-line);
  stroke-width: 1;
}

.line-chart__text,
.bar-chart__text {
  fill: var(--muted);
  font-size: 14px;
}

.pie-chart__value {
  fill: var(--text);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pie-chart__label {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pie-chart__segment-label {
  fill: rgba(255, 255, 255, 0.96);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.02em;
  paint-order: stroke;
  stroke: rgba(10, 16, 18, 0.2);
  stroke-width: 2px;
  stroke-linejoin: round;
}

.pie-chart {
  display: grid;
  place-items: center;
  width: min(100%, 330px);
  height: 330px;
  justify-self: center;
}

.pie-chart__svg {
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.08));
}

body[data-theme="dark"] .pie-chart__svg {
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.22));
}

.chart-readout {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.card--pie {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 330px minmax(0, 1fr);
  row-gap: 8px;
  align-items: start;
  align-self: stretch;
  min-height: 0;
  padding: 16px 14px;
}

.card--pie .card-head {
  grid-column: 1 / -1;
  width: 100%;
  justify-self: center;
  margin-bottom: 2px;
}

.card--pie.card--pie-half .card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  min-height: 84px;
  width: 100%;
  gap: 12px;
  margin-bottom: 2px;
}

.card--pie.card--pie-half .card-head h3 {
  margin: 0;
  line-height: 1.25;
}

.card--pie.card--pie-half .card-head .card-head__value-group {
  align-self: start;
  margin-top: 0;
  min-width: 146px;
}

.card--pie.card--pie-half .card-head .card-head__value-group strong,
.card--pie.card--pie-half .card-head .card-head__value-group small {
  white-space: nowrap;
}

.card--pie.card--pie-half .card-head .card-head__value-group small {
  line-height: 1.25;
}

.card--pie .stacked-bar {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin: 0 auto;
  width: 100%;
  height: 330px;
  align-self: start;
}

.card--pie .legend {
  display: grid;
  gap: 8px;
  margin: 0;
  align-content: start;
  justify-self: center;
  justify-items: start;
  width: fit-content;
  max-width: 100%;
}

.card--pie-half:not(.card--pie) {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card--pie-half:not(.card--pie) .notes--inline {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
}

.chart-readout strong {
  color: var(--text);
  font-weight: 700;
}

.chart-readout--table {
  gap: 6px;
}

.chart-readout__row {
  display: grid;
  grid-template-columns: minmax(136px, 156px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.chart-readout__row--quad {
  grid-template-columns: minmax(136px, 156px) minmax(0, 1fr) minmax(136px, 156px) minmax(0, 1fr);
}

.chart-readout__row span {
  color: var(--muted);
}

.chart-readout__row strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chart-readout__highlight-card {
  grid-column: span 2;
  display: grid;
  grid-template-columns: minmax(136px, 156px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 12px;
  background: var(--surface-readout-highlight);
  box-shadow: inset 0 1px 0 var(--surface-readout-sheen);
}

.chart-readout__highlight-label {
  color: var(--text) !important;
  font-weight: 800;
}

.chart-readout__highlight-value {
  justify-self: start;
}

#entnahmeCashflowReadout .chart-readout__row {
  grid-template-columns: minmax(148px, 168px) minmax(0, 1fr);
  gap: 18px;
}

@media (max-width: 720px) {
  .chart-readout__row,
  .chart-readout__row--quad,
  .chart-readout__highlight-card,
  #entnahmeCashflowReadout .chart-readout__row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.chart-tooltip {
  position: fixed;
  z-index: 5000;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-tooltip);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

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

.chart-tooltip__row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.chart-tooltip__row + .chart-tooltip__row {
  margin-top: 4px;
}

.chart-tooltip__label {
  color: var(--muted);
  white-space: nowrap;
}

.chart-tooltip__value {
  justify-self: end;
  text-align: right;
  color: var(--text);
}

.doc-overlay {
  position: fixed;
  inset: 0;
  z-index: 6000;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

.doc-overlay[hidden] {
  display: none;
}

.doc-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay-backdrop);
  backdrop-filter: blur(8px);
}

.doc-overlay__panel {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100vw - 32px));
  height: calc(100dvh - 8px);
  max-height: 1200px;
  margin: 20px auto 4px;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-doc-panel);
  box-shadow: 0 32px 80px rgba(7, 18, 16, 0.28);
  overflow: hidden;
  overscroll-behavior: contain;
}

.doc-overlay__header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  min-height: 56px;
  padding: 10px 124px 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-doc-header);
}

.doc-overlay__header .eyebrow {
  margin-bottom: 4px;
  font-size: 0.72rem;
}

.doc-overlay__header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.doc-overlay__close {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.doc-overlay__frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: var(--surface-iframe);
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.history-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

#inflationPanel .history-table-wrap {
  overflow: visible;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.history-table th,
.history-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.history-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-table--inflation th,
.history-table--inflation td {
  width: 16.66%;
}

.history-table--inflation th:nth-child(odd),
.history-table--inflation td:nth-child(odd) {
  padding-right: 6px;
}

.history-table--inflation th:nth-child(even),
.history-table--inflation td:nth-child(even) {
  padding-left: 6px;
}

.history-table--inflation th:nth-child(2),
.history-table--inflation th:nth-child(4),
.history-table--inflation td:nth-child(2),
.history-table--inflation td:nth-child(4) {
  padding-right: 18px;
  border-right: 1px solid var(--range-separator);
}

.history-table--inflation th:nth-child(3),
.history-table--inflation th:nth-child(5),
.history-table--inflation td:nth-child(3),
.history-table--inflation td:nth-child(5) {
  padding-left: 18px;
}

.history-table__range-cell {
  background: var(--surface-accent-soft);
}

.history-table__range-cell.is-start,
.history-table__range-cell.is-target {
  background: var(--surface-accent-strong);
  font-weight: 800;
}

.history-table__year-cell {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.history-table__tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-1) 18%, var(--surface-strong));
  color: var(--accent-1);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.legal-note {
  margin: 10px 0 0;
  font-size: 0.86rem;
}

.card--compact {
  padding-top: 20px;
  padding-bottom: 20px;
}

@media (max-width: 1320px) {
  .tabs,
  .tabs--wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1080px) {
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .tab-groups {
    display: grid;
  }

  .tab-group {
    display: block;
    min-width: 0;
  }

  .tab-group--article {
    margin-left: 0;
  }

  .tab-group--article::before {
    display: none;
  }

  .tab-panel {
    min-height: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: auto;
    max-width: 1180px;
    margin: 0 10px;
    padding: 18px 0 28px;
  }

  .hero-topline {
    flex-direction: column;
    align-items: flex-start;
  }

  #page-title {
    white-space: normal;
    line-height: 1.02;
  }

  .tab-groups {
    gap: 10px;
  }

  .tab-group {
    width: 100%;
    flex: none;
    display: block;
    z-index: 1;
  }

  .tab-group--article {
    min-width: 0;
  }

  .tabs {
    grid-template-columns: 1fr;
  }

  .tabs--wide {
    grid-template-columns: 1fr;
  }

  .tab-group__trigger {
    height: auto;
    min-height: auto;
  }

  .tab-group__trigger span {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .tab-group__menu {
    position: static;
    margin-top: 0;
    padding: 0 10px;
    border-color: transparent;
    box-shadow: none;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    overflow: hidden;
    transform: none;
    pointer-events: none;
  }

  .tab-group__menu--compact {
    left: auto;
    right: auto;
    width: 100%;
  }

  .tab-group.is-open .tab-group__menu,
  .tab-group:focus-within .tab-group__menu {
    margin-top: 8px;
    padding: 10px;
    border-color: var(--line);
    opacity: 1;
    visibility: visible;
    max-height: 520px;
    pointer-events: auto;
  }

  .tab-group.is-locked-closed .tab-group__menu,
  .tab-group.is-locked-closed:focus-within .tab-group__menu {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-color: transparent;
    opacity: 0;
    visibility: hidden;
    max-height: 0;
    pointer-events: none;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card strong {
    font-size: 1.14rem;
  }

  .comparison-grid__head {
    display: none;
  }

  .comparison-grid__row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .comparison-grid__cell {
    padding-top: 2px;
  }

  .comparison-grid__mobile-head {
    display: block;
  }

  .card-head {
    display: block;
  }

  .card-head h3 {
    margin-bottom: 4px;
  }

  .card-head span,
  .card-head__value-group small {
    display: block;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .results {
    grid-template-columns: 1fr;
  }

  .results > .card,
  .results > .hero-card {
    grid-column: auto;
  }

  .card--pie {
    grid-template-columns: 1fr;
  }

  .card--pie .legend {
    margin-top: 12px;
  }

  .legend {
    display: grid;
    gap: 8px;
  }

  .legend span {
    font-size: 0.86rem;
  }

  .line-chart__text,
  .bar-chart__text {
    font-size: 11px;
  }

  .chart-readout {
    font-size: 0.88rem;
    gap: 6px;
  }

  .chart-readout strong {
    line-height: 1.35;
  }

  .calculator,
  .card,
  .hero-card {
    padding: 18px;
  }

  .doc-button {
    position: static;
    margin-bottom: 12px;
    justify-self: start;
    color: var(--text);
    border-color: rgba(23, 33, 32, 0.12);
    background: var(--surface);
    backdrop-filter: none;
  }

  .doc-overlay__panel {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    margin: 8px auto;
  }

  .doc-overlay__header {
    min-height: 56px;
    padding: 10px 92px 10px 16px;
  }

  .history-table--inflation th,
  .history-table--inflation td {
    width: auto;
  }

  .history-table--inflation thead {
    display: none;
  }

  .history-table--inflation tbody {
    display: grid;
    gap: 10px;
  }

  .history-table--inflation tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-strong);
  }

  .history-table--inflation td {
    border-bottom: 1px solid var(--line);
  }

  .history-table--inflation tr td:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}

@media (max-width: 560px) {
  .history-table {
    font-size: 0.82rem;
    min-width: 560px;
  }

  .history-table th,
  .history-table td {
    padding: 6px 8px;
  }

  .doc-overlay__header {
    gap: 10px;
  }

  .doc-overlay__close {
    top: 50%;
    right: 16px;
    min-height: 40px;
    padding: 0 12px;
  }

}
