:root {
  --ink: #1c2530;
  --muted: #64707d;
  --line: #d8dde3;
  --panel: #ffffff;
  --soft: #f4f6f8;
  --aia-red: #d31145;
  --blue: #2563eb;
  --teal: #0f766e;
  --shadow: 0 2px 8px rgba(28, 37, 48, 0.035);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #eef1f4;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: 100%;
  max-width: 1600px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 44px;
}

.app-header,
.panel-heading,
.header-actions,
.legend,
.segmented {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.app-header {
  margin-bottom: 18px;
}

.secondary-link {
  display: inline-grid;
  min-height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
}

.secondary-link:hover {
  border-color: var(--aia-red);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--aia-red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  letter-spacing: 0;
}

h1,
h2,
h3,
p,
summary,
label span,
.detail-list strong,
.detail-list span {
  overflow-wrap: break-word;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 10px;
  min-width: 0;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  gap: 18px;
  align-items: start;
  margin-bottom: 0;
}

.top-card-grid,
#modelWorkspace {
  display: grid;
  gap: 18px;
}

.top-card-grid {
  margin-bottom: 18px;
}

#modelWorkspace {
  scroll-margin-top: 16px;
}

.top-card-grid > .panel,
#modelWorkspace > *,
.setup-grid > .panel {
  margin-bottom: 0;
}

.panel {
  margin-bottom: 18px;
}

.panel-heading {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.status-pill {
  display: inline-grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
}

.product-selector-body {
  display: grid;
  gap: 16px;
  padding: 18px 20px 20px;
}

.product-select-field {
  display: grid;
  width: 100%;
  max-width: none;
}

.product-detail-details > .product-detail-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  padding: 18px 20px;
}

.product-detail-details {
  border-top: 1px solid var(--line);
}

.product-detail-details summary {
  min-height: 52px;
  padding: 14px 16px;
}

.detail-list {
  display: grid;
  gap: 12px;
  padding: 18px 20px 20px;
}

.detail-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-list > div {
  border: 1px solid var(--line);
  background: var(--soft);
  padding: 13px;
}

.detail-list > div > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.detail-list > div > strong {
  display: block;
  margin-bottom: 6px;
  font-size: 16px;
}


.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px 20px 20px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

.checkbox-field {
  display: flex;
  align-items: center;
  min-height: 40px;
  gap: 10px;
}

.checkbox-field input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 18px;
}

.checkbox-field span {
  margin: 0;
}

input:focus,
select:focus {
  border-color: var(--aia-red);
  box-shadow: 0 0 0 3px rgba(211, 17, 69, 0.12);
}

.secondary-button,
.segmented button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  font-weight: 800;
}

.secondary-button:hover,
.segmented button:hover {
  border-color: var(--aia-red);
}

.secondary-button:disabled,
.segmented button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.segment-active {
  border-color: var(--aia-red) !important;
  background: var(--aia-red) !important;
  color: #fff !important;
}

.chart-wrap {
  position: relative;
}

.chart-panel canvas {
  width: 100%;
  height: 300px;
  display: block;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  width: min(360px, calc(100% - 16px));
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 42px rgba(28, 37, 48, 0.18);
  padding: 14px;
  pointer-events: none;
  font-size: 13px;
  line-height: 1.45;
}

.tooltip-date {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.tooltip-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 8px;
}

.tooltip-line span {
  color: var(--muted);
  font-weight: 800;
}

.tooltip-line strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.tooltip-subline {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.tooltip-divider {
  height: 1px;
  margin: 11px 0 9px;
  background: var(--line);
}

.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  vertical-align: -1px;
}

.legend-swatch.red {
  background: var(--aia-red);
}

.legend-swatch.blue {
  background: var(--blue);
}

.hidden {
  display: none !important;
}

.legend {
  justify-content: flex-end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.legend i {
  display: inline-block;
  width: 22px;
  height: 3px;
  margin-right: 6px;
  vertical-align: middle;
}

.legend .red {
  background: var(--aia-red);
}

.legend .blue {
  background: var(--blue);
}

.timeline-viewport {
  padding: 18px 20px 12px;
  overflow-x: auto;
}

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px 0;
}

.timeline-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.timeline-chip.charge {
  background: #fff4f7;
  border-color: #f3b7c7;
  color: #9f1239;
}

.timeline-chip.bonus {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #047857;
}

.timeline-chip.dividend {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.timeline-chip.withdrawal {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.timeline-chip.topup {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #0f766e;
}

.timeline-chip.holiday {
  background: #fef3c7;
  border-color: #fde68a;
  color: #92400e;
}

.timeline-chip.muted {
  color: var(--muted);
}

.timeline-note {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.beta-label {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
  vertical-align: 4px;
}

.compact-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.visual-timeline {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(246, 248, 250, 0.96)),
    repeating-linear-gradient(90deg, rgba(216, 221, 227, 0.32) 0, rgba(216, 221, 227, 0.32) 1px, transparent 1px, transparent 72px);
  padding: 18px;
}

.timeline-value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.timeline-value-card {
  min-height: 114px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 18px rgba(28, 37, 48, 0.1);
  padding: 14px;
  outline: none;
}

.timeline-value-card:hover,
.timeline-value-card:focus,
.age-marker:hover,
.age-marker:focus,
.lane-band:hover,
.lane-band:focus {
  outline: 2px solid rgba(211, 17, 69, 0.35);
  outline-offset: 2px;
}

.timeline-value-card strong,
.timeline-value-card em,
.timeline-value-card small {
  display: block;
}

.timeline-value-card strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
  text-transform: uppercase;
}

.timeline-value-card em {
  margin-top: 8px;
  color: var(--ink);
  font-style: normal;
  font-size: 22px;
  font-weight: 900;
}

.timeline-value-card small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.timeline-value-card.premium {
  background: #4f4698;
  color: #fff;
}

.timeline-value-card.premium strong,
.timeline-value-card.premium em,
.timeline-value-card.premium small {
  color: #fff;
}

.timeline-value-card.dividend {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.timeline-value-card.withdrawal {
  border-color: #fed7aa;
  background: #fff7ed;
}

.timeline-value-card.topup {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.timeline-value-card.holiday {
  border-color: #fde68a;
  background: #fffbeb;
}

.timeline-value-card.maturity {
  border-color: #10b8c7;
}

.timeline-axis {
  position: relative;
  height: 118px;
  margin-bottom: 18px;
}

.policy-bar {
  position: absolute;
  top: 36px;
  height: 42px;
  background: #10b8c7;
  border: 2px solid #0b8794;
  box-shadow: 0 5px 12px rgba(28, 37, 48, 0.18);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 38px;
  text-align: right;
}

.policy-bar::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -24px;
  width: 24px;
  height: 42px;
  background: #10b8c7;
  border-right: 2px solid #0b8794;
  border-top: 2px solid #0b8794;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.policy-bar > span {
  position: relative;
  z-index: 1;
  padding-right: 18px;
}

.premium-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
  min-width: 170px;
  background: #4f4698;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.age-marker {
  position: absolute;
  top: 82px;
  z-index: 5;
  display: grid;
  width: 38px;
  height: 38px;
  transform: translateX(-50%);
  place-items: center;
  border-radius: 999px;
  border: 1px solid #b7d4e8;
  background: #eef7fb;
  box-shadow: 0 4px 8px rgba(28, 37, 48, 0.12);
  color: #1f83b7;
  font-size: 15px;
  font-weight: 900;
  outline: none;
}

.age-marker.start {
  border-color: #c8c4ee;
  background: #f0effb;
  color: #4f4698;
}

.age-marker.teal {
  border-color: #9ee8ee;
  background: #e7fbfd;
  color: #0b8794;
}

.timeline-lanes {
  display: grid;
  gap: 9px;
}

.timeline-lane {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.lane-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.lane-track {
  position: relative;
  height: 34px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.lane-band,
.lane-empty {
  position: absolute;
  top: 5px;
  min-width: 150px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  padding: 0 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  outline: none;
}

.lane-band.bonus {
  background: #059669;
}

.lane-band.investment {
  background: #047857;
}

.lane-band.performance {
  background: #0f766e;
}

.lane-band.special {
  background: #0d9488;
}

.lane-band.charge {
  background: #f97316;
}

.lane-band.surrender {
  background: #4d7c0f;
}

.lane-band.partial {
  background: #65a30d;
}

.lane-band.cashflow {
  min-width: 8px;
  overflow: visible;
  padding: 0;
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.lane-band.cashflow::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 7px);
  top: 50%;
  transform: translateY(-50%);
  color: inherit;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.lane-band.cashflow.withdrawal {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.lane-band.cashflow.topup {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #0f766e;
}

.lane-band.cashflow.holiday {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.lane-empty {
  left: 12px;
  background: transparent;
  color: var(--muted);
  justify-content: flex-start;
  padding-left: 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

#tableOutput {
  position: relative;
}

.projection-sticky-block {
  position: sticky;
  top: 0;
  z-index: 25;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 22px rgba(28, 37, 48, 0.08);
}

.projection-sticky-block .panel-heading {
  border-bottom: 1px solid var(--line);
}

.sticky-table-header {
  position: relative;
  z-index: 1;
  background: #fff;
  scrollbar-width: none;
}

.sticky-table-header::-webkit-scrollbar {
  display: none;
}

#tableOutput thead {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.table-status {
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.table-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.table-footer {
  display: flex;
  justify-content: center;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

.projection-table {
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: center;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: center;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}

th {
  color: var(--muted);
  background: var(--soft);
  font-size: 12px;
  font-weight: 800;
}

th:first-child {
  background: var(--soft);
}

#tableOutput th,
.sticky-table-header th {
  z-index: 3;
  height: 48px;
  padding: 7px 8px;
  white-space: normal;
  line-height: 1.15;
  vertical-align: bottom;
}

.sticky-table-header th:first-child,
#tableOutput th:first-child {
  z-index: 4;
}

#tableOutput td {
  padding: 8px;
  transition: background 120ms ease;
}

#tableOutput tbody tr:hover td {
  background: #fff4f7;
}

td {
  font-size: 13px;
}

.inline-details {
  overflow: hidden;
}

.inline-details {
  border-top: 1px solid var(--line);
}

.inline-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  padding: 18px 20px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.inline-details summary::-webkit-details-marker {
  display: none;
}

.inline-details summary::after {
  content: "+";
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  background: var(--soft);
  color: var(--aia-red);
  font-weight: 900;
}

.inline-details[open] summary::after {
  content: "-";
}

.summary-hint {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.details-body {
  border-top: 1px solid var(--line);
  padding: 18px 20px 20px;
  min-width: 0;
}

.details-form {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

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

.breakdown-grid section {
  border: 1px solid var(--line);
  background: var(--soft);
  min-width: 0;
  padding: 14px;
}

.breakdown-grid h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.breakdown-grid p,
.breakdown-grid li {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.breakdown-grid p {
  margin: 0 0 10px;
}

.compact-table table {
  min-width: 560px;
}

.compact-table th,
.compact-table td {
  padding: 9px 10px;
}

.rate-details {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.rate-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
}

.rate-details summary::-webkit-details-marker {
  display: none;
}

.rate-details summary::after {
  content: "+";
  display: inline-grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  place-items: center;
  background: var(--soft);
  color: var(--aia-red);
  font-weight: 900;
}

.rate-details[open] summary::after {
  content: "-";
}

.rate-details .table-wrap {
  border-top: 1px solid var(--line);
}

.note {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.site-footer {
  margin: 28px auto 6px;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}

.footer-disclaimer {
  width: 100%;
  max-width: none;
  color: var(--muted);
}

.footer-disclaimer h2 {
  color: var(--ink);
  font-size: 18px;
}

.footer-disclaimer p:not(.eyebrow),
.footer-credit {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.footer-credit {
  color: var(--ink);
  font-weight: 800;
}

.faq-list {
  display: grid;
}

.faq-list details {
  border-top: 1px solid var(--line);
}

.faq-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  padding: 18px 20px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

.faq-list summary::after {
  content: "+";
  display: inline-grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  background: var(--soft);
  color: var(--aia-red);
  font-weight: 900;
}

.faq-list details[open] summary::after {
  content: "-";
}

.faq-answer p {
  margin: 0;
  padding: 0 20px 20px;
  color: var(--muted);
  line-height: 1.55;
}

.faq-table {
  width: calc(100% - 40px);
  max-width: calc(100% - 40px);
  margin: 0 20px 20px;
  border: 1px solid var(--line);
}

.faq-table table {
  min-width: 0;
  table-layout: fixed;
}

.faq-table th,
.faq-table td {
  white-space: normal;
}

.faq-table th:first-child,
.faq-table td:first-child {
  width: 86px;
}

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--aia-red);
  box-shadow: var(--shadow);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 20px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease, background-color 180ms ease;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover,
.back-to-top:focus-visible {
  background: #a70d34;
}

@media (max-width: 1000px) {
  .shell {
    padding: 22px;
  }

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

@media (max-width: 720px) {
  .shell {
    padding: 14px;
  }

  .app-header,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup-grid,
  .detail-list,
  .product-detail-grid,
  .breakdown-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 25px;
  }

  .summary-hint {
    display: none;
  }

  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .timeline-viewport {
    padding-left: 14px;
    padding-right: 14px;
  }

  .visual-timeline {
    padding: 14px;
  }

  .timeline-lane {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
  }

  .lane-label {
    font-size: 11px;
  }

  .policy-bar {
    font-size: 13px;
  }

  .policy-bar > span {
    padding-right: 10px;
  }

  .premium-bar {
    min-width: 104px;
    font-size: 11px;
  }

  .table-toolbar .segmented {
    width: 100%;
  }

  .table-toolbar .compact-button {
    width: 100%;
  }

  .table-toolbar .segmented button {
    flex: 1;
  }

  .table-status,
  .note {
    padding-left: 14px;
    padding-right: 14px;
  }

  .faq-answer p {
    padding-left: 14px;
    padding-right: 14px;
  }

  .faq-table {
    width: calc(100% - 28px);
    max-width: calc(100% - 28px);
    margin-left: 14px;
    margin-right: 14px;
  }

  .back-to-top {
    right: 14px;
    bottom: 14px;
  }
}

/* Primary workflow */
.product-selector-body {
  grid-template-columns: minmax(260px, 480px) 1fr;
  align-items: center;
}
.product-quick-facts {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.product-selector-body.has-variants .product-quick-facts {
  grid-column: 1 / -1;
  margin-top: 0;
}
.product-payment-note,
.optional-feature-note {
  margin: 0;
  padding: 0 20px 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.product-modelling-notes {
  margin: 0;
  padding: 0 36px 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.product-modelling-notes li + li { margin-top: 6px; }
.premium-bar.single-premium {
  min-width: 0;
  max-width: 100%;
  padding: 0 10px;
}
.product-select-field select { font-weight: 650; }
input, select, button, .secondary-link { border-radius: 5px; }
.field-error { color: #a70d34; font-size: 12px; line-height: 1.4; }
.field-error:empty { display: none; }
[aria-invalid="true"] { border-color: #a70d34; }
.input-status { color: #a70d34; padding: 16px 20px; margin: 0; background: #fff2f5; border-radius: 8px; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #d3114566; outline-offset: 3px; }
@media (max-width: 720px) {
  .product-selector-body { grid-template-columns: 1fr; gap: 10px; }
  .product-quick-facts { margin: 0; }
  .product-detail-details > .product-detail-grid { grid-template-columns: 1fr; }
  .chart-panel canvas { height: 260px; }
}

/* Optional historical research workspace; independent from normal projections. */
.assumption-help { margin: 0; padding: 0 20px 16px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.historical-details > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 20px; cursor: pointer; font-weight: 800; }
.historical-details > summary::before { content: "+"; color: var(--aia-red); font-size: 22px; }
.historical-details[open] > summary::before { content: "−"; }
.historical-body { padding: 0 20px 20px; }
.historical-intro, .historical-method-note { font-size: 13px; line-height: 1.65; }
.historical-method-note { border-left: 3px solid var(--blue); background: #f4f7fc; padding: 14px 18px; margin: 16px 0; }
.historical-method-note ul { padding-left: 20px; margin-bottom: 0; }
.historical-method-note li + li { margin-top: 6px; }
.historical-allocation-row { display: grid; grid-template-columns: minmax(0, 1fr) 125px 100px; gap: 12px; align-items: end; margin: 14px 0; }
.historical-allocation-row label, .historical-date-grid label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; min-width: 0; }
.historical-allocation-row select, .historical-allocation-row input, .historical-date-grid input { width: 100%; min-width: 0; min-height: 44px; padding: 9px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--ink); }
.historical-allocation-row button { min-height: 44px; }
.historical-allocation-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 12px; color: var(--muted); margin: 12px 0 24px; }
.historical-date-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: end; }
.historical-run-button { border: 1px solid var(--aia-red); background: var(--aia-red); color: white; min-height: 44px; padding: 9px 16px; border-radius: 4px; font-weight: 800; }
.historical-run-button:hover { background: #ae0d38; }
.historical-status { border: 1px solid var(--line); border-radius: 4px; background: var(--soft); padding: 12px 14px; font-size: 13px; line-height: 1.55; }
.historical-status.historical-error { color: #9d1538; border-color: #f0c4d0; background: #fff5f7; }
.historical-result-heading { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 24px; }
.historical-result-heading h3 { margin: 0 0 8px; }
.historical-result-heading p { font-size: 13px; }
.historical-notices { padding: 14px 14px 14px 32px; border: 1px solid #ebd8b4; background: #fffbf2; font-size: 13px; line-height: 1.6; }
.historical-value-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.historical-value-grid > div { background: var(--soft); border: 1px solid var(--line); padding: 16px; display: grid; gap: 9px; }
.historical-value-grid span { font-size: 12px; color: var(--muted); }
.historical-value-grid strong { font-size: 21px; overflow-wrap: anywhere; }
.historical-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; margin: 22px 0 6px; }
.historical-legend span { display: flex; align-items: center; gap: 6px; }
.historical-legend i { width: 12px; height: 3px; }
.historical-chart svg { display: block; width: 100%; height: auto; min-height: 180px; }
.historical-chart text { fill: var(--muted); font-size: 12px; font-family: inherit; }
.historical-comparison { width: 100%; min-width: 420px; }
.historical-comparison caption { padding: 12px 0; font-size: 12px; color: var(--muted); text-align: left; }
.historical-comparison th, .historical-comparison td, .historical-audit th, .historical-audit td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 12px; white-space: nowrap; }
.historical-comparison th { text-align: left; }
.historical-comparison td, .historical-audit td { text-align: right; font-variant-numeric: tabular-nums; }
.historical-comparison thead, .historical-audit thead { background: var(--soft); }
.historical-audit { margin-top: 18px; }
.historical-audit-actions { padding: 14px 0; }
.historical-audit table { width: 100%; min-width: 1000px; }
.historical-panel button:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 640px) {
  .historical-body { padding: 0 14px 16px; }
  .historical-details > summary { padding: 16px 14px; }
  .historical-details > summary .summary-hint { flex-basis: 100%; }
  .historical-allocation-row { grid-template-columns: minmax(0, 1fr) 95px; }
  .historical-allocation-row label:first-child { grid-column: 1 / -1; }
  .historical-date-grid { grid-template-columns: 1fr 1fr; }
  .historical-run-button { grid-column: 1 / -1; }
  .historical-value-grid { grid-template-columns: 1fr; }
  .historical-value-grid > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
  .historical-value-grid strong { font-size: 19px; }
}
.historical-data-notes > div { padding: 0 20px 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.historical-data-notes p { margin: 0 0 14px; padding: 0; }
.historical-data-notes ul { padding-left: 20px; }
.historical-data-notes h4 { margin: 14px 0 6px; }
.historical-data-notes a { color: var(--blue); text-underline-offset: 2px; }

/* Both simulator tabs share the same policy form and output rhythm. */
.app-header { flex-wrap: wrap; }
.simulator-menu { margin-left: auto; }
.simulator-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.simulator-tabs [role="tab"] { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 40px; padding: 9px 14px; border: 1px solid transparent; border-radius: 5px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 750; }
.simulator-tabs [role="tab"][aria-selected="true"] { color: var(--aia-red); background: #fff1f5; border-color: #f4cfda; }
.simulator-tabs [role="tab"]:hover { color: var(--aia-red); }
.simulator-panel, #historicalOutputs { display: grid; gap: 18px; min-width: 0; }
.simulator-panel > .panel, #historicalOutputs > .panel, .policy-panel-slot > .panel { margin-bottom: 0; }
.policy-panel-slot { min-width: 0; }
.historical-assumptions-form { padding: 2px 20px 8px; }
.historical-assumptions-form .historical-allocation-row { grid-template-columns: minmax(0, 1fr) 90px 76px; gap: 9px; }
.historical-assumptions-form .historical-allocation-row button { padding-inline: 8px; font-size: 12px; }
.historical-assumptions-form .historical-date-grid { grid-template-columns: 1fr 1fr; }
.historical-assumptions-form .note { margin: 12px 0; padding: 0; }
.historical-assumptions-form .historical-allocation-actions { margin-bottom: 18px; }
.historical-assumptions-form .historical-eligibility-note { font-size: 11px; }
#historicalAssumptionsBody > .note { padding: 16px 20px; }
.historical-output-panel .historical-legend { margin: 0; }
.historical-output-panel .historical-chart { position: relative; padding: 16px 12px 0; }
#historicalChartSvg:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.historical-output-panel > .historical-notices { margin: 0 20px 18px; }
.historical-secondary-panel > details { margin: 0; }
.historical-secondary-panel .historical-value-grid { margin: 16px 20px; }
.historical-secondary-panel .historical-audit-actions { padding: 14px 20px; }
@media (max-width: 1100px) {
  .simulator-menu { order: 3; flex-basis: 100%; margin-left: 0; }
  .simulator-tabs { width: fit-content; }
}
@media (max-width: 720px) {
  .simulator-menu, .simulator-tabs { width: 100%; }
  .simulator-tabs [role="tab"] { flex: 1; flex-wrap: wrap; padding-inline: 8px; font-size: 12px; }
  .historical-assumptions-form { padding-inline: 14px; }
  .historical-assumptions-form .historical-allocation-row { grid-template-columns: minmax(0, 1fr) 80px; }
  .historical-assumptions-form .historical-allocation-row label:first-child { grid-column: 1 / -1; }
  .historical-assumptions-form .historical-date-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

.protection-inputs { border-top: 1px solid var(--border, #dce1e7); margin-top: 18px; padding-top: 16px; }
.protection-inputs h3 { display: flex; gap: 8px; align-items: center; margin: 0 0 14px; font-size: 16px; }
.protection-inputs .note { margin: 12px 0; }
.protection-inputs .checkbox-field { align-self: center; }
.beta-badge { display: inline-block; padding: 3px 7px; border-radius: 5px; background: #fff2d7; color: #805500; font-size: 11px; font-weight: 700; vertical-align: middle; }
.plp-reference { max-width: 900px; margin: 32px auto; line-height: 1.65; }
.plp-reference h1 { font-size: clamp(24px, 4vw, 36px); line-height: 1.25; }
.plp-reference h2 { font-size: 20px; margin-top: 28px; }
.plp-reference li { margin-bottom: 10px; }
@media (max-width: 640px) { .plp-reference { margin: 12px; } }
