/* The Fertility Index - design system v2 "Calm Register" (Nov 2026). Binding rules: DESIGN.md.
   Type: Newsreader (display: wordmark, h1-h3) + Inter (text, UI, data/prices with tabular figures).
   Self-hosted variable fonts, SIL Open Font License 1.1.
   Newsreader (c) 2020 The Newsreader Project Authors; Inter (c) 2020 The Inter Project Authors. License text: /fonts/OFL.txt
   Colors: literal values live ONLY in the two token blocks below (light :root, dark [data-theme="dark"]).
   Everything else uses var(--token). Checked by tools/check-design.mjs (WCAG 2.2 AA pairs + literal lint). */
@font-face {
  font-family: 'Newsreader';
  src: url('/tfi-static/62981321d9a3cc7a61a7/fonts/newsreader-var.woff2') format('woff2');
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('/tfi-static/d5ef0c60c29c5ca4c78e/fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

/* ---------- Tokens: light ---------- */
:root {
  /* Surfaces */
  --cream: #F8F3EA;          /* page background */
  --card: #FFFEFA;           /* raised surface */
  --field: #F8F3EA;          /* form field fill */
  --sand: #F3E4CC;           /* warm highlight surface */
  --sage-wash: #EBF0EB;      /* calm tinted surface */
  /* Text */
  --ink: #3D372E;            /* primary text  10.6:1 on cream */
  --ink-soft: #6E6455;       /* secondary text 5.2:1 on cream */
  --muted: #736A5B;          /* tertiary text, captions; on cream/card only */
  --placeholder: #6E6E6E;
  /* Brand */
  --sage: #3B5A47;           /* primary action + links 6.9:1 on cream */
  --sage-dark: #2F4A3A;      /* hover/pressed, emphasis numbers */
  --sage-light: #7A9B8A;     /* decorative; focus border; never text */
  --terra: #D98E6A;          /* DECORATIVE ONLY (2.4:1) - accents, rules, charts; never text */
  --accent: var(--sage);
  --on-primary: #FFFFFF;
  --primary-bg: #3B5A47;
  --primary-bg-hover: #2F4A3A;
  /* Lines */
  --line: #E8DFCE;           /* dividers, card borders (decorative) */
  --line-strong: #8E836F;    /* form-control + chip boundaries, 3:1 non-text */
  /* Status (text pairs pass 4.5:1 on their own bg) */
  --ok-bg: #E3EEE6;     --ok-ink: #2E5540;
  --warn-bg: #F3E4CC;   --warn-ink: #7A5B2E;
  --caution-bg: #F6E3D3; --caution-ink: #8A4A2B; --caution-line: #E5C3AB;
  --danger-bg: #F7E2DC; --danger-ink: #A03D2A;
  --amber-bg: #F6ECD4;  --amber-ink: #7A5C18;
  --neutral-bg: #E8E2D2; --neutral-ink: #6B5C3F;
  --error: #B3261E;
  --notice-bg: #FFF4D6; --notice-line: #D9A441; --notice-ink: #6B5410;
  /* Effects */
  --focus: rgba(59, 90, 71, .35);
  --focus-halo: rgba(59, 90, 71, .14);
  --scrim: rgba(30, 25, 18, .5);
  --glow: rgba(217, 142, 106, .08);
  --shadow-sm: 0 1px 2px rgba(74, 58, 36, .05);
  --shadow-md: 0 1px 2px rgba(74, 58, 36, .04), 0 8px 24px rgba(74, 58, 36, .06);
  --shadow-inset: inset 0 1px 2px rgba(74, 58, 36, .04);

  /* Type */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-text: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: var(--font-text);
  --text-micro: 12px;        /* dense data tables only */
  --text-caption: 12.5px;    /* labels, badges, captions (minimum outside tables) */
  --text-small: 13.5px;
  --text-ui: 14.5px;
  --text-body: 16.5px;
  --text-lead: 18px;
  --text-h3: 20px;
  --text-h2: 25px;
  --text-h1: 36px;
  --text-h1-wide: 44px;
  --text-price: 30px;
  --leading-tight: 1.15;
  --leading-snug: 1.4;
  --leading-body: 1.65;

  /* Space (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-7: 32px; --sp-8: 48px; --sp-9: 64px;
  --gutter: 24px;
  --measure: 760px;
  --target: 44px;            /* tap target for primary controls (buttons, fields, accordions) */
  --icon-btn: 34px;          /* compact round header icon buttons; WCAG 2.2 AA 2.5.8 minimum is 24px */

  /* Shape */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius: 16px;            /* cards, panels */
  --radius-pill: 999px;

  /* Motion */
  --dur: 160ms;
  --ease: cubic-bezier(.2, .6, .2, 1);
}

/* ---------- Tokens: dark (every light token has a pair here) ---------- */
[data-theme="dark"] {
  --cream: #1D1A15;
  --card: #29251E;
  --field: #211E19;
  --sand: #3D362A;
  --sage-wash: #2C3A31;
  --ink: #EDE6DA;
  --ink-soft: #B8AE9D;
  --muted: #9A9184;
  --placeholder: #8A8A8A;
  --sage: #93BBA2;
  --sage-dark: #ACCFB8;
  --sage-light: #6E9180;
  --terra: #E4A37F;
  --on-primary: #1D1A15;     /* dark text on light-sage actions in dark mode */
  --primary-bg: #93BBA2;
  --primary-bg-hover: #ACCFB8;
  --line: #463F33;
  --line-strong: #857A66;
  --ok-bg: #2E4A3A;     --ok-ink: #BFE3CD;
  --warn-bg: #4A3E28;   --warn-ink: #EBD5AE;
  --caution-bg: #3A2A20; --caution-ink: #E8B48F; --caution-line: #6B4A35;
  --danger-bg: #4A2B22; --danger-ink: #EDA58C;
  --amber-bg: #4A3D20;  --amber-ink: #E0C887;
  --neutral-bg: #3A3428; --neutral-ink: #CDBEA0;
  --error: #F2B8B5;
  --notice-bg: #3A3220; --notice-line: #8A6A2A; --notice-ink: #EBD5AE;
  --focus: rgba(147, 187, 162, .45);
  --focus-halo: rgba(147, 187, 162, .2);
  --scrim: rgba(0, 0, 0, .6);
  --glow: rgba(228, 163, 127, .07);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 1px 2px rgba(0,0,0,.28), 0 8px 24px rgba(0,0,0,.32);
  --shadow-inset: inset 0 1px 2px rgba(0,0,0,.35);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 500px at 50% -180px, var(--glow), transparent), var(--cream);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--sp-2); top: var(--sp-2); background: var(--card); padding: var(--sp-2) 14px; z-index: 10; border-radius: var(--radius-sm); }

/* Header */
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px var(--gutter); max-width: var(--measure); margin: 0 auto;
  border-bottom: 2px solid var(--ink);
}
.wordmark { font-family: var(--font-display); font-weight: 600; font-size: 22px; letter-spacing: -.015em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.top nav { display: flex; align-items: center; }
.top nav a { color: var(--ink-soft); margin-left: 18px; text-decoration: none; font-size: var(--text-ui); font-weight: 500; }
.top nav a:hover { color: var(--sage); }

main { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter) 72px; }

/* Type scale */
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.015em; color: var(--ink); font-optical-sizing: auto; }
h1 { font-weight: 600; letter-spacing: -.02em; font-size: var(--text-h1); line-height: var(--leading-tight); margin: 56px 0 14px; }
h2 { font-size: var(--text-h2); line-height: 1.25; margin: 56px 0 6px; position: relative; padding-bottom: var(--sp-3); }
h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 34px; height: 3px; border-radius: 2px; background: var(--terra); }
.sub { font-size: var(--text-lead); line-height: 1.55; color: var(--ink-soft); margin: 0 0 28px; max-width: 34em; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--sp-6); margin: var(--sp-4) 0;
}
.clinic { transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.clinic:hover { border-color: var(--sage-light); }

/* Forms */
form.card label {
  display: block; font-size: var(--text-caption); font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-soft); margin: var(--sp-4) 0 6px;
}
form.card label:first-of-type { margin-top: 2px; }
form.card label .opt { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: var(--text-caption); }
form.card input, form.card select, .sortbar select, .sortbar input#clinic-q, #ex-q {
  width: 100%; padding: 13px 14px; font-size: 16px; font-family: var(--font-text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--field);
  color: var(--ink); min-height: 52px; box-shadow: var(--shadow-inset);
  appearance: none; -webkit-appearance: none;
}
form.card input::placeholder, .sortbar input#clinic-q::placeholder, #ex-q::placeholder { color: var(--placeholder); opacity: 1; }
form.card select, .sortbar select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236E6455' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px;
}
form.card input:focus, form.card select:focus, .sortbar select:focus, #ex-q:focus {
  outline: none; border-color: var(--sage);
  box-shadow: 0 0 0 3px var(--focus-halo);
}
button {
  display: block; width: 100%; margin-top: var(--sp-5); padding: 15px; font-size: var(--text-body); font-weight: 600;
  font-family: var(--font-text); letter-spacing: .01em;
  background: var(--primary-bg); color: var(--on-primary); border: 0;
  border-radius: var(--radius-md); cursor: pointer; min-height: 52px;
  box-shadow: var(--shadow-sm);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
button:hover { background: var(--primary-bg-hover); }
button:active { box-shadow: none; }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.trust { font-size: var(--text-small); color: var(--ink-soft); text-align: center; margin: 14px 0 0; }
.scope, .note { font-size: var(--text-ui); color: var(--ink-soft); }

/* Clinic card anatomy */
.clinic h3 { margin: 0 0 3px; font-size: var(--text-h3); letter-spacing: -.01em; }
.clinic .city { font-size: var(--text-small); color: var(--ink-soft); }
.dist { font-size: var(--text-small); color: var(--ink-soft); margin: 3px 0 var(--sp-2); font-weight: 500; }
.tag {
  display: inline-block; font-size: var(--text-caption); font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-pill); margin: 10px 10px var(--sp-1) 0;
}
.tag.verified { background: var(--primary-bg); color: var(--on-primary); }
.tag.est { background: var(--sand); color: var(--ink); }
.tag.none { background: transparent; color: var(--ink-soft); border: 1px dashed var(--line-strong); }
.tag.kind { background: var(--neutral-bg); color: var(--neutral-ink); }
.transparency { font-size: var(--text-small); color: var(--sage); font-weight: 600; }
/* Prices: Inter with tabular figures so columns align in every view. */
.price {
  font-family: var(--font-text); font-size: var(--text-price); font-weight: 650; letter-spacing: -.02em;
  color: var(--sage-dark); margin: 10px 0 var(--sp-1); font-variant-numeric: tabular-nums; line-height: 1.2;
}
.price small { display: block; margin-top: 3px; line-height: var(--leading-snug); font-family: var(--font-text); font-size: var(--text-small); font-weight: 500; color: var(--ink-soft); letter-spacing: 0; }
.meds { font-size: var(--text-small); line-height: 1.5; margin: 6px 0; }

/* Details accordion */
.clinic details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.clinic summary {
  cursor: pointer; font-weight: 600; font-size: var(--text-ui); color: var(--sage);
  list-style: none; display: flex; align-items: center; gap: var(--sp-2); border-radius: var(--radius-sm); padding: 2px 0;
  min-height: var(--target);
}
.clinic summary::-webkit-details-marker { display: none; }
.clinic summary::before {
  content: ""; width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%;
  background: var(--sage-wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M5 1v8M1 5h8' fill='none' stroke='%233B5A47' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center no-repeat;
  transition: transform var(--dur) var(--ease);
}
.clinic details[open] summary::before { transform: rotate(45deg); }
.clinic summary:hover { color: var(--sage-dark); }

table.breakdown { width: 100%; border-collapse: collapse; margin: var(--sp-3) 0; font-size: var(--text-ui); }
table.breakdown td { padding: var(--sp-2) 0; border-bottom: 1px dashed var(--line); }
table.breakdown td:last-child { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.src { font-size: var(--text-small); color: var(--ink-soft); margin-top: 10px; }
.src a { color: var(--sage); }
.unknown { font-size: var(--text-small); line-height: 1.55; background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px var(--sp-3); margin: 10px 0; }

/* Empty state */
.empty { text-align: center; padding: 36px var(--sp-6); color: var(--ink-soft); }
.empty strong { display: block; font-family: var(--font-display); font-size: var(--text-h3); color: var(--ink); margin-bottom: 6px; }

/* Secondary button */
.copy-btn {
  background: var(--card); color: var(--sage); border: 1.5px solid var(--sage);
  width: auto; padding: 11px var(--sp-5); margin-top: var(--sp-3); font-size: var(--text-ui); box-shadow: none; min-height: var(--target);
}
.copy-btn:hover { background: var(--sage-wash); box-shadow: none; }

/* Checklists */
.check { list-style: none; padding: 0; margin: 10px 0; }
.check li { padding: 9px 0 9px 30px; position: relative; font-size: var(--text-ui); }
.check li::before { content: ""; position: absolute; left: 0; top: var(--sp-3); width: 15px; height: 15px; border: 1.5px solid var(--sage-light); border-radius: 5px; background: var(--card); }

/* Sort bar */
.sortbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 14px; font-size: var(--text-small); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); }
.sortbar select { width: auto; max-width: 100%; min-width: 0; min-height: var(--target); padding: var(--sp-2) 36px var(--sp-2) var(--sp-3); font-size: var(--text-small); border-radius: 10px; }
.sortbar input#clinic-q { flex: 1 1 170px; min-width: 0; }

/* Results entrance */
#results:not([hidden]) { animation: rise .3s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  #results:not([hidden]) { animation: none; }
  *, *::before, *::after { transition: none !important; }
}

footer { border-top: 1px solid var(--line); padding: 22px var(--gutter) 36px; text-align: center; font-size: var(--text-small); color: var(--ink-soft); }
footer a, a { color: var(--sage); }
#payways ul { margin: var(--sp-2) 0; padding-left: var(--sp-5); }
#payways li { margin: 10px 0; font-size: var(--text-ui); }

@media (min-width: 760px) {
  h1 { font-size: var(--text-h1-wide); }
  .sub { font-size: 19px; }
}
h3.sub3 { font-size: var(--text-h3); margin: 30px 0 var(--sp-1); }
.about-story { font-size: 17px; line-height: 1.7; }
.about-story p { margin: 0 0 14px; }
.about-story .sig { font-family: var(--font-display); font-size: var(--text-lead); color: var(--sage); margin-top: 18px; }

/* services list (schema v2) */
.services { margin-top: 10px; font-size: var(--text-ui); }
.services ul { margin: 6px 0 0; padding-left: 0; list-style: none; }
.services li { margin: 3px 0; }
.services .svc-yes { color: var(--sage); font-weight: 700; }
.services .muted, .muted { color: var(--muted); }

.privacy-badge { position: fixed; bottom: 10px; inset-inline-start: 10px; z-index: 9999; background: var(--notice-bg); border: 1px solid var(--notice-line); color: var(--notice-ink); border-radius: var(--radius-pill); padding: 3px 10px; font-size: var(--text-caption); line-height: 1.5; pointer-events: none; box-shadow: var(--shadow-sm); }
.explore-btn { display: block; width: 100%; margin: var(--sp-1) 0 18px; padding: 13px var(--sp-4); background: var(--card); border: 1.5px dashed var(--sage); border-radius: var(--radius-md); color: var(--sage); font: 600 var(--text-ui)/1.3 var(--font-text); cursor: pointer; text-align: center; box-shadow: none; }
.explore-btn:hover { background: var(--sand); }
.ex-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 6px; font-size: var(--text-small); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.ex-filters select { width: auto; min-height: var(--target); padding: 7px 32px 7px 10px; font-size: var(--text-small); border-radius: 10px; }
.ex-check { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 500; font-size: var(--text-small); }
.count { font-size: var(--text-small); color: var(--ink-soft); margin: var(--sp-1) 0 var(--sp-2); }

/* cheaper-options explorer: oversight signal */
.tag.sig-strong { background: var(--ok-bg); color: var(--ok-ink); }
.tag.sig-mid { background: var(--warn-bg); color: var(--warn-ink); }
.tag.sig-weak { background: var(--caution-bg); color: var(--caution-ink); }
.note.travel { color: var(--ink-soft); }
.meds.bundle { color: var(--ink-soft); }
.meds.bundle em { color: var(--muted); font-style: normal; }

/* clinic detail page */
.sub2 { color: var(--muted); margin: -6px 0 18px; }
ul.plain { margin: 0; padding-left: var(--sp-5); }
ul.plain li { margin: var(--sp-1) 0; overflow-wrap: anywhere; }
main#clinic h1 { font-size: 30px; margin: 10px 0 var(--sp-1); }
main#clinic h2 { font-size: var(--text-h3); margin: 28px 0 10px; }

@media (max-width:560px) {
  table.breakdown { font-size: var(--text-small); }
  table.breakdown td { display: block; width: 100%; padding: 6px 0 0; border-bottom: none; }
  table.breakdown td:last-child { text-align: left; white-space: normal; padding: 0 0 var(--sp-2); border-bottom: 1px dashed var(--line); }
  .card { overflow-wrap: break-word; }
}

/* clinic detail page v2 */
.hero-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-5) 22px; margin: 14px 0 18px; }
.hero-card h1 { margin: 0 0 2px; }
.hero-card .sub2 { margin: 0 0 var(--sp-3); }
.hero-price { font-size: 26px; }
details.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md); margin: 10px 0; }
details.sec > summary { cursor: pointer; padding: 13px 18px; font-weight: 600; font-size: var(--text-ui); list-style: none; min-height: var(--target); }
details.sec > summary::after { content: '+'; float: right; color: var(--muted); font-weight: 400; }
details.sec[open] > summary::after { content: '\2212'; }
details.sec .sec-body { padding: 2px 18px var(--sp-4); border-top: 1px solid var(--line); }
details.sec.more { border-style: dashed; }
details.sec.more > summary { font-weight: 500; color: var(--muted); }
.more-h { font-size: var(--text-small); margin: var(--sp-4) 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* feedback widget */
.feedback { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px var(--sp-5); margin: 22px 0 10px; }
.fb-q { font-weight: 600; font-size: var(--text-ui); margin: 6px 0; }
.fb-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: 10px; }
.fb-btn { border: 1.5px solid var(--sage); background: var(--card); color: var(--sage); border-radius: 22px; padding: var(--sp-2) var(--sp-4); font-size: var(--text-small); cursor: pointer; font-family: inherit; min-height: var(--target); }
.fb-btn:hover:not(:disabled) { background: var(--sage-wash); }
.fb-btn:disabled { opacity: .45; cursor: default; }
.fb-priv { color: var(--muted); font-size: var(--text-caption); margin-top: var(--sp-1); }
.fb-thanks { color: var(--sage); font-weight: 600; font-size: var(--text-small); margin-top: 6px; }

/* Theme toggle (dark mode) */
#theme-toggle {
  width: var(--icon-btn); height: var(--icon-btn); min-height: 0; padding: 0; margin: 0 0 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-soft); font-size: var(--text-ui); line-height: 1; cursor: pointer; box-shadow: none;
}
#theme-toggle:hover { background: transparent; border-color: var(--sage-light); color: var(--sage); box-shadow: none; }
#theme-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Dark mode: only what tokens cannot express (SVG data URIs). */
[data-theme="dark"] form.card select, [data-theme="dark"] .sortbar select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23B8AE9D' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
}
[data-theme="dark"] .clinic summary::before {
  background: var(--sage-wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M5 1v8M1 5h8' fill='none' stroke='%2393BBA2' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center no-repeat;
}

@media (max-width:560px) {
  .top { padding: 14px var(--sp-4); }
  .top nav a { margin-left: 10px; }
  #theme-toggle { margin-left: 6px; }
}

/* Price inclusion badge: every price states whether medications are included */
.inc { display: inline-block; font-size: var(--text-caption); font-weight: 600; border-radius: var(--radius-pill); padding: 3px var(--sp-3); margin: var(--sp-1) 0 0; letter-spacing: .02em; }
.inc-yes { background: var(--ok-bg); color: var(--ok-ink); }
.inc-no { background: var(--caution-bg); color: var(--caution-ink); }
.inc-unk { background: transparent; color: var(--ink-soft); border: 1px dashed var(--line-strong); }
.inc-sep { background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); }
.inc a { color: inherit; text-decoration: underline; }

/* Explorer: one simple search box, advanced filters tucked away */
.ex-q-label { display: block; font-size: var(--text-caption); font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-soft); margin: 2px 0 6px; }
.ex-more { margin: var(--sp-2) 0 var(--sp-1); }
.ex-more > summary { cursor: pointer; font-weight: 600; font-size: var(--text-ui); color: var(--sage); padding: 6px 0; list-style: none; min-height: var(--target); display: flex; align-items: center; }
.ex-more > summary::-webkit-details-marker { display: none; }
.ex-more > summary::before { content: "+ "; white-space: pre; }
.ex-more[open] > summary::before { content: "\2212 "; }

/* Evidence labels for priced add-ons (HFEA ratings) */
.ev { display: inline-block; font-size: var(--text-caption); font-weight: 700; border-radius: 20px; padding: 1px 9px; text-decoration: none; vertical-align: 1px; white-space: nowrap; }
.ev-red { background: var(--danger-bg); color: var(--danger-ink); }
.ev-amber { background: var(--amber-bg); color: var(--amber-ink); }
.ev-green { background: var(--ok-bg); color: var(--ok-ink); }
.ev-note { color: var(--muted); font-size: var(--text-caption); }
.addon-line { font-size: var(--text-small); color: var(--muted); margin: var(--sp-1) 0 2px; }
.addon-line a { color: var(--danger-ink); font-weight: 600; }
.addon-entry { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: var(--sp-4) 18px; margin: 14px 0; }
.ev-explain { font-size: var(--text-small); color: var(--ink-soft); line-height: 1.45; margin: var(--sp-1) 0 2px; max-width: 52ch; }
.ev-explain a { color: inherit; }
.form-note { font-size: var(--text-caption); color: var(--muted); margin: -2px 0 var(--sp-2); line-height: 1.5; }

/* Open-message feedback widget */
.fb-msg { margin-top: var(--sp-3); }
.fb-msg-label { display: block; font-size: var(--text-small); font-weight: 600; margin-bottom: 6px; }
.fb-msg-text { width: 100%; padding: 10px var(--sp-3); font-size: 16px; font-family: inherit; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--field); color: var(--ink); resize: vertical; }
.fb-msg-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.fb-count { font-size: var(--text-caption); color: var(--muted); }
.fb-hp { position: absolute; left: -9999px; top: -9999px; height: 1px; width: 1px; opacity: 0; }
.fb-msg-status { font-size: var(--text-small); color: var(--error); margin-top: 6px; }
.fb-msg-wrap { border-top: 1px solid var(--line); margin-top: var(--sp-3); padding-top: var(--sp-1); }
.fb-bottom { display: flex; flex-direction: column; align-items: center; margin: 26px 0 18px; }
button.fb-link { background: none; border: none; box-shadow: none; color: var(--ink-soft); font-size: var(--text-small); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-family: inherit; padding: 6px 10px; min-height: var(--target); width: auto; }
button.fb-link:hover { background: none; box-shadow: none; color: var(--ink); }
.fb-bottom-panel { max-width: 520px; margin: 10px auto 0; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--ink); }
.fb-msg-row .fb-btn { width: auto; padding: 9px 18px; margin: 0; }

/* SART results tables - fixed layout so all columns fit the container at any width
   (Owner 2026-10-21: no horizontal scrolling to see the numbers). Dense: --text-micro allowed. */
.tscroll { overflow-x: hidden; }
.sart-tbl { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: var(--text-micro); margin: var(--sp-1) 0 2px; font-variant-numeric: tabular-nums; }
.sart-tbl th { text-align: right; color: var(--sage); font-size: var(--text-micro); border-bottom: 1.5px solid var(--line); padding: var(--sp-1) 2px; white-space: normal; }
.sart-tbl td { border-bottom: 1px solid var(--line); padding: 5px 2px; text-align: right; white-space: normal; }
.sart-tbl td:first-child, .sart-tbl th:first-child { text-align: left; width: 34%; }
.sart-h { font-weight: 700; font-size: var(--text-small); margin: 14px 0 2px; }
.sart-small { font-size: var(--text-micro); color: var(--danger-ink); font-weight: 400; }
.sart-more { margin-top: 10px; }
.sart-more summary { cursor: pointer; font-size: var(--text-small); font-weight: 600; color: var(--sage); }

/* SART age picker (must beat the generic full-width button rule) */
.agepick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: var(--sp-2) 0 6px; }
.agepick-label { font-size: var(--text-caption); color: var(--ink-soft); width: 100%; }
button.agechip { width: auto; flex: 0 0 auto; border: 1px solid var(--line-strong); background: transparent; color: inherit; border-radius: var(--radius-pill); padding: var(--sp-1) 14px; font-size: var(--text-caption); font-weight: 600; cursor: pointer; font-family: inherit; box-shadow: none; text-transform: none; letter-spacing: 0; min-height: 36px; margin: 0; }
button.agechip:hover { background: var(--sage-wash); box-shadow: none; }
button.agechip.on, button.agechip.on:hover { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--on-primary); }

/* Breakdown price column is nowrap; the inline HFEA explanation inside it must wrap. */
table.breakdown td:last-child .ev-explain,
table.breakdown td:last-child .ev-explain a { white-space: normal; }

/* National comparison line under a rate (SART national, same age band) */
.sart-us { font-size: var(--text-micro); color: var(--ink-soft); font-weight: 400; }
.sart-usabout { margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px dashed var(--line); }
.sart-cum { background: var(--sage-wash); border-radius: var(--radius-md); padding: 10px 14px; margin: 6px 0 10px; font-size: var(--text-small); line-height: 1.5; }

.ex-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.ex-chip { padding: 6px 14px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); background: transparent; color: var(--ink); cursor: pointer; font-size: var(--text-small); font-family: var(--font-text); min-height: 36px; }
.ex-chip.active { background: var(--primary-bg); color: var(--on-primary); border-color: var(--primary-bg); }
.team-cat { font-size: var(--text-body); margin: var(--sp-4) 0 var(--sp-1); }

/* Label legend + Transparency popup */
.legend-link { display: inline-block; margin: -6px 0 10px; font-size: var(--text-small); color: var(--sage); text-decoration: underline dotted; text-underline-offset: 3px; }
.legend { margin-top: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 18px var(--sp-5); box-shadow: var(--shadow-sm); }
.legend h2 { font-family: var(--font-display); font-size: var(--text-h3); font-weight: 600; color: var(--ink); margin: 0 0 10px; letter-spacing: -.01em; }
.legend ul { margin: 0; padding: 0; list-style: none; }
.legend li { font-size: var(--text-small); line-height: 1.55; color: var(--ink-soft); margin: var(--sp-3) 0; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.legend li .tag { flex: 0 0 auto; margin-top: 1px; }
.legend li > span:last-child { flex: 1 1 220px; min-width: 0; }
.legend li .tp-sample { flex: 0 0 auto; margin-top: 1px; margin-left: 0; }
.tp-btn { display: inline-block; width: auto; min-height: 0; margin: 0 0 0 6px; padding: 2px var(--sp-1); background: none; border: 0; border-radius: 0; box-shadow: none; font-family: var(--font-text); font-size: var(--text-small); letter-spacing: 0; color: var(--sage); font-weight: 600; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; vertical-align: baseline; transition: none; }
.tp-btn:hover { background: none; color: var(--sage-dark); box-shadow: none; }
.tp-btn:active { box-shadow: none; }
.tp-btn .tp-info { font-style: normal; font-size: var(--text-caption); margin-left: 2px; }
.tp-backdrop { position: fixed; inset: 0; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 60; }
.tp-backdrop[hidden] { display: none; }
.tp-modal { background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); max-width: 520px; width: 100%; max-height: 86vh; overflow: auto; padding: 22px 22px 18px; position: relative; }
.tp-modal h2 { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -.01em; margin: 0 46px 10px 0; line-height: 1.25; }
.tp-modal p { font-size: var(--text-ui); line-height: 1.6; color: var(--ink-soft); margin: 0 0 10px; }
.tp-modal ul { margin: 0 0 var(--sp-3); padding-left: var(--sp-5); }
.tp-modal li { font-size: var(--text-ui); line-height: 1.6; color: var(--ink-soft); margin: 3px 0; }
.tp-modal .tp-score { font-weight: 600; color: var(--ink); }
.tp-close { position: absolute; top: 8px; right: 8px; width: var(--target); height: var(--target); border-radius: 50%; border: 1px solid var(--line); background: transparent; color: var(--ink-soft); font-size: var(--text-lead); line-height: 1; cursor: pointer; min-height: 0; padding: 0; box-shadow: none; margin: 0; }
.tp-close:hover { background: var(--sage-wash); box-shadow: none; }

/* Public records section on clinic pages */
.rec-wrap { margin: var(--sp-1) 0; }
.rec-item { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--sp-3) 14px; margin: 10px 0; background: var(--card); }
.rec-meta { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin: 0 0 var(--sp-1); }
.rec-pill { font-size: var(--text-caption); font-weight: 600; color: var(--ink-soft); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 2px 10px; background: var(--sage-wash); }
.rec-date { font-size: var(--text-caption); color: var(--muted); }
.rec-scope { font-size: var(--text-caption); color: var(--muted); font-style: italic; }
.rec-text { margin: var(--sp-1) 0; font-size: var(--text-ui); line-height: 1.55; }
.rec-src { font-size: var(--text-small); color: var(--ink-soft); margin: var(--sp-1) 0 0; }

#clinic .team-cat + ul .muted { overflow-wrap: anywhere; }

/* A panel already has padding; its first heading is not a new section. */
.about-story > :is(h2,h3):first-child { margin-top: 0; }

/* Article categories, readable cards in both themes, grouped footer. */
.article-category-nav { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 28px 0 36px; }
.article-category-nav a { display: inline-flex; align-items: center; min-height: var(--target); padding: var(--sp-2) 15px; border: 1px solid var(--line); border-radius: var(--sp-6); color: var(--ink); font-size: var(--text-small); text-decoration: none; background: var(--card); }
.article-category-nav a:hover { border-color: var(--accent); background: var(--sage-wash); }
.article-category { margin: 0 0 44px; scroll-margin-top: var(--sp-6); }
.article-category-heading { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); border-top: 1px solid var(--line); padding-top: 22px; margin-bottom: var(--sp-4); }
.article-category-heading h2 { margin: 0 !important; font-family: var(--font-display) !important; font-size: 23px !important; line-height: 1.25 !important; color: var(--ink); }
.article-category-number { font-size: var(--text-caption); color: var(--muted); letter-spacing: .08em; }
.article-category-heading .topic-count { margin-left: auto; }
.article-library .topic-cards { padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.article-library .rcard { margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.article-library .rcard h3 { margin: 0; font-size: 17px; line-height: 1.45; }
.article-library .rcard a { display: block; padding: 22px; min-height: 88px; color: var(--ink); text-decoration: none; }
.article-library .rcard a:hover { text-decoration: underline; text-underline-offset: 4px; }
.article-library .rcard:hover { border-color: var(--accent); }
html[data-theme="dark"] .hap-art { background: var(--sage-wash) !important; color: var(--ink) !important; }
html[data-theme="dark"] .hap-art span { color: var(--ink) !important; }
footer.tfi-footer-columns { margin: var(--sp-9) auto 0; padding: 36px var(--gutter) 28px; text-align: left; border-top: 1px solid var(--line); max-width: 1120px; }
.tfi-footer-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: var(--sp-7); }
.tfi-footer-group h2 { font-family: var(--font-display); font-size: var(--text-ui); line-height: var(--leading-snug); margin: 0 0 14px; color: var(--ink); }
.tfi-footer-group a { display: block; color: var(--ink-soft); font-size: var(--text-small); line-height: 1.5; margin: 0 0 10px; text-decoration: none; width: fit-content; }
.tfi-footer-group a:hover { text-decoration: underline; }
.tfi-footer-bottom { border-top: 1px solid var(--line); margin-top: var(--sp-6); padding-top: 18px; color: var(--muted); font-size: var(--text-caption); line-height: 1.6; }
.tfi-footer-bottom p { margin: 6px 0; }
.tfi-footer-bottom a { color: inherit; }
@media (max-width:620px) {
  .article-library .topic-cards { grid-template-columns: 1fr; }
  .article-category-heading h2 { font-size: 21px !important; }
  .article-category-heading .topic-count { margin-left: 0; }
  .article-library .rcard a { min-height: 68px; padding: 18px; }
  .tfi-footer-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
  .tfi-footer-group:first-child { grid-column: 1/-1; }
  .tfi-footer-group:first-child nav { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--sp-4); }
  .article-category-nav { gap: 7px; }
  .article-category-nav a { font-size: var(--text-small); padding: 7px var(--sp-3); }
}
