﻿:root {
  --page-bg: #f6f6f2;
  --surface: #ffffff;
  --surface-secondary: #f8f8f4;
  --surface-muted: #ededE8;
  --surface-strong: #111111;
  --text-primary: #111111;
  --text-secondary: #60645f;
  --text-inverse: #ffffff;
  --border: #d8d8d0;
  --border-color: #d8d8d0;
  --primary: #315c4f;
  --primary-dark: #111111;
  --brand-primary: #111111;
  --brand-primary-dark: #000000;
  --brand-accent: #315c4f;
  --success: #237a57;
  --error: #b42318;
  --warning-bg: #fff7e6;
  --focus-ring: rgba(49, 92, 79, 0.24);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 8px 22px rgba(24, 38, 33, 0.07);
  --shadow-md: 0 18px 45px rgba(24, 38, 33, 0.11);
  --content-width: 1160px;
  --heading-font: Georgia, "Times New Roman", "Noto Serif TC", serif;
  --body-font: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --space-xs: 6px;
  --space-sm: 10px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 36px;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--text-primary);
  background: var(--page-bg);
  line-height: 1.7;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  transform: translateY(-160%);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  background: var(--brand-primary);
  font-weight: 900;
  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.96);
  font-family: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

.site-header-inner,
.site-footer-inner {
  width: min(var(--content-width), calc(100% - 32px));
  max-width: 100%;
  margin: 0 auto;
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.brand,
.site-nav,
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.brand {
  gap: 10px;
  min-height: 44px;
  color: var(--brand-primary-dark);
  font-weight: 900;
  line-height: 1.2;
  text-decoration: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 8px solid var(--brand-primary);
  border-right-color: var(--brand-accent);
  border-radius: 50%;
}

.brand-text {
  line-height: 1.2;
  white-space: nowrap;
}

.site-nav {
  gap: 4px 14px;
}

.site-nav a,
.footer-nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: var(--text-secondary);
  font-weight: 800;
  text-decoration: none;
}

.site-nav a {
  line-height: 1.2;
}

.site-nav a:hover,
.site-nav a[aria-current="page"],
.footer-nav a:hover,
.footer-nav a[aria-current="page"] {
  color: var(--brand-primary);
}

.nav-cta {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-inverse);
  background: var(--brand-primary);
  font-weight: 900;
  line-height: 1.2;
  text-decoration: none;
}

.nav-cta:hover {
  background: var(--brand-primary-dark);
}

.app-shell {
  width: min(var(--content-width), calc(100% - 32px));
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 44px 0 56px;
}

.hero {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.page-intro {
  max-width: 820px;
}

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

h1 {
  margin: 0;
  font-family: var(--heading-font);
  font-size: clamp(2.15rem, 5vw, 3.6rem);
  line-height: 1.12;
  text-wrap: balance;
}

.intro-text {
  max-width: 760px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.08rem;
}

.intro-note {
  max-width: 680px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.feature-tags span,
.result-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid rgba(22, 116, 95, 0.22);
  border-radius: 999px;
  color: var(--primary-dark);
  background: #edf6f2;
  font-size: 0.82rem;
  font-weight: 800;
}

.calculator-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
  gap: var(--space-lg);
  align-items: start;
  max-width: 100%;
  min-width: 0;
}

.calculator-results-column {
  display: grid;
  gap: var(--space-lg);
  align-self: start;
  min-width: 0;
}

.result-guide-card {
  overflow: hidden;
  padding: 0;
}

.result-guide-card img {
  display: block;
  width: 100%;
  height: auto;
}

.panel-card,
.retirement-form,
.results,
.etf-breakdown-panel,
.scenario-panel,
.projection-panel,
.table-panel {
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.retirement-form,
.results,
.etf-breakdown-panel,
.scenario-panel,
.projection-panel,
.table-panel {
  max-width: 100%;
  min-width: 0;
  padding: var(--space-lg);
}

.etf-breakdown-panel,
.scenario-panel,
.projection-panel,
.table-panel {
  margin-top: var(--space-lg);
}

.panel-header,
.scenario-header,
.projection-header {
  display: grid;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
}

.panel-header h2,
.scenario-header h2,
.projection-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.22rem;
  line-height: 1.3;
}

.panel-header p,
.scenario-header p,
.projection-header p,
.section-note {
  margin: 0;
  color: var(--text-secondary);
}

.form-section {
  min-width: 0;
  margin: 0;
  padding: 0 0 var(--space-lg);
  border: 0;
}

.retirement-form {
  display: grid;
  gap: var(--space-lg);
}

.retirement-form .form-section {
  padding: var(--space-lg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #ffffff 0%, #fbfbf7 100%);
}

.form-section + .form-section {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.retirement-form .form-section + .form-section {
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.form-section legend {
  margin-bottom: var(--space-md);
  color: var(--text-primary);
  font-size: 1.02rem;
  font-weight: 800;
}

.retirement-form .form-section > legend {
  padding: 0 8px;
  color: var(--brand-primary);
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.etf-list {
  display: grid;
  gap: var(--space-md);
}

.etf-entry {
  min-width: 0;
  margin: 0;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
}

.retirement-form .etf-entry {
  padding: clamp(14px, 2.4vw, 20px);
  border-color: rgba(17, 17, 17, 0.14);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(90deg, rgba(49, 92, 79, 0.08), transparent 48px),
    var(--surface);
}

.etf-entry legend {
  margin-bottom: var(--space-sm);
  padding: 0;
  color: var(--primary-dark);
  font-size: 0.98rem;
  font-weight: 900;
}

.retirement-form .etf-entry legend {
  padding: 0 8px;
  color: var(--brand-accent);
  font-size: 1rem;
}

.etf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  min-width: 0;
}

.field {
  display: grid;
  align-self: start;
  align-content: start;
  gap: 8px;
  min-width: 0;
  color: var(--text-primary);
  font-weight: 800;
}

.field-wide {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.94rem;
}

.retirement-form .field {
  gap: 7px;
}

.retirement-form .field label {
  color: var(--text-primary);
  font-size: 0.93rem;
  line-height: 1.35;
}

.input-unit {
  position: relative;
  display: grid;
  align-items: center;
}

.input-unit input {
  padding-right: 72px;
}

.retirement-form .input-unit input {
  padding-right: 78px;
  background: #ffffff;
}

.retirement-form .input-unit input:focus {
  background: #ffffff;
}

.input-unit span {
  position: absolute;
  right: 13px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 800;
  pointer-events: none;
}

.retirement-form .input-unit span {
  right: 12px;
  max-width: 58px;
  color: var(--brand-accent);
  font-size: 0.86rem;
  line-height: 1.2;
  text-align: right;
  white-space: normal;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  background: var(--surface-secondary);
  font: inherit;
}

select {
  cursor: pointer;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: none;
}

input[readonly] {
  color: var(--text-secondary);
  background: #eef4f1;
}

.field-note,
.risk-note {
  margin: 0;
  color: var(--text-secondary);
  font-weight: 400;
  line-height: 1.55;
}

.field-note {
  font-size: 0.86rem;
}

.retirement-form .field-note,
.retirement-form .section-note {
  color: #6b6d67;
  font-size: 0.86rem;
}

.rate-help {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border: 1px solid rgba(22, 116, 95, 0.18);
  border-radius: var(--radius-md);
  background: #f4faf7;
  color: var(--text-secondary);
}

.retirement-form .rate-help {
  border-color: rgba(49, 92, 79, 0.2);
  background: #f3f5f0;
}

.rate-help summary {
  color: var(--primary-dark);
  font-weight: 900;
  cursor: pointer;
}

.rate-help summary:focus-visible {
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: none;
}

.rate-help-content {
  display: grid;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  font-size: 0.92rem;
}

.rate-help-content ol {
  margin: 0;
  padding-left: 1.35rem;
}

.rate-help-content p {
  margin: 0;
}

.etf-return-preview {
  display: grid;
  gap: var(--space-sm);
  min-width: 0;
  padding: var(--space-md);
  border: 1px solid rgba(22, 116, 95, 0.18);
  border-radius: var(--radius-md);
  background: #ffffff;
}

.retirement-form .etf-return-preview {
  padding: clamp(10px, 2vw, 14px);
  border-color: rgba(17, 17, 17, 0.12);
  background: #fafaf7;
}

.etf-return-preview-title {
  margin: 0;
  color: var(--primary-dark);
  font-size: 0.95rem;
  font-weight: 900;
}

.etf-return-preview-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 700;
}

.etf-return-preview-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1.25fr) repeat(3, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--border);
  font-size: 0.86rem;
}

.etf-return-preview-grid span {
  min-width: 0;
  padding: 8px 10px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

.etf-return-preview-corner,
.etf-return-preview-heading {
  color: var(--text-primary);
  background: var(--surface-secondary) !important;
  font-weight: 900;
}

.etf-return-preview-heading,
.etf-return-preview-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.etf-return-preview-row-label {
  color: var(--text-secondary);
  font-weight: 800;
}

.etf-return-preview-value {
  color: var(--text-primary);
  font-weight: 900;
}

.breakdown-scenario-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.etf-breakdown-panel {
  border-color: rgba(17, 17, 17, 0.14);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfbf7 100%);
}

.etf-breakdown-panel .panel-header {
  margin-bottom: var(--space-md);
}

.etf-breakdown-panel .breakdown-scenario-controls {
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #f8f8f4;
}

.breakdown-scenario-button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid rgba(22, 116, 95, 0.28);
  border-radius: var(--radius-sm);
  color: var(--primary-dark);
  background: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.etf-breakdown-panel .breakdown-scenario-button {
  flex: 1 1 120px;
  min-height: 42px;
  border-color: rgba(17, 17, 17, 0.14);
  color: var(--text-primary);
  background: #ffffff;
}

.breakdown-scenario-button:hover,
.breakdown-scenario-button:focus-visible,
.breakdown-scenario-button[aria-pressed="true"] {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

.etf-breakdown-panel .breakdown-scenario-button[aria-pressed="true"] {
  border-color: var(--brand-primary);
  color: #ffffff;
  background: var(--brand-primary);
}

.breakdown-scenario-button:focus-visible {
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: none;
}

.breakdown-current-scenario {
  margin: 0 0 var(--space-md);
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 800;
}

.etf-breakdown-panel .breakdown-current-scenario {
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(49, 92, 79, 0.2);
  border-radius: var(--radius-sm);
  color: var(--brand-accent);
  background: #ffffff;
}

.currency-display-controls {
  min-width: 0;
  margin-bottom: var(--space-lg);
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
}

.results {
  border-color: rgba(17, 17, 17, 0.14);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfbf7 100%);
}

.results .panel-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.results .panel-header h2,
.etf-breakdown-panel .panel-header h2 {
  font-family: var(--heading-font);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.results .panel-header p,
.etf-breakdown-panel .panel-header p {
  max-width: 54rem;
  font-size: 0.92rem;
  line-height: 1.65;
}

.results .currency-display-controls {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  border-color: rgba(49, 92, 79, 0.2);
  background:
    linear-gradient(90deg, rgba(49, 92, 79, 0.08), transparent 80px),
    #f8faf6;
}

.currency-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  min-width: 0;
}

.results .currency-control-grid {
  align-items: start;
}

.results .currency-display-controls .field {
  gap: 7px;
}

.results .currency-display-controls .field label {
  font-size: 0.9rem;
  line-height: 1.35;
}

.results .currency-display-controls input,
.results .currency-display-controls select {
  background: #ffffff;
}

.currency-error {
  min-height: 1.45em;
  margin: 0;
  color: var(--error);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.currency-display-status {
  margin: var(--space-md) 0 0;
  color: var(--primary-dark);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.results .currency-display-status {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid rgba(49, 92, 79, 0.2);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.submit-button {
  width: 100%;
  min-height: 54px;
  margin-top: var(--space-sm);
  border: 0;
  border-radius: var(--radius-md);
  color: #ffffff;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.retirement-form .submit-button {
  min-height: 58px;
  margin-top: 0;
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-sm);
  background: var(--brand-primary);
  letter-spacing: 0.02em;
}

.secondary-button,
.remove-etf-button {
  min-height: 44px;
  border: 1px solid rgba(22, 116, 95, 0.28);
  border-radius: var(--radius-md);
  color: var(--primary-dark);
  background: #ffffff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.retirement-form .secondary-button {
  border-color: rgba(49, 92, 79, 0.32);
  color: var(--brand-primary);
  background: #f8faf6;
}

.retirement-form .remove-etf-button {
  border-color: rgba(180, 35, 24, 0.24);
  color: #7f2d25;
  background: #fffaf8;
}

.secondary-button {
  width: 100%;
  margin-top: var(--space-md);
}

.remove-etf-button {
  grid-column: 1 / -1;
  align-self: end;
  justify-self: end;
  padding: 9px 12px;
}

.submit-button:hover,
.submit-button:focus-visible,
.secondary-button:hover,
.secondary-button:focus-visible,
.remove-etf-button:hover,
.remove-etf-button:focus-visible {
  background: var(--primary-dark);
  color: #ffffff;
}

.submit-button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.submit-button:focus-visible {
  box-shadow: 0 0 0 4px var(--focus-ring), var(--shadow-sm);
  outline: none;
}

.secondary-button:focus-visible,
.remove-etf-button:focus-visible {
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: none;
}

.submit-button:disabled,
.remove-etf-button:disabled {
  color: rgba(255, 255, 255, 0.78);
  background: #9badA6;
  box-shadow: none;
  cursor: not-allowed;
}

.retirement-form .remove-etf-button:disabled {
  border-color: var(--border);
  color: #898b84;
  background: #eeeeea;
}

.status-message {
  min-height: 24px;
  margin: var(--space-md) 0 0;
  color: var(--primary-dark);
  font-weight: 800;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.results .result-grid {
  gap: 14px;
}

.result-card {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
}

.results .result-card {
  position: relative;
  align-content: start;
  padding: 15px;
  border-color: rgba(17, 17, 17, 0.12);
  background: #ffffff;
}

.results .result-card::before {
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: rgba(49, 92, 79, 0.4);
  content: "";
}

.result-card-primary {
  grid-column: 1 / -1;
  border-color: rgba(22, 116, 95, 0.34);
  background: #edf6f2;
}

.results .result-card-primary {
  border-color: rgba(49, 92, 79, 0.32);
  background:
    linear-gradient(135deg, rgba(49, 92, 79, 0.13), transparent 56%),
    #f4f7f2;
}

.result-card-secondary {
  border-color: rgba(35, 122, 87, 0.24);
}

.results .result-card-secondary {
  border-color: rgba(17, 17, 17, 0.14);
  background: #fbfbf8;
}

.result-card-cashflow {
  border-color: rgba(22, 116, 95, 0.24);
  background: #f2f8f5;
}

.results .result-card-cashflow {
  border-color: rgba(35, 122, 87, 0.24);
  background: #f6faf6;
}

.result-label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
}

.results .result-label {
  font-size: 0.86rem;
  line-height: 1.45;
}

.result-value {
  color: var(--text-primary);
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.results .result-value {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.result-card-primary .result-value {
  color: var(--primary-dark);
  font-size: clamp(1.8rem, 4vw, 2.45rem);
}

.result-card-secondary .result-value {
  font-size: clamp(1.45rem, 3vw, 1.9rem);
}

.result-card-cashflow .result-value {
  color: var(--success);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
}

.risk-note {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid #f0d9a6;
  border-radius: var(--radius-md);
  background: var(--warning-bg);
  font-size: 0.9rem;
}

.results .risk-note {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr);
  gap: 12px;
  border-color: #e7d39f;
  background: #fff9ea;
  color: #5f5642;
}

.results .risk-note::before {
  border-radius: 999px;
  background: #c69b3c;
  content: "";
}

#growth-chart {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 360px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
}

.table-scroll {
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.table-scroll-hint {
  margin: 0 0 var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.yearly-table,
.etf-breakdown-table,
.scenario-table {
  max-width: none;
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

.yearly-table {
  min-width: 680px;
}

.etf-breakdown-table {
  min-width: 920px;
}

.etf-breakdown-panel .table-scroll {
  border-color: rgba(17, 17, 17, 0.14);
  background: #ffffff;
}

.etf-breakdown-panel .table-scroll-hint {
  color: #6b6d67;
}

.etf-breakdown-panel .etf-breakdown-table {
  min-width: 920px;
}

.etf-breakdown-table .etf-name-column {
  width: 180px;
  min-width: 180px;
  max-width: 260px;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
}

.etf-breakdown-panel .etf-breakdown-table .etf-name-column {
  width: 190px;
  min-width: 190px;
}

.scenario-table {
  min-width: 820px;
}

.yearly-table caption,
.etf-breakdown-table caption,
.scenario-table caption {
  padding: 12px 14px;
  color: var(--text-secondary);
  text-align: left;
  font-weight: 800;
}

.etf-breakdown-panel .etf-breakdown-table caption {
  color: var(--brand-primary);
  background: #ffffff;
}

.yearly-table th,
.yearly-table td,
.etf-breakdown-table th,
.etf-breakdown-table td,
.scenario-table th,
.scenario-table td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.yearly-table thead th,
.etf-breakdown-table thead th,
.scenario-table thead th {
  color: var(--text-primary);
  background: var(--surface-secondary);
  font-size: 0.92rem;
}

.etf-breakdown-panel .etf-breakdown-table thead th {
  color: #ffffff;
  background: var(--brand-primary);
}

.yearly-table tbody th,
.etf-breakdown-table tbody th,
.scenario-table tbody th {
  color: var(--text-primary);
  font-weight: 800;
}

.yearly-table .numeric,
.etf-breakdown-table .numeric,
.scenario-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.etf-breakdown-table .etf-breakdown-total-row th,
.etf-breakdown-table .etf-breakdown-total-row td {
  border-top: 2px solid rgba(22, 116, 95, 0.28);
  font-weight: 900;
}

.etf-breakdown-panel .etf-breakdown-table .etf-breakdown-total-row th,
.etf-breakdown-panel .etf-breakdown-table .etf-breakdown-total-row td {
  border-top-color: rgba(17, 17, 17, 0.42);
  background: #f4f7f2;
}

.scenario-panel,
.projection-panel,
.table-panel {
  border-color: rgba(17, 17, 17, 0.14);
  background:
    linear-gradient(180deg, #ffffff 0%, #fbfbf7 100%);
}

.scenario-panel .panel-header,
.projection-panel .panel-header,
.table-panel .panel-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.scenario-panel .panel-header h2,
.projection-panel .panel-header h2,
.table-panel .panel-header h2 {
  font-family: var(--heading-font);
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

.scenario-panel .panel-header p,
.projection-panel .panel-header p,
.table-panel .panel-header p {
  max-width: 54rem;
  font-size: 0.92rem;
  line-height: 1.65;
}

.scenario-panel .table-scroll,
.table-panel .table-scroll {
  border-color: rgba(17, 17, 17, 0.14);
  background: #ffffff;
}

.scenario-panel .table-scroll-hint,
.table-panel .table-scroll-hint {
  color: #6b6d67;
}

.scenario-panel .scenario-table caption,
.table-panel .yearly-table caption {
  color: var(--brand-primary);
  background: #ffffff;
}

.scenario-panel .scenario-table thead th,
.table-panel .yearly-table thead th {
  color: #ffffff;
  background: var(--brand-primary);
}

.scenario-panel .scenario-table tbody th,
.table-panel .yearly-table tbody th {
  color: var(--brand-primary);
}

.scenario-panel .scenario-table .numeric,
.table-panel .yearly-table .numeric {
  font-variant-numeric: tabular-nums;
}

.scenario-table .scenario-neutral th,
.scenario-table .scenario-neutral td {
  background: #edf6f2;
}

.scenario-panel .scenario-table .scenario-neutral th,
.scenario-panel .scenario-table .scenario-neutral td {
  background: #f4f7f2;
}

.scenario-panel .scenario-table .scenario-neutral th {
  color: var(--brand-primary);
}

.scenario-panel .scenario-tag {
  border-color: rgba(49, 92, 79, 0.28);
  border-radius: var(--radius-sm);
  color: var(--brand-accent);
  background: #ffffff;
}

.projection-panel {
  overflow: hidden;
}

.projection-panel #growth-chart {
  border-color: rgba(17, 17, 17, 0.14);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, #ffffff 0%, #f7f8f4 100%);
  box-shadow: inset 0 0 0 1px rgba(49, 92, 79, 0.06);
}

.table-panel .yearly-table tbody tr:last-child th,
.table-panel .yearly-table tbody tr:last-child td {
  border-bottom: 1px solid var(--border);
}

.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--surface);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  align-items: center;
  justify-content: space-between;
  padding: 30px 0;
}

.footer-brand {
  margin: 0 0 4px;
  font-weight: 900;
}

.footer-note {
  max-width: 420px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.footer-nav {
  gap: 2px 16px;
}

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

@media (max-width: 840px) {
  .site-header-inner,
  .site-footer-inner,
  .app-shell {
    width: min(100% - 24px, var(--content-width));
  }

  .site-nav {
    order: 3;
    width: 100%;
  }

  .nav-cta {
    margin-left: auto;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 640px);
    padding: 32px 0;
  }

  .retirement-form {
    gap: var(--space-md);
  }

  .retirement-form,
  .results,
  .etf-breakdown-panel,
  .scenario-panel,
  .projection-panel,
  .table-panel {
    padding: var(--space-md);
  }

  .retirement-form .form-section {
    padding: var(--space-md);
  }

  .form-grid,
  .etf-grid,
  .currency-control-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .etf-return-preview {
    padding: var(--space-sm);
  }

  .etf-return-preview-grid {
    grid-template-columns: minmax(82px, 1.08fr) repeat(3, minmax(42px, 0.78fr));
    font-size: 0.78rem;
  }

  .etf-return-preview-grid span {
    padding: 7px 6px;
  }

  .remove-etf-button {
    width: 100%;
    justify-self: stretch;
  }

  .breakdown-scenario-button {
    flex: 1 1 calc((100% - var(--space-sm) * 2) / 3);
    min-width: 88px;
    padding-right: 10px;
    padding-left: 10px;
  }

  .result-card-primary {
    grid-column: auto;
  }

  .results .result-card {
    padding: 14px;
  }

  .results .currency-display-controls,
  .etf-breakdown-panel .breakdown-scenario-controls {
    padding: 10px;
  }

  .etf-breakdown-panel .breakdown-scenario-button {
    flex-basis: calc((100% - var(--space-sm) * 2) / 3);
    min-width: 88px;
  }

  #growth-chart {
    height: 320px;
  }

  .scenario-panel .panel-header,
  .projection-panel .panel-header,
  .table-panel .panel-header {
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .projection-panel #growth-chart {
    border-radius: var(--radius-md);
  }

  .yearly-table th,
  .yearly-table td,
  .etf-breakdown-table th,
  .etf-breakdown-table td,
  .scenario-table th,
  .scenario-table td {
    padding: 10px 12px;
  }
}

@media (max-width: 520px) {
  .site-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .site-nav a {
    justify-content: center;
    padding: 5px 4px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.92rem;
    text-align: center;
    white-space: normal;
  }
}

.status-message {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  line-height: 1.45;
}

.status-idle {
  color: var(--text-secondary);
  background: var(--surface-secondary);
  border-color: var(--border);
}

.status-success {
  color: var(--primary-dark);
  background: #edf6f2;
  border-color: rgba(35, 122, 87, 0.32);
}

.status-error {
  color: var(--error);
  background: #fff1ef;
  border-color: rgba(180, 35, 24, 0.28);
}

.table-scroll:focus-visible {
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: none;
}

.yearly-table thead th,
.etf-breakdown-table thead th,
.scenario-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.yearly-table tbody tr:nth-child(even),
.etf-breakdown-table tbody tr:nth-child(even),
.scenario-table tbody tr:nth-child(even) {
  background: #fbfdfc;
}

.yearly-table tbody tr:hover,
.etf-breakdown-table tbody tr:hover,
.scenario-table tbody tr:hover {
  background: #f1f7f4;
}

.scenario-tag {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid rgba(22, 116, 95, 0.28);
  border-radius: 999px;
  color: var(--primary-dark);
  background: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  vertical-align: middle;
}

.projection-panel .panel-header {
  margin-bottom: var(--space-md);
}

#growth-chart {
  border-color: rgba(22, 116, 95, 0.2);
  background: linear-gradient(180deg, #fbfdfc 0%, #f7fbf9 100%);
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible {
  box-shadow: 0 0 0 6px var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .submit-button:active {
    transform: none;
  }
}

@media (max-width: 420px) {
  .app-shell {
    width: min(100% - 20px, 640px);
  }

  .site-header-inner,
  .site-footer-inner {
    width: min(100% - 20px, var(--content-width));
  }

  .brand-text {
    white-space: normal;
  }

  .results .panel-header,
  .results .currency-display-controls,
  .result-grid,
  .etf-breakdown-panel .panel-header {
    gap: 10px;
  }

  .results .result-card {
    padding: 12px;
  }

  .results .result-card::before {
    width: 28px;
  }

  .results .result-card-primary .result-value {
    font-size: clamp(1.55rem, 9vw, 1.95rem);
  }

  .results .result-value {
    font-size: clamp(1.12rem, 6vw, 1.42rem);
  }

  .results .currency-display-status,
  .etf-breakdown-panel .breakdown-current-scenario {
    width: 100%;
  }

  .scenario-panel .panel-header,
  .projection-panel .panel-header,
  .table-panel .panel-header {
    gap: 8px;
  }

  .scenario-panel .panel-header h2,
  .projection-panel .panel-header h2,
  .table-panel .panel-header h2 {
    font-size: 1.28rem;
  }

  .scenario-panel .table-scroll-hint,
  .table-panel .table-scroll-hint {
    font-size: 0.8rem;
    line-height: 1.5;
  }

  .etf-breakdown-panel .breakdown-scenario-button {
    flex-basis: 100%;
  }

  .etf-entry {
    padding: var(--space-sm);
  }

  .retirement-form .form-section {
    padding: 12px;
  }

  .retirement-form .etf-entry {
    padding: 10px;
  }

  .retirement-form .input-unit input {
    padding-right: 66px;
  }

  .retirement-form .input-unit span {
    max-width: 50px;
    font-size: 0.78rem;
  }

  .feature-tags {
    gap: 8px;
  }

  .feature-tags span,
  .result-badge {
    min-height: 26px;
    font-size: 0.78rem;
  }

  #growth-chart {
    height: 300px;
  }

  .etf-return-preview {
    padding: 8px;
  }

  .etf-return-preview-grid {
    grid-template-columns: minmax(64px, 0.95fr) repeat(3, minmax(38px, 0.74fr));
    font-size: 0.73rem;
  }

  .etf-return-preview-grid span {
    padding: 5px 3px;
  }
}


