/* Curing Lyme: public site styles */

:root {
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-2: #eef2ea;
  --surface-3: #e4eadf;
  --ink: #16211b;
  --ink-2: #4b5b51;
  --ink-3: #74837a;
  --line: #dde4da;
  --line-2: #c9d3c6;
  --brand: #1e5034;
  --brand-2: #2c7349;
  --brand-ink: #ffffff;
  --accent: #b6d33a;
  --accent-soft: #eef6cf;
  --warn-bg: #fff6e5;
  --warn-line: #f0d9a8;
  --warn-ink: #7a5310;

  --c-antibiotic: #2563a8;  --c-antibiotic-bg: #e6eff9;
  --c-herbal: #2c7349;      --c-herbal-bg: #e3f1e7;
  --c-persister: #6a46b8;   --c-persister-bg: #efe9fb;
  --c-iv: #b03a6f;          --c-iv-bg: #fae8f0;
  --c-support: #a46a12;     --c-support-bg: #fbf0dc;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(22, 33, 27, .06), 0 1px 1px rgba(22, 33, 27, .04);
  --shadow: 0 1px 2px rgba(22, 33, 27, .05), 0 8px 24px -8px rgba(22, 33, 27, .12);
  --shadow-lg: 0 2px 4px rgba(22, 33, 27, .04), 0 24px 48px -16px rgba(22, 33, 27, .22);

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --wrap: 1180px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1511;
    --surface: #151f19;
    --surface-2: #1a261f;
    --surface-3: #213027;
    --ink: #e7eee9;
    --ink-2: #a9b8ae;
    --ink-3: #7f9086;
    --line: #25352b;
    --line-2: #314539;
    --brand: #84cc9e;
    --brand-2: #9bd8b0;
    --brand-ink: #0e1511;
    --accent: #c5e05a;
    --accent-soft: #2a3315;
    --warn-bg: #2a2212;
    --warn-line: #4a3a17;
    --warn-ink: #f0cf8a;
    --c-antibiotic: #7fb2ec;  --c-antibiotic-bg: #172638;
    --c-herbal: #84cc9e;      --c-herbal-bg: #16291e;
    --c-persister: #b9a0f0;   --c-persister-bg: #241c38;
    --c-iv: #ee93bb;          --c-iv-bg: #35192a;
    --c-support: #e9b864;     --c-support-bg: #33260f;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
    --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1511;
  --surface: #151f19;
  --surface-2: #1a261f;
  --surface-3: #213027;
  --ink: #e7eee9;
  --ink-2: #a9b8ae;
  --ink-3: #7f9086;
  --line: #25352b;
  --line-2: #314539;
  --brand: #84cc9e;
  --brand-2: #9bd8b0;
  --brand-ink: #0e1511;
  --accent: #c5e05a;
  --accent-soft: #2a3315;
  --warn-bg: #2a2212;
  --warn-line: #4a3a17;
  --warn-ink: #f0cf8a;
  --c-antibiotic: #7fb2ec;  --c-antibiotic-bg: #172638;
  --c-herbal: #84cc9e;      --c-herbal-bg: #16291e;
  --c-persister: #b9a0f0;   --c-persister-bg: #241c38;
  --c-iv: #ee93bb;          --c-iv-bg: #35192a;
  --c-support: #e9b864;     --c-support-bg: #33260f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 48px -16px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::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-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand-2); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand); }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; color: var(--ink); font-optical-sizing: auto; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.45rem, 2.6vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

.skip-link { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 66px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--font-serif); font-weight: 600; font-size: 1.28rem; letter-spacing: -.01em; white-space: nowrap; }
.logo:hover { color: var(--ink); }
.logo-mark { width: 32px; height: 32px; flex: none; }
.logo em { font-style: normal; color: var(--brand-2); }

.main-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.main-nav a { color: var(--ink-2); text-decoration: none; font-size: .94rem; font-weight: 500; padding: 8px 12px; border-radius: 999px; transition: background .15s, color .15s; }
.main-nav a:hover { color: var(--ink); background: var(--surface-2); }
.main-nav a.is-active { color: var(--brand); background: var(--surface-2); }
.header-search { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 999px; color: var(--ink-2); text-decoration: none; }
.header-search:hover { background: var(--surface-2); color: var(--ink); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); color: var(--ink); width: 42px; height: 42px; border-radius: 10px; cursor: pointer; align-items: center; justify-content: center; }

@media (max-width: 960px) {
  .nav-toggle { display: inline-flex; }
  .header-search { margin-left: 0; }
  .main-nav {
    position: absolute; left: 0; right: 0; top: 66px;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 8px 16px 16px; box-shadow: var(--shadow);
    display: none;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 12px 10px; border-radius: 10px; font-size: 1rem; }
}

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .95rem/1 var(--font-sans);
  padding: 12px 18px; border-radius: 999px; border: 1px solid transparent;
  text-decoration: none; cursor: pointer; transition: transform .12s, background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-2); color: var(--brand-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-amazon { background: #ffb43a; color: #1a1205; }
.btn-amazon:hover { background: #ffa51a; color: #1a1205; }
.btn-sm { padding: 8px 13px; font-size: .86rem; }
.btn svg { width: 16px; height: 16px; flex: none; }

.input, .select {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 11px 16px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 18%, transparent); }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search-field .input { padding-left: 44px; }

/* ---------- Badges & chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .74rem; font-weight: 600; letter-spacing: .02em;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge-antibiotic { background: var(--c-antibiotic-bg); color: var(--c-antibiotic); }
.badge-herbal { background: var(--c-herbal-bg); color: var(--c-herbal); }
.badge-persister { background: var(--c-persister-bg); color: var(--c-persister); }
.badge-iv { background: var(--c-iv-bg); color: var(--c-iv); }
.badge-support { background: var(--c-support-bg); color: var(--c-support); }
.badge-free { background: var(--c-herbal-bg); color: var(--c-herbal); }
.badge-low { background: var(--c-support-bg); color: var(--c-support); }
.badge-paid { background: var(--c-antibiotic-bg); color: var(--c-antibiotic); }
.badge-rx { background: transparent; border: 1px solid var(--line-2); color: var(--ink-2); }
.badge-rx::before { display: none; }

.pill { display: inline-block; font-size: .78rem; font-weight: 500; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font: 500 .9rem/1 var(--font-sans);
  padding: 9px 14px; border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
  border: 1px solid var(--line-2); text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { font-size: .76rem; opacity: .65; font-variant-numeric: tabular-nums; }

/* ---------- Layout bits ---------- */
main { min-height: 60vh; }
.section { padding-top: 56px; padding-bottom: 56px; }
.section-tight { padding-top: 32px; padding-bottom: 32px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: 6px 0 0; color: var(--ink-2); }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--brand-2); margin-bottom: 12px; }
.lead { font-size: 1.14rem; color: var(--ink-2); max-width: 62ch; }
.muted { color: var(--ink-2); }
.small { font-size: .88rem; }

.page-hero { padding: 48px 0 28px; border-bottom: 1px solid var(--line); background:
  radial-gradient(900px 300px at 85% -10%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
  radial-gradient(700px 260px at 0% 0%, color-mix(in srgb, var(--brand-2) 10%, transparent), transparent 70%);
}
.page-hero h1 { margin-bottom: 10px; }
.page-hero .lead { margin: 0; }

.breadcrumb { font-size: .86rem; color: var(--ink-3); margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-2); text-decoration: underline; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm);
}
.card-link { display: block; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; }
.card-link:hover { color: inherit; transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }

.toolbar { display: flex; flex-direction: column; gap: 14px; padding: 22px 0 8px; }
.toolbar-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.toolbar .search-field { flex: 1 1 260px; max-width: 420px; }
.toolbar .select { width: auto; flex: 0 0 auto; padding-right: 36px; }
.result-count { font-size: .88rem; color: var(--ink-3); margin-left: auto; }

.empty { text-align: center; padding: 48px 16px; color: var(--ink-2); border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--surface); }

/* ---------- Home ---------- */
.hero { position: relative; padding: 64px 0 56px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(800px 420px at 92% 10%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 65%),
    radial-gradient(700px 420px at 0% 100%, color-mix(in srgb, var(--brand-2) 14%, transparent), transparent 65%);
}
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 3.9rem); margin-bottom: 18px; }
.hero h1 .hl { color: var(--brand-2); }
.hero .lead { font-size: 1.2rem; margin-bottom: 28px; }
.hero-search { display: flex; gap: 10px; max-width: 540px; }
.hero-search .search-field { flex: 1; }
.hero-search .input { padding-top: 14px; padding-bottom: 14px; box-shadow: var(--shadow-sm); }
.hero-quick { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .9rem; color: var(--ink-3); }
.hero-quick a { color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; text-decoration: none; }
.hero-quick a:hover { border-color: var(--line-2); color: var(--ink); }
.hero-stack { position: relative; min-height: 360px; }
.hero-stack .stack-card { position: absolute; width: 100%; max-width: 400px; right: 0; }
.hero-stack .stack-card:nth-child(1) { top: 0; transform: rotate(2.5deg) translateX(14px); opacity: .55; }
.hero-stack .stack-card:nth-child(2) { top: 18px; transform: rotate(-1.5deg) translateX(-6px); opacity: .8; }
.hero-stack .stack-card:nth-child(3) { top: 40px; box-shadow: var(--shadow-lg); }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-stack { display: none; }
}

.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.pillars-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .pillars-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { .pillars { grid-template-columns: 1fr; } .pillars.pillars-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .pillars.pillars-4 { grid-template-columns: 1fr; } }
.pillar-community { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); background: linear-gradient(160deg, var(--surface) 55%, var(--accent-soft)); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.hero-mine { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .9rem; color: var(--ink-3); }
.hero-mine a { color: var(--brand); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); padding: 5px 11px; border-radius: 999px; text-decoration: none; font-weight: 600; }
.home-join { margin-top: 18px; }
.pillar { display: flex; flex-direction: column; gap: 10px; padding: 26px; }
.pillar-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand-2); }
.pillar-icon svg { width: 24px; height: 24px; }
.pillar h3 { margin: 6px 0 0; font-size: 1.3rem; }
.pillar p { margin: 0; color: var(--ink-2); }
.pillar .more { margin-top: auto; padding-top: 6px; font-weight: 600; font-size: .92rem; color: var(--brand-2); }
.pillar .stat { font-family: var(--font-serif); font-size: .95rem; color: var(--ink-3); }

.rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; counter-reset: rule; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.rule { padding: 24px; border-right: 1px solid var(--line); counter-increment: rule; }
.rule:last-child { border-right: 0; }
.rule::before { content: counter(rule, decimal-leading-zero); display: block; font-family: var(--font-serif); font-size: 2rem; color: var(--accent); -webkit-text-stroke: 1px var(--brand-2); color: transparent; margin-bottom: 8px; }
.rule h3 { font-size: 1.05rem; margin-bottom: 6px; }
.rule p { color: var(--ink-2); font-size: .93rem; margin: 0; }
@media (max-width: 900px) { .rules { grid-template-columns: 1fr 1fr; } .rule:nth-child(2) { border-right: 0; } .rule:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
@media (max-width: 560px) { .rules { grid-template-columns: 1fr; } .rule { border-right: 0; border-bottom: 1px solid var(--line); } .rule:last-child { border-bottom: 0; } }

.band { background: var(--brand); color: var(--brand-ink); border-radius: calc(var(--radius) + 6px); padding: 40px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.band::after { content: ""; position: absolute; right: -80px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 35%, transparent); filter: blur(10px); }
.band h2, .band p { color: inherit; position: relative; z-index: 1; }
.band p { opacity: .85; margin: 0; }
.band .btn { position: relative; z-index: 1; background: var(--accent); color: #1a2405; }
.band .btn:hover { background: #c9e352; }
@media (max-width: 700px) { .band { grid-template-columns: 1fr; padding: 28px; } }

/* ---------- Protocol cards ---------- */
.protocol-card { display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 22px; }
.protocol-card .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.protocol-card h3 { margin: 0; font-size: 1.22rem; }
.protocol-card .sub { margin: -4px 0 0; color: var(--ink-2); font-size: .93rem; }
.protocol-card .components { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.protocol-card .components li { font-size: .8rem; color: var(--ink-2); background: var(--surface-2); padding: 4px 9px; border-radius: 6px; }
.protocol-card .foot { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: .84rem; color: var(--ink-3); }
.protocol-card .targets { display: flex; flex-wrap: wrap; gap: 6px; }
.go { font-weight: 600; color: var(--brand-2); font-size: .9rem; white-space: nowrap; }

.intensity { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--ink-3); white-space: nowrap; }
.intensity .dots { display: inline-flex; gap: 3px; }
.intensity .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.intensity[data-level="1"] .dots i:nth-child(-n+1),
.intensity[data-level="2"] .dots i:nth-child(-n+2),
.intensity[data-level="3"] .dots i:nth-child(-n+3) { background: var(--brand-2); }
.intensity[data-level="3"] .dots i { background: var(--c-iv); }

/* table view */
.view-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; background: var(--surface); }
.view-toggle button { font: 500 .85rem var(--font-sans); background: none; border: 0; color: var(--ink-2); padding: 7px 12px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.view-toggle button.is-active { background: var(--surface-2); color: var(--ink); }
.view-toggle svg { width: 15px; height: 15px; }

.compare-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.compare { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 760px; }
.compare th, .compare td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare th { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.compare tr:last-child td { border-bottom: 0; }
.compare td a { font-weight: 600; color: var(--ink); text-decoration: none; }
.compare td a:hover { color: var(--brand-2); text-decoration: underline; }
/* Phones: each protocol becomes a card instead of a wide table row */
@media (max-width: 720px) {
  .compare-wrap { overflow: visible; border: 0; border-radius: 0; background: none; }
  .compare, .compare tbody { display: block; min-width: 0; }
  .compare thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .compare tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
  .compare tr[hidden] { display: none; }
  .compare td { display: block; padding: 0; border: 0; }
  .compare .cmp-title { flex: 1 0 100%; font-size: 1.02rem; line-height: 1.3; }
  .compare .cmp-type { order: 1; }
  .compare .cmp-intensity { order: 2; }
  .compare .cmp-rx { order: 3; }
  .compare .cmp-rx::before { content: attr(data-label) ": "; color: var(--ink-3); }
  .compare .cmp-components, .compare .cmp-targets { order: 4; flex: 1 0 100%; }
  .compare .cmp-components::before, .compare .cmp-targets::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
}

/* ---------- Protocol detail ---------- */
.detail-hero { padding: 36px 0 30px; border-bottom: 1px solid var(--line); background: radial-gradient(900px 300px at 90% -20%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%); }
.detail-hero .badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.detail-hero h1 { max-width: 22ch; }
.detail-hero .subtitle { font-size: 1.15rem; color: var(--ink-2); margin: 0; max-width: 60ch; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.fact { padding: 14px 18px; border-right: 1px solid var(--line); }
.fact:last-child { border-right: 0; }
.fact dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; margin-bottom: 4px; }
.fact dd { margin: 0; font-size: .95rem; font-weight: 500; }
@media (max-width: 760px) { .facts { grid-template-columns: 1fr 1fr; } .fact:nth-child(2) { border-right: 0; } .fact:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; padding-top: 40px; padding-bottom: 64px; }
svg.inline { width: 14px; height: 14px; display: inline-block; vertical-align: -2px; }
@media (max-width: 960px) { .detail-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; } }
.detail-main, .aside-card { min-width: 0; }
.detail-main > section { margin-bottom: 40px; }
.detail-main h2 { font-size: 1.5rem; }
.summary-lead { font-size: 1.15rem; color: var(--ink); line-height: 1.65; }

.regimen { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.regimen-row { display: grid; grid-template-columns: 34px minmax(0, 1.2fr) minmax(0, 1fr) 86px; gap: 16px; align-items: start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.regimen-row:last-child { border-bottom: 0; }
.regimen-row .n { width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); color: var(--brand-2); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.regimen-row .name { font-weight: 600; }
.regimen-row .notes { font-size: .86rem; color: var(--ink-3); margin-top: 2px; }
.regimen-row .dose { font-size: .94rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.regimen-row .dose-label { display: none; }
.regimen-head { background: var(--surface-2); padding: 10px 18px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); font-weight: 600; }
.regimen-head.regimen-row { border-bottom: 1px solid var(--line); }
@media (max-width: 640px) {
  .regimen-head { display: none; }
  .regimen-row { grid-template-columns: 30px 1fr; }
  .regimen-row .dose, .regimen-row .buy { grid-column: 2; }
  .regimen-row .dose-label { display: inline; color: var(--ink-3); font-size: .8rem; }
}

.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { position: relative; padding: 12px 14px 12px 44px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.checklist li::before { content: ""; position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); border: 1.5px solid var(--brand-2); }
.checklist li::after { content: ""; position: absolute; left: 20px; top: 19px; width: 6px; height: 9px; border: solid var(--brand-2); border-width: 0 2px 2px 0; transform: rotate(45deg); }

.prose { font-size: 1.02rem; }
.prose h2 { margin-top: 1.6em; font-size: 1.35rem; }
.prose h3 { margin-top: 1.4em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin-bottom: .35em; }
.prose blockquote { margin: 1em 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-2); }
.prose code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: .9em; }
.prose > :first-child { margin-top: 0; }

.aside-card { display: flex; flex-direction: column; gap: 16px; }
.toc { position: sticky; top: calc(88px + env(safe-area-inset-top)); max-height: calc(100vh - 110px); overflow-y: auto; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.toc a { display: block; padding: 6px 10px; margin: 0 -10px; border-radius: 8px; font-size: .9rem; color: var(--ink-2); text-decoration: none; line-height: 1.35; }
.toc a:hover { background: var(--surface-2); color: var(--ink); }
.toc a.is-current { color: var(--brand); background: var(--surface-2); font-weight: 600; }
@media (max-width: 960px) { .toc { position: static; max-height: none; } }
.prose h2, .prose h3 { scroll-margin-top: 90px; }
#the-regimen, #discussion { scroll-margin-top: 90px; }
.md-table-wrap { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.md-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.md-table th, .md-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md-table th { background: var(--surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.md-table tr:last-child td { border-bottom: 0; }
.md-table td:first-child { font-weight: 600; white-space: nowrap; }
/* Phones: each row becomes a small card, with the column name beside every value */
@media (max-width: 600px) {
  .md-table-wrap { overflow: visible; }
  .md-table, .md-table tbody, .md-table tr { display: block; }
  .md-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .md-table tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .md-table tr:last-child { border-bottom: 0; }
  .md-table td { display: grid; grid-template-columns: minmax(84px, 36%) 1fr; gap: 10px; padding: 3px 0; border: 0; font-size: .9rem; }
  .md-table td::before { content: attr(data-label); font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding-top: 2px; }
  .md-table td:first-child { display: block; padding: 0 0 4px; font-size: .98rem; white-space: normal; }
  .md-table td:first-child::before { content: none; }
}
.aside-card .card { padding: 20px; }
.aside-card h3 { font-size: 1rem; font-family: var(--font-sans); font-weight: 700; margin-bottom: 10px; }
.source-box { font-size: .92rem; }
.source-box a { word-break: break-word; }
.related-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.related-list a { display: block; padding: 8px 10px; margin: 0 -10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .93rem; }
.related-list a:hover { background: var(--surface-2); }
.related-list small { display: block; color: var(--ink-3); font-size: .8rem; }

.notice { display: flex; gap: 12px; padding: 16px 18px; border-radius: var(--radius); background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); font-size: .93rem; }
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice p { margin: 0; }
.notice strong { color: inherit; }
.notice-info { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }

/* ---------- Research ---------- */
.paper { padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.paper .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .82rem; color: var(--ink-3); }
.paper .year { font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.paper .journal { font-style: italic; }
.paper h3 { margin: 0; font-size: 1.14rem; line-height: 1.3; }
.paper h3 a { color: var(--ink); text-decoration: none; }
.paper h3 a:hover { color: var(--brand-2); text-decoration: underline; }
.paper .authors { font-size: .86rem; color: var(--ink-3); margin: 0; }
.paper .summary { margin: 4px 0 0; color: var(--ink-2); font-size: .96rem; }
.paper .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; align-items: center; }
.paper details { margin-top: 4px; }
.paper summary { cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--brand-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.paper summary::-webkit-details-marker { display: none; }
.paper summary::before { content: "+"; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid currentColor; font-size: .8rem; line-height: 1; }
.paper details[open] summary::before { content: "−"; }
.paper .abstract { margin-top: 10px; font-size: .9rem; color: var(--ink-2); background: var(--surface-2); padding: 14px 16px; border-radius: var(--radius-sm); white-space: pre-line; }
.paper.is-featured { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.link-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .82rem; font-weight: 600; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); text-decoration: none; }
.link-pill:hover { border-color: var(--brand-2); color: var(--brand-2); }
.link-pill.oa { border-color: color-mix(in srgb, var(--c-herbal) 50%, transparent); color: var(--c-herbal); background: var(--c-herbal-bg); }
.link-pill svg { width: 13px; height: 13px; }

/* ---------- Supplements ---------- */
.disclosure { font-size: .86rem; color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.disclosure svg { width: 16px; height: 16px; flex: none; }
.supp { display: flex; flex-direction: column; padding: 0; overflow: hidden; height: 100%; }
.supp-media { height: 150px; background: linear-gradient(135deg, var(--surface-2), var(--accent-soft)); display: grid; place-items: center; position: relative; border-bottom: 1px solid var(--line); }
.supp-media img { width: 100%; height: 100%; object-fit: contain; padding: 14px; background: #fff; }
.supp-mono { font-family: var(--font-serif); font-size: 2.4rem; color: var(--brand-2); opacity: .9; }
.supp-media .badge { position: absolute; left: 12px; top: 12px; }
.supp-media .star { position: absolute; right: 12px; top: 12px; font-size: .74rem; font-weight: 700; background: var(--accent); color: #1a2405; padding: 4px 9px; border-radius: 999px; }
.supp-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.supp-body h3 { margin: 0; font-size: 1.12rem; }
.supp-brand { font-size: .82rem; color: var(--ink-3); margin-top: -4px; }
.supp-body p { margin: 0; color: var(--ink-2); font-size: .93rem; }
.supp-dose { font-size: .86rem; color: var(--ink-2); background: var(--surface-2); padding: 9px 12px; border-radius: 8px; }
.supp-dose b { color: var(--ink); font-weight: 600; }
.supp-caution { font-size: .82rem; color: var(--warn-ink); }
.supp-used { font-size: .82rem; color: var(--ink-3); }
.supp-used a { color: var(--ink-2); }
.supp-foot { margin-top: auto; padding-top: 10px; }
.supp-foot .btn { width: 100%; }

/* ---------- FAQ ---------- */
.faq { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { list-style: none; cursor: pointer; padding: 18px 56px 18px 22px; font-weight: 600; font-size: 1.04rem; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 24px; top: 50%; width: 10px; height: 10px; border: solid var(--ink-3); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); transition: transform .2s; }
.faq details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.faq summary:hover { background: var(--surface-2); }
.faq .answer { padding: 0 22px 20px; color: var(--ink-2); }

.steps { display: grid; gap: 14px; counter-reset: step; }
.step { display: grid; grid-template-columns: 48px 1fr; gap: 16px; padding: 20px; counter-increment: step; }
.step::before { content: counter(step); width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-family: var(--font-serif); font-size: 1.1rem; }
.step h3 { margin: 6px 0 6px; font-size: 1.1rem; }
.step p, .step ul { margin: 0; color: var(--ink-2); }
.step ul { padding-left: 1.2em; }
.step li { margin-bottom: 3px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- Tick labs ---------- */
.lab { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.lab h3 { margin: 0; font-size: 1.1rem; }
.lab dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: .88rem; }
.lab dt { color: var(--ink-3); font-weight: 500; }
.lab dd { margin: 0; color: var(--ink-2); }
.lab p { margin: 0; font-size: .92rem; color: var(--ink-2); }
.lab .price { font-weight: 600; color: var(--ink); }
.lab .foot { margin-top: auto; padding-top: 8px; }

/* ---------- Resources ---------- */
.res { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.res h3 { margin: 0; font-size: 1.05rem; font-family: var(--font-sans); font-weight: 650; }
.res .by { font-size: .84rem; color: var(--ink-3); margin: 0; }
.res p { margin: 0; font-size: .92rem; color: var(--ink-2); }
.res .host { font-size: .8rem; color: var(--ink-3); margin-top: auto; padding-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.res-group { margin-bottom: 44px; }
.res-group h2 { display: flex; align-items: baseline; gap: 10px; }
.res-group h2 small { font-family: var(--font-sans); font-size: .9rem; color: var(--ink-3); font-weight: 500; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 40px; border-top: 1px solid var(--line); background: var(--surface); padding: 48px 0 28px; font-size: .92rem; color: var(--ink-2); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 32px; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { font-family: var(--font-sans); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--brand-2); text-decoration: underline; }
.footer-legal { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--ink-3); display: grid; gap: 8px; }
.theme-toggle { background: none; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 999px; padding: 6px 12px; font: 500 .82rem var(--font-sans); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.theme-toggle svg { width: 14px; height: 14px; }

/* ---------- Search page ---------- */
.search-group { margin-bottom: 36px; }
.search-group h2 { font-size: 1.2rem; font-family: var(--font-sans); font-weight: 700; }
.search-hit { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.search-hit:hover strong { color: var(--brand-2); text-decoration: underline; }
.search-hit strong { display: block; color: var(--ink); }
.search-hit span { font-size: .9rem; color: var(--ink-2); }
mark { background: var(--accent-soft); color: inherit; padding: 0 2px; border-radius: 3px; }

/* ---------- Forms & flashes (shared with admin) ---------- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: .93rem; border: 1px solid var(--line); background: var(--surface); }
.flash-success { background: var(--c-herbal-bg); border-color: color-mix(in srgb, var(--c-herbal) 30%, transparent); color: var(--c-herbal); }
.flash-error { background: var(--c-iv-bg); border-color: color-mix(in srgb, var(--c-iv) 30%, transparent); color: var(--c-iv); }
.flash-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.flash a { color: inherit; font-weight: 600; }

/* Forms */
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 0; border: 0; padding: 0; min-width: 0; }
.field > span, .field legend, .field-label { font-size: .86rem; font-weight: 600; color: var(--ink); display: inline-flex; align-items: center; gap: 6px; }
.field > span svg, .field-label svg { width: 16px; height: 16px; color: var(--brand-2); }
.field legend { margin-bottom: 6px; }
.md-hint { font-style: normal; font-weight: 500; font-size: .72rem; color: var(--ink-3); background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
.field-input {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.field-input { resize: vertical; line-height: 1.5; }
.field-input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 18%, transparent); }
.help { font-size: .82rem; color: var(--ink-3); margin: 6px 0 0; }
.help code, .settings-grid code { font-size: .8rem; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
.field-error { font-size: .84rem; color: var(--c-iv); margin: 6px 0 0; font-weight: 500; }
.check { display: flex; align-items: center; gap: 8px; font-size: .93rem; padding: 3px 0; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand-2); }
.flash-info { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); }
.flash-wrap { padding-top: 18px; }
.flash-wrap .flash:last-child { margin-bottom: 0; }
.linkish { display: inline-flex; align-items: center; gap: 5px; background: none; border: 0; padding: 0; font: inherit; font-size: .86rem; color: var(--ink-3); cursor: pointer; text-decoration: none; }
.linkish:hover { color: var(--brand-2); }
.linkish svg { width: 15px; height: 15px; }
.linkish.danger { color: var(--c-iv); }
.linkish.ok { color: var(--c-herbal); font-weight: 600; }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Community ---------- */
.header-signin { font-size: .92rem; font-weight: 600; color: var(--brand); text-decoration: none; padding: 7px 14px; border: 1px solid var(--line-2); border-radius: 999px; white-space: nowrap; }
.header-signin:hover { background: var(--surface-2); color: var(--brand); }
.header-account { display: inline-flex; text-decoration: none; }
@media (max-width: 1100px) {
  .nav-toggle { display: inline-flex; }
  .main-nav { position: absolute; left: 0; right: 0; top: 66px; flex-direction: column; align-items: stretch; gap: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; box-shadow: var(--shadow); display: none; }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 12px 10px; border-radius: 10px; font-size: 1rem; }
}

.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-size: .82rem; font-weight: 700; flex: none; letter-spacing: .02em; }
.avatar-sm { width: 34px; height: 34px; font-size: .74rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.2rem; }
.avatar-violet { background: var(--c-persister-bg); color: var(--c-persister); }
.avatar-aqua { background: #dff3f1; color: #1b6f68; }
.avatar-green { background: var(--c-herbal-bg); color: var(--c-herbal); }
.avatar-orange { background: var(--c-support-bg); color: var(--c-support); }
.avatar-blue { background: var(--c-antibiotic-bg); color: var(--c-antibiotic); }
.avatar-magenta { background: var(--c-iv-bg); color: var(--c-iv); }
:root[data-theme="dark"] .avatar-aqua { background: #123331; color: #7fd6cd; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar-aqua { background: #123331; color: #7fd6cd; } }

.ttag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; vertical-align: 1px; white-space: nowrap; }
.ttag-accent { background: var(--c-antibiotic-bg); color: var(--c-antibiotic); }
.ttag-success { background: var(--c-herbal-bg); color: var(--c-herbal); }
.ttag-warning { background: var(--c-support-bg); color: var(--c-support); }
.ttag-violet { background: var(--c-persister-bg); color: var(--c-persister); }
.ttag-neutral { background: var(--surface-3); color: var(--ink-2); }
.mbadge { display: inline-flex; align-items: center; gap: 4px; font-size: .7rem; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.mbadge-mod { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.mbadge-pending { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.mbadge-hidden { background: var(--c-iv-bg); color: var(--c-iv); border-color: transparent; }

.thread-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.thread-row { display: grid; grid-template-columns: minmax(0, 1fr) 62px 76px; gap: 14px; align-items: center; padding: 13px 18px; border-bottom: 1px solid var(--line); }
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.thread-row.is-pinned { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.tr-title { display: block; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.4; }
.tr-title:hover { color: var(--brand-2); }
.tr-pin { width: 14px; height: 14px; color: var(--ink-3); vertical-align: -2px; margin-right: 4px; }
.tr-sub { font-size: .82rem; color: var(--ink-3); margin-top: 2px; }
.tr-sub a { color: var(--ink-2); }
.unanswered { color: var(--warn-ink); }
.tr-count { display: inline-flex; align-items: center; justify-content: center; gap: 5px; font-size: .86rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tr-count svg { width: 15px; height: 15px; color: var(--ink-3); }
.tr-time { font-size: .8rem; color: var(--ink-3); text-align: right; white-space: nowrap; }
@media (max-width: 600px) {
  .thread-row { grid-template-columns: minmax(0, 1fr) auto; padding: 12px 14px; }
  .tr-time { display: none; }
}
.empty-threads { padding: 28px 18px; text-align: center; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.thread-list .empty-threads { border: 0; border-radius: 0; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.pager a, .pager span { min-width: 36px; text-align: center; padding: 7px 11px; border-radius: 8px; font-size: .9rem; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink-2); }
.pager .is-current { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pager .gap { border: 0; background: none; }

.community-hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.community-cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; max-width: 320px; }
.community-cta p { flex-basis: 100%; text-align: right; }
.community-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
@media (max-width: 960px) { .community-grid { grid-template-columns: 1fr; } .community-cta { justify-content: flex-start; } .community-cta p { text-align: left; } }
.hub-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.community-side { display: flex; flex-direction: column; gap: 16px; }
.community-side .card { padding: 18px; }
.community-side h3 { font-family: var(--font-sans); font-size: .95rem; font-weight: 700; margin-bottom: 10px; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-list li { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.side-list a { display: block; padding: 7px 10px; margin: 0 -10px; border-radius: 8px; text-decoration: none; color: var(--ink); flex: 1; min-width: 0; }
.side-list a:hover { background: var(--surface-2); }
.side-list strong { display: block; font-size: .92rem; font-weight: 600; }
.side-list small { display: block; font-size: .78rem; color: var(--ink-3); }
.side-list .count { font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.crisis-note { display: flex; gap: 10px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); font-size: .86rem; color: var(--ink-2); }
.crisis-note svg { width: 18px; height: 18px; flex: none; color: var(--brand-2); margin-top: 2px; }
.crisis-note p { margin: 0; }

.board-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; }
.board-head h1 { max-width: 26ch; }

.thread-hero { padding-bottom: 22px; }
.thread-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.thread-title-row h1 { font-size: clamp(1.6rem, 3.2vw, 2.3rem); max-width: 30ch; }
.thread-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mod-inline { display: flex; gap: 6px; }

.posts { display: flex; flex-direction: column; gap: 14px; }
.post { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); scroll-margin-top: 90px; }
.post:target { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 15%, transparent); }
.post.is-first { border-color: var(--line-2); }
.post.is-pending { background: color-mix(in srgb, var(--warn-bg) 50%, var(--surface)); border-style: dashed; }
.post.is-hidden { opacity: .6; }
.post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 6px; }
.post-author { font-size: .95rem; }
.post-time { font-size: .8rem; color: var(--ink-3); text-decoration: none; }
.post-body { font-size: 1rem; line-height: 1.65; overflow-wrap: anywhere; }
.post-body p { margin: 0 0 .8em; }
.post-body p:last-child { margin-bottom: 0; }
.post-quote { margin: 4px 0 10px; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: .88rem; color: var(--ink-2); }
.post-quote a { font-weight: 600; color: var(--ink-2); text-decoration: none; }
.post-actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 12px; }
.inline-form { display: inline-flex; gap: 12px; margin: 0; }
.report-box { position: relative; }
.report-box summary { list-style: none; }
.report-box summary::-webkit-details-marker { display: none; }
.report-box[open] .report-pop { position: absolute; z-index: 5; top: 26px; left: 0; width: 280px; padding: 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg); display: grid; gap: 12px; }
.block-form { padding-top: 10px; border-top: 1px solid var(--line); }
@media (max-width: 600px) { .post { grid-template-columns: 1fr; } .post-avatar { display: none; } }

.composer { margin-top: 28px; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.composer h2 { font-size: 1.25rem; }
.composer-foot { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.composer-foot .help { flex: 1 1 280px; }
.quote-preview { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: .88rem; color: var(--ink-2); }
.join-card { display: flex; gap: 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; padding: 22px; background: linear-gradient(135deg, var(--surface), var(--accent-soft)); border: 1px solid var(--line); border-radius: var(--radius); }
.join-card h3 { margin: 0 0 4px; }
.join-card p { margin: 0; }
.join-actions { display: flex; gap: 10px; }
.composer .join-card { border: 0; padding: 0; background: none; }

.discussion-preview { margin-bottom: 40px; }
.dp-head { display: flex; justify-content: space-between; align-items: end; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.dp-head h2 { margin: 0; }
.dp-head p { margin: 4px 0 0; }
.link-pill.discuss { color: var(--brand-2); border-color: color-mix(in srgb, var(--brand-2) 40%, transparent); }
.lab-foot { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.supp-discuss { margin-top: 2px; }
.supp-filter { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--brand-2) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand-2) 25%, transparent); }
.supp-filter > div { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.supp-filter > div svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--brand-2); }
.supp-filter p { margin: 0; }

/* "Discuss" pill near the top of content pages */
.discuss-cta { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 16px; padding: 7px 14px; border-radius: 999px; font-size: .88rem; font-weight: 600; color: var(--brand-2); text-decoration: none; background: color-mix(in srgb, var(--brand-2) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand-2) 30%, transparent); }
.discuss-cta:hover { border-color: var(--brand-2); }
.discuss-cta svg { width: 15px; height: 15px; flex: none; }
.discuss-cta .dc-count { font-weight: 500; color: var(--ink-3); }
.discuss-cta .dc-count::before { content: "·"; margin-right: 8px; color: var(--ink-3); }
.page-hero .discuss-cta + .disclosure { margin-top: 12px !important; }
.detail-hero .discuss-cta { margin-top: 14px; }
@media print { .discuss-cta { display: none; } }

.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-option { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer; background: var(--surface); }
.tag-option:has(input:checked) { border-color: var(--brand-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-2) 20%, transparent); }
.tag-option input { accent-color: var(--brand-2); }

.auth-wrap { display: grid; place-items: center; padding: 56px 16px; }
.auth-panel { width: 100%; max-width: 460px; padding: 30px; display: flex; flex-direction: column; gap: 12px; }
.auth-panel h1 { font-size: 1.8rem; margin: 0; }
.auth-panel .form-stack .help { margin-top: -8px; }
.resend { margin: -4px 0 4px; }
.account-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.account-head h1 { margin: 0 0 4px; }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.account-grid h2 { font-size: 1.2rem; font-family: var(--font-sans); font-weight: 700; }
@media (max-width: 860px) { .account-grid { grid-template-columns: 1fr; } }
.check-row { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.follow-list { list-style: none; margin: 0; padding: 0; }
.follow-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.follow-list li:last-child { border-bottom: 0; }
.follow-list a { font-weight: 600; text-decoration: none; color: var(--ink); }
.follow-list form { margin-left: auto; }
.danger-details { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.danger-details summary { cursor: pointer; color: var(--c-iv); font-size: .9rem; font-weight: 600; }
.btn-danger { color: var(--c-iv); border-color: color-mix(in srgb, var(--c-iv) 40%, transparent); }

.queue { display: grid; gap: 32px; }
.queue h2 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; }
.count-pill { font-family: var(--font-sans); font-size: .8rem; font-weight: 700; background: var(--surface-3); color: var(--ink-2); padding: 2px 9px; border-radius: 999px; }
.queue-item { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; padding: 18px; }
.qi-head { display: flex; gap: 12px; align-items: flex-start; }
.qi-head span, .qi-head div { display: block; }
.qi-body { padding: 12px 14px; background: var(--surface-2); border-radius: 10px; font-size: .95rem; }
.qi-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }

/* ---------- Helpful, best answer, protocol badges ---------- */
.helpful { display: inline-flex; align-items: center; gap: 5px; font: 500 .84rem var(--font-sans); color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; cursor: pointer; transition: color .15s, background .15s, border-color .15s; }
.helpful svg { width: 15px; height: 15px; }
.helpful:hover:not(:disabled) { color: var(--c-iv); border-color: color-mix(in srgb, var(--c-iv) 40%, transparent); }
.helpful.is-on { color: var(--c-iv); background: var(--c-iv-bg); border-color: color-mix(in srgb, var(--c-iv) 35%, transparent); }
.helpful.is-on svg { fill: currentColor; }
.helpful:disabled { cursor: default; opacity: .85; }
.helpful-count { font-variant-numeric: tabular-nums; font-weight: 700; }
.helpful-count:empty { display: none; }
.mbadge-best { background: var(--c-herbal-bg); color: var(--c-herbal); border-color: color-mix(in srgb, var(--c-herbal) 35%, transparent); }
.mbadge-on { background: var(--accent-soft); color: var(--brand); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.mbadge-done { background: var(--surface-2); color: var(--ink-2); }
.mbadge svg.inline { width: 12px; height: 12px; }
.post.is-best { border-color: color-mix(in srgb, var(--c-herbal) 55%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-herbal) 10%, transparent); }
.best-callout { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin-bottom: 14px; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--c-herbal) 40%, var(--line)); background: color-mix(in srgb, var(--c-herbal-bg) 60%, var(--surface)); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.best-by { font-weight: 600; font-size: .9rem; }
.best-text { color: var(--ink-2); font-size: .92rem; flex: 1 1 300px; }
.best-jump { font-size: .85rem; font-weight: 600; color: var(--c-herbal); }
.answered { color: var(--c-herbal); font-weight: 600; }
.answered svg.inline { width: 12px; height: 12px; }
.post-blocked { display: block; padding: 12px 18px; color: var(--ink-3); font-size: .9rem; background: var(--surface-2); }
.post-blocked summary { cursor: pointer; list-style: none; }
.post-blocked .post-body { margin-top: 10px; color: var(--ink-2); }
a.post-author { color: var(--ink); font-weight: 700; text-decoration: none; }
a.post-author:hover { color: var(--brand-2); text-decoration: underline; }
.tr-sub a { text-decoration: none; }
.tr-sub a:hover { text-decoration: underline; }

.on-card .on-stats { margin: 0 0 12px; font-size: .92rem; color: var(--ink-2); }
.on-card .on-stats strong { font-family: var(--font-serif); font-size: 1.3rem; color: var(--ink); }
.on-form { display: grid; gap: 10px; }
.on-buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.on-mine { margin: 0 0 10px; font-weight: 600; color: var(--brand); font-size: .93rem; }
.on-count { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; color: var(--ink-3); margin-left: auto; margin-right: 10px; }
.on-count svg { width: 14px; height: 14px; }

/* ---------- Header bell & member nav ---------- */
.header-bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 999px; color: var(--ink-2); text-decoration: none; }
.header-bell:hover { background: var(--surface-2); color: var(--ink); }
.header-bell svg, .header-search svg { width: 20px; height: 20px; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--c-iv); color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--c-iv); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; }
.nav-member, .nav-member-sep { display: none; }
@media (max-width: 1100px) {
  .main-nav .nav-member { display: block; }
  .main-nav .nav-member-sep { display: block; height: 1px; background: var(--line); margin: 8px 0; }
}

/* ---------- Notifications & inbox ---------- */
.notif-list, .inbox-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.notif-list li, .inbox-list li { border-bottom: 1px solid var(--line); }
.notif-list li:last-child, .inbox-list li:last-child { border-bottom: 0; }
.notif-list a, .inbox-list a { display: flex; gap: 14px; align-items: center; padding: 14px 18px; text-decoration: none; color: var(--ink); }
.notif-list a:hover, .inbox-list a:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.notif-list li.is-unread, .inbox-list li.is-unread { background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
.notif-icon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--brand-2); }
.notif-icon svg { width: 17px; height: 17px; }
.notif-helpful { background: var(--c-iv-bg); color: var(--c-iv); }
.notif-best, .notif-approved { background: var(--c-herbal-bg); color: var(--c-herbal); }
.notif-message { background: var(--c-antibiotic-bg); color: var(--c-antibiotic); }
.notif-text { flex: 1; font-size: .94rem; line-height: 1.45; min-width: 0; }
.notif-text strong { font-weight: 600; }
.notif-text small { display: block; color: var(--ink-3); font-size: .78rem; margin-top: 2px; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c-iv); flex: none; }
.inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.inbox-snippet { color: var(--ink-3); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-list li.is-unread .inbox-snippet { color: var(--ink); font-weight: 500; }
.inbox-time { font-size: .78rem; color: var(--ink-3); white-space: nowrap; }

/* ---------- Conversation ---------- */
/* ---------- Private message chat ---------- */
.chat-app { position: relative; display: flex; flex-direction: column; max-width: 820px; height: calc(100dvh - 150px); min-height: 460px; margin: 24px auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.chat-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; list-style: none; flex: none; }
.chat-icon-btn::-webkit-details-marker { display: none; }
.chat-icon-btn:hover, .chat-icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--brand-2); }
.chat-icon-btn svg { width: 22px; height: 22px; }
.chat-peer { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--ink); text-decoration: none; }
.chat-peer-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.chat-peer strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-peer small { color: var(--ink-3); font-size: .78rem; }
.chat-menu { position: relative; }
.chat-menu-pop { position: absolute; right: 0; top: 46px; z-index: 30; min-width: 210px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.chat-menu-pop a, .chat-menu-pop button { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: .95rem; text-align: left; text-decoration: none; cursor: pointer; }
.chat-menu-pop a:hover, .chat-menu-pop button:hover { background: var(--surface-2); }
.chat-menu-pop .is-danger { color: #b42318; }
.chat-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.chat-empty { margin: auto; text-align: center; color: var(--ink-2); max-width: 34ch; }
.chat-empty .avatar { margin: 0 auto 10px; }
.chat-empty p { margin: 4px 0; }
.chat-note { align-self: center; max-width: 92%; margin: 6px 0; padding: 8px 12px; border-radius: 12px; font-size: .86rem; text-align: center; background: var(--surface-2); color: var(--ink-2); }
.chat-note-error { background: color-mix(in srgb, #d92d20 12%, var(--surface)); color: var(--ink); }
.chat-note-success, .chat-note-info { background: color-mix(in srgb, var(--brand-2) 12%, var(--surface)); color: var(--ink); }
.chat-day { align-self: center; font-size: .72rem; font-weight: 600; color: var(--ink-3); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; margin: 12px 0 6px; }
.bubble-row { display: flex; flex-direction: column; align-items: flex-start; scroll-margin-top: 20px; }
.bubble-row.is-mine { align-items: flex-end; }
.bubble { position: relative; max-width: min(80%, 560px); padding: 8px 12px 5px; border-radius: 18px 18px 18px 6px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.bubble-row.is-mine .bubble { border-radius: 18px 18px 6px 18px; background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.bubble-row.is-mine .bubble a { color: inherit; }
.bubble .post-body { font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.bubble .post-body p { margin: 0 0 .4em; }
.bubble .post-body p:last-child { margin: 0; }
.bubble-meta { font-size: .68rem; opacity: .7; text-align: right; margin-top: 1px; }
.bubble-row.is-emoji .bubble { background: none; border-color: transparent; padding: 0 2px; }
.bubble-row.is-emoji .post-body { font-size: 2.6rem; line-height: 1.15; }
.bubble-row.is-emoji.is-mine .bubble { color: var(--ink); }
.bubble.is-selected { outline: 2px solid color-mix(in srgb, var(--brand-2) 55%, transparent); outline-offset: 2px; }
.react-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 8px 4px; position: relative; z-index: 1; }
.react-chips:empty { display: none; }
.react-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .9rem; line-height: 1.3; cursor: pointer; box-shadow: var(--shadow-sm); }
.react-chip b { font-size: .72rem; font-weight: 600; color: var(--ink-3); }
.react-chip.is-mine { border-color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 12%, var(--surface)); }
.react-tray { display: flex; align-items: center; gap: 2px; margin: 4px 0 6px; padding: 4px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-lg); animation: tray-in .14s ease-out; }
.react-tray button { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; font-size: 1.45rem; cursor: pointer; transition: transform .12s; }
.react-tray button:hover, .react-tray button:focus-visible { transform: scale(1.18); background: var(--surface-2); }
.react-tray button.is-mine { background: color-mix(in srgb, var(--brand-2) 16%, var(--surface)); }
.react-tray .react-more { width: auto; padding: 0 12px; font-size: .82rem; font-weight: 600; color: var(--ink-2); border-radius: 999px; }
@keyframes tray-in { from { opacity: 0; transform: translateY(4px) scale(.96); } to { opacity: 1; transform: none; } }
.chat-foot { flex: none; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px; }
.chat-form { display: flex; gap: 6px; align-items: flex-end; }
.chat-input { flex: 1; min-height: 42px; max-height: 140px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 21px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.35; resize: none; }
.chat-input:focus { outline: none; border-color: var(--brand-2); }
.chat-input { box-sizing: border-box; scrollbar-width: none; }
.chat-input::-webkit-scrollbar { display: none; }
.chat-send { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--brand); color: var(--brand-ink); cursor: pointer; }
.chat-send svg { width: 20px; height: 20px; margin-left: -2px; }
.chat-send:disabled { opacity: .5; }
.emoji-panel { margin: -8px -10px 8px; border-bottom: 1px solid var(--line); }
.emoji-tabs { display: flex; overflow-x: auto; padding: 0 6px; scrollbar-width: none; }
.emoji-tabs::-webkit-scrollbar { display: none; }
.emoji-tabs button { flex: 1 0 auto; min-width: 44px; padding: 8px 6px 6px; border: 0; border-bottom: 2px solid transparent; background: none; font-size: 1.25rem; cursor: pointer; }
.emoji-tabs button[aria-selected="true"] { border-bottom-color: var(--brand-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); height: 220px; overflow-y: auto; padding: 6px 8px; align-content: start; }
.emoji-grid button { height: 42px; border: 0; border-radius: 10px; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.emoji-grid button:hover, .emoji-grid button:focus-visible { background: var(--surface-2); }
.emoji-grid .emoji-empty { grid-column: 1 / -1; padding: 24px 8px; text-align: center; color: var(--ink-3); font-size: .9rem; }
.chat-dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(92vw, 380px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.chat-dialog::backdrop { background: rgba(10, 20, 14, .45); }
.chat-dialog h3 { margin: 0; }
.chat-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Phones: the chat takes over the whole screen, like a messaging app */
@media (max-width: 720px) {
  body.is-chat { overflow: hidden; }
  body.is-chat .site-header, body.is-chat .site-footer, body.is-chat .flash-wrap, body.is-chat .push-prompt-wrap, body.is-chat .tabbar { display: none; }
  body.is-chat .chat-app { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vv-height, 100dvh); min-height: 0; margin: 0; max-width: none; border: 0; border-radius: 0; box-shadow: none; z-index: 60; }
  body.is-chat .chat-bar { padding-top: calc(8px + env(safe-area-inset-top)); padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  body.is-chat .chat-foot { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  body.is-chat.keyboard-open .chat-foot { padding-bottom: 8px; }
}

/* ---------- Profiles ---------- */
.profile-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.profile-id { flex: 1 1 320px; min-width: 0; }
.profile-id h1 { margin: 0 0 6px; font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
.profile-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-bio { margin: 12px 0 0; color: var(--ink-2); max-width: 60ch; }
.profile-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 28px; }
.stat-row > div { padding: 16px; text-align: center; border-right: 1px solid var(--line); }
.stat-row > div:last-child { border-right: 0; }
.stat-row strong { display: block; font-family: var(--font-serif); font-size: 1.6rem; }
.stat-row span { font-size: .8rem; color: var(--ink-3); }
@media (max-width: 560px) { .stat-row { grid-template-columns: 1fr 1fr; } .stat-row > div:nth-child(2) { border-right: 0; } .stat-row > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.profile-grid h2 { font-size: 1.25rem; }
.profile-grid aside .card { padding: 18px; }
.profile-grid aside h3 { font-family: var(--font-sans); font-size: .95rem; font-weight: 700; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }
.reply-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.reply-list li { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.reply-list a { font-weight: 600; color: var(--ink); text-decoration: none; }
.reply-list p { margin: 4px 0; color: var(--ink-2); font-size: .93rem; }
.proto-row { align-items: center; }
.proto-edit { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; flex-basis: 100%; margin-left: 0 !important; }
.proto-edit .field-input { width: auto; padding: 5px 8px; font-size: .85rem; }

/* ---------- App / mobile polish ---------- */
html { -webkit-tap-highlight-color: transparent; }
.site-header { padding-top: env(safe-area-inset-top); }
.main-nav { top: calc(66px + env(safe-area-inset-top)) !important; }
.site-footer { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.wrap { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (min-width: 720px) { .wrap { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); } }
@media (max-width: 760px) {
  /* iOS zooms into inputs smaller than 16px */
  .input, .select, .field-input, textarea { font-size: 16px !important; }
  .btn, .chip { min-height: 40px; }
}
@media (max-width: 400px) {
  .header-inner { gap: 6px; }
  .logo { font-size: 1.08rem; gap: 8px; }
  .logo-mark { width: 28px; height: 28px; }
  .header-search, .header-bell { width: 34px; height: 34px; }
  .nav-toggle { width: 38px; height: 38px; }
  .header-account .avatar-sm { width: 30px; height: 30px; }
  .header-signin { padding: 6px 10px; font-size: .85rem; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .aside-card .no-print, .no-print, .toolbar { display: none !important; }
  body { background: #fff; color: #000; }
  .detail-grid { grid-template-columns: 1fr; }
  .card, .regimen, .checklist li { box-shadow: none; }
  a { color: #000; }
}

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

/* ---------- iOS / Android app ---------- */
.push-prompt-wrap { padding-top: 14px; }
.push-prompt { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--brand-2) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand-2) 30%, transparent); }
.push-prompt strong { display: block; }
.push-prompt span { font-size: .9rem; color: var(--ink-2); }
.push-prompt-actions { display: flex; gap: 8px; }
.push-state { display: none; margin: 4px 0 0; }
html[data-push="default"] .push-state-default,
html[data-push="denied"] .push-state-denied,
html[data-push="granted"] .push-state-granted { display: block; }
.get-app a { font-weight: 600; }

/* ---------- Friends ---------- */
.chip svg { width: 15px; height: 15px; flex: none; }
.chips .chip { white-space: nowrap; }
.social-hero { padding-bottom: 0; }
.social-hero h1 { margin-bottom: 14px; }
.seg-tabs { display: flex; gap: 4px; }
.seg-tabs a { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; border-radius: 12px 12px 0 0; font-weight: 600; color: var(--ink-2); text-decoration: none; border-bottom: 3px solid transparent; }
.seg-tabs a:hover { color: var(--ink); }
.seg-tabs a.is-active { color: var(--brand-2); border-bottom-color: var(--brand-2); }
.seg-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #d92d20; color: #fff; font-size: .72rem; line-height: 20px; text-align: center; }
.inline-form { display: inline; margin: 0; }
.friend-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.friend-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
.friend-row:first-child { border-top: 0; }
.friend-row.is-unread { background: color-mix(in srgb, var(--brand-2) 6%, var(--surface)); }
.friend-who { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; color: var(--ink); text-decoration: none; }
.friend-who > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.friend-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-who small { color: var(--ink-3); font-size: .8rem; }
.friend-row.is-unread .friend-who small { color: var(--brand-2); font-weight: 600; }
.friend-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.friend-actions .btn { position: relative; }
.friend-actions .notif-dot { position: absolute; top: -3px; right: -3px; }
.btn.is-friend { color: var(--brand-2); border-color: color-mix(in srgb, var(--brand-2) 45%, transparent); }
.friend-h { font-size: 1.05rem; margin: 22px 0 10px; }
.friend-h:first-child { margin-top: 4px; }
.friend-alert { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--brand-2) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand-2) 30%, transparent); color: var(--ink); font-weight: 600; text-decoration: none; }
.friend-alert span { flex: 1; }
.friend-alert svg { width: 18px; height: 18px; color: var(--brand-2); flex: none; }
.friend-search { display: flex; gap: 8px; margin-bottom: 18px; }
.friend-search .search-field { flex: 1; }
.friend-strip { display: flex; gap: 6px; overflow-x: auto; margin: 0 -4px 18px; padding: 4px 4px 8px; scrollbar-width: none; }
.friend-strip::-webkit-scrollbar { display: none; }
.friend-strip a { flex: none; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; }
.friend-strip-av { position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; }
.friend-strip-av .avatar { width: 56px; height: 56px; font-size: 1rem; }
.friend-strip-av .notif-dot { position: absolute; top: 2px; right: 2px; box-shadow: 0 0 0 2px var(--bg); }
.friend-strip a.is-unread .friend-strip-name { color: var(--ink); font-weight: 700; }
.friend-strip-all .friend-strip-av { background: var(--surface); border: 1px dashed var(--line-2); color: var(--brand-2); }
.friend-strip-all svg { width: 24px; height: 24px; }
.friend-strip-name { font-size: .75rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) {
  .friend-row { flex-wrap: wrap; }
  .friend-actions { margin-left: 52px; }
  .friend-list .friend-row:has(.friend-actions .btn-primary:only-child) { flex-wrap: nowrap; }
  .friend-list .friend-row:has(.friend-actions .btn-primary:only-child) .friend-actions { margin-left: 0; }
}

/* ---------- Phone tab bar ---------- */
.tabbar { display: none; }
@media (max-width: 720px) {
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; justify-content: space-around; align-items: stretch; padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--surface) 94%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px); border-top: 1px solid var(--line); transition: transform .25s ease; }
  .tabbar.is-hidden { transform: translateY(110%); }
  .tabbar a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 4px; border-radius: 10px; color: var(--ink-3); text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .tabbar a.is-active { color: var(--brand-2); }
  .tabbar a:active { background: var(--surface-2); }
  .tab-icon { position: relative; display: inline-flex; }
  .tab-icon svg { width: 25px; height: 25px; stroke-width: 1.7; }
  .tabbar a.is-active .tab-icon svg { stroke-width: 2.3; }
  .tab-label { font-size: .7rem; font-weight: 600; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tab-badge { position: absolute; top: -5px; right: -9px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #d92d20; color: #fff; font-size: .65rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
  /* Room for the bar under the page, and its links replace the header's bell and Sign in */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .header-bell, .header-signin { display: none; }
}
@media print { .tabbar { display: none !important; } }
