:root {
  --bg: #ffffff;
  --surface: #f8fafc;
  --surface-strong: #f1f5f9;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --profit: #16a34a;
  --fee: #ea580c;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.7rem 1rem;
  background: var(--text);
  color: white;
  border-radius: 6px;
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.narrow {
  max-width: 780px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

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

.nav,
.footer-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav a,
.footer-links a {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
  text-decoration: none;
}

.nav a:hover,
.footer-links a:hover,
.source-list a:hover,
.related-link:hover {
  color: var(--primary);
}

.hero {
  padding: 72px 0 48px;
  background:
    linear-gradient(180deg, #eef2ff 0%, rgba(238, 242, 255, 0) 72%),
    var(--bg);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.7fr);
  align-items: center;
  gap: 48px;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--primary-dark);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  max-width: 920px;
  font-size: clamp(2.35rem, 6vw, 4.7rem);
  line-height: 0.98;
  letter-spacing: 0;
}

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

h3 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.hero-lede,
.page-hero p,
.section-heading p,
.split p,
.signup-box p,
.content-card p,
.tool-card span,
.steps p {
  color: var(--muted);
}

.hero-lede {
  max-width: 650px;
  margin: 1.35rem 0 0;
  font-size: 1.2rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1.8rem;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.72rem 1rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  color: white;
}

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

.button.secondary {
  background: white;
  color: var(--text);
  border-color: var(--border);
}

.button.secondary:hover {
  border-color: #c7d2fe;
  color: var(--primary-dark);
}

.button.compact {
  min-height: 38px;
  padding: 0.55rem 0.75rem;
}

.button.full {
  width: 100%;
}

.hero-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.mini-result {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mini-result span {
  color: var(--muted);
  font-weight: 700;
}

.mini-result strong {
  font-size: 1.55rem;
}

.mini-result.profit strong {
  color: var(--profit);
}

.mini-result.fee strong {
  color: var(--fee);
}

.section {
  padding: 56px 0;
}

.page-hero {
  padding: 56px 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.page-hero h1 {
  font-size: clamp(2.1rem, 5vw, 4rem);
}

.page-hero p {
  max-width: 760px;
  margin: 1rem 0 0;
  font-size: 1.08rem;
}

.section-heading {
  display: grid;
  gap: 0.35rem;
  max-width: 720px;
  margin-bottom: 28px;
}

.calculator-group + .calculator-group {
  margin-top: 34px;
}

.calculator-group h3 {
  margin-bottom: 14px;
}

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

.tool-card,
.content-card,
.calculator-card,
.result-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
}

.tool-card {
  min-height: 178px;
  display: grid;
  align-content: start;
  gap: 0.65rem;
  padding: 1rem;
  text-decoration: none;
}

.tool-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.1);
}

.tool-card strong {
  font-size: 1.15rem;
}

.tool-card-kicker {
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.band {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

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

.steps > div {
  min-height: 190px;
  padding: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.step-number {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  background: #eef2ff;
  color: var(--primary-dark);
  border-radius: 50%;
  font-weight: 900;
}

.signup-band {
  background: #f0fdf4;
  border-top: 1px solid #bbf7d0;
}

.signup-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 36px;
  align-items: center;
}

.signup-form {
  display: grid;
  gap: 0.65rem;
}

.signup-form label,
.field span:first-child {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 800;
}

.signup-helper {
  min-height: 22px;
  margin: 0;
  font-size: 0.9rem;
}

.signup-row {
  display: flex;
  gap: 0.65rem;
}

.signup-row input {
  min-width: 0;
  flex: 1;
}

input,
select {
  width: 100%;
  min-height: 46px;
  color: var(--text);
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #c7d2fe;
  outline-offset: 2px;
}

.calculator-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.75fr);
  gap: 20px;
  align-items: start;
  padding-top: 28px;
}

.calculator-card,
.result-card,
.content-card {
  padding: 1.2rem;
}

.card-header,
.result-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-header h2 {
  font-size: 1.25rem;
}

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

.field {
  display: grid;
  gap: 0.45rem;
}

.input-shell {
  position: relative;
  display: block;
}

.input-prefix,
.input-suffix {
  position: absolute;
  top: 50%;
  color: var(--muted);
  font-weight: 800;
  transform: translateY(-50%);
}

.input-prefix {
  left: 0.8rem;
}

.input-suffix {
  right: 0.8rem;
}

.input-shell.has-prefix input {
  padding-left: 1.65rem;
}

.input-shell.has-suffix input {
  padding-right: 2rem;
}

.result-card {
  position: sticky;
  top: 92px;
  min-height: 360px;
  box-shadow: var(--shadow);
}

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

.copy-button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--primary-dark);
  font-weight: 800;
  cursor: pointer;
}

.result-primary {
  min-height: 64px;
  color: var(--profit);
  font-size: clamp(2rem, 5vw, 3.1rem);
  font-weight: 900;
  line-height: 1;
}

.result-card p {
  min-height: 48px;
  color: var(--muted);
}

.result-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 1rem;
}

.result-row {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--border);
}

.result-row span {
  color: var(--muted);
}

.result-row strong {
  text-align: right;
}

.warning {
  margin-top: 1rem;
  padding: 0.75rem;
  color: #7c2d12;
  background: #fffbeb;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-weight: 700;
}

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

.content-grid > .content-card:nth-child(3) {
  grid-column: 1 / -1;
}

.content-card h2 {
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.plain-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
}

.related-list,
.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.assumption-list {
  margin-top: 1rem;
}

.related-link,
.source-list a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.55rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.breakdown {
  display: grid;
  gap: 0.85rem;
}

.bar-row {
  display: grid;
  gap: 0.35rem;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  background: var(--surface-strong);
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  width: var(--bar-width, 0%);
  background: var(--primary);
  border-radius: inherit;
}

.bar-fill.profit {
  background: var(--profit);
}

.bar-fill.fee {
  background: var(--fee);
}

.bar-fill.warning {
  background: var(--warning);
}

.table-card {
  overflow: hidden;
}

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

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

th,
td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface);
  font-size: 0.86rem;
  text-transform: uppercase;
}

td strong {
  color: var(--profit);
}

.best-row {
  background: #f0fdf4;
}

.form-message {
  min-height: 24px;
  margin: 0;
  color: var(--profit);
  font-weight: 800;
}

.disclaimer-section {
  padding-top: 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

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

.site-footer {
  padding: 34px 0;
  background: #0f172a;
  color: white;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.footer-brand {
  display: flex;
  gap: 0.85rem;
  max-width: 460px;
}

.footer-brand p,
.site-footer a {
  color: #cbd5e1;
}

.footer-brand p {
  margin: 0.2rem 0 0;
}

@media (max-width: 860px) {
  .header-inner,
  .footer-grid,
  .split,
  .signup-box {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-grid,
  .calculator-shell,
  .content-grid,
  .split,
  .signup-box {
    grid-template-columns: 1fr;
  }

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

  .result-card {
    position: static;
  }

  .hero {
    padding-top: 48px;
  }
}

@media (max-width: 560px) {
  .container {
    width: min(100% - 24px, 1120px);
  }

  .header-inner {
    min-height: auto;
    padding: 0.85rem 0;
  }

  .nav {
    width: 100%;
  }

  .hero-actions,
  .signup-row,
  .footer-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .button,
  .signup-row input {
    width: 100%;
  }

  .calculator-card,
  .result-card,
  .content-card {
    padding: 1rem;
  }

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

  .mini-result,
  .result-row,
  .bar-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .section {
    padding: 42px 0;
  }

  table {
    min-width: 620px;
  }
}
