/* TikTok Shop Profit Calculator – design system (dark theme) */
:root {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #1a2332;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: #243044;
  --brand: #f8fafc;
  --accent: #fe2c55;
  --accent-2: #25f4ee;
  --accent-soft: rgba(254, 44, 85, 0.14);
  --green: #34d399;
  --green-bg: rgba(16, 185, 129, 0.12);
  --green-line: rgba(52, 211, 153, 0.35);
  --red: #f87171;
  /* Bottom chrome stack (js/bottom-stack.js) */
  --tts-stack-ad: 0px;
  --tts-stack-net: 0px;
  --tts-stack-consent-bottom: 0px;
  --tts-body-chrome-pad: 0px;
  --red-bg: rgba(248, 113, 113, 0.12);
  --red-line: rgba(248, 113, 113, 0.35);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --max: 1100px;
  --header-h: 64px;
  /* Default calculator mode accent (profit); overridden by [data-mode] / .mode-* */
  --mode-accent: #22c55e;
  /* Chrome overlays */
  --chrome-bg: rgba(11, 18, 32, 0.92);
  --chrome-bg-solid: rgba(17, 24, 39, 0.97);
  --link-underline: rgba(226, 232, 240, 0.28);
  --chip-active-fg: #fda4af;
}

/* Light theme (user toggle or system preference) */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #0f172a;
  --accent: #fe2c55;
  --accent-2: #0891b2;
  --accent-soft: #fff1f3;
  --green: #047857;
  --green-bg: #ecfdf5;
  --green-line: #a7f3d0;
  --red: #b91c1c;
  --red-bg: #fef2f2;
  --red-line: #fecaca;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
  --chrome-bg: rgba(255, 255, 255, 0.92);
  --chrome-bg-solid: rgba(255, 255, 255, 0.97);
  --link-underline: rgba(15, 23, 42, 0.25);
  --chip-active-fg: #9f1239;
}

/*
 * Calculator mode accents
 * Set data-mode on body, .calc-shell, .results-billboard, and/or .page-hero
 * (or use .mode-profit | .mode-breakeven | .mode-fbt | .mode-creator | .mode-ads).
 * Mode chips should carry their own data-mode for active tint.
 */
[data-mode="profit"],
.mode-profit {
  --mode-accent: #22c55e;
}
[data-mode="breakeven"],
.mode-breakeven {
  --mode-accent: #f59e0b;
}
[data-mode="fbt"],
.mode-fbt {
  --mode-accent: #3b82f6;
}
[data-mode="creator"],
.mode-creator {
  --mode-accent: #a855f7;
}
[data-mode="ads"],
.mode-ads {
  --mode-accent: #f43f5e;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

::selection {
  background: rgba(254, 44, 85, 0.35);
  color: #fff;
}

/* Form controls follow active theme (html color-scheme) */
input,
select,
textarea,
button {
  color-scheme: inherit;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Bottom chrome (ad + net stickies) measured by bottom-stack.js */
  padding-bottom: calc(var(--tts-body-chrome-pad, 0px) + env(safe-area-inset-bottom, 0px));
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ——— Layout ——— */
.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.container-narrow {
  width: min(100% - 2rem, 720px);
  margin-inline: auto;
}

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--chrome-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  height: var(--header-h);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  /* Fallback if image fails: keep brand tile look */
  background: #0f172a;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Legacy text mark (if any page still uses span.logo-mark without img) */
span.logo-mark {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #ff6b81 50%, var(--accent-2));
  color: white;
  font-size: 13px;
  font-weight: 800;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav a {
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-2);
}

.nav a[aria-current="page"] {
  box-shadow: inset 0 0 0 1px var(--line);
}

.nav-sep {
  width: 1px;
  height: 1rem;
  margin: 0 0.35rem;
  background: var(--line);
  flex-shrink: 0;
  align-self: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-shrink: 0;
}

/* Wide screens: logo | nav (flex) | theme toggle */
@media (min-width: 861px) {
  .header-actions {
    margin-left: 0;
    order: 3;
  }
  .nav[data-nav] {
    order: 2;
    flex: 1;
    justify-content: flex-end;
    margin-right: 0.25rem;
  }
  .logo {
    order: 1;
  }
}

@media (max-width: 860px) {
  .header-actions {
    margin-left: auto;
  }
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--accent-2) 40%, var(--line));
  color: var(--accent-2);
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 25%, transparent);
}

.theme-toggle-icon {
  display: none;
  width: 1.15rem;
  height: 1.15rem;
  pointer-events: none; /* clicks hit the button, not SVG children */
}

/* Dark active → show sun (switch to light). Light active → show moon. */
html[data-theme="dark"] .theme-toggle-icon--sun,
html:not([data-theme]) .theme-toggle-icon--sun {
  display: block;
}
html[data-theme="light"] .theme-toggle-icon--moon {
  display: block;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 1100px) {
  .nav a {
    font-size: 0.8125rem;
    padding: 0.35rem 0.5rem;
  }
  .nav-sep {
    margin: 0 0.2rem;
  }
}

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1rem 1rem;
    gap: 0.15rem;
  }
  .nav.is-open {
    display: flex;
  }
  .nav a {
    padding: 0.7rem 0.85rem;
    font-size: 0.875rem;
  }
  .nav-sep {
    width: auto;
    height: 1px;
    margin: 0.4rem 0.85rem;
    align-self: stretch;
  }
}

/* ——— Hero ——— */
.hero {
  padding: 2.75rem 0 1.5rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  margin-bottom: 1rem;
  max-width: 100%;
  line-height: 1.35;
}

.hero-badge a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(226, 232, 240, 0.28);
  white-space: nowrap;
}

.hero-badge a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.hero-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2);
  flex-shrink: 0;
}

/* Compact fee verification / sources line (under H1 or with hero badge) */
.trust-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.trust-line a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(226, 232, 240, 0.28);
}

.trust-line a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
  max-width: 18ch;
}

.hero-lead {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 1.25rem;
}

/* Instinctive question heroes (calc-first fold) */
.hero-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.hero-question {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
  max-width: 22ch;
}

.hero .hero-question {
  max-width: 18ch;
}

.hero-one-liner {
  font-size: 1.02rem;
  color: var(--muted);
  max-width: 48ch;
  margin: 0;
  line-height: 1.45;
}

.hero .hero-one-liner {
  margin: 0 0 0.25rem;
}

.hero-seo-title {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

/* Compact calculator hero (mode question + SEO label) */
.page-hero--compact {
  padding-top: 1.35rem;
  padding-bottom: 0.85rem;
}

.page-hero--compact .hero-seo-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.7;
  margin: 0 0 0.45rem;
}

.page-hero--compact .hero-question {
  font-size: clamp(1.45rem, 3.8vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  max-width: 28ch;
  color: var(--ink);
}

/* Mode accent when parent or body has data-mode */
.page-hero--compact[data-mode] .hero-question,
[data-mode] .page-hero--compact .hero-question,
[data-mode] .hero .hero-question {
  border-left: 3px solid var(--mode-accent);
  padding-left: 0.75rem;
}

.page-hero--compact .hero-one-liner {
  color: var(--muted);
  max-width: 36rem;
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .page-hero--compact {
    padding-top: 1rem;
    padding-bottom: 0.65rem;
  }

  .page-hero--compact .hero-question {
    font-size: clamp(1.3rem, 6vw, 1.65rem);
    max-width: none;
  }

  .page-hero--compact .hero-one-liner {
    font-size: 0.9rem;
  }
}

.embed-hero {
  padding: 0.65rem 0 0.25rem;
}

.embed-hero .hero-question {
  font-size: 1.15rem;
  max-width: none;
  margin: 0;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}

/* Mobile: denser hero so calculator reaches above the fold faster */
@media (max-width: 640px) {
  .hero {
    padding: 1.15rem 0 0.75rem;
  }

  .page-hero {
    padding: 1.1rem 0 0.7rem;
  }

  .hero-badge {
    margin-bottom: 0.55rem;
    padding: 0.22rem 0.6rem;
    font-size: 0.7rem;
  }

  .hero h1,
  .hero .hero-question {
    font-size: clamp(1.4rem, 6.5vw, 1.75rem);
    margin: 0 0 0.45rem;
    max-width: none;
  }

  .page-hero h1,
  .page-hero .hero-question {
    font-size: clamp(1.35rem, 6vw, 1.65rem);
    margin: 0 0 0.4rem;
    max-width: none;
  }

  .hero-lead,
  .hero-one-liner {
    font-size: 0.9rem;
    line-height: 1.45;
    margin: 0 0 0.65rem;
    /* Truncate long lead so results / form start sooner */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .page-hero p.hero-one-liner {
    font-size: 0.9rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .page-hero--compact {
    padding: 1rem 0 0.55rem;
  }

  .hero-kicker {
    font-size: 0.72rem;
    margin-bottom: 0.2rem;
  }

  .hero-meta {
    gap: 0.35rem 0.85rem;
    font-size: 0.75rem;
  }
}

/* Very small phones: drop secondary meta chips (badge keeps date / no signup) */
@media (max-width: 420px) {
  .hero {
    padding: 0.9rem 0 0.55rem;
  }

  .page-hero {
    padding: 0.85rem 0 0.5rem;
  }

  .hero-meta {
    display: none;
  }

  .hero-lead,
  .hero-one-liner {
    margin-bottom: 0;
    -webkit-line-clamp: 2;
  }
}

/* ——— Calculator ——— */
.calc-section {
  padding: 0 0 3rem;
}

/* Mode switcher — label + pill chips; horizontal scroll on narrow viewports */
.mode-switcher {
  margin: 0 0 1rem;
  padding: 0.15rem 0 0.85rem;
  border-bottom: 1px solid var(--line);
}

.mode-switcher-label {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.mode-switcher-chips {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
  padding-bottom: 0.1rem;
}

.mode-switcher-chips::-webkit-scrollbar {
  height: 4px;
}

.mode-switcher-chips::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 999px;
}

.mode-chip {
  appearance: none;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.mode-chip:hover {
  border-color: color-mix(in srgb, var(--mode-accent, var(--accent)) 40%, var(--line));
  background: color-mix(in srgb, var(--mode-accent, var(--accent)) 6%, var(--surface));
  color: var(--ink);
  text-decoration: none;
}

.mode-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mode-accent, var(--accent)) 28%, transparent);
}

/* Active chip: border + soft fill from its own --mode-accent (set data-mode on chip) */
.mode-chip.is-active {
  border-color: color-mix(in srgb, var(--mode-accent) 70%, var(--line));
  background: color-mix(in srgb, var(--mode-accent) 14%, var(--surface));
  color: color-mix(in srgb, var(--mode-accent) 55%, var(--ink));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--mode-accent) 18%, transparent);
}

.mode-chip.is-active:hover {
  background: color-mix(in srgb, var(--mode-accent) 18%, var(--surface));
  color: color-mix(in srgb, var(--mode-accent) 55%, var(--ink));
  text-decoration: none;
}

/* Emphasized primary fields inherit mode accent border */
.field-emphasis {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--mode-accent) 7%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--mode-accent) 22%, var(--line));
}

.field-emphasis label {
  color: color-mix(in srgb, var(--mode-accent) 45%, var(--ink));
}

.field-emphasis input,
.field-emphasis select {
  border-color: color-mix(in srgb, var(--mode-accent) 55%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--mode-accent) 12%, transparent);
  background: var(--surface);
}

.field-emphasis input:focus,
.field-emphasis select:focus {
  border-color: var(--mode-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mode-accent) 22%, transparent);
  outline: none;
}

/* ——— Creator commission slider (data-mode=creator / [data-creator-slider]) ——— */
.field--creator-slider {
  gap: 0.45rem;
}

.creator-slider-ui {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.creator-slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.creator-slider-range {
  flex: 1 1 auto;
  min-width: 0;
  height: 1.35rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  accent-color: var(--mode-accent, #a855f7);
  cursor: pointer;
}

/* WebKit track uses purple-ish mode accent when available */
.creator-slider-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mode-accent, #a855f7) 28%, var(--line));
}

.creator-slider-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--mode-accent, #a855f7);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}

.creator-slider-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--mode-accent, #a855f7) 28%, var(--line));
}

.creator-slider-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--mode-accent, #a855f7);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  cursor: pointer;
}

.creator-slider-row input[type="number"] {
  flex: 0 0 5.25rem;
  width: 5.25rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.creator-slider-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.creator-slider-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  line-height: 1.3;
}

.creator-slider-chip:hover {
  border-color: color-mix(in srgb, var(--mode-accent, #a855f7) 45%, var(--line));
  background: color-mix(in srgb, var(--mode-accent, #a855f7) 8%, var(--surface));
}

.creator-slider-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mode-accent, #a855f7) 25%, transparent);
}

.creator-slider-chip.is-active {
  border-color: color-mix(in srgb, var(--mode-accent, #a855f7) 70%, var(--line));
  background: color-mix(in srgb, var(--mode-accent, #a855f7) 16%, var(--surface));
  color: color-mix(in srgb, var(--mode-accent, #a855f7) 50%, var(--ink));
}

/* ——— Ads mode CPA ladder (under results) ——— */
.cpa-ladder {
  margin-top: 1.25rem;
  border-color: color-mix(in srgb, var(--mode-accent, var(--accent)) 20%, var(--line));
}

.cpa-ladder .panel-title {
  margin-bottom: 0.35rem;
}

.cpa-ladder-intro {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.cpa-ladder-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cpa-ladder-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.cpa-ladder-table th,
.cpa-ladder-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.cpa-ladder-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: color-mix(in srgb, var(--mode-accent, var(--accent)) 6%, var(--bg));
}

.cpa-ladder-label {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cpa-ladder-row.is-profit .cpa-ladder-status {
  color: var(--green);
  font-weight: 700;
}

.cpa-ladder-row.is-loss .cpa-ladder-status {
  color: var(--red);
  font-weight: 700;
}

.cpa-ladder-row.is-even .cpa-ladder-status {
  color: var(--warn);
  font-weight: 700;
}

.cpa-ladder-row.is-profit td:nth-child(3) {
  color: var(--green);
  font-weight: 700;
}

.cpa-ladder-row.is-loss td:nth-child(3) {
  color: var(--red);
  font-weight: 700;
}

.cpa-ladder-meta {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
}

.calc-shell {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 900px) {
  .calc-shell {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

@media (max-width: 520px) {
  .field-grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.field .hint {
  font-size: 0.72rem;
  color: #94a3b8;
}

.field input,
.field select {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent-2) 50%, var(--line));
  box-shadow: 0 0 0 3px rgba(37, 244, 238, 0.12);
  background: var(--surface);
}

.field-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.35rem 0;
}

.field-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}

.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: var(--accent);
}

.advanced-panel {
  margin-top: 0.75rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}

/* ——— Preset chips (regional demos + product scenarios) ——— */
.preset-stack {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0 0 0.95rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin: 0 0 0.95rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

/* Rows inside a stack share one outer divider */
.preset-stack .preset-row {
  margin: 0;
  padding: 0;
  border-bottom: 0;
}

.preset-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  flex-shrink: 0;
  min-width: 4.5rem;
}

.preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 auto;
  min-width: 0;
}

.preset-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
  line-height: 1.3;
}

.preset-chip:hover {
  border-color: var(--muted);
  background: var(--surface);
}

.preset-chip:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 244, 238, 0.15);
}

.preset-chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--chip-active-fg);
}

.preset-chip--reset {
  color: var(--muted);
  font-weight: 500;
  border-style: dashed;
}

.preset-chip--reset:hover {
  color: var(--ink);
}

/* Results */
/* Large mode-aware billboard (set data-mode on billboard or ancestor) */
.results-billboard {
  padding: 1.2rem 1.3rem 1.15rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--mode-accent) 8%, var(--bg));
  border: 1px solid color-mix(in srgb, var(--mode-accent) 22%, var(--line));
  margin-bottom: 1rem;
}

.results-billboard-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.results-billboard-value {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0.2rem 0 0;
  font-variant-numeric: tabular-nums;
  color: var(--mode-accent);
}

/* Keep red for negative profit (and any explicit negative state) */
.results-billboard.is-negative,
.results-billboard[data-sign="negative"] {
  background: var(--red-bg);
  border-color: var(--red-line);
}

.results-billboard.is-negative .results-billboard-value,
.results-billboard[data-sign="negative"] .results-billboard-value,
.results-billboard-value.is-negative {
  color: var(--red);
}

/* Positive profit / headroom → green value (overrides mode accent on the number) */
.results-billboard.is-positive .results-billboard-value {
  color: var(--green);
}

.results-billboard-sub {
  font-weight: 700;
  font-size: 0.95rem;
  margin-top: 0.2rem;
  color: var(--ink);
}

.results-billboard.is-positive .results-billboard-sub {
  color: var(--green);
}

.results-billboard.is-negative .results-billboard-sub {
  color: var(--red);
}

.results-billboard-basis {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 0.85rem;
  line-height: 1.35;
}

/* Secondary breakdown under billboard */
.results-secondary {
  margin-bottom: 1rem;
}

.results-breakdown {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0.35rem 0.65rem 0.65rem;
  margin-bottom: 0.85rem;
}

.results-breakdown-summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.45rem 0.2rem;
  list-style: none;
}

.results-breakdown-summary::-webkit-details-marker {
  display: none;
}

.results-breakdown-summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s ease;
}

.results-breakdown[open] > .results-breakdown-summary::before {
  transform: rotate(90deg);
}

.results-breakdown .results-grid {
  margin-top: 0.35rem;
}

.results-secondary .result-value {
  font-size: 0.98rem;
  font-weight: 600;
}

.results-hero {
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  background: var(--bg);
}

.results-hero.is-positive {
  background: var(--green-bg);
  border-color: var(--green-line);
}

.results-hero.is-negative {
  background: var(--red-bg);
  border-color: var(--red-line);
}

.results-hero-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.results-hero-value {
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0.25rem 0 0.15rem;
  font-variant-numeric: tabular-nums;
}

.results-hero.is-positive .results-hero-value {
  color: var(--green);
}

.results-hero.is-negative .results-hero-value {
  color: var(--red);
}

.results-hero-basis {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 0.4rem;
  line-height: 1.35;
}

.results-hero-margin {
  font-weight: 700;
  font-size: 0.95rem;
}

.results-hero-margin.is-positive {
  color: var(--green);
}
.results-hero-margin.is-negative {
  color: var(--red);
}
.results-hero-margin.is-warn {
  color: var(--warn);
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

@media (max-width: 420px) {
  .results-grid {
    grid-template-columns: 1fr;
  }
}

.result-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
}

.result-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.result-value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.result-value.is-positive {
  color: var(--green);
}
.result-value.is-negative {
  color: var(--red);
}

.result-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.compare-box {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem;
  background: var(--surface-2);
}

.compare-title {
  margin: 0 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 700;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.compare-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
}

.compare-mode {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.compare-profit {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0.15rem 0;
  font-variant-numeric: tabular-nums;
}

.compare-profit.is-positive {
  color: var(--green);
}
.compare-profit.is-negative {
  color: var(--red);
}

.compare-meta {
  font-size: 0.72rem;
  color: var(--muted);
}

.compare-winner {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, background 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #e0264c;
  color: #fff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover {
  background: var(--bg);
  color: var(--ink);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: #e0264c;
  color: white;
}

/* ——— Content pages ——— */
.page-hero {
  padding: 2.25rem 0 1.25rem;
}

.page-hero h1 {
  font-size: clamp(1.6rem, 3.5vw, 2.15rem);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  max-width: 22ch;
}

.page-hero p {
  color: var(--muted);
  max-width: 60ch;
  margin: 0;
  font-size: 1.02rem;
}

/* Intent-answer landing (answer → table → example → calculator) */
.page-hero.page-hero-tight {
  padding-bottom: 0.5rem;
}

.answer-block.prose {
  padding: 0 0 1.5rem;
}

.answer-block .short-answer {
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 0.75rem;
}

.answer-block .short-answer-sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.answer-block .answer-heading {
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
}

.answer-block table {
  margin: 0 0 1.15rem;
}

.example-callout .example-assumptions {
  margin: 0.45rem 0 0.5rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.example-callout .example-list {
  margin: 0.35rem 0 0.65rem;
  padding-left: 1.15rem;
}

.example-callout .example-list li {
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.example-callout .example-rule {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.calc-section-title {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.calc-section-lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1rem;
  max-width: 60ch;
}

.prose {
  padding: 0 0 3rem;
}

.prose h2 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 2rem 0 0.75rem;
}

.prose h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

.prose p,
.prose li {
  color: var(--muted);
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.9rem;
  margin: 1rem 0 1.5rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

.prose th {
  background: var(--bg);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}

.prose tr:last-child td {
  border-bottom: none;
}

.callout {
  background: var(--accent-soft);
  border: 1px solid #ffd0d8;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: 0.9rem;
  margin: 1.25rem 0;
}

/* Fee-updates changelog */
.changelog-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.15rem;
  margin: 1.25rem 0;
}

.changelog-entry time {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.changelog-entry h2 {
  margin: 0.35rem 0 0.65rem;
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}

.changelog-entry p:last-child {
  margin-bottom: 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.25rem 0;
}

.sources-note {
  font-size: 0.88rem;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  margin: 0.5rem 0 1.25rem;
}

.prose table a {
  word-break: break-word;
}

.callout strong {
  color: var(--accent);
}

.disclaimer {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 1.5rem 0;
}

/* Feature grid */
.features {
  padding: 0.5rem 0 3rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

@media (max-width: 800px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
}

.feature-card h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
}

.feature-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.feature-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  margin-bottom: 0.65rem;
}

/* Related links */
.related {
  padding: 0 0 3rem;
}

.related h2 {
  font-size: 1.15rem;
  margin: 0 0 0.85rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
}

.related a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.related a:hover {
  border-color: color-mix(in srgb, var(--muted) 50%, var(--line));
  box-shadow: var(--shadow);
  color: var(--ink);
}

.related a span {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* Partner / seller resource blocks (affiliate-ready placeholders) */
.partner-block {
  padding: 0 0 2.75rem;
}

.partner-block h2 {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.partner-note {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}

.partner-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  color: var(--ink);
}

.partner-card strong {
  font-size: 0.9rem;
  font-weight: 600;
}

.partner-card span {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.partner-card:not(.is-placeholder):hover {
  border-color: color-mix(in srgb, var(--muted) 50%, var(--line));
  box-shadow: var(--shadow);
  color: var(--ink);
}

.partner-card.is-placeholder {
  opacity: 0.72;
  cursor: default;
  pointer-events: none;
  background: var(--surface-2);
  border-style: dashed;
  color: var(--muted);
}

.partner-card.is-placeholder strong {
  color: var(--muted);
}

.partner-card.is-placeholder span {
  color: var(--muted);
}

.partner-card.is-placeholder::after {
  content: "Coming soon";
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* Resources hub */
.resources-section {
  padding: 0 0 2.5rem;
}

.resources-section h2 {
  font-size: 1.15rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.65rem;
  margin-bottom: 2rem;
}

.resources-grid a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.resources-grid a:hover {
  border-color: color-mix(in srgb, var(--muted) 50%, var(--line));
  box-shadow: var(--shadow);
  color: var(--ink);
}

.resources-grid a span {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* FAQ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.faq-item summary {
  padding: 0.9rem 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  font-weight: 400;
  color: var(--muted);
  font-size: 1.2rem;
}

.faq-item[open] summary::after {
  content: "−";
}

.faq-item .faq-body {
  padding: 0 1rem 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 2.5rem 0 2rem;
  margin-top: 1rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 700px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.footer-brand {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.footer-brand p,
.site-footer p {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.footer-col h4 {
  margin: 0 0 0.6rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.footer-col a {
  display: block;
  text-decoration: none;
  font-size: 0.88rem;
  color: var(--ink);
  padding: 0.2rem 0;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Ad slots — CLS-safe reserved space; label always present until .is-live */
.ad-slot {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 90px; /* leaderboard / mobile banner reserve */
  margin: 1.75rem 0;
  padding: 0.5rem;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
  contain: layout style;
  box-sizing: border-box;
}

/* Medium rectangle reserve (optional modifier) */
.ad-slot--rect {
  min-height: 250px;
}

/* In-article / mid-content reserve (long guides) */
.ad-slot--inarticle {
  min-height: 280px;
}

/* Sticky footer unit reserve */
.ad-slot--sticky {
  min-height: 60px;
  margin: 0;
  border: none;
  background: transparent;
  border-radius: 0;
}

/* Optional sidebar / rail (desktop layouts) */
.ad-rail {
  display: none;
}

@media (min-width: 1100px) {
  .ad-rail {
    display: block;
    width: 160px;
    flex-shrink: 0;
  }

  .ad-rail .ad-slot {
    min-height: 600px;
    margin: 0;
  }
}

/* When AdSense (or ads.js) injects creative into the slot */
.ad-slot.is-live {
  border-style: solid;
  border-color: transparent;
  background: transparent;
  color: transparent;
  font-size: 0;
  letter-spacing: 0;
  padding: 0;
}

.ad-slot.is-live > * {
  max-width: 100%;
}

/* Never place ads inside calculator controls / panels */
.calc-shell .ad-slot,
.panel .ad-slot,
[data-calc-form] .ad-slot,
.field-grid .ad-slot,
form .ad-slot {
  display: none !important;
}

/*
 * Bottom chrome stack (measured by js/bottom-stack.js):
 *   physical bottom → ad sticky → mobile net sticky → consent card
 * Vars set on :root: --tts-stack-ad | --tts-stack-net | --tts-stack-consent-bottom | --tts-body-chrome-pad
 */

/* Sticky bottom ad bar — hidden until .is-enabled and not [hidden] */
.ad-sticky-footer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--chrome-bg-solid);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.35);
  padding: 0.35rem 2.25rem 0.35rem 0.75rem;
  padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.ad-sticky-footer.is-enabled:not([hidden]) {
  display: block;
}

.ad-sticky-footer [data-ad-sticky-dismiss] {
  position: absolute;
  top: 0.25rem;
  right: 0.35rem;
  z-index: 1;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.ad-sticky-footer [data-ad-sticky-dismiss]:hover,
.ad-sticky-footer [data-ad-sticky-dismiss]:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}

/* Mobile sticky net summary — sits above ad sticky via --tts-stack-ad */
.mobile-net-sticky {
  display: none;
}

@media (max-width: 700px) {
  .mobile-net-sticky {
    display: block;
    position: fixed;
    bottom: var(--tts-stack-ad, 0px);
    left: 0;
    right: 0;
    z-index: 45;
    background: var(--chrome-bg-solid);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.4);
    /* Safe-area only when this bar is the bottommost chrome */
    padding: 0.65rem 1rem;
    padding-bottom: 0.65rem;
    box-sizing: border-box;
  }

  body:not(.has-ad-sticky-footer) .mobile-net-sticky {
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
  }

  .mobile-net-sticky-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: min(100%, var(--max));
    margin-inline: auto;
  }

  .mobile-net-sticky-main {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    min-width: 0;
  }

  .mobile-net-sticky-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
  }

  .mobile-net-sticky-value {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
  }

  .mobile-net-sticky-value.is-positive {
    color: var(--green);
  }

  .mobile-net-sticky-value.is-negative {
    color: var(--red);
  }

  .mobile-net-sticky-margin {
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .mobile-net-sticky-margin.is-positive {
    color: var(--green);
  }

  .mobile-net-sticky-margin.is-negative {
    color: var(--red);
  }

  .mobile-net-sticky-margin.is-warn {
    color: var(--warn);
  }
}

/* ——— Cookie consent banner (non-blocking) ——— */
/* Theme-aware card (must NOT use --ink as background — --ink flips with light/dark). */
/* Sits above ad + net stickies via --tts-stack-consent-bottom */
.consent-banner {
  position: fixed;
  z-index: 100;
  bottom: calc(var(--tts-stack-consent-bottom, 0px) + 1rem + env(safe-area-inset-bottom, 0px));
  left: 1rem;
  right: auto;
  max-width: 420px;
  width: min(420px, calc(100vw - 2rem));
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--line) 80%, transparent);
  padding: 1rem 1.1rem 1.05rem;
  font-size: 0.875rem;
  line-height: 1.5;
  box-sizing: border-box;
  transition: bottom 0.18s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.consent-banner__inner {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.consent-banner__text {
  margin: 0;
  color: var(--muted);
}

.consent-banner__text a {
  color: var(--accent-2);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent-2) 45%, transparent);
}

.consent-banner__text a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.consent-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.consent-banner__btn {
  padding: 0.5rem 0.85rem;
  font-size: 0.8125rem;
}

/* Primary = brand accent (readable on both themes) */
.consent-banner .btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.consent-banner .btn-primary:hover {
  background: #e0264c;
  color: #fff;
}

/* Secondary = outlined surface */
.consent-banner .btn-secondary {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
}

.consent-banner .btn-secondary:hover {
  background: var(--bg);
  color: var(--ink);
  border-color: color-mix(in srgb, var(--muted) 45%, var(--line));
}

.consent-banner__customize {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--line);
}

.consent-banner__customize[hidden] {
  display: none !important;
}

.consent-banner__check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.consent-banner__check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

@media (max-width: 700px) {
  .consent-banner {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-width: none;
    /* Offset already includes ad + net heights from bottom-stack.js */
    bottom: calc(var(--tts-stack-consent-bottom, 0px) + 0.75rem);
  }

  /* When no full-width stickies, keep home-indicator clear */
  body:not(.has-mobile-net-sticky):not(.has-ad-sticky-footer) .consent-banner {
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }
}

/* Prefer reduced motion: skip bottom transition */
@media (prefers-reduced-motion: reduce) {
  .consent-banner {
    transition: none;
  }
}

/* Print: no fixed chrome */
@media print {
  .ad-sticky-footer,
  .mobile-net-sticky,
  .consent-banner {
    display: none !important;
  }

  body {
    padding-bottom: 0 !important;
  }
}

/* ——— Embed (iframe) ——— */
body.is-embed {
  background: var(--bg);
  min-height: 0;
}

body.is-embed .embed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.9rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-height: 44px;
}

body.is-embed .embed-bar .logo {
  font-size: 0.88rem;
}

body.is-embed .embed-full-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

body.is-embed .embed-full-link:hover {
  color: var(--accent);
}

body.is-embed .embed-main {
  padding: 0.75rem 0 0.25rem;
}

body.is-embed .calc-section {
  padding: 0 0 0.75rem;
}

body.is-embed .container {
  width: min(100% - 1.25rem, var(--max));
}

body.is-embed .calc-shell {
  gap: 0.9rem;
}

body.is-embed .panel {
  padding: 1rem 1.1rem;
}

body.is-embed .embed-disclaimer {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

body.is-embed .embed-credit {
  padding: 0.65rem 0.9rem 0.85rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

body.is-embed .embed-credit a {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

body.is-embed .embed-credit a:hover {
  color: var(--accent);
}

/* Hide mobile sticky chrome inside iframes (results already in panel) */
body.is-embed .mobile-net-sticky,
body.is-embed.has-mobile-net-sticky .mobile-net-sticky {
  display: none !important;
}

body.is-embed.has-mobile-net-sticky {
  padding-bottom: 0 !important;
}

/* Embed guide code blocks */
.embed-code {
  margin: 0.85rem 0 1.1rem;
  padding: 0.9rem 1rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.embed-code code {
  font-family: inherit;
  font-size: inherit;
  background: none;
  padding: 0;
  color: inherit;
}

.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0.12rem 0.35rem;
  border-radius: 5px;
  color: var(--accent-2);
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .ad-slot,
  .ad-sticky-footer,
  .ad-rail,
  .nav-toggle,
  .results-actions,
  .btn-link,
  .mobile-net-sticky,
  .partner-block,
  .consent-banner,
  .embed-bar,
  .embed-credit,
  .mode-switcher {
    display: none !important;
  }
  .calc-shell {
    grid-template-columns: 1fr;
  }
  body {
    background: white;
    color: #0f172a;
    color-scheme: light;
  }
  body.has-mobile-net-sticky,
  body.has-ad-sticky-footer,
  body.has-consent-banner {
    padding-bottom: 0;
  }
  .panel {
    box-shadow: none;
  }
}
