/* ============================================================
   Causal — shared design system (app.css)
   Dark-premium consumer-health brand. Matches condition.html + home.html.
   Font (add to each page <head>):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&display=swap" rel="stylesheet">
   <link rel="stylesheet" href="app.css">
   ============================================================ */

:root{
  --bg:#0f131a; --bg2:#141922; --panel:#181d25; --panel2:#21262f; --line:#2a303c;
  --ink:#f1f5f5; --muted:#9ea8a8; --muted2:#6f7a89;
  --teal:#36a19b; --teal-l:#47d1ca; --coral:#b5495b; --coral-l:#e0857f; --gold:#d8a24a;
  --good:#36a19b; --warn:#c8a04e;
  --maxw:1440px;
  --sans:'Hanken Grotesk',-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;background:var(--bg);color:var(--ink);font-family:var(--sans);
  font-size:16px;line-height:1.55;-webkit-font-smoothing:antialiased;overflow-x:hidden;
}
a{color:inherit;text-decoration:none}
h1,h2,h3{margin:0;line-height:1.1;letter-spacing:-.02em;font-weight:800}
p{margin:0}
img{max-width:100%}

/* ---- layout ---- */
.wrap{max-width:var(--maxw);margin:0 auto;padding:0 24px}
/* one width for the whole site — every page lines up with the home page */
.wrap-narrow{max-width:var(--maxw);margin:0 auto;padding:0 24px}
/* desktop: use more of the screen; mobile stays a single flowy column */
/* text-heavy blocks keep a readable measure without narrowing the page */
.wrap-narrow .lede,.wrap-narrow .sec-sub{max-width:70ch}
section{padding:56px 0}

/* subtle radial page glow — add class "glow" to a full-width band/hero */
.glow{position:relative;overflow:hidden}
.glow::before{
  content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:
    radial-gradient(680px 460px at 16% -6%, rgba(47,158,143,.16), transparent 60%),
    radial-gradient(620px 460px at 96% 6%, rgba(181,73,91,.13), transparent 62%),
    radial-gradient(900px 700px at 50% 120%, rgba(107,127,181,.10), transparent 60%);
}
/* whole-page ambient glow (optional, cheap) */
body.ambient::before{
  content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;
  background:
    radial-gradient(760px 520px at 12% -8%, rgba(47,158,143,.10), transparent 60%),
    radial-gradient(680px 520px at 98% 2%, rgba(181,73,91,.08), transparent 62%);
}

/* ---- brand / text accents ---- */
.grad{
  background:linear-gradient(96deg,#f4f8f8 0%,#7fe8d6 46%,#47d1ca 100%);
  -webkit-background-clip:text;background-clip:text;
  -webkit-text-fill-color:transparent;color:transparent;
}
.teal{color:var(--teal-l)}
.coralt{color:var(--coral-l)}
.muted{color:var(--muted)}
.muted2{color:var(--muted2)}
.num,.tnum{font-variant-numeric:tabular-nums}
.eyebrow{
  font-size:12.5px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:var(--teal-l);
}

/* ---- nav ---- */
header.nav{
  position:sticky;top:0;z-index:50;backdrop-filter:blur(12px);
  background:rgba(13,17,23,.72);border-bottom:1px solid var(--line);
}
.nav-in{display:flex;align-items:center;gap:14px;height:64px;max-width:var(--maxw);margin:0 auto;padding:0 24px}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:19px;letter-spacing:-.02em}
.dot{
  width:15px;height:15px;border-radius:50%;flex:none;
  background:radial-gradient(circle at 34% 30%,#47d1ca,#36a19b 72%);
  box-shadow:0 0 14px 2px rgba(47,158,143,.55),0 0 4px rgba(127,232,214,.9);
}
.nav-links{margin-left:auto;display:flex;align-items:center;gap:24px;font-size:14.5px;color:var(--muted);font-weight:500}
.nav-links a:hover{color:var(--ink)}
.nav-links .profile-ico{width:36px;height:36px;border:1px solid var(--line);border-radius:50%;display:grid;place-items:center;color:#cbd3de;background:var(--panel);flex:none}
.nav-links .profile-ico:hover{color:var(--teal-l);border-color:var(--teal)}
.nav-links .profile-ico svg{width:17px;height:17px;stroke:currentColor;stroke-width:2;fill:none}
.nav .btn{padding:9px 16px;font-size:14px;white-space:nowrap}
.nav-in .back{margin-left:auto;font-size:14px;color:var(--muted)}
.nav-in .back:hover{color:var(--ink)}
@media(max-width:720px){.nav-links a.hidem{display:none}
  /* on a phone the header is just logo + primary action — the Dashboard link is clutter */
  .nav-links a[href="dashboard.html"]{display:none}
  .nav-links{gap:12px}.nav .btn{padding:10px 15px}
  .nav-links .profile-ico{width:38px;height:38px}}

/* ---- buttons ---- */
.btn{
  display:inline-flex;align-items:center;gap:8px;border:none;cursor:pointer;font-family:inherit;
  font-weight:700;font-size:15px;border-radius:11px;padding:13px 22px;
  background:linear-gradient(94deg,#5fd9d1,#36a19b);color:#08130f;
  transition:transform .12s ease,filter .12s ease,border-color .12s ease;
}
.btn-primary{background:linear-gradient(94deg,#5fd9d1,#36a19b);color:#08130f}
.btn:hover{transform:translateY(-1px);filter:brightness(1.06)}
.btn-ghost{background:transparent;color:var(--ink);border:1px solid var(--line)}
.btn-ghost:hover{border-color:#3d4757;filter:none}
.btn-sm{padding:9px 15px;font-size:13.5px;border-radius:10px}
.btn[disabled],.btn:disabled{opacity:.45;cursor:not-allowed;transform:none;filter:none}

/* ---- pill + generic chip ---- */
.pill{
  display:inline-block;font-size:12px;font-weight:600;color:var(--muted);border:1px solid var(--line);
  border-radius:20px;padding:4px 11px;background:var(--panel);
}

/* ---- cards ---- */
.card{background:var(--panel);border:1px solid var(--line);border-radius:15px;padding:22px}
.card.pad-lg{padding:26px}
.card h3{font-size:17px;margin:0 0 8px;letter-spacing:-.02em}
.card p{font-size:14px;color:var(--muted);line-height:1.55}
.card-hl{background:linear-gradient(180deg,#16211c,#12171d);border:1px solid #2f5e46;border-radius:16px;padding:24px}

/* ---- section headings (both styles from the site) ---- */
.sec-h{font-size:13px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin-bottom:4px}
.sec-sub{color:#bcc5d2;font-size:15px;margin-bottom:20px}
.sec-head{max-width:680px;margin-bottom:34px}
.sec-head h2{font-size:32px;letter-spacing:-.03em}
.sec-head p{margin-top:12px;color:#bcc5d2;font-size:16.5px}
@media(max-width:860px){.sec-head h2{font-size:26px}}
@media(max-width:720px){
  .wrap,.wrap-narrow{padding-left:16px;padding-right:16px}
  section{padding:34px 0}
  .card,.card.pad-lg{padding:16px;border-radius:12px}
  .card-hl{padding:18px;border-radius:14px}
  .sec-sub{font-size:14px;line-height:1.45;margin-bottom:14px}
  .banner{padding:12px 13px;border-radius:11px}
}

/* ---- badges ---- */
.badge{
  display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:700;
  letter-spacing:.06em;text-transform:uppercase;border-radius:20px;padding:2px 9px;border:1px solid transparent;
  line-height:1.5;white-space:nowrap;
}
.b-root{color:#86d6ae;background:#173225;border-color:#2f5e46}          /* root  = green */
.b-engine{color:#a7c3c0;background:#1a2430;border-color:#2c3a44}        /* engine= teal-grey */
.b-surface{color:var(--muted);background:var(--panel2);border-color:var(--line)} /* surface = muted */
.b-high{color:var(--coral-l);background:#2a1b1e;border-color:#4a2b30}   /* HIGH  = coral */
.b-normal{color:#86d6ae;background:#16241d;border-color:#274a3a}        /* NORMAL= muted-green */
.b-low{color:#d6b06a;background:#241f14;border-color:#4a3d24}           /* LOW   = amber (bonus) */

/* ---- forms ---- */
label,.label{display:block;font-size:12.5px;font-weight:700;letter-spacing:.02em;color:var(--muted);margin-bottom:7px}
.field{margin-bottom:16px}
.field .hint{font-size:12px;color:var(--muted2);margin-top:6px}
input,select,textarea{
  width:100%;font-family:inherit;font-size:15px;color:var(--ink);background:var(--panel);
  border:1px solid var(--line);border-radius:12px;padding:13px 15px;outline:none;
  transition:border-color .12s;
}
textarea{resize:vertical;min-height:88px;line-height:1.5}
input::placeholder,textarea::placeholder{color:var(--muted2)}
input:focus,select:focus,textarea:focus{border-color:var(--teal)}
select{appearance:none;-webkit-appearance:none;cursor:pointer;
  background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);
  background-position:calc(100% - 20px) 55%,calc(100% - 14px) 55%;background-size:6px 6px,6px 6px;background-repeat:no-repeat;
  padding-right:40px;
}
input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:6px;border-radius:5px;padding:0;
  background:linear-gradient(90deg,#36a19b,#47d1ca) no-repeat, #242b35;background-size:50% 100%;border:none;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:20px;height:20px;border-radius:50%;cursor:pointer;
  background:radial-gradient(circle at 34% 30%,#bff3e8,#36a19b 74%);border:2px solid #08130f;
  box-shadow:0 0 10px 1px rgba(47,158,143,.5);
}
input[type=range]::-moz-range-thumb{
  width:18px;height:18px;border-radius:50%;cursor:pointer;
  background:radial-gradient(circle at 34% 30%,#bff3e8,#36a19b 74%);border:2px solid #08130f;
}
input[type=checkbox],input[type=radio]{width:auto;accent-color:var(--teal)}
.rangewrap{display:flex;align-items:center;gap:14px}
.rangewrap .rv{flex:none;width:38px;text-align:right;font-variant-numeric:tabular-nums;font-weight:800;font-size:18px;color:var(--teal-l)}

/* ---- grids ---- */
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
@media(max-width:720px){.grid2,.grid3{grid-template-columns:1fr}}

/* ---- steps timeline (numbered) ---- */
.steps{display:flex;flex-direction:column;gap:2px;margin:6px 0}
.st{display:flex;gap:10px;align-items:flex-start;font-size:13.5px;color:#c9d1db;padding:6px 0;line-height:1.45}
.st .n{
  flex:none;width:22px;height:22px;border-radius:50%;background:#233042;color:#47d1ca;font-weight:700;
  font-size:11px;display:flex;align-items:center;justify-content:center;border:1px solid #34455a;margin-top:1px;
}
.st.done .n{background:var(--teal-l);color:#08130f;border-color:var(--teal-l)}
.st b{color:var(--ink);font-weight:700}

/* ---- result rows (marker readouts) ---- */
.rows{background:var(--panel);border:1px solid var(--line);border-radius:15px;padding:6px 18px}
.row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0;border-top:1px solid var(--line)}
.row:first-child{border-top:none}
.row .nm{font-weight:600;font-size:14.5px}
.row .sub{font-size:12px;color:var(--muted);margin-top:2px;line-height:1.4}
.row .rt{display:flex;align-items:center;gap:12px;flex:none}
.row .val{font-variant-numeric:tabular-nums;font-weight:800;font-size:15px}
.row .val small{font-weight:600;font-size:11.5px;color:var(--muted);margin-left:2px}
.row .ref{font-size:11.5px;color:var(--muted2);font-variant-numeric:tabular-nums}
.val.high{color:var(--coral-l)} .val.low{color:var(--gold)} .val.normal{color:var(--teal-l)}
@media(max-width:620px){
  .rows{padding:4px 12px;border-radius:12px}
  .row{display:block;padding:11px 0}
  .row .rt{margin-top:7px;justify-content:flex-start}
}

/* relevance / fit bar */
.relbar{width:56px;height:5px;border-radius:4px;background:#242b35;overflow:hidden;flex:none}
.relbar>span{display:block;height:100%;background:linear-gradient(90deg,#36a19b,#47d1ca)}

/* ---- status banners ---- */
.banner{
  display:flex;align-items:flex-start;gap:11px;border:1px solid var(--line);border-radius:13px;
  padding:14px 16px;font-size:14px;line-height:1.5;color:#d3dae3;background:var(--panel);margin:14px 0;
}
.banner .bi{flex:none;font-size:15px;line-height:1.4}
.banner b{color:var(--ink)}
.banner.amber{border-color:#4a3d24;background:linear-gradient(180deg,#241f14,#1b1811);color:#e7d6b0}
.banner.amber .bi{color:var(--gold)}
.banner.green{border-color:#2f5e46;background:linear-gradient(180deg,#16241d,#121a15);color:#bfe6d2}
.banner.green .bi{color:var(--teal-l)}

/* ---- misc utility ---- */
.stack{display:flex;flex-direction:column;gap:14px}
.rowflex{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.spread{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.disc{color:var(--muted2);font-size:12px;line-height:1.6;margin:26px 0 40px;border-top:1px solid var(--line);padding-top:16px}
.loading,.err{color:var(--muted);padding:60px 0;font-size:16px}
.err a{color:var(--teal-l);font-weight:600}
.divider{height:1px;background:var(--line);border:none;margin:24px 0}

/* shared nav + journey rail
   ------------------------------------------------------------------
   Drop-in shared components for every member-facing page. These promote
   the journey tracker already proven on dashboard.html into the shared
   sheet (identical class names + values) so any page can reuse it.
   1) Top-nav: the <header class="nav"> markup styled above IS the shared
      nav; add class "active" to the current section's link to mark it.
   2) .journey: a 4-step progress rail (Test -> Results -> Plan -> Retest).
      Mark the CURRENT step with class "current" and every EARLIER step with
      class "done"; leave later steps unclassed. Set those classes from Store
      state (see the snippet note) — e.g. done once Store.results('baseline')
      exists, current = the first not-yet-done step. */

/* active state for the shared top-nav link (equiv. to the inline color used today) */
.nav-links a.active{color:var(--ink);font-weight:600}

/* journey rail (mirrors dashboard.html's tracker so markup is portable) */
.journey{display:grid;grid-template-columns:repeat(4,1fr);margin:26px 0 4px}
.jstep{position:relative;text-align:center;padding-top:4px}
.jstep::before{content:"";position:absolute;top:20px;left:-50%;width:100%;height:2px;background:var(--line);z-index:0}
.jstep:first-child::before{display:none}
.jstep.done::before,.jstep.current::before{background:linear-gradient(90deg,#36a19b,#47d1ca)}
.jnode{position:relative;z-index:1;width:42px;height:42px;border-radius:50%;margin:0 auto;display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:16px;background:var(--panel);border:1px solid var(--line);color:var(--muted2);box-shadow:0 0 0 5px var(--bg)}
.jstep.done .jnode{background:var(--teal-l);color:#08130f;border-color:var(--teal-l)}
.jstep.current .jnode{border-color:var(--teal);color:var(--teal-l);box-shadow:0 0 0 5px var(--bg),0 0 0 8px rgba(47,158,143,.16),0 0 18px rgba(47,158,143,.4)}
.jlabel{font-size:12.5px;margin-top:11px;color:var(--muted);font-weight:600;line-height:1.3;padding:0 4px}
.jstep.current .jlabel,.jstep.done .jlabel{color:var(--ink)}
.jsub{font-size:11px;color:var(--muted2);margin-top:3px;font-variant-numeric:tabular-nums}
@media(max-width:560px){.jnode{width:34px;height:34px;font-size:14px}.jstep::before{top:16px}.jlabel{font-size:11px}}

/* ---- icons (see icons.js) — inherit colour via currentColor ---- */
.ic{display:inline-block;vertical-align:-.16em;flex:none}
.ic.teal{color:var(--teal-l)} .ic.coral{color:var(--coral-l)} .ic.gold{color:var(--gold)}
.ic.mut{color:var(--muted)}
/* round icon chip used for section/card glyphs */
.icchip{width:42px;height:42px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;
  background:var(--panel2);border:1px solid var(--line);color:var(--teal-l)}
.icchip-sm{width:30px;height:30px;border-radius:9px}

/* ---- UK testing-provider directory (shared component) ---- */
.prov-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:6px}
@media(max-width:640px){.prov-grid{grid-template-columns:1fr}}
.prov{display:flex;gap:13px;align-items:flex-start;text-decoration:none;background:var(--panel);border:1.5px solid var(--line);
  border-radius:14px;padding:15px 16px;transition:border-color .13s,transform .13s,background .13s}
.prov:hover{border-color:var(--teal);transform:translateY(-1px);background:#12201b}
.prov-mark{flex:none;width:42px;height:42px;border-radius:11px;display:flex;align-items:center;justify-content:center;
  color:#fff;font-weight:800;font-size:15px;letter-spacing:-.02em;box-shadow:inset 0 0 0 1px rgba(255,255,255,.14)}
.prov-body{display:flex;flex-direction:column;gap:3px;min-width:0}
.prov-nm{font-weight:700;font-size:15.5px;color:var(--ink);display:flex;align-items:center;gap:8px}
.prov-go{font-size:11.5px;font-weight:700;color:var(--teal-l);opacity:.85}
.prov-tag{font-size:11px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted2)}
.prov-good{font-size:13px;color:#c2ccd8;line-height:1.45;margin-top:2px}
.prov-note{font-size:12px;color:var(--muted);line-height:1.55;margin-top:14px;padding:12px 14px;background:var(--panel);
  border:1px solid var(--line);border-radius:11px}
.prov-note b{color:#9fb0c2}

/* ---- responsive collapse ---- */
@media(max-width:720px){
  section{padding:40px 0}
  .nav-in{gap:10px}
  .spread{align-items:flex-start}
}

/* ---- desktop breathing room ----
   On wide screens the tight inline padding-top values between stacked sections
   read cramped. Add vertical rhythm here (margin, so it stacks on top of any
   inline padding) — mobile stays flowy and untouched. */
@media(min-width:900px){
  section{padding:64px 0}
  section.hero{padding-bottom:10px}
  section + section{margin-top:30px}
  .hero + section{margin-top:14px}
  .sec-sub{margin-bottom:26px}
}
@media(min-width:1280px){
  section + section{margin-top:40px}
}

/* brand: neuron mark + GRUMBLE-style wordmark (uppercase, heavy, wide tracking) */
.brand{display:flex;align-items:center;gap:11px;text-decoration:none}
.brand .mark{width:29px;height:29px;flex:none;display:block}
.brand .wordmark{font-weight:800;font-size:17.5px;letter-spacing:.19em;text-transform:uppercase;
  color:var(--ink);line-height:1;-webkit-text-fill-color:currentColor}
@media(max-width:600px){.brand .wordmark{font-size:15px;letter-spacing:.15em}}
