*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--brand-ink);
  background: var(--brand-paper);
  line-height: 1.45;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--brand-blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-navy);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.site-header {
  background: var(--brand-navy);
  color: #fff;
  border-bottom: 2px solid var(--brand-orange);
}

.site-header__inner {
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.site-logo img {
  height: 40px;
  width: auto;
}

.site-header__back {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.page-home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.25rem 1.5rem;
}

.home__logo {
  height: 72px;
  width: auto;
  margin: 0 0 1.5rem;
}

.home__title {
  margin: 0 0 1.75rem;
  font-family: var(--headline-font);
  font-size: clamp(1.85rem, 3vw, 2.35rem);
  color: var(--brand-navy);
  font-weight: 700;
  line-height: 1.15;
}

.home__nav {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
  max-width: 22rem;
}

.home__btn {
  display: block;
  padding: 0.85rem 1.1rem;
  background: var(--brand-blue);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid var(--brand-blue);
  text-align: center;
  transition: transform var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}

.home__btn:active {
  transform: scale(0.97);
}

.home__btn--soon {
  background: #fff;
  color: var(--brand-gray-9);
  border-color: var(--brand-line-strong);
  font-weight: 600;
  cursor: default;
}

@media (hover: hover) and (pointer: fine) {
  a.home__btn:hover {
    background: #1665a4;
    border-color: #1665a4;
    color: #fff;
  }
}

.site-footer--home {
  padding-bottom: 1.5rem;
}

.site-footer--home .site-footer__box {
  max-width: 36rem;
  margin: 0 auto;
  text-align: center;
}

.shell {
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 2.5rem;
}

.shell--calc {
  padding-top: 1.25rem;
}

.calc-top {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--brand-line-strong);
}

.calc-top__title {
  flex: 1 1 16rem;
  min-width: 0;
}

.calc-top__title h1 {
  margin: 0 0 0.25rem;
  font-family: var(--headline-font);
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  font-weight: 700;
  color: var(--brand-navy);
  line-height: 1.2;
}

.calc-top__title p {
  margin: 0;
  color: var(--brand-gray-9);
  font-size: 0.92rem;
  max-width: 34rem;
}

.calc-top__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.75rem;
  align-items: end;
}

.page-hero {
  margin-bottom: 1.75rem;
  max-width: 40rem;
}

.page-hero h1 {
  margin: 0 0 0.4rem;
  font-family: var(--headline-font);
  font-size: clamp(1.65rem, 2.6vw, 2.1rem);
  font-weight: 700;
  color: var(--brand-navy);
  line-height: 1.2;
}

.page-hero p {
  margin: 0;
  color: var(--brand-gray-9);
  font-size: 0.98rem;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 9.5rem;
}

.meta-field label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-ink);
}

.meta-field input {
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  color: var(--brand-ink);
  background: #fff;
  min-width: 10rem;
}

.meta-field input:focus {
  outline: 2px solid var(--brand-blue);
  outline-offset: 1px;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  border-radius: 4px;
  padding: 0.55rem 1rem;
  transition: transform var(--transition), background var(--transition);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--brand-blue);
  color: #fff;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: #1665a4;
  }

  .link-btn:hover {
    color: var(--brand-deep);
  }

  .legend-btn:hover {
    background: var(--brand-paper);
  }

  .site-header__back:hover {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  a:hover {
    color: var(--brand-deep);
  }
}

.btn-print {
  white-space: nowrap;
}

.link-btn {
  appearance: none;
  border: none;
  background: none;
  margin: 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brand-blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  position: relative;
  min-height: 2.5rem;
  padding: 0.45rem 0.35rem;
  display: inline-flex;
  align-items: center;
}

.link-btn:active {
  transform: scale(0.97);
}

.field__label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
  min-height: 2.5rem;
}

.field__label-row label {
  margin-bottom: 0;
}

.withdraw-row {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}

.withdraw-row .segmented,
.withdraw-row .input-row {
  min-height: 2.5rem;
}

.withdraw-row .segmented {
  margin-bottom: 0;
  flex-shrink: 0;
}

.withdraw-row__input {
  flex: 1;
  min-width: 0;
}

.layout-calc {
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
}

.panel {
  background: #fff;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
}

.panel--assumptions {
  padding: 0.95rem;
  position: sticky;
  top: 0.65rem;
  max-height: calc(100vh - 1.3rem);
  overflow-y: auto;
}

.panel__title {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
  font-family: var(--headline-font);
  color: var(--brand-navy);
  font-weight: 700;
}

.field {
  margin-bottom: 0.75rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand-ink);
  margin-bottom: 0.3rem;
}

.field__hint {
  margin: 0.25rem 0 0;
  font-size: 0.76rem;
  color: var(--brand-gray-9);
}

.input-row {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}

.input-row:focus-within {
  outline: 2px solid var(--brand-blue);
  outline-offset: 1px;
}

.input-prefix,
.input-suffix {
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  background: var(--brand-paper);
  color: var(--brand-gray-9);
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.input-row input {
  flex: 1;
  border: none;
  padding: 0.5rem 0.55rem;
  font: inherit;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  background: transparent;
  color: var(--brand-ink);
}

.input-row input:focus {
  outline: none;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.segmented button {
  appearance: none;
  border: none;
  background: #fff;
  color: var(--brand-gray-9);
  font: inherit;
  font-weight: 700;
  padding: 0 0.65rem;
  cursor: pointer;
  min-width: 2.5rem;
  transition: transform var(--transition), background var(--transition), color var(--transition);
}

.segmented button:active {
  transform: scale(0.97);
}

.segmented button[aria-pressed="true"] {
  background: var(--brand-navy);
  color: #fff;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  align-items: start;
}

.field-row .field {
  margin-bottom: 0;
  min-width: 0;
}

.field-row .input-row {
  min-height: 2.35rem;
}

.input-short {
  text-align: right;
  max-width: 100%;
}

.field__hint--row {
  margin-top: 0.4rem;
}

.section-label {
  margin: 0.85rem 0 0.45rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--brand-line);
  font-size: 0.84rem;
  font-family: var(--headline-font);
  color: var(--brand-navy);
  font-weight: 700;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.verdict {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  background: #fff;
}

.verdict strong {
  font-family: var(--headline-font);
  font-size: 1.05rem;
  color: var(--brand-navy);
}

.verdict span {
  font-size: 0.86rem;
  color: var(--brand-gray-9);
}

.verdict--ahead {
  background: #f3faf6;
  border-color: rgba(31, 122, 77, 0.3);
}

.verdict--ahead strong {
  color: #1f7a4d;
}

.verdict--behind {
  background: #fbf8ef;
  border-color: rgba(138, 106, 18, 0.3);
}

.verdict--behind strong {
  color: #8a6a12;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #fff;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  overflow: hidden;
}

.kpi {
  padding: 0.8rem 0.85rem;
  border-right: 1px solid var(--brand-line);
}

.kpi:last-child {
  border-right: none;
}

.kpi__label {
  margin: 0 0 0.25rem;
  font-size: 0.74rem;
  color: var(--brand-gray-9);
  font-weight: 700;
}

.kpi__value {
  margin: 0;
  font-family: var(--headline-font);
  font-size: clamp(1.1rem, 1.8vw, 1.35rem);
  color: var(--brand-navy);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.kpi__value--good {
  color: #1f7a4d;
}

.kpi__value--bad {
  color: #a94412;
}

.kpi__sub {
  margin: 0.28rem 0 0;
  font-size: 0.74rem;
  color: var(--brand-gray-9);
  line-height: 1.3;
}

.chart-panel {
  padding: 0.85rem 0.95rem 0.95rem;
}

.chart-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.55rem;
}

.chart-panel h2 {
  margin: 0;
  font-size: 0.98rem;
  font-family: var(--headline-font);
  color: var(--brand-navy);
}

.chart-panel__note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--brand-gray-9);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 0.55rem;
  padding: 0;
  list-style: none;
}

.legend-btn {
  appearance: none;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--brand-gray-9);
  cursor: pointer;
  border-radius: 3px;
}

.legend-btn[aria-pressed="false"] {
  opacity: 0.4;
  text-decoration: line-through;
}

.swatch {
  width: 12px;
  height: 2px;
  background: currentColor;
  flex-shrink: 0;
}

.swatch--balance { color: var(--brand-blue); }
.swatch--portfolio { color: #1f7a4d; }
.swatch--pension {
  color: var(--brand-gray-9);
  border-top: 2px dashed currentColor;
  height: 0;
  background: none;
}
.swatch--total { color: var(--brand-orange); }

.chart-wrap {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--brand-line);
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  display: block;
}

.compare-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #fff;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  overflow: hidden;
}

.compare-card {
  padding: 0.85rem 0.95rem;
  min-width: 0;
}

.compare-card:first-child {
  border-right: 1px solid var(--brand-line);
}

.compare-card__kicker {
  margin: 0 0 0.25rem;
  font-size: 0.74rem;
  color: var(--brand-gray-9);
  font-weight: 700;
}

.compare-card__value {
  margin: 0;
  font-family: var(--headline-font);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  color: var(--brand-navy);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.compare-card__sub {
  margin: 0.28rem 0 0;
  font-size: 0.74rem;
  color: var(--brand-gray-9);
  line-height: 1.3;
}

.kpi-strip--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}

.summary-table th,
.summary-table td {
  padding: 0.55rem 0.85rem;
  text-align: right;
  border-bottom: 1px solid var(--brand-line);
  font-size: 0.88rem;
  color: var(--brand-ink);
}

.summary-table tbody tr:last-child th,
.summary-table tbody tr:last-child td {
  border-bottom: none;
}

.summary-table th:first-child,
.summary-table td:first-child {
  text-align: left;
  font-weight: 700;
  color: var(--brand-gray-9);
  font-size: 0.82rem;
}

.summary-table thead th {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--brand-navy);
  background: var(--brand-paper);
}

.pair-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.pair-fields fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

.pair-fields legend {
  padding: 0;
  margin: 0 0 0.45rem;
  font-size: 0.84rem;
  font-family: var(--headline-font);
  color: var(--brand-navy);
  font-weight: 700;
}

.segmented--wide {
  display: flex;
  width: 100%;
  margin-bottom: 0.75rem;
}

.segmented--wide button {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.25rem;
  font-size: 0.78rem;
}

.coming-soon {
  padding: 1.75rem 1.25rem;
  background: #fff;
  border: 1px solid var(--brand-line-strong);
  border-radius: 4px;
  max-width: 32rem;
}

.coming-soon h2 {
  margin: 0 0 0.4rem;
  font-family: var(--headline-font);
  color: var(--brand-navy);
  font-size: 1.25rem;
}

.coming-soon p {
  margin: 0 0 1rem;
  color: var(--brand-gray-9);
}

.site-footer {
  max-width: var(--shell-width);
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

.site-footer__box {
  padding: 1rem 0 0;
  border-top: 1px solid var(--brand-line-strong);
  color: var(--brand-gray-9);
  font-size: 0.78rem;
  line-height: 1.5;
}

.site-footer__box p {
  margin: 0 0 0.5rem;
}

.site-footer__box p:last-child {
  margin-bottom: 0;
}

.site-footer__legal {
  color: var(--brand-gray-7);
}

@media (max-width: 980px) {
  .kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi:nth-child(2n) {
    border-right: none;
  }

  .kpi:nth-child(-n + 2) {
    border-bottom: 1px solid var(--brand-line);
  }

  .kpi-strip--3 {
    grid-template-columns: 1fr;
  }

  .kpi-strip--3 .kpi {
    border-right: none;
    border-bottom: 1px solid var(--brand-line);
  }

  .kpi-strip--3 .kpi:last-child {
    border-bottom: none;
  }
}

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

  .panel--assumptions {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .calc-top__meta {
    width: 100%;
  }

  .btn-print {
    width: 100%;
  }

  .meta-field {
    flex: 1 1 10rem;
  }

  .meta-field input {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .compare-pair,
  .pair-fields {
    grid-template-columns: 1fr;
  }

  .compare-card:first-child {
    border-right: none;
    border-bottom: 1px solid var(--brand-line);
  }

  .kpi-strip {
    grid-template-columns: 1fr;
  }

  .kpi {
    border-right: none;
    border-bottom: 1px solid var(--brand-line);
  }

  .kpi:last-child {
    border-bottom: none;
  }

  .kpi:nth-child(-n + 2) {
    border-bottom: 1px solid var(--brand-line);
  }

  .site-logo img {
    height: 36px;
  }

  .home__logo {
    height: 56px;
  }
}
