:root {
  --ink: #15231b;
  --ink-soft: #48544d;
  --paper: #f3f5f0;
  --white: #ffffff;
  --line: #d9ded8;
  --line-strong: #bcc6be;
  --accent: #5450e4;
  --accent-dark: #3e3ab9;
  --accent-wash: #edecff;
  --lime: #c9f66f;
  --mint: #dbf3e4;
  --amber: #ffdf9e;
  --danger: #b53c33;
  --shadow: 0 18px 46px rgba(22, 40, 29, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  color: white;
  background: var(--ink);
  border-radius: 8px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 16px; }

.site-header {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--ink);
  border-radius: 10px;
  transform: rotate(-3deg);
}
.brand-mark svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.header-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}
.status-dot { width: 8px; height: 8px; background: #45a566; border-radius: 50%; box-shadow: 0 0 0 4px rgba(69, 165, 102, 0.12); }

main { overflow: hidden; }

.hero {
  max-width: 1260px;
  min-height: 520px;
  margin: 20px auto 64px;
  padding: 58px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.72fr);
  align-items: center;
  gap: 70px;
  background: var(--ink);
  border-radius: 38px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.19em;
}

.hero .eyebrow { color: var(--lime); }
.hero h1 {
  margin: 0;
  color: white;
  font-size: clamp(54px, 6vw, 86px);
  line-height: 1.14;
  letter-spacing: -0.07em;
  font-weight: 720;
}
.hero h1 span { color: var(--lime); }

.hero-lede {
  max-width: 640px;
  margin: 28px 0 32px;
  color: #bfcac2;
  font-size: 17px;
  line-height: 1.8;
}

.hero-points { display: flex; flex-wrap: wrap; gap: 22px; color: white; font-size: 13px; font-weight: 600; }
.hero-points span { display: inline-flex; align-items: center; gap: 8px; }
.hero-points i { color: var(--lime); font-size: 10px; font-style: normal; letter-spacing: 0.08em; }

.hero-card {
  min-height: 352px;
  padding: 26px;
  color: var(--ink);
  background: var(--lime);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  box-shadow: 16px 16px 0 rgba(255, 255, 255, 0.08);
  transform: rotate(1.5deg);
}
.hero-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; font-weight: 800; }
.pill { padding: 5px 9px; color: white; background: var(--ink); border-radius: 999px; font-size: 10px; letter-spacing: 0.04em; }
.hero-stat { margin: 42px 0 12px; }
.hero-stat strong { display: block; font-size: 49px; line-height: 1; letter-spacing: -0.07em; }
.hero-stat strong small { padding: 0 6px; font-size: 27px; }
.hero-stat span { display: block; margin-top: 8px; font-size: 12px; font-weight: 650; }
.mini-chart { height: 76px; margin: 28px 0 22px; display: flex; align-items: flex-end; gap: 7px; border-bottom: 1px solid rgba(21,35,27,0.45); }
.mini-chart i { flex: 1; background: var(--ink); border-radius: 3px 3px 0 0; opacity: 0.82; }
.hero-card p { margin: 0; font-size: 12px; font-weight: 600; line-height: 1.75; }

.calculator-shell {
  max-width: 1260px;
  margin: 0 auto;
  padding: 34px 0 70px;
}

.section-heading { margin-bottom: 28px; display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.section-heading h2, .method-intro h2, .sources h2 { margin: 0; font-size: clamp(28px, 4vw, 43px); line-height: 1.15; letter-spacing: -0.045em; }
.section-heading > p { max-width: 310px; margin: 0 0 4px; color: var(--ink-soft); font-size: 13px; text-align: right; }

.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.tab {
  min-width: 0;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  gap: 13px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.tab:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.tab.active { color: white; background: var(--ink); border-color: var(--ink); }
.tab-index { color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: 0.06em; }
.tab.active .tab-index { color: var(--lime); }
.tab strong, .tab small { display: block; white-space: nowrap; }
.tab strong { font-size: 14px; }
.tab small { margin-top: 2px; color: #7c8880; font-size: 10px; }
.tab.active small { color: #aebbb2; }

.tab-panel { animation: panel-in 0.35s ease; }
@keyframes panel-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  gap: 14px;
  align-items: start;
}

.input-card, .result-card {
  padding: 30px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.result-card { min-height: 610px; position: sticky; top: 18px; overflow: hidden; }

.card-heading { margin-bottom: 28px; display: flex; align-items: flex-start; gap: 13px; }
.section-number { flex: none; margin-top: 4px; color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: 0.08em; }
.card-heading h3 { margin: 0; font-size: 24px; line-height: 1.25; letter-spacing: -0.03em; }
.card-heading p { margin: 5px 0 0; color: var(--ink-soft); font-size: 12px; }

fieldset { padding: 0; border: 0; }
.mode-fieldset { margin: 0 0 22px; }
.mode-fieldset legend { margin-bottom: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.segment-control { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--paper); border-radius: 12px; }
.segment-control.three { grid-template-columns: repeat(3, 1fr); }
.segment { padding: 9px 12px; background: transparent; border: 0; border-radius: 9px; cursor: pointer; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.segment.active { color: var(--ink); background: white; box-shadow: 0 2px 9px rgba(21,35,27,0.08); }
.combined-mode-fieldset { margin-top: 22px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 13px; }
.span-2 { grid-column: span 2; }
.field { display: block; }
.field > span:first-child, .field > label:first-child { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.field small { display: block; margin-top: 6px; color: #7c8780; font-size: 10px; line-height: 1.5; }
.featured-field { margin-bottom: 20px; }

.money-input, .suffix-input {
  height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  background: #fafbf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.money-input:focus-within, .suffix-input:focus-within { background: white; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(84,80,228,0.1); }
.money-input i, .suffix-input i { flex: none; color: #849087; font-size: 12px; font-style: normal; font-weight: 700; }
.money-input input, .suffix-input input { width: 100%; min-width: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 20px; font-weight: 720; letter-spacing: -0.02em; }
.money-input.compact input, .suffix-input input { font-size: 15px; }
.suffix-input i { white-space: nowrap; }
input::-webkit-inner-spin-button { opacity: 0.35; }

.linked-data {
  margin: 18px 0;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--paper);
  border-radius: 12px;
}
.linked-data span, .linked-data strong { display: block; }
.linked-data span { color: var(--ink-soft); font-size: 10px; }
.linked-data strong { margin-top: 2px; font-size: 12px; }
.text-button { padding: 0; color: var(--accent); background: none; border: 0; cursor: pointer; font-size: 11px; font-weight: 750; }

.check-field {
  margin: 16px 0;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fafbf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}
.check-field input { position: absolute; opacity: 0; pointer-events: none; }
.custom-check { flex: none; width: 20px; height: 20px; margin-top: 1px; display: grid; place-items: center; border: 1.5px solid var(--line-strong); border-radius: 6px; }
.check-field input:checked + .custom-check { background: var(--accent); border-color: var(--accent); }
.check-field input:checked + .custom-check::after { content: "✓"; color: white; font-size: 12px; font-weight: 900; }
.check-field input:focus-visible + .custom-check { box-shadow: 0 0 0 3px rgba(84,80,228,0.18); }
.check-field strong, .check-field small { display: block; }
.check-field strong { font-size: 12px; }
.check-field small { margin-top: 4px; color: var(--ink-soft); font-size: 10px; line-height: 1.55; }

.callout { margin: 20px 0; padding: 13px 14px; display: flex; align-items: flex-start; gap: 10px; border-radius: 12px; }
.callout > span { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; font-size: 10px; font-weight: 850; }
.callout p { margin: 0; font-size: 10px; line-height: 1.65; }
.callout.neutral { color: #455049; background: #f0f3ef; }
.callout.neutral > span { color: white; background: #7f8d83; }
.callout.policy { color: #35318c; background: var(--accent-wash); }
.callout.policy > span { color: white; background: var(--accent); }
.callout.warning { color: #6c4a12; background: #fff5df; }
.callout.warning > span { color: #6c4a12; background: var(--amber); }

.primary-button {
  width: 100%;
  min-height: 54px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 750;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.primary-button:hover { background: var(--accent-dark); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(84,80,228,0.22); }
.primary-button:active { transform: translateY(0); }
.primary-button span:last-child { font-size: 20px; font-weight: 400; }
.form-error { min-height: 0; margin: 9px 0 0; color: var(--danger); font-size: 11px; font-weight: 650; }
.form-error:empty { display: none; }

.empty-state { min-height: 548px; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; }
.empty-icon { width: 56px; height: 56px; margin-bottom: 20px; display: grid; place-items: center; color: var(--accent); background: var(--accent-wash); border-radius: 17px; font-size: 25px; }
.empty-state h3 { margin: 0; font-size: 18px; }
.empty-state p { max-width: 390px; margin: 9px 0 0; color: var(--ink-soft); font-size: 12px; }

/* Dynamically rendered result components */
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.result-head .kicker { margin: 0 0 5px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: 0.12em; }
.result-head h3 { margin: 0; font-size: 21px; letter-spacing: -0.03em; }
.result-head > span { padding: 5px 9px; color: #246f3d; background: var(--mint); border-radius: 99px; font-size: 10px; font-weight: 800; white-space: nowrap; }

.hero-result {
  margin: 24px 0 13px;
  padding: 23px;
  color: white;
  background: var(--ink);
  border-radius: 18px;
}
.hero-result > span { color: #b7c2ba; font-size: 11px; }
.hero-result strong { display: block; margin-top: 4px; font-size: clamp(34px, 5vw, 48px); line-height: 1.1; letter-spacing: -0.055em; }
.hero-result small { display: block; margin-top: 7px; color: var(--lime); font-size: 10px; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric { padding: 14px; background: var(--paper); border-radius: 12px; }
.metric span, .metric strong, .metric small { display: block; }
.metric span { color: var(--ink-soft); font-size: 9px; }
.metric strong { margin-top: 4px; font-size: 15px; letter-spacing: -0.02em; }
.metric small { margin-top: 2px; color: #728078; font-size: 9px; }

.result-section { margin-top: 23px; }
.result-section-title { margin: 0 0 10px; display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; }
.result-section-title span { color: var(--ink-soft); font-size: 9px; font-weight: 500; }
.formula-list { border-top: 1px solid var(--line); }
.formula-row { padding: 11px 2px; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: start; border-bottom: 1px solid var(--line); }
.formula-row > i { color: var(--accent); font-size: 9px; font-style: normal; font-weight: 850; }
.formula-row span { color: var(--ink-soft); font-size: 10px; }
.formula-row span b { display: block; color: var(--ink); font-size: 11px; font-weight: 750; }
.formula-row strong { font-size: 11px; white-space: nowrap; }
.formula-row.total { background: #fafbf8; }
.formula-row.total strong { color: var(--accent); }

.table-wrap { max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 11px; border-bottom: 1px solid var(--line); font-size: 9px; text-align: right; white-space: nowrap; }
th { position: sticky; top: 0; color: var(--ink-soft); background: #f8faf7; font-weight: 750; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbf8; }

.comparison-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 23px 0; }
.comparison-card { position: relative; padding: 18px; background: var(--paper); border: 1px solid transparent; border-radius: 15px; }
.comparison-card.recommended { background: var(--accent-wash); border-color: rgba(84,80,228,0.25); }
.recommend-tag { position: absolute; right: 12px; top: 12px; padding: 3px 7px; color: white; background: var(--accent); border-radius: 99px; font-size: 8px; font-weight: 850; }
.comparison-card > span { color: var(--ink-soft); font-size: 10px; }
.comparison-card h4 { margin: 9px 0 1px; font-size: 25px; letter-spacing: -0.04em; }
.comparison-card > small { color: #77847b; font-size: 9px; }
.comparison-card dl { margin: 14px 0 0; }
.comparison-card dl div { padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(73,84,77,0.12); font-size: 9px; }
.comparison-card dt { color: var(--ink-soft); }
.comparison-card dd { margin: 0; font-weight: 750; }

.saving-banner { padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: var(--ink); background: var(--lime); border-radius: 13px; }
.saving-banner span { font-size: 10px; font-weight: 650; }
.saving-banner strong { font-size: 18px; }

.allocation { margin: 22px 0 8px; }
.allocation-labels { margin-bottom: 8px; display: flex; justify-content: space-between; gap: 12px; font-size: 9px; }
.allocation-labels span:last-child { text-align: right; }
.allocation-labels b { display: block; font-size: 11px; }
.allocation-bar { height: 16px; display: flex; overflow: hidden; background: var(--line); border-radius: 99px; }
.allocation-bar i { display: block; min-width: 2px; }
.allocation-bar .salary-part { background: var(--accent); }
.allocation-bar .bonus-part { background: var(--lime); }
.allocation-bar .equity-part { background: #ffb45e; }
.income-legend { margin-bottom: 9px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.income-legend span { position: relative; padding-left: 13px; color: var(--ink-soft); font-size: 9px; }
.income-legend span:nth-child(2) { text-align: center; }
.income-legend span:nth-child(3) { text-align: right; }
.income-legend i { position: absolute; left: 0; top: 5px; width: 7px; height: 7px; border-radius: 2px; }
.income-legend span:nth-child(2) i { left: calc(50% - 42px); }
.income-legend span:nth-child(3) i { left: auto; right: 70px; }
.income-legend b { display: block; color: var(--ink); font-size: 10px; }
.salary-key { background: var(--accent); }
.bonus-key { background: #9dcc3d; }
.equity-key { background: #ffb45e; }
.combined-comparison { margin-bottom: 14px; }
.saving-banner.manual-warning { background: var(--amber); }

.method-section {
  max-width: 1260px;
  margin: 0 auto 74px;
  padding: 58px;
  display: grid;
  grid-template-columns: 0.8fr 1.4fr;
  gap: 70px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 32px;
}
.method-intro > p:last-child { margin: 20px 0 0; color: var(--ink-soft); font-size: 13px; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.method-grid article { padding-top: 12px; border-top: 2px solid var(--ink); }
.method-grid article > span { color: var(--accent); font-size: 10px; font-weight: 850; }
.method-grid h3 { margin: 35px 0 8px; font-size: 15px; }
.method-grid p { margin: 0; color: var(--ink-soft); font-size: 11px; }

.sources {
  max-width: 1260px;
  margin: 0 auto 70px;
  display: grid;
  grid-template-columns: 0.65fr 1.35fr;
  gap: 70px;
}
.source-list { border-top: 1px solid var(--line-strong); }
.source-list a { padding: 17px 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); text-decoration: none; }
.source-list span { color: var(--ink-soft); font-size: 10px; }
.source-list strong { font-size: 11px; text-align: right; }
.source-list a:hover strong { color: var(--accent); }
.disclaimer { grid-column: 2; margin: -45px 0 0; color: #7d8981; font-size: 9px; line-height: 1.75; }

footer {
  max-width: 1260px;
  margin: 0 auto;
  padding: 25px 0 35px;
  display: flex;
  justify-content: space-between;
  color: #77827b;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

@media (max-width: 1320px) {
  .hero, .calculator-shell, .method-section, .sources, footer { margin-left: 24px; margin-right: 24px; }
}

@media (max-width: 980px) {
  .hero { min-height: auto; padding: 48px; grid-template-columns: minmax(0, 1fr); gap: 44px; }
  .hero-copy, .hero-card { min-width: 0; }
  .hero-card { width: 100%; max-width: 440px; }
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .calculator-layout { grid-template-columns: 1fr; }
  .result-card { min-height: 500px; position: static; }
  .empty-state { min-height: 430px; }
  .method-section { grid-template-columns: 1fr; gap: 42px; }
  .sources { grid-template-columns: 1fr; gap: 35px; }
  .disclaimer { grid-column: 1; margin: 0; }
}

@media (max-width: 680px) {
  body { overflow-x: hidden; }
  .site-header { width: 100%; min-width: 0; padding: 18px 18px; }
  .header-meta { min-width: 0; max-width: 155px; justify-content: flex-end; font-size: 9px; line-height: 1.35; text-align: right; }
  .hero, .calculator-shell, .method-section, .sources, footer { margin-left: 12px; margin-right: 12px; }
  .hero { width: calc(100% - 24px); max-width: calc(100% - 24px); margin-top: 7px; padding: 38px 25px; overflow: hidden; border-radius: 25px; }
  .hero > * { width: 100%; max-width: 100%; }
  .hero h1 { max-width: 100%; font-size: 46px; }
  .hero-lede { max-width: 100%; overflow-wrap: anywhere; font-size: 14px; }
  .hero-points { gap: 13px; }
  .hero-card { width: 100%; max-width: 100%; min-height: 330px; box-shadow: 8px 8px 0 rgba(255,255,255,0.08); transform: none; }
  .hero-card-top { flex-wrap: wrap; }
  .hero-card p { overflow-wrap: anywhere; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
  .section-heading > p { text-align: left; }
  .tabs { display: flex; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 188px; }
  .input-card, .result-card { padding: 22px 18px; border-radius: 21px; }
  .calculator-layout, .input-card, .result-card { min-width: 0; }
  .field-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .comparison-grid { grid-template-columns: 1fr; }
  .income-legend { grid-template-columns: 1fr; }
  .income-legend span, .income-legend span:nth-child(2), .income-legend span:nth-child(3) { text-align: left; }
  .income-legend span:nth-child(2) i, .income-legend span:nth-child(3) i { left: 0; right: auto; }
  .result-head { flex-direction: column; gap: 9px; }
  .method-section { padding: 35px 22px; }
  .method-grid { grid-template-columns: 1fr; }
  .method-grid h3 { margin-top: 18px; }
  .source-list a { align-items: flex-start; flex-direction: column; gap: 4px; }
  .source-list strong { text-align: left; }
  footer { gap: 10px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
