:root {
  --brand-red: #C70101;
  --brand-red-dark: #9b0000;
  --ink: #222;
  --ink-soft: #555;
  --line: #ececec;
  --bg: #fff;
  --bg-soft: #F4F4F4;
  --bar-track: #f0f0f0;
  --bar-alt: #777;
  --field-border: #d0d0d0;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --font: "Nexa", "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", "DejaVu Sans", Verdana, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body[data-mode="iframed"] { background: transparent; }

body[data-mode="iframed"] .page-header { display: none !important; }
body[data-mode="standalone"] .page-header { display: block; }

.page-header {
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
  background: #fff;
}
.page-header__inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.page-header__brand {
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--brand-red);
}
.page-header__title {
  font-size: 14px;
  color: var(--ink-soft);
}

.calc {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

body[data-mode="iframed"] .calc {
  box-shadow: none;
  border-radius: 0;
  margin: 0 auto;
}

.calc__hero {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  color: #fff;
  padding: 32px 28px;
}
.calc__hero h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.calc__hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  line-height: 1.4;
}

.calc__inputs {
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}
.calc__inputs-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 540px) {
  .calc__inputs-row { grid-template-columns: 1fr; }
}

.calc__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.calc__field label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.calc__field input,
.calc__field select {
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  font-size: 15px;
  background: #fff;
  font-family: inherit;
  color: inherit;
}
.calc__field input:focus,
.calc__field select:focus {
  outline: none;
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px rgba(199, 1, 1, 0.15);
}
.calc__field--full { grid-column: 1 / -1; }
.calc__optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 11px;
}

.calc__toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.calc__toggle-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.calc__toggle {
  display: inline-flex;
  background: #f4f4f4;
  border-radius: 8px;
  padding: 4px;
}
.calc__toggle button {
  background: none;
  border: 0;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 6px;
  font-family: inherit;
}
.calc__toggle button.is-active {
  background: #fff;
  color: var(--brand-red);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.calc__toggle button:focus-visible {
  outline: 2px solid var(--brand-red);
  outline-offset: 2px;
}

.calc__headline {
  padding: 28px 28px 24px;
  background: var(--bg-soft);
  text-align: center;
  border-bottom: 1px solid var(--line);
}
.calc__headline-number {
  font-size: clamp(36px, 7vw, 52px);
  font-weight: 800;
  color: var(--brand-red);
  line-height: 1;
  letter-spacing: -0.02em;
}
.calc__headline-number small {
  font-size: clamp(16px, 3vw, 22px);
  color: var(--ink);
  font-weight: 600;
  margin-left: 6px;
  letter-spacing: 0;
}
.calc__headline-label {
  margin-top: 8px;
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.calc__headline-label span { font-weight: 600; color: var(--ink); }

.calc__chart {
  padding: 22px 28px 26px;
}
.calc__chart-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 70px;
  align-items: center;
  gap: 12px;
}
@media (max-width: 540px) {
  .bar-row { grid-template-columns: 110px 1fr 56px; gap: 8px; }
  .bar-label { font-size: 13px; }
}
.bar-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.bar-row.is-selected .bar-label {
  color: var(--brand-red);
  font-weight: 700;
}
.bar-track {
  height: 26px;
  background: var(--bar-track);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--bar-alt);
  border-radius: 4px;
  transition: width 0.35s ease;
}
.bar-row.is-selected .bar-fill { background: var(--brand-red); }
.bar-value {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.calc__footnote {
  margin: 18px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}
