:root {
  --bg: #f7f9fc;
  --paper: #ffffff;
  --paper-soft: #f2f7f8;
  --ink: #17202a;
  --muted: #637282;
  --faint: #91a0ad;
  --line: #dce5ea;
  --line-strong: #c1d0d8;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #2563eb;
  --amber: #d8871d;
  --amber-soft: #fff6e2;
  --shadow: 0 24px 80px rgba(25, 43, 60, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.065), transparent 370px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    Arial,
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar,
main,
.footer {
  width: min(1220px, calc(100% - 48px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 850;
  white-space: nowrap;
}

.brand img {
  width: 36px;
  height: 36px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

nav a,
.nav-group button,
.top-action,
#reset-button {
  border-radius: 8px;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease;
}

.nav-group {
  position: relative;
}

nav a,
.nav-group button {
  padding: 9px 12px;
}

.nav-group button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 760;
}

.nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  display: none;
  min-width: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--paper);
  box-shadow: 0 18px 50px rgba(25, 43, 60, 0.14);
}

.nav-menu a {
  display: block;
  white-space: nowrap;
}

.nav-group.open .nav-menu {
  display: block;
}

nav a:hover,
.nav-group button:hover,
.top-action:hover,
#reset-button:hover {
  background: var(--paper-soft);
  color: var(--ink);
}

.top-action,
#reset-button {
  min-height: 38px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  background: var(--paper);
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 0 18px;
}

.intro h1 {
  max-width: 800px;
  margin: 0 0 12px;
  font-size: clamp(34px, 4.7vw, 58px);
  line-height: 1.04;
  letter-spacing: 0;
}

.intro p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.city-switch {
  display: grid;
  grid-template-columns: repeat(5, minmax(66px, 1fr));
  gap: 6px;
  width: min(426px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: var(--paper);
  box-shadow: 0 10px 35px rgba(25, 43, 60, 0.06);
}

.city-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.city-switch button.active {
  background: var(--teal-dark);
  color: #fff;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(360px, 0.82fr);
  gap: 18px;
  align-items: stretch;
}

.input-panel,
.result-panel,
.detail-card,
.note-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head span {
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 800;
}

.panel-head strong {
  font-size: 23px;
}

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

.form-grid label {
  display: grid;
  gap: 7px;
}

.form-grid span,
.control-row,
.rate-board span,
.metric-grid span,
.ledger span,
.note-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 760;
}

.form-grid input:focus,
.form-grid select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0;
  padding: 13px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--paper-soft);
  line-height: 1.5;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.check-stack {
  display: grid;
  gap: 8px;
}

.checkline input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.rate-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.rate-board article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.rate-board strong {
  display: block;
  margin-top: 7px;
  font-size: 20px;
}

.result-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(17, 94, 89, 0.98), rgba(15, 118, 110, 0.94)),
    var(--teal-dark);
  color: #fff;
}

.result-main {
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 18px;
}

.result-main span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 760;
}

.result-main strong {
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1;
}

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

.metric-grid article {
  min-height: 88px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.08);
}

.metric-grid span,
.ledger span {
  color: rgba(255, 255, 255, 0.7);
}

.metric-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 21px;
}

.ledger {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  padding: 13px;
  background: rgba(255, 247, 230, 0.13);
}

.ledger div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.detail-card {
  margin-top: 18px;
  padding: 22px 24px 24px;
  box-shadow: none;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.section-head p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 820;
}

td {
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fbfdff;
}

.note-card {
  margin-top: 18px;
  padding: 22px;
  box-shadow: none;
}

.note-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.note-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.tool-suite {
  margin-top: 18px;
}

.suite-head {
  align-items: start;
  margin-bottom: 14px;
  padding: 0 2px;
}

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

.mini-tool {
  display: grid;
  align-content: start;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 16px 52px rgba(25, 43, 60, 0.07);
}

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

.mini-tool-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.mini-tool-head span,
.compact-form span,
.tool-result span,
.single-result span,
.compare-strip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.mini-tool-head strong {
  font-size: 22px;
}

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

.compact-form label {
  display: grid;
  gap: 7px;
}

.compact-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 760;
}

.compact-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.deduction-check {
  min-height: 44px;
  align-self: end;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

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

.package-result {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tool-result div,
.single-result,
.compare-strip button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
}

.tool-result div {
  min-height: 86px;
  padding: 13px;
}

.tool-result strong,
.single-result strong,
.compare-strip strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.single-result {
  padding: 16px;
}

.single-result p,
.tool-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.tool-note {
  min-height: 23px;
  margin-top: -4px;
}

.compare-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.compare-strip button {
  min-height: 118px;
  padding: 14px;
  color: var(--ink);
  text-align: left;
}

.compare-strip button.active {
  border-color: rgba(17, 94, 89, 0.42);
  background: #e9f6f4;
}

.compare-strip em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

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

.mortgage-plan {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--paper-soft);
}

.primary-plan {
  border-color: rgba(17, 94, 89, 0.36);
  background: #e9f6f4;
}

.plan-title,
.plan-main,
.mortgage-plan dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.plan-title span,
.plan-main span,
.mortgage-plan dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.plan-title strong {
  font-size: 24px;
}

.plan-main {
  align-items: start;
  border-top: 1px solid rgba(99, 114, 130, 0.16);
  border-bottom: 1px solid rgba(99, 114, 130, 0.16);
  padding: 16px 0;
}

.plan-main strong {
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  text-align: right;
}

.mortgage-plan dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.mortgage-plan dd {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 820;
  text-align: right;
}

.mortgage-detail {
  margin-top: 0;
}

.policy-page {
  max-width: 920px;
}

.policy-hero {
  padding: 34px 0 18px;
}

.policy-hero span {
  color: var(--teal-dark);
  font-size: 14px;
  font-weight: 820;
}

.policy-hero h1 {
  margin: 10px 0 10px;
  font-size: clamp(38px, 5vw, 62px);
  line-height: 1.05;
}

.policy-hero p {
  margin: 0;
  color: var(--muted);
}

.policy-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.policy-card h2 {
  margin: 28px 0 10px;
  font-size: 22px;
}

.policy-card h2:first-child {
  margin-top: 0;
}

.policy-card p,
.policy-card li {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.policy-card a,
.footer a {
  color: var(--teal-dark);
  font-weight: 800;
}

.policy-card ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 24px 0 32px;
  color: var(--faint);
  font-size: 13px;
}

@media (max-width: 980px) {
  .topbar,
  .intro,
  .section-head,
  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 14px;
  }

  nav {
    justify-content: flex-start;
    overflow-x: auto;
    width: 100%;
  }

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

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

  .mini-tool-grid {
    grid-template-columns: 1fr;
  }

  .compare-strip,
  .mortgage-compare,
  .package-result {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar,
  main,
  .footer {
    width: min(100% - 28px, 1220px);
  }

  .intro h1 {
    font-size: 35px;
  }

  .city-switch,
  .form-grid,
  .rate-board,
  .metric-grid,
  .compact-form,
  .tool-result,
  .compare-strip,
  .mortgage-compare {
    grid-template-columns: 1fr;
  }

  .input-panel,
  .result-panel,
  .detail-card {
    padding: 18px;
  }

  .footer {
    flex-direction: column;
    align-items: center;
  }
}
