:root {
  color-scheme: light;
  --bg: #f8faf7;
  --surface: #ffffff;
  --surface-strong: #eef6f1;
  --ink: #17211d;
  --muted: #5b6862;
  --line: #d9e2dc;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-soft: #d9f2ed;
  --warn: #8a4b0f;
  --warn-bg: #fff4dc;
  --danger: #9f1239;
  --danger-bg: #fff1f4;
  --gold: #c48a12;
  --blue: #2563eb;
  --shadow: 0 20px 55px rgba(23, 33, 29, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(217, 242, 237, 0.68), rgba(248, 250, 247, 0) 420px),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

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

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid rgba(217, 226, 220, 0.8);
  background: rgba(248, 250, 247, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

.top-nav {
  display: flex;
  gap: 8px;
}

.top-nav a {
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.top-nav a:hover {
  background: var(--surface-strong);
  color: var(--ink);
}

.hero {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 42px;
}

.hero-copy {
  max-width: 820px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.4rem, 7vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.lead {
  max-width: 740px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.notice {
  display: inline-flex;
  max-width: 780px;
  margin: 18px 0 0;
  border: 1px solid #f1d28c;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 700;
}

.tool-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: 18px;
  align-items: stretch;
}

.calculator-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calculator-panel {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 3vw, 28px);
}

.result-panel {
  padding: clamp(20px, 3vw, 30px);
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

label,
legend {
  color: var(--ink);
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.currency-input,
.percent-input {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
}

.currency-input:focus-within,
.percent-input:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.currency-input input,
.percent-input input {
  min-height: 44px;
  border: 0;
  padding: 8px 0;
  box-shadow: none;
}

.currency-input span,
.percent-input span {
  color: var(--muted);
  font-weight: 800;
}

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

.segment-group label {
  cursor: pointer;
}

.segment-group input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.segment-group span {
  display: grid;
  min-height: 62px;
  place-items: center;
  border: 1px solid #cbd7d0;
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  text-align: center;
  font-weight: 900;
}

.segment-group small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.segment-group input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.form-error {
  margin: 0;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 800;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button,
.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 900;
  text-align: center;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover {
  background: var(--surface-strong);
}

.result-topline {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.result-topline span,
.result-grid span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.result-topline strong {
  color: var(--accent-strong);
  font-size: clamp(2.35rem, 7vw, 4.3rem);
  line-height: 1;
  letter-spacing: 0;
}

.result-summary {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

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

.result-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.result-grid strong {
  font-size: 1.22rem;
  line-height: 1.15;
}

.comparison {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.bar-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.bar-row span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 900;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7eee9;
}

.bar i {
  display: block;
  width: var(--bar-width, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue));
}

.bar.subdued i {
  background: linear-gradient(90deg, #94a3b8, var(--gold));
}

.assumptions {
  margin-top: 20px;
  border: 1px solid #f1d28c;
  border-radius: 8px;
  padding: 14px;
  background: var(--warn-bg);
}

.assumptions h2 {
  font-size: 1rem;
}

.assumptions ul {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.assumptions li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(138, 75, 15, 0.16);
  padding-bottom: 8px;
}

.assumptions li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.assumptions span {
  color: #73410e;
}

.assumptions strong {
  text-align: right;
}

.assumptions p {
  margin: 0;
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 700;
}

.content-section {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 18px;
}

.section-heading p {
  color: var(--muted);
}

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

.formula-grid article {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
}

.formula-grid span {
  display: grid;
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 900;
}

.formula-grid p,
.status-section p,
.faq-section p {
  color: var(--muted);
}

.rate-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.rate-table [role='row'] {
  display: grid;
  grid-template-columns: minmax(140px, 2fr) repeat(3, minmax(70px, 1fr));
}

.rate-table span {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  font-weight: 800;
}

.rate-table [role='row']:last-child span {
  border-bottom: 0;
}

.table-header {
  background: var(--ink);
  color: #fff;
}

.faq-section {
  display: grid;
  gap: 10px;
}

.faq-section .section-heading {
  margin-bottom: 8px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

summary {
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 900;
}

details p {
  margin: 0;
  padding: 0 18px 16px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 24px;
  padding: 28px clamp(18px, 4vw, 48px);
  border-top: 1px solid var(--line);
  background: #eef6f1;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--accent-strong);
  font-weight: 900;
}

.not-found {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.not-found h1,
.not-found p {
  margin: 0;
}

@media (max-width: 860px) {
  .site-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .top-nav {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    padding-top: 34px;
  }

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

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

@media (max-width: 560px) {
  .hero,
  .content-section {
    width: min(100% - 24px, 1180px);
  }

  .segment-group,
  .button-row,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .rate-table {
    overflow-x: auto;
  }

  .rate-table [role='row'] {
    min-width: 520px;
  }

  .site-footer {
    flex-direction: column;
  }
}
