:root {
  --indigo-50:  #EEF2FF;
  --indigo-100: #E0E7FF;
  --indigo-200: #C7D2FE;
  --indigo-500: #6366F1;
  --indigo-600: #4F46E5;
  --indigo-700: #4338CA;
  --indigo-800: #3730A3;

  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;

  --green-50: #ECFDF5;
  --green-100: #D1FAE5;
  --green-500: #10B981;
  --green-600: #059669;
  --green-700: #047857;

  --amber-50: #FFFBEB;
  --amber-100: #FEF3C7;
  --amber-500: #F59E0B;
  --amber-600: #D97706;
  --amber-700: #B45309;
  --amber-800: #92400E;
  --amber-900: #78350F;

  --red-50:  #FEF2F2;
  --red-100: #FEE2E2;
  --red-500: #EF4444;
  --red-600: #DC2626;
  --red-700: #B91C1C;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-focus: 0 0 0 3px rgba(79, 70, 229, 0.15);
  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.04);

  --container: 1100px;
  --container-narrow: 760px;

  /* Semantic theme tokens — overridden in [data-theme="dark"] */
  --bg:           #FFFFFF;
  --bg-elevated:  #FFFFFF;
  --bg-subtle:    #F9FAFB;
  --bg-muted:     #F3F4F6;
  --surface:      #FFFFFF;
  --surface-alt:  rgba(255, 255, 255, 0.85);
  --text:         #111827;
  --text-muted:   #4B5563;
  --text-subtle:  #6B7280;
  --text-faint:   #9CA3AF;
  --border:       #E5E7EB;
  --border-strong:#D1D5DB;
  --border-soft:  #F3F4F6;
  --link:         var(--indigo-600);
  --link-hover:   var(--indigo-700);
  --on-accent:    #FFFFFF;
  --code-bg:      #F3F4F6;
  --shadow-card-rgba: 17, 24, 39;
}

[data-theme="dark"] {
  --bg:           #0B0F19;
  --bg-elevated:  #131826;
  --bg-subtle:    #161B2A;
  --bg-muted:     #1B2133;
  --surface:      #131826;
  --surface-alt:  rgba(19, 24, 38, 0.85);
  --text:         #E5E7EB;
  --text-muted:   #C7CEDB;
  --text-subtle:  #9CA3AF;
  --text-faint:   #6B7280;
  --border:       #2A3148;
  --border-strong:#3A4263;
  --border-soft:  #1F2538;
  --link:         #A5B4FC;
  --link-hover:   #C7D2FE;
  --on-accent:    #FFFFFF;
  --code-bg:      #1B2133;
  --shadow-focus: 0 0 0 3px rgba(129, 140, 248, 0.28);
  --shadow-card-rgba: 0, 0, 0;

  --indigo-50:  #1E1B3A;
  --indigo-100: #2A2554;
  --green-50:   #052E22;
  --green-100:  #064E3B;
  --amber-50:   #2A1F05;
  --amber-100:  #3B2B05;
  --red-50:     #2A0F0F;
  --red-100:    #3B1414;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 200ms ease, color 200ms ease;
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; height: auto; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container.narrow { max-width: var(--container-narrow); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===== Nav ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--gray-200);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--gray-900); }
.logo:hover { text-decoration: none; }
.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--indigo-600);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 16px;
  font-family: var(--font-serif);
  letter-spacing: -0.02em;
}
.logo-mark.small { width: 24px; height: 24px; font-size: 13px; border-radius: 6px; }
.logo-text { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a {
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 500;
}
.nav-links a:hover, .nav-links a.active { color: var(--indigo-600); text-decoration: none; }
.nav-links .dropdown { position: relative; }
.nav-links .dropdown-toggle {
  background: none;
  border: 0;
  padding: 0;
  color: var(--gray-700);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-links .dropdown-toggle:hover { color: var(--indigo-600); }
.nav-links .dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 200px;
  box-shadow: 0 4px 12px rgba(17,24,39,0.08);
  z-index: 60;
}
.nav-links .dropdown:hover .dropdown-menu,
.nav-links .dropdown:focus-within .dropdown-menu { display: block; }
.nav-links .dropdown-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--gray-700);
}
.nav-links .dropdown-menu a:hover { background: var(--gray-50); color: var(--indigo-600); text-decoration: none; }

.menu-toggle {
  display: none;
  background: none;
  border: 0;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--gray-900);
  position: relative;
}
.menu-toggle span::before, .menu-toggle span::after {
  content: ''; position: absolute; left: 0; width: 18px; height: 1.5px; background: var(--gray-900);
}
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }

@media (max-width: 800px) {
  .nav-links { display: none; }
  .menu-toggle { display: inline-flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 24px 16px;
    gap: 14px;
  }
  .nav-links.open .dropdown-menu { position: static; display: block; box-shadow: none; border: 0; padding: 4px 0 4px 12px; }
}

/* ===== Hero ===== */
.hero {
  padding: 48px 0 32px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, var(--indigo-50) 0%, transparent 70%),
    #FFFFFF;
}
.eyebrow {
  font-size: 13px;
  color: var(--indigo-700);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 12px;
}
h1 {
  font-family: var(--font-serif);
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1.05;
  font-weight: 400;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
}
h1 .vs { font-style: italic; color: var(--indigo-600); }
.lede {
  font-size: 18px;
  color: var(--gray-600);
  max-width: 580px;
  margin: 0 0 32px;
  line-height: 1.55;
}

/* ===== Calculator card ===== */
.calc-card {
  background: #FFFFFF;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-card);
  max-width: 720px;
}
.calc-header {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--gray-200);
}
.select-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--gray-500);
}
.select-group label { font-weight: 500; }
.select-group select {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-900);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
}
.select-group select:focus { border-color: var(--indigo-600); box-shadow: var(--shadow-focus); }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}
.field { position: relative; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: #FFFFFF;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
  padding: 0 12px;
  height: 46px;
}
.input-wrap.small { height: 38px; }
.input-wrap:hover { border-color: var(--gray-400); }
.input-wrap:focus-within {
  border-color: var(--indigo-600);
  box-shadow: var(--shadow-focus);
}
.input-wrap input {
  flex: 1;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--gray-900);
  padding: 0;
  min-width: 0;
}
.input-wrap input::placeholder { color: var(--gray-400); }
.prefix, .suffix {
  color: var(--gray-500);
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}
.prefix { margin-right: 6px; }
.suffix { margin-left: 6px; }
.auto-tag {
  position: absolute;
  top: -7px;
  right: 8px;
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}
.field.driver .input-wrap {
  border-color: var(--indigo-600);
  border-width: 2px;
  padding: 0 11px;
}
.field.driver .auto-tag { opacity: 0; }
.field.computed .input-wrap {
  background: var(--gray-50);
  border-color: var(--gray-200);
}
.field.computed input { color: var(--gray-700); }
.field.computed .auto-tag { opacity: 1; }
.field.loss .input-wrap { border-color: var(--red-500); }
.field.loss input { color: var(--red-600); }

.hint {
  font-size: 12px;
  color: var(--gray-500);
  margin: 8px 0 16px;
}
.alert {
  background: var(--amber-50);
  border: 1px solid var(--amber-100);
  border-left: 3px solid var(--amber-500);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--amber-900);
  margin-bottom: 14px;
}
.alert.error {
  background: var(--red-50);
  border-color: var(--red-100);
  border-left-color: var(--red-500);
  color: var(--red-700);
}
.alert .swap-btn {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}

/* ===== Fees panel ===== */
.fees-toggle {
  background: transparent;
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-md);
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--indigo-600);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 120ms ease, background 120ms ease;
  margin-top: 4px;
}
.fees-toggle:hover { background: var(--indigo-50); border-color: var(--indigo-600); border-style: solid; }
.fees-toggle .plus {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--indigo-100);
  color: var(--indigo-700);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}
.fees-toggle[aria-expanded="true"] {
  background: var(--indigo-50);
  border-style: solid;
  border-color: var(--indigo-200);
}
.fees-panel {
  margin-top: 12px;
  padding: 18px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}
.fees-section { margin-bottom: 18px; }
.fees-section:last-child { margin-bottom: 0; }
.fees-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  margin-bottom: 10px;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: #FFFFFF;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  transition: all 120ms ease;
}
.chip:hover { border-color: var(--indigo-600); color: var(--indigo-700); }
.chip.active {
  background: var(--indigo-600);
  border-color: var(--indigo-600);
  color: white;
}
.custom-fee, .tax-rate, .fees-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}
.mini-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 5px;
}
.custom-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.custom-line {
  display: grid;
  grid-template-columns: 1fr 120px auto;
  gap: 8px;
  align-items: center;
}
.custom-line input[type="text"] {
  height: 36px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  outline: none;
}
.custom-line input[type="text"]:focus { border-color: var(--indigo-600); box-shadow: var(--shadow-focus); }
.remove-line {
  background: transparent;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  width: 36px; height: 36px;
  color: var(--gray-500);
  font-size: 18px;
}
.remove-line:hover { color: var(--red-600); border-color: var(--red-500); }

.link-btn {
  background: transparent;
  border: 0;
  color: var(--indigo-600);
  font-size: 13px;
  font-weight: 500;
  padding: 4px 0;
  font-family: inherit;
}
.link-btn:hover { text-decoration: underline; }

.calc-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.btn-primary {
  background: var(--indigo-600);
  color: white;
  border: 0;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: background 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--indigo-700); text-decoration: none; }
.btn-secondary {
  background: #FFFFFF;
  border: 1px solid var(--gray-300);
  color: var(--gray-700);
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: all 120ms ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-secondary:hover { border-color: var(--indigo-600); color: var(--indigo-600); text-decoration: none; }
.btn-secondary.toast { background: var(--green-50); border-color: var(--green-500); color: var(--green-700); }
.btn-outline {
  background: #FFFFFF;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 120ms ease;
}
.btn-outline:hover { border-color: var(--indigo-600); color: var(--indigo-600); text-decoration: none; }

/* ===== Results ===== */
.results {
  background: var(--indigo-50);
  border-radius: var(--radius-xl);
  padding: 22px;
  margin-top: 16px;
  max-width: 720px;
}
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.results-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--indigo-700);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.results-sub { font-size: 12px; color: var(--gray-500); }
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
}
.result-metric { min-width: 0; }
.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.metric-value {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}
.metric-value.good { color: var(--green-600); }
.metric-value.warn { color: var(--amber-600); }
.metric-value.bad { color: var(--red-600); }
.metric-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 6px;
}
.metric-tag.good { background: var(--green-100); color: var(--green-700); }
.metric-tag.warn { background: var(--amber-100); color: var(--amber-800); }
.metric-tag.bad { background: var(--red-100); color: var(--red-700); }
.metric-tag.neutral { background: var(--gray-100); color: var(--gray-600); }

.results-net {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--indigo-100);
}
.net-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--indigo-700);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.fees-breakdown {
  margin-top: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--gray-700);
  display: grid;
  gap: 4px;
}
.fees-breakdown .br-row {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.fees-breakdown .br-row.total {
  font-weight: 600;
  border-top: 1px dashed var(--gray-300);
  padding-top: 6px;
  margin-top: 4px;
}
.step-toggle { margin-top: 14px; font-weight: 500; }
.step-panel {
  margin-top: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-800);
  overflow-x: auto;
  white-space: pre-wrap;
}
.step-panel .step-title {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--indigo-700);
  margin-bottom: 4px;
  margin-top: 10px;
}
.step-panel .step-title:first-child { margin-top: 0; }

/* ===== Section ===== */
.section { padding: 64px 0; border-top: 1px solid var(--gray-200); }
.section h2 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.025em;
  margin-bottom: 12px;
}
.section h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.015em;
  margin: 28px 0 10px;
}
.section h2 .arrow { color: var(--indigo-600); font-style: italic; }
.section-lede {
  font-size: 15px;
  color: var(--gray-600);
  margin: 0 0 28px;
}
.prose {
  font-size: 16px;
  line-height: 1.7;
  color: var(--gray-700);
  margin: 0 0 14px;
}
.prose em { font-family: var(--font-serif); font-size: 1.1em; font-style: italic; color: var(--gray-900); }
.prose strong { color: var(--gray-900); font-weight: 600; }
.prose a { font-weight: 500; }
.section.alt { background: var(--gray-50); }

/* ===== Chart ===== */
.chart-card {
  background: #FFFFFF;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.chart-head {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  padding: 12px 18px;
  background: var(--gray-50);
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--gray-200);
}
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  font-variant-numeric: tabular-nums;
  transition: background 120ms ease;
}
.chart-row:last-child { border-bottom: 0; }
.chart-row:hover { background: var(--indigo-50); }
.chart-row.highlight { background: var(--indigo-50); color: var(--gray-900); font-weight: 500; }
.chart-row .chart-note { color: var(--gray-500); font-size: 13px; }
.chart-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .chart-head, .chart-row { grid-template-columns: 1fr 1fr; }
  .chart-note { display: none; }
}

.embed-modal {
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.embed-modal[hidden] { display: none; }
.embed-inner {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 520px;
  width: 100%;
}
.embed-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.embed-desc { font-size: 14px; color: var(--gray-600); margin: 0 0 14px; }
.embed-code {
  background: var(--gray-900);
  color: #E5E7EB;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
  margin: 0 0 14px;
  white-space: pre-wrap;
  word-break: break-all;
}
.embed-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ===== Formula cards ===== */
.formula-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 24px 0;
}
.formula-card {
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.formula-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--indigo-700);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.formula {
  background: white;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.formula span {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--gray-900);
  font-weight: 500;
}
.formula-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--indigo-800);
  margin: 0;
}

.callout {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin: 24px 0;
}
.callout.warning {
  background: var(--amber-50);
  border-left: 3px solid var(--amber-500);
  color: var(--amber-900);
}
.callout.info {
  background: var(--indigo-50);
  border-left: 3px solid var(--indigo-600);
  color: var(--indigo-800);
}
.callout-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.callout-body { font-size: 14px; line-height: 1.6; }

/* ===== Examples / industries ===== */
.examples-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.example-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: left;
  font-family: inherit;
  transition: all 150ms ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}
.example-card:hover {
  border-color: var(--indigo-600);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
  text-decoration: none;
}
.ex-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.ex-scenario {
  font-size: 14px;
  color: var(--gray-900);
  margin-bottom: 12px;
  line-height: 1.45;
}
.ex-numbers {
  display: flex;
  gap: 14px;
  font-size: 12px;
  font-weight: 500;
}
.ex-good { color: var(--green-600); }
.ex-warn { color: var(--amber-600); }
.ex-neutral { color: var(--gray-500); }

.mistakes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 28px;
}
.mistake {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.mistake-num {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 400;
  color: var(--indigo-600);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.mistake h3 {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}
.mistake p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-600);
  margin: 0;
}

/* ===== FAQ ===== */
.faq-item {
  border-bottom: 1px solid var(--gray-200);
}
.faq-item:first-of-type { border-top: 1px solid var(--gray-200); }
.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-900);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  color: var(--gray-400);
  font-size: 22px;
  font-weight: 300;
  flex-shrink: 0;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { color: var(--indigo-600); }
.faq-body { padding: 0 0 18px; }
.faq-body p {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--gray-700);
}
.faq-body p:last-child { margin: 0; }

/* ===== Page hero (non-home pages) ===== */
.page-hero {
  padding: 64px 0 32px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, var(--indigo-50) 0%, transparent 70%),
    #FFFFFF;
}
.breadcrumb {
  display: flex;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 12px;
}
.breadcrumb a { color: var(--gray-500); }
.breadcrumb a:hover { color: var(--indigo-600); }
.breadcrumb .sep { color: var(--gray-300); }
.page-hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  margin-bottom: 12px;
}
.page-hero .lede { max-width: 620px; }

/* ===== Industry / vertical pages ===== */
.preset-banner {
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  font-size: 14px;
  color: var(--indigo-800);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.preset-banner strong { color: var(--indigo-700); }

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 24px 0;
}
.stat {
  background: var(--gray-50);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.stat-value {
  font-family: var(--font-serif);
  font-size: 24px;
  color: var(--gray-900);
  letter-spacing: -0.02em;
}

/* ===== Blog list ===== */
.blog-list { display: grid; gap: 0; }
.blog-card {
  display: block;
  padding: 22px 0;
  border-bottom: 1px solid var(--gray-200);
  color: inherit;
  text-decoration: none;
}
.blog-card:first-child { border-top: 1px solid var(--gray-200); }
.blog-card:hover { text-decoration: none; }
.blog-card:hover h3 { color: var(--indigo-600); }
.blog-card .meta {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.blog-card h3 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  transition: color 120ms ease;
}
.blog-card p { font-size: 15px; color: var(--gray-600); margin: 0; line-height: 1.55; }

/* ===== Article ===== */
.article {
  padding: 32px 0 64px;
}
.article-meta {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
}
.article h1 {
  font-size: clamp(32px, 5vw, 44px);
  margin: 8px 0 16px;
}
.article-lede {
  font-size: 19px;
  color: var(--gray-600);
  line-height: 1.55;
  margin: 0 0 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-200);
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
}
.article h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 40px 0 14px;
}
.article h3 {
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 600;
  margin: 28px 0 10px;
}
.article p, .article ul, .article ol {
  font-size: 17px;
  line-height: 1.75;
  color: var(--gray-700);
  margin: 0 0 16px;
}
.article ul, .article ol { padding-left: 22px; }
.article li { margin-bottom: 6px; }
.article a { font-weight: 500; }
.article blockquote {
  border-left: 3px solid var(--indigo-600);
  padding: 4px 0 4px 18px;
  margin: 24px 0;
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--gray-700);
  font-style: italic;
}
.article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--gray-100);
  padding: 1px 6px;
  border-radius: 4px;
}
.article-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}
.article-table th, .article-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.article-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cta-card {
  background: var(--indigo-50);
  border: 1px solid var(--indigo-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin: 36px 0;
  text-align: center;
}
.cta-card h3 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.cta-card p { font-size: 14px; color: var(--indigo-800); margin: 0 0 16px; }

/* ===== Footer ===== */
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 48px 0 28px;
  margin-top: 64px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--gray-800);
}
.footer-brand-block { color: var(--gray-300); }
.footer-brand-block .brand-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
}
.footer-brand-block .brand-row span { color: white; font-weight: 600; }
.footer-brand-block p { font-size: 13px; line-height: 1.6; margin: 0; max-width: 280px; }
.footer-col h3 {
  color: white;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-col a {
  color: var(--gray-400);
  font-size: 13px;
}
.footer-col a:hover { color: white; text-decoration: none; }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 24px;
  font-size: 12px;
  color: var(--gray-500);
}
@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

/* ===== Back to top ===== */
.back-to-top {
  position: fixed;
  right: 20px; bottom: 20px;
  background: var(--indigo-600);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  z-index: 30;
  transition: opacity 200ms ease, transform 200ms ease;
}
.back-to-top:hover { transform: translateY(-2px); }
.back-to-top[hidden] { display: none; }

/* ===== Mobile ===== */
@media (max-width: 640px) {
  .hero, .page-hero { padding: 32px 0 24px; }
  .calc-card { padding: 18px; border-radius: var(--radius-lg); }
  .calc-header { flex-direction: column; align-items: stretch; gap: 8px; }
  .select-group { justify-content: space-between; }
  .results { padding: 18px; }
  .results-grid { gap: 12px; }
  .metric-value { font-size: 24px; }
  .formula-grid { grid-template-columns: 1fr; }
  .examples-grid { grid-template-columns: 1fr; }
  .mistakes-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .section { padding: 44px 0; }
  .custom-fee, .tax-rate, .fees-row { grid-template-columns: 1fr; }
  .article p, .article ul, .article ol { font-size: 16px; }
}

/* ===== Embed page (minimal) ===== */
body.embed-mode .nav, body.embed-mode .footer, body.embed-mode .back-to-top { display: none; }
body.embed-mode { background: transparent; }
body.embed-mode .hero { padding: 16px 0; background: transparent; }
body.embed-mode .container { padding: 0 12px; }
body.embed-mode h1, body.embed-mode .eyebrow, body.embed-mode .lede { display: none; }

/* ============================================================
 * Dark mode overrides
 * Maps the existing hardcoded surfaces to semantic theme tokens
 * when [data-theme="dark"] is on <html>. Light mode is unchanged.
 * ============================================================ */
[data-theme="dark"] .nav { background: var(--surface-alt); border-bottom-color: var(--border); }
[data-theme="dark"] .dropdown-menu { background: var(--surface); border-color: var(--border); box-shadow: 0 4px 12px rgba(0,0,0,0.4); }
[data-theme="dark"] .calc-card,
[data-theme="dark"] .results,
[data-theme="dark"] .stat,
[data-theme="dark"] .blog-card,
[data-theme="dark"] .cta-card,
[data-theme="dark"] .article-table thead,
[data-theme="dark"] .industry-card,
[data-theme="dark"] .preset-banner,
[data-theme="dark"] .faq-item,
[data-theme="dark"] .step-panel,
[data-theme="dark"] .fees-panel,
[data-theme="dark"] .results-net { background: var(--surface); border-color: var(--border); }

[data-theme="dark"] .input-wrap { background: var(--bg-elevated); border-color: var(--border); }
[data-theme="dark"] .input-wrap input { color: var(--text); }
[data-theme="dark"] .input-wrap input::placeholder { color: var(--text-faint); }
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }

[data-theme="dark"] .chip { background: var(--bg-muted); color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] .chip.active { background: var(--indigo-600); color: var(--on-accent); border-color: var(--indigo-600); }
[data-theme="dark"] .chip:hover:not(.active) { background: var(--bg-subtle); border-color: var(--border-strong); }

[data-theme="dark"] .btn-secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border-strong); }
[data-theme="dark"] .btn-secondary:hover { background: var(--bg-muted); }

[data-theme="dark"] .hero,
[data-theme="dark"] .page-hero,
[data-theme="dark"] .section { background: var(--bg); }
[data-theme="dark"] .section.alt,
[data-theme="dark"] .section-alt { background: var(--bg-subtle); }

[data-theme="dark"] .footer { background: var(--bg-subtle); border-top-color: var(--border); color: var(--text-muted); }
[data-theme="dark"] .footer a { color: var(--text-muted); }
[data-theme="dark"] .footer a:hover { color: var(--text); }

[data-theme="dark"] .field label,
[data-theme="dark"] .fees-title,
[data-theme="dark"] .metric-label,
[data-theme="dark"] .results-label { color: var(--text-muted); }
[data-theme="dark"] .hint,
[data-theme="dark"] .prose,
[data-theme="dark"] .lede,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .blog-meta { color: var(--text-subtle); }

[data-theme="dark"] code,
[data-theme="dark"] pre,
[data-theme="dark"] .embed-snippet { background: var(--code-bg); color: var(--text); border-color: var(--border); }

[data-theme="dark"] table { color: var(--text); }
[data-theme="dark"] .article-table th,
[data-theme="dark"] .article-table td { border-color: var(--border); }
[data-theme="dark"] .article-table tbody tr:nth-child(even) { background: var(--bg-subtle); }

[data-theme="dark"] hr { border-color: var(--border); }
[data-theme="dark"] .breadcrumb,
[data-theme="dark"] .breadcrumb a { color: var(--text-subtle); }

[data-theme="dark"] .back-to-top { background: var(--indigo-600); }

[data-theme="dark"] .auto-tag { background: var(--bg-muted); color: var(--text-faint); }
[data-theme="dark"] .alert { background: var(--red-50); border-color: var(--red-700); color: #FCA5A5; }
[data-theme="dark"] .alert.warn { background: var(--amber-50); border-color: var(--amber-700); color: #FCD34D; }

[data-theme="dark"] .metric-tag.healthy { background: var(--green-50); color: #6EE7B7; border-color: var(--green-700); }
[data-theme="dark"] .metric-tag.tight { background: var(--bg-muted); color: var(--text-muted); }
[data-theme="dark"] .metric-tag.very-tight { background: var(--amber-50); color: #FCD34D; border-color: var(--amber-700); }
[data-theme="dark"] .metric-tag.loss { background: var(--red-50); color: #FCA5A5; border-color: var(--red-700); }

/* Theme toggle button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-left: 6px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.theme-toggle:hover { background: var(--bg-muted); color: var(--text); border-color: var(--border-strong); }
.theme-toggle svg { width: 18px; height: 18px; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (max-width: 768px) {
  .theme-toggle { margin-left: auto; margin-right: 8px; }
}

/* ============================================================
 * New: Tabs (for homepage Calculator / Compare / Break-even)
 * ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tab-btn {
  background: transparent;
  border: 0;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-subtle);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
  font-family: inherit;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--indigo-600);
  border-bottom-color: var(--indigo-600);
}
[data-theme="dark"] .tab-btn.active { color: var(--link); border-bottom-color: var(--link); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
 * New: Compare table (multi-product comparison)
 * ============================================================ */
.compare-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.compare-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.compare-toolbar .toolbar-spacer { flex: 1; }
.compare-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -24px;
  padding: 0 24px;
  max-width: calc(100% + 48px);
  /* Subtle right-side fade to hint that horizontal scroll is available */
  background:
    linear-gradient(to right, var(--bg) 30%, transparent),
    linear-gradient(to right, transparent, var(--bg) 70%) 100% 0,
    radial-gradient(farthest-side at 0 50%, rgba(0,0,0,0.08), transparent),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,0.08), transparent) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.compare-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  min-width: 720px;
}
.compare-table thead th {
  font-weight: 500;
  text-align: left;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}
.compare-table tbody td {
  padding: 8px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.compare-table tbody tr:hover { background: var(--bg-subtle); }
.compare-table input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  background: var(--bg-elevated);
  color: var(--text);
}
.compare-table input:focus { outline: 0; border-color: var(--indigo-600); box-shadow: var(--shadow-focus); }
.compare-table .name-col input { font-weight: 500; }
.compare-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.compare-table .num.computed { color: var(--text); font-weight: 500; }
.compare-table .row-rank {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--indigo-50);
  color: var(--indigo-700);
  font-size: 11px;
  font-weight: 600;
}
[data-theme="dark"] .compare-table .row-rank { background: var(--indigo-50); color: #C7D2FE; }
.compare-table .row-rank.best { background: var(--green-100); color: var(--green-700); }
[data-theme="dark"] .compare-table .row-rank.best { background: var(--green-100); color: #6EE7B7; }
.compare-table .delete-row {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.compare-table .delete-row:hover { color: var(--red-600); background: var(--red-50); }
.compare-summary {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-muted);
}
.compare-summary strong { color: var(--text); }
.compare-summary .pill {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--indigo-50);
  color: var(--indigo-700);
  font-weight: 500;
}
[data-theme="dark"] .compare-summary .pill { background: var(--indigo-100); color: #C7D2FE; }

/* ============================================================
 * New: Break-even calculator
 * ============================================================ */
.breakeven-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.be-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) {
  .be-grid { grid-template-columns: 1fr; }
}
.be-results {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 600px) {
  .be-results { grid-template-columns: 1fr; }
}
.be-metric {
  text-align: left;
}
.be-metric-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.be-metric-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.be-metric-sub {
  font-size: 13px;
  color: var(--text-subtle);
  margin-top: 4px;
}
.be-chart {
  margin-top: 24px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}
.be-chart svg { display: block; width: 100%; height: auto; max-height: 280px; }

/* ============================================================
 * New: Fee-preset region dropdown row
 * ============================================================ */
.region-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-muted);
}
.region-row select {
  padding: 4px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
}

/* Print / PDF clean styles (used by browser print fallback) */
@media print {
  .nav, .footer, .back-to-top, .calc-actions, .fees-toggle, .step-toggle, .theme-toggle, .tabs { display: none !important; }
  body { background: white !important; color: black !important; }
  .calc-card, .results, .compare-card, .breakeven-card { box-shadow: none; border-color: #ddd; }
}

/* ============================================================
 * Free tools grid (network sites listing)
 * ============================================================ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 0;
}
.tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
  position: relative;
  overflow: hidden;
}
.tool-card:hover {
  border-color: var(--indigo-500);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(var(--shadow-card-rgba), 0.08);
}
.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.tool-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.tool-card-arrow {
  color: var(--indigo-500);
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 150ms ease, transform 150ms ease;
}
.tool-card:hover .tool-card-arrow {
  opacity: 1;
  transform: translate(2px, -2px);
}
.tool-card p {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-subtle);
  margin: 0 0 12px 0;
}
.tool-card-domain {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
[data-theme="dark"] .tool-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.3); }

/* ============================================================
 * Contact card
 * ============================================================ */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}
.contact-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--indigo-50);
  color: var(--indigo-600);
  font-size: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
[data-theme="dark"] .contact-card-icon {
  background: var(--indigo-100);
  color: #C7D2FE;
}
.contact-email-btn {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: -0.01em;
}
@media (max-width: 600px) {
  .contact-card { padding: 24px 20px; }
  .contact-email-btn { font-size: 13px; word-break: break-all; }
}

/* ============================================================
 * Adsterra ad banner — sits below nav, above page content
 * Desktop: 728x90  |  Mobile: 320x50
 * ============================================================ */
.ad-banner {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  min-height: 70px;
}
.ad-banner-inner {
  display: none;
  background: transparent;
  margin: 0 auto;
}
.ad-banner-inner.desktop {
  width: 728px;
  height: 90px;
  max-width: 100%;
}
.ad-banner-inner.mobile {
  width: 320px;
  height: 50px;
  max-width: 100%;
}
@media (min-width: 768px) {
  .ad-banner-inner.desktop { display: block; }
  .ad-banner { min-height: 110px; }
}
@media (max-width: 767px) {
  .ad-banner-inner.mobile { display: block; }
  .ad-banner { min-height: 70px; padding: 8px 12px; }
}
/* Hide ad in embed mode and in print */
body.embed-mode .ad-banner { display: none; }
@media print {
  .ad-banner { display: none !important; }
}

/* ============================================================
 * SEO/UX update: bump font sizes site-wide for readability
 * ============================================================
 *
 * Strategy:
 *   - Increase body base from 16px → 17px (proportional everywhere)
 *   - Bump specific prose/body text classes that were 14-15px → 16-17px
 *   - Slight increase to article body text
 *   - Larger article and FAQ readability
 *   - Bigger button text
 *   - Keep micro-labels (eyebrow, badges, footnotes) small
 *
 * Loaded LAST so it overrides the earlier declarations.
 */
body { font-size: 17px; line-height: 1.55; }

/* Page-hero lede gets slightly larger and easier to read */
.lede { font-size: 19px; line-height: 1.55; }
.hero .lede { font-size: 20px; line-height: 1.5; }

/* Article body content */
.article .prose,
.article-lede,
.article p,
.article li {
  font-size: 17px;
  line-height: 1.7;
}
.article-lede { font-size: 19px; line-height: 1.6; }

/* Blog cards become more readable */
.blog-card h3 { font-size: 19px; line-height: 1.35; }
.blog-card p { font-size: 15px; line-height: 1.55; }
.blog-card .meta { font-size: 13px; }

/* Lists and prose in narrow content sections */
section.container.narrow p,
section.container.narrow li,
.prose p, .prose li {
  font-size: 17px;
  line-height: 1.65;
}

/* FAQ readability */
.faq-item summary {
  font-size: 17px;
  line-height: 1.5;
  font-weight: 600;
  padding: 16px 0;
}
.faq-item .faq-body { font-size: 16px; line-height: 1.65; }
.faq-toc {
  font-size: 15px;
  line-height: 1.8;
  padding: 16px 20px;
  background: var(--bg-subtle);
  border-radius: 8px;
  margin: 24px 0 32px;
}
.faq-toc a { color: var(--link); margin: 0 4px; }

/* Calculator labels are slightly more readable */
.select-group label,
.calc-card label { font-size: 14px; }
.calc-card input[type="number"],
.calc-card input[type="text"],
.calc-card select { font-size: 16px; }

/* Results display larger */
.results-header .net-header,
.results .result-label { font-size: 14px; }
.results .result-value { font-size: 28px; }

/* Buttons feel a touch bigger */
.btn-primary,
.btn-secondary,
button.btn { font-size: 15px; padding: 11px 20px; }

/* Article tables get more breathing room */
.article-table th, .article-table td { font-size: 15px; padding: 12px 14px; }

/* Article headings get a slight bump */
.article h1 { font-size: 40px; line-height: 1.15; }
.article h2 { font-size: 28px; line-height: 1.25; margin-top: 40px; }
.article h3 { font-size: 22px; line-height: 1.3; margin-top: 28px; }

/* Footer slightly more readable */
.footer-col ul li { font-size: 15px; line-height: 1.9; }
.footer-col h3 { font-size: 14px; }
.footer-brand-block p { font-size: 15px; line-height: 1.55; }
.footer-bottom { font-size: 14px; }

/* Tool cards on the free-tools page */
.tool-card h3 { font-size: 17px; }
.tool-card p { font-size: 15px; }

/* Nav links a touch larger */
.nav-links a { font-size: 15px; }
.dropdown-toggle { font-size: 15px; }
.dropdown-menu a { font-size: 15px; }

/* Privacy / about / contact page prose */
.article ul, .article ol { font-size: 17px; line-height: 1.7; }
.article ul li, .article ol li { margin: 6px 0; }

/* Callouts */
.callout { font-size: 16px; line-height: 1.6; padding: 18px 20px; }
.callout-title { font-size: 16px; }

/* Mobile: tighter scale to preserve real estate */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .lede { font-size: 17px; }
  .hero .lede { font-size: 17px; }
  .article .prose,
  .article p,
  .article li,
  section.container.narrow p,
  section.container.narrow li { font-size: 16px; }
  .article-lede { font-size: 17px; }
  .article h1 { font-size: 30px; }
  .article h2 { font-size: 23px; }
  .article h3 { font-size: 19px; }
  .blog-card h3 { font-size: 17px; }
  .faq-item summary { font-size: 16px; }
  .results .result-value { font-size: 24px; }
}

/* ============================================================
 * Mobile UX polish — minimum tap target sizing for inline links
 * ============================================================ */
@media (max-width: 600px) {
  /* Breadcrumb taps — increase vertical padding for finger-friendly hits */
  .breadcrumb a {
    padding: 6px 4px;
    margin: -6px -4px;  /* preserve visual layout */
    display: inline-block;
  }
  /* Footer link spacing — already vertically stacked, just bump line height */
  .footer-col ul li { padding: 4px 0; }
  .footer-col ul li a {
    display: inline-block;
    padding: 4px 0;
    min-height: 32px;
    line-height: 24px;
  }
  /* Article inline links — add a touch of padding so links inside paragraphs are easier to tap */
  .article .prose a,
  .faq-body a {
    padding: 2px 0;
  }
  /* Brand link — make full clickable area tall enough */
  .logo {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  /* FAQ summary already has good vertical padding via the earlier override — verify */
  .faq-item summary { min-height: 44px; }
  /* Theme toggle button + hamburger — make sure they're 40px+ */
  .menu-toggle, .theme-toggle {
    min-width: 40px;
    min-height: 40px;
  }
}

/* Ensure compare table doesn't extend the page width even when rendered */
.compare-table-wrap { width: 100%; }
