/* MarginHelper — light slate / white / emerald theme. No framework, no web fonts. */
:root {
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #475569;
  --ink-3: #64748B;
  --line: #E2E8F0;
  --line-2: #CBD5E1;
  --emerald: #059669;
  --emerald-2: #10B981;
  --emerald-ink: #047857;
  --emerald-wash: #ECFDF5;
  --emerald-line: #A7F3D0;
  --red: #DC2626;
  --red-wash: #FEF2F2;
  --red-line: #FECACA;
  --seg-cogs: #334155;
  --seg-fees: #F59E0B;
  --seg-ship: #94A3B8;
  --seg-ads: #F43F5E;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .10);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--emerald-ink); text-underline-offset: 3px; }
a:hover { color: var(--emerald); }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; margin: 0; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--emerald-2); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: 1136px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 750; font-size: 18px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; flex: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.brand span span { color: var(--emerald); }
.site-nav { display: flex; gap: 4px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { padding: 8px 12px; border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 550; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { background: var(--bg); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--emerald-wash); color: var(--emerald-ink); }

/* ---------- Hero ---------- */
.hero { padding: 36px 0 22px; }
.eyebrow { display: inline-block; margin-bottom: 12px; padding: 4px 10px; border: 1px solid var(--emerald-line); border-radius: 999px; background: var(--emerald-wash); color: var(--emerald-ink); font-size: 12.5px; font-weight: 650; letter-spacing: .02em; }
.hero h1 { font-size: clamp(28px, 5.2vw, 44px); font-weight: 780; max-width: 20ch; }
.hero p { max-width: 62ch; margin: 14px 0 0; color: var(--ink-2); font-size: clamp(16px, 2vw, 18px); }

/* ---------- Calculator ---------- */
#calculator { min-height: 720px; }
.mm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.mm-tabs { display: flex; gap: 6px; padding: 5px; margin-bottom: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; scrollbar-width: none; }
.mm-tabs::-webkit-scrollbar { display: none; }
.mm-tab { flex: 1 0 auto; padding: 10px 16px; border-radius: 10px; color: var(--ink-2); font-weight: 600; font-size: 15px; text-align: center; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.mm-tab:hover { background: var(--bg); color: var(--ink); }
.mm-tab.is-on { background: var(--emerald); color: #fff; box-shadow: 0 1px 2px rgba(5, 150, 105, .35); }

.mm-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.mm-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
@media (min-width: 940px) {
  .mm-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 20px; }
  .mm-col--results { position: sticky; top: 16px; }
}

.mm-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.mm-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mm-card-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.mm-card-head .mm-card-title { margin-bottom: 0; }
.mm-card-title--gap { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }

.mm-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; align-items: end; }
.mm-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.mm-field--wide { margin-bottom: 14px; }
.mm-spacer { display: block; }
.mm-label { color: var(--ink-2); font-size: 13px; font-weight: 600; line-height: 1.3; }
.mm-input { display: flex; align-items: center; height: 46px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.mm-input:focus-within { border-color: var(--emerald-2); box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.mm-input--suffix { flex-direction: row-reverse; }
.mm-affix { flex: none; width: 34px; text-align: center; color: var(--ink-3); font-weight: 600; }
.mm-input input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: 600 16px/1 var(--font); font-variant-numeric: tabular-nums; padding: 0 10px 0 0; -moz-appearance: textfield; appearance: textfield; }
.mm-input--suffix input { padding: 0 0 0 12px; }
.mm-input input::-webkit-outer-spin-button, .mm-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mm-select { position: relative; display: block; }
.mm-select::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.mm-select select { width: 100%; height: 46px; padding: 0 36px 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); font: 600 16px/1 var(--font); appearance: none; -webkit-appearance: none; }
.mm-select select:focus { outline: 0; border-color: var(--emerald-2); box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); }
.mm-note { margin: 14px 0 0; color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.mm-link { border: 0; background: none; padding: 0; color: var(--emerald-ink); font: 600 13px/1.3 var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

/* Results */
.mm-hero { display: grid; gap: 2px; padding: 18px; border: 1px solid var(--emerald-line); border-radius: 12px; background: var(--emerald-wash); }
.mm-hero-label { color: var(--emerald-ink); font-size: 13px; font-weight: 650; }
.mm-hero-value { color: var(--emerald-ink); font-size: clamp(38px, 9vw, 48px); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mm-hero-sub { color: var(--emerald-ink); font-size: 13.5px; }
.mm-hero.is-loss { border-color: var(--red-line); background: var(--red-wash); }
.mm-hero.is-loss > * { color: var(--red); }

.mm-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 16px 0 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mm-stats > div { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mm-stats > div:nth-child(odd) { border-right: 1px solid var(--line); }
.mm-stats > div:nth-last-child(-n+2) { border-bottom: 0; }
.mm-stats dt { color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.mm-stats dd { margin: 2px 0 0; font-size: 19px; font-weight: 720; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mm-roas-hint { margin: 10px 2px 0; color: var(--ink-3); font-size: 13px; line-height: 1.5; }

.mm-subtitle { margin: 20px 0 10px; font-size: 14px; font-weight: 700; }
.mm-bar { display: flex; height: 16px; gap: 2px; border-radius: 999px; overflow: hidden; background: var(--line); }
.mm-bar span { flex: 0 0 auto; min-width: 2px; transition: flex-basis .25s ease; }
.mm-seg-cogs { background: var(--seg-cogs); }
.mm-seg-fees { background: var(--seg-fees); }
.mm-seg-shipCost { background: var(--seg-ship); }
.mm-seg-ads { background: var(--seg-ads); }
.mm-seg-profit { background: var(--emerald-2); }
.mm-legend { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 7px; font-size: 14px; }
.mm-legend li { display: grid; grid-template-columns: 10px 1fr auto 56px; gap: 10px; align-items: center; }
.mm-legend i { width: 10px; height: 10px; border-radius: 3px; }
.mm-legend span { color: var(--ink-2); }
.mm-legend b { font-weight: 650; font-variant-numeric: tabular-nums; }
.mm-legend b.is-loss { color: var(--red); }
.mm-legend em { color: var(--ink-3); font-style: normal; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }

/* Target finder */
.mm-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.mm-seg-btn { height: 38px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font: 600 14px/1 var(--font); cursor: pointer; }
.mm-seg-btn.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .12); }
.mm-target { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.mm-target-out { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.mm-target-price { display: flex; align-items: center; height: 46px; color: var(--emerald-ink); font-size: 24px; font-weight: 780; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mm-btn { width: 100%; height: 48px; margin-top: 14px; border: 0; border-radius: 10px; background: var(--emerald); color: #fff; font: 650 15px/1 var(--font); cursor: pointer; transition: background .15s, transform .05s; }
.mm-btn:hover { background: var(--emerald-ink); }
.mm-btn:active { transform: translateY(1px); }
.mm-btn:disabled { background: var(--line-2); cursor: not-allowed; }

/* Phone summary dock */
.mm-dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, .18); transform: translateY(110%); transition: transform .2s ease; }
.mm-dock.is-visible { transform: none; }
.mm-dock div { display: grid; min-width: 0; }
.mm-dock span { color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.mm-dock strong { font-size: 17px; font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-dock div:first-child strong { color: var(--emerald-ink); }
.mm-dock strong.is-loss { color: var(--red) !important; }
@media (min-width: 940px) { .mm-dock { display: none; } }
@media (max-width: 939px) { body { padding-bottom: 76px; } }
@media (max-width: 359px) { .mm-fields, .mm-target { grid-template-columns: 1fr; } .mm-spacer { display: none; } }

/* ---------- Content ---------- */
.content { padding: 48px 0 8px; }
.content section { max-width: 760px; margin-bottom: 44px; }
.content section.wide { max-width: none; }
.content h2 { font-size: clamp(22px, 3.4vw, 28px); font-weight: 760; margin-bottom: 14px; }
.content h3 { font-size: 17px; font-weight: 700; margin: 22px 0 8px; }
.content p, .content li { color: var(--ink-2); }
.content ul, .content ol { padding-left: 20px; margin: 0 0 1em; }
.content li { margin-bottom: 6px; }
.content strong { color: var(--ink); }
.reviewed { color: var(--ink-3); font-size: 13.5px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 560px; }
th, td { padding: 12px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th { background: var(--bg); color: var(--ink-2); font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
td:first-child { color: var(--ink); font-weight: 650; white-space: nowrap; }
td { color: var(--ink-2); }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cards a { display: grid; gap: 6px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.cards a:hover { border-color: var(--emerald-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.cards b { font-size: 17px; }
.cards span { color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.cards em { color: var(--emerald-ink); font-style: normal; font-weight: 650; font-size: 14px; }

.formula { margin: 0 0 1em; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--emerald-2); border-radius: 10px; color: var(--ink); font: 500 14.5px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; }

.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.faq summary { padding: 15px 44px 15px 16px; font-weight: 650; cursor: pointer; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--emerald); font-size: 22px; font-weight: 500; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0; padding: 0 16px 16px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 24px; padding: 28px 0 36px; border-top: 1px solid var(--line); background: var(--card); color: var(--ink-3); font-size: 13.5px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 12px; }
.site-footer nav a { color: var(--ink-2); font-weight: 600; text-decoration: none; }
.site-footer nav a:hover { color: var(--emerald-ink); }
.site-footer p { margin: 0 0 6px; max-width: 80ch; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Sponsored slot (above footer) ---------- */
.ad-slot { margin: 8px 0 40px; }
.ad-slot__label { display: block; margin-bottom: 8px; color: var(--ink-3); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ad-slot__unit { width: 100%; max-width: 100%; overflow: hidden; }
.ad-slot__unit:empty { display: none; }
.ad-slot__unit:not(:empty) { margin-bottom: 12px; }
.pn-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 16px 18px; background: var(--card); border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.pn-card:hover { border-color: var(--emerald-2); box-shadow: var(--shadow); color: var(--ink); }
.pn-card__text { flex: 1 1 260px; display: grid; gap: 2px; min-width: 0; }
.pn-card__text b { font-size: 16px; }
.pn-card__text span { color: var(--ink-3); font-size: 13.5px; line-height: 1.5; }
.pn-card__cta { flex: none; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 10px; color: var(--emerald-ink); font-size: 14px; font-weight: 650; white-space: nowrap; }

/* ---------- Footer badge ---------- */
.site-footer__base { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.site-footer__base p { margin: 0; }
.su-badge { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink-2); font-size: 12.5px; font-weight: 600; text-decoration: none; transition: border-color .15s, color .15s; }
.su-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-2); }
.su-badge:hover { border-color: var(--emerald-line); color: var(--emerald-ink); }

/* ---------- Install banner ---------- */
.mh-install { position: fixed; z-index: 30; right: 16px; bottom: 16px; width: min(360px, calc(100vw - 24px)); display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px -10px rgba(15, 23, 42, .28); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.mh-install.is-open { opacity: 1; transform: none; pointer-events: auto; }
.mh-install img { width: 44px; height: 44px; border-radius: 11px; }
.mh-install__text { display: grid; min-width: 0; }
.mh-install__text b { font-size: 14.5px; line-height: 1.3; }
.mh-install__text span { color: var(--ink-3); font-size: 12.5px; line-height: 1.35; }
.mh-install__actions { display: flex; align-items: center; gap: 2px; }
.mh-install__go { height: 38px; padding: 0 14px; border: 0; border-radius: 9px; background: var(--emerald); color: #fff; font: 650 14px/1 var(--font); cursor: pointer; white-space: nowrap; }
.mh-install__go:hover { background: var(--emerald-ink); }
.mh-install__close { width: 34px; height: 38px; border: 0; border-radius: 9px; background: none; color: var(--ink-3); font-size: 20px; line-height: 1; cursor: pointer; }
.mh-install__close:hover { background: var(--bg); color: var(--ink); }
@media (max-width: 939px) {
  /* sit above the phone summary dock */
  .mh-install { left: 12px; right: 12px; width: auto; bottom: calc(82px + env(safe-area-inset-bottom)); }
}
@media print { .ad-slot, .mh-install, .mm-dock { display: none !important; } }
