:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f1;
  --text: #17201f;
  --muted: #5d6b69;
  --line: #dde4e2;
  --brand: #0f6b63;
  --brand-ink: #ffffff;
  --brand-soft: #e1f0ee;
  --focus: #1f8a80;
  --major: #b42318;
  --major-bg: #fdecea;
  --moderate: #a15c07;
  --moderate-bg: #fdf3e2;
  --minor: #2d6a4f;
  --minor-bg: #e6f4ec;
  --info: #3b5b8c;
  --info-bg: #e9eff8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 23, .06), 0 4px 16px rgba(16, 24, 23, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1413;
    --surface: #161e1d;
    --surface-2: #1d2726;
    --text: #e6eceb;
    --muted: #93a3a0;
    --line: #2a3634;
    --brand: #4fc1b4;
    --brand-ink: #062522;
    --brand-soft: #173431;
    --focus: #6fd6ca;
    --major: #ff8a80;
    --major-bg: #3a1714;
    --moderate: #f5b85c;
    --moderate-bg: #352812;
    --minor: #7fd1a6;
    --minor-bg: #12301f;
    --info: #9bb8e8;
    --info-bg: #1a2638;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  padding-bottom: calc(68px + var(--safe-b));
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- chrome ---------- */
/* Mobile: brand bar on top, nav pinned to the bottom. Desktop: nav sits in the top bar. */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1040px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 1.2rem; text-decoration: none; color: var(--text); letter-spacing: -.02em; }
.brand b { color: var(--brand); font-weight: 800; }
.brand .logo { width: 30px; height: 30px; color: var(--brand); flex: none; }

main { max-width: 1040px; margin: 0 auto; padding: 20px 16px 32px; outline: none; min-height: 60vh; }
/* main is focused programmatically on navigation (for screen readers); it shouldn't show a ring. */
#view:focus, #view:focus-visible { outline: none; }

.mainnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center; gap: 2px;
  padding: 6px 6px calc(6px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.mainnav a {
  position: relative; flex: 1; max-width: 140px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 10px;
  font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none;
}
.mainnav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.mainnav a.active { color: var(--brand); background: var(--brand-soft); }
.tab-badge {
  position: absolute; top: 2px; left: calc(50% + 8px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--brand); color: var(--brand-ink); font-size: .7rem; line-height: 18px; text-align: center;
}
@media (min-width: 760px) {
  body { padding-bottom: 0; }
  .mainnav { position: static; padding: 0; background: none; border: 0; gap: 4px; }
  .mainnav a { flex: none; max-width: none; flex-direction: row; gap: 6px; padding: 8px 12px; font-size: .92rem; }
  .mainnav svg { width: 18px; height: 18px; }
  .tab-badge { position: static; margin-left: 2px; }
}
.sitefoot {
  max-width: 1040px; margin: 0 auto; padding: 16px 16px 28px;
  border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 6px 18px;
}

/* ---------- typography ---------- */
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 0 0 4px; }
.lede { color: var(--muted); margin: 0 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- cards & forms ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 14px; }
.field label, .field-label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); }
.input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: 1rem; /* >=16px avoids iOS zoom */
}
.input:focus { outline: none; border-color: var(--focus); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.imprint-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; letter-spacing: .06em; font-size: 1.15rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); font-weight: 650; cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--brand); padding: 8px 10px; }
.btn.block { width: 100%; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: .85rem; cursor: pointer; user-select: none;
}
.chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); flex: none; }
.chip svg { width: 22px; height: 16px; }

.id-fields { display: grid; gap: 14px; }
@media (min-width: 640px) { .id-fields { grid-template-columns: 3fr 2fr; } }

/* ---------- results ---------- */
.results { display: grid; gap: 12px; margin-top: 18px; }
.result {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px; align-items: center;
  text-decoration: none; color: inherit;
}
.result:hover { border-color: var(--brand); }
.pill-art { width: 92px; height: 72px; display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; }
.pill-art svg { width: 84px; height: 64px; }
.result h3 { font-size: 1.02rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: .82rem; color: var(--muted); margin-top: 4px; }
.meta b { color: var(--text); font-weight: 600; }
.imprint-tag { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; color: var(--text); }

.status { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: .92rem; }
.status.error { background: var(--major-bg); color: var(--major); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: -4px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 96px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.disclaimer { font-size: .8rem; color: var(--muted); margin-top: 24px; }

/* ---------- interactions ---------- */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.14);
  max-height: 320px; overflow: auto;
}
.ac-list li { padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.ac-list li[aria-selected="true"], .ac-list li:hover { background: var(--brand-soft); }
.ac-list .sub { font-size: .8rem; color: var(--muted); }

.med-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; }
.med {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--surface-2);
}
.med .name { font-weight: 650; }
.med .ing { font-size: .8rem; color: var(--muted); }
.icon-btn { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 1.3rem; line-height: 1; }
.icon-btn:hover { background: var(--surface); color: var(--major); }

.summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 10px; }
.sev-pill { padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.sev-major { color: var(--major); background: var(--major-bg); }
.sev-moderate { color: var(--moderate); background: var(--moderate-bg); }
.sev-minor { color: var(--minor); background: var(--minor-bg); }
.sev-label { color: var(--info); background: var(--info-bg); }


.ix-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ix-pair { font-weight: 700; font-size: 1.02rem; }
.ix-finding + .ix-finding { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.ix-finding h4 { margin: 0 0 2px; font-size: .95rem; }
.ix-finding p { margin: 4px 0; font-size: .92rem; }
.ix-finding .advice { color: var(--text); }
.ix-finding .advice::before { content: "What to do: "; font-weight: 650; }
blockquote.label-quote { margin: 8px 0 0; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: .86rem; color: var(--muted); }
blockquote.label-quote mark { background: color-mix(in srgb, var(--moderate) 28%, transparent); color: var(--text); border-radius: 3px; padding: 0 2px; }
.source { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ---------- drug detail ---------- */
.detail-hero { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; }
.detail-hero .pill-art { width: 120px; height: 96px; }
.detail-hero .pill-art svg { width: 110px; height: 84px; }
@media (max-width: 480px) { .detail-hero { grid-template-columns: 1fr; } .detail-hero .pill-art { width: 100%; } }
.spec { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: .92rem; margin: 0; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; font-weight: 550; }
.gallery { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.gallery a { flex: none; scroll-snap-align: start; }
.gallery img { height: 140px; width: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: block; }
details.section { border-top: 1px solid var(--line); padding: 12px 0; }
details.section:first-of-type { border-top: 0; }
details.section > summary { cursor: pointer; font-weight: 650; }
.section-body { font-size: .92rem; white-space: pre-line; margin-top: 8px; max-height: 420px; overflow: auto; }
.boxed { border: 2px solid var(--major); border-radius: 10px; padding: 12px 14px; background: var(--major-bg); }
.boxed h3 { color: var(--major); }
.boxed p { font-size: .92rem; margin: 0 0 8px; }
.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; z-index: 50;
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
}

/* ---------- drug directory ---------- */
.browse-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px; }
.browse-tools .input { flex: 1 1 240px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.popular { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.popular .chip, .chips a.chip { text-decoration: none; color: var(--text); padding: 5px 10px; font-size: .82rem; }
.popular .chip:hover, .chips a.chip:hover { border-color: var(--brand); color: var(--brand); }

details.cat { padding: 0; margin-bottom: 10px; overflow: hidden; }
details.cat > summary {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; list-style: none;
  font-weight: 700;
}
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin-left: 4px; transition: transform .15s; }
details.cat[open] > summary::after { transform: rotate(-135deg); }
details.cat[open] > summary { border-bottom: 1px solid var(--line); }
.cat-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: .95rem; flex: none; }
.cat-name { flex: 1; }
.cat-count { font-size: .78rem; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.cat-body { padding: 6px 16px 14px; columns: 2 300px; column-gap: 28px; }
.sub { break-inside: avoid; padding-top: 10px; }
.sub-name { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; }

.drug-rows { list-style: none; margin: 0; padding: 0; }
.drow { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.drow:last-child { border-bottom: 0; }
.drow > a { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; padding: 7px 0; text-decoration: none; color: var(--text); }
.drow > a:hover .dname { color: var(--brand); text-decoration: underline; }
/* Long names (vaccines, multi-ingredient products) end in "…" instead of spilling past the column;
   the name keeps priority and the brand/notes text takes whatever room is left. */
.dname { flex: 0 1 auto; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dbrand { flex: 1 1 0; min-width: 0; font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.add-btn { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--brand); font-weight: 700; cursor: pointer; line-height: 1; }
.add-btn:hover { border-color: var(--brand); }
.add-btn.added { background: var(--brand-soft); border-color: transparent; }

.letters { position: sticky; top: 55px; z-index: 5; display: flex; gap: 2px; padding: 8px 0; background: var(--bg); overflow-x: auto; scrollbar-width: none; }
.letters a, .letters span { flex: none; }
@media (min-width: 760px) { .letters { top: 61px; flex-wrap: wrap; } }
.letters a, .letters span { width: 28px; text-align: center; padding: 3px 0; border-radius: 6px; font-weight: 700; font-size: .85rem; text-decoration: none; }
.letters a:hover { background: var(--brand-soft); }
.letters span { color: var(--line); }
.az-group { scroll-margin-top: 120px; }
.az-letter { font-size: 1.3rem; color: var(--brand); border-bottom: 2px solid var(--brand-soft); padding-bottom: 2px; margin: 18px 0 2px; }
.az-group .drug-rows { columns: 2 300px; column-gap: 28px; }
.az-group .drow { break-inside: avoid; }

/* ---------- drug page extras ---------- */
.crumbs { margin: 4px 0 0; color: var(--muted); }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumbs .sep { margin: 0 8px; }
.forms { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.form-tile { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.pill-art.sm { width: 64px; height: 50px; flex: none; }
.pill-art.sm svg { width: 58px; height: 44px; }
.section-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 18px 0 8px; padding-bottom: 4px; scrollbar-width: thin; }
.section-tabs button { flex: none; border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.section-tabs button[aria-selected="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
/* Label sections: structured text with headings, lists and tables */
.section-panel { position: relative; scroll-margin-top: 80px; }
.section-panel.clamped:not(.expanded) { max-height: 680px; overflow: hidden; padding-bottom: 72px; }
.section-panel.clamped:not(.expanded)::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 140px; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--surface) 60%); border-radius: 0 0 var(--radius) var(--radius);
}
.lt-more { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 1; }
.section-panel.expanded .lt-more { position: static; transform: none; display: block; margin: 16px auto 0; }
.lt-points { background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: .93rem; }
.lt-points-title { font-size: .74rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); margin-bottom: 4px; }
.lt-points ul, .lt-points ol { margin: 4px 0 0; padding-left: 20px; }
.lt-points li + li { margin-top: 4px; }
.lt-points p { margin: 4px 0; }
.lt-body { font-size: .95rem; line-height: 1.6; max-width: 72ch; }
.lt-body > p:first-child { margin-top: 0; }
.lt-body p { margin: 0 0 12px; }
.lt-body ul, .lt-body ol { margin: 0 0 12px; padding-left: 22px; }
.lt-body li { margin: 3px 0; }
.lt-sub + .lt-sub { margin-top: 6px; }
.lt-body h3 { font-size: 1.02rem; margin: 22px 0 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.lt-body > .lt-sub:first-child h3 { margin-top: 4px; padding-top: 0; border-top: 0; }
.lt-body h4 { font-size: .92rem; margin: 16px 0 6px; color: var(--muted); text-transform: none; }
.lt-table { overflow-x: auto; margin: 4px 0 16px; max-width: 100%; }
.lt-table table { border-collapse: collapse; font-size: .84rem; min-width: 100%; }
.lt-table caption { text-align: left; font-weight: 650; padding: 0 0 6px; }
.lt-table th, .lt-table td { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; text-align: left; }
.lt-table thead td, .lt-table thead th, .lt-table tr:first-child td b { background: var(--surface-2); }
@media (max-width: 480px) { .lt-body { font-size: .92rem; } }

/* ---------- compare ---------- */
.cmp-picks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cmp-picks:empty { display: none; }
.pick { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.pick .icon-btn { width: 28px; height: 28px; font-size: 1.1rem; color: var(--brand); }
.vs { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.pair { display: flex; align-items: center; gap: 8px; padding: 12px 14px; text-decoration: none; color: var(--text); font-weight: 650; }
.pair:hover { border-color: var(--brand); color: var(--brand); }
.cmp-notes { display: grid; gap: 10px; margin: 18px 0 14px; }
.cmp-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.cmp { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: calc(120px + var(--cols) * 170px); font-size: .9rem; }
.cmp th, .cmp td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.cmp thead th { position: sticky; top: 0; background: var(--surface); border-bottom: 2px solid var(--line); }
.cmp th.corner { width: 120px; }
.cmp tbody th[scope="row"] { width: 120px; color: var(--muted); font-weight: 600; font-size: .82rem; position: sticky; left: 0; background: var(--surface); }
.cmp td + td, .cmp th[scope="col"] + th[scope="col"] { border-left: 1px solid var(--line); }
.cmp tr.grp th { background: var(--surface-2); color: var(--brand); font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; padding: 7px 12px; position: static; }
.cmp-head { display: flex; flex-direction: column; gap: 6px; }
.cmp-head a { font-weight: 750; font-size: 1rem; text-decoration: none; color: var(--text); line-height: 1.25; }
.cmp-head a:hover { color: var(--brand); text-decoration: underline; }
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.clamp.open { display: block; }
.clamp-btn { border: 0; background: none; color: var(--brand); font-weight: 650; padding: 4px 0 0; cursor: pointer; font-size: .82rem; }
@media (max-width: 600px) {
  .cmp th.corner, .cmp tbody th[scope="row"] { width: 92px; }
  table.cmp { min-width: calc(92px + var(--cols) * 122px); font-size: .85rem; }
  .cmp th, .cmp td { padding: 8px; }
}

/* ---------- interaction quick picks ---------- */
.popular-meds { border-top: 1px solid var(--line); padding-top: 14px; }
.pop-group + .pop-group { margin-top: 10px; }
.pop-title { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.pop-chip { padding: 6px 11px; }
.pop-chip > span[aria-hidden] { color: var(--brand); font-weight: 800; width: 10px; text-align: center; }
.pop-brand { color: var(--muted); font-size: .75rem; }
.pop-chip[aria-pressed="true"] .pop-brand { color: inherit; opacity: .75; }

/* ---------- help ---------- */
.help-emergency { display: grid; gap: 6px; padding: 14px 16px; border-radius: var(--radius); background: var(--major-bg); color: var(--text); font-size: .92rem; border: 1px solid color-mix(in srgb, var(--major) 25%, transparent); }
.help-emergency a { color: var(--major); font-weight: 700; }
.help-search { margin: 18px 0 10px; }
.help-topics { margin-bottom: 8px; }
.help-topics .chip { text-decoration: none; color: var(--text); }
.help-topics .chip:hover { border-color: var(--brand); color: var(--brand); }
.help-sec { margin-top: 26px; scroll-margin-top: 80px; }
.help-sec .card p:first-child { margin-top: 0; }
.help-sec .card p:last-child { margin-bottom: 0; }
.faq-list { padding: 0 16px; }
.faq { border-top: 1px solid var(--line); }
.faq:first-child { border-top: 0; }
.faq > summary { cursor: pointer; padding: 13px 26px 13px 0; font-weight: 600; list-style: none; position: relative; }
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after { content: ""; position: absolute; right: 4px; top: 19px; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.faq[open] > summary::after { transform: rotate(-135deg); top: 22px; }
.faq-a { padding: 0 0 14px; color: var(--muted); font-size: .94rem; }
.faq-a b { color: var(--text); }
.src-list { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- conditions & alerts ---------- */
.uses { margin: 2px 0; }
.conds { display: flex; flex-wrap: wrap; gap: 6px; }
.cond { padding: 4px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: .84rem; font-weight: 600; }
.cond.more { background: var(--surface-2); color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badges:empty { display: none; }
.alert-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 0; cursor: default; font-family: inherit; }
button.alert-badge { cursor: pointer; }
button.alert-badge:hover { text-decoration: underline; }
.alert-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.alert-badge.danger { color: var(--major); background: var(--major-bg); }
.alert-badge.warn { color: var(--moderate); background: var(--moderate-bg); }
.alert-badge.info { color: var(--info); background: var(--info-bg); }
.alert-panel { margin-top: 14px; scroll-margin-top: 80px; }
.alert-panel h2 { margin-bottom: 6px; }
.alert-panel p { margin: 6px 0; }
.recall-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 10px; }
.recall-list li { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.recall-head { margin-bottom: 4px; }
.rclass { font-size: .72rem; font-weight: 800; padding: 1px 7px; border-radius: 6px; background: var(--moderate-bg); color: var(--moderate); }
.rclass.c1 { background: var(--major-bg); color: var(--major); }
.cmp-head .badges { margin-top: 0; }

/* ---------- prices ---------- */
.price-card { margin-top: 14px; }
.save-note { display: inline-block; margin: 0 0 10px; padding: 4px 10px; border-radius: 8px; background: var(--minor-bg); color: var(--minor); font-weight: 700; font-size: .88rem; }
.price-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 6px 0 10px; }
.price-table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.price-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.price-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.price-table th:not(:first-child) { text-align: right; }
@media (max-width: 480px) { .price-table { font-size: .84rem; } .price-table td, .price-table th { padding: 6px 4px; } }

/* ---------- form tabs ---------- */
.form-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; padding: 3px; border-radius: 10px; background: var(--surface-2); }
.form-tabs a { padding: 6px 12px; border-radius: 8px; font-size: .86rem; font-weight: 650; color: var(--muted); text-decoration: none; }
.form-tabs a:hover { color: var(--brand); }
.form-tabs a[aria-current="page"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.cmp-head .form-tabs { margin-top: 2px; }
.cmp-head .form-tabs a { padding: 3px 8px; font-size: .76rem; }

/* ---------- full A-Z list ---------- */
.letters a[aria-current="true"] { background: var(--brand); color: var(--brand-ink); }
.az-flat { columns: 2 300px; column-gap: 28px; }
.az-flat .drow { break-inside: avoid; }
.common { flex: none; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); background: var(--brand-soft); padding: 1px 6px; border-radius: 5px; }

.form-tabs a { display: inline-flex; align-items: center; gap: 5px; }
.form-icon { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cmp-head .form-icon { width: 12px; height: 12px; }

/* ---------- severity icons (instead of colored card edges) ---------- */
.sev-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; flex: none; }
.sev-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sev-icon-major, .sev-icon-danger { color: var(--major); background: var(--major-bg); }
.sev-icon-moderate, .sev-icon-warn { color: var(--moderate); background: var(--moderate-bg); }
.sev-icon-minor { color: var(--minor); background: var(--minor-bg); }
.sev-icon-label, .sev-icon-info { color: var(--info); background: var(--info-bg); }
.ix-pair { display: flex; align-items: center; gap: 8px; }
.alert-title { display: flex; align-items: center; gap: 8px; }

/* Boxed warning */
.boxed-kicker { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--major); }
.boxed h3 { margin: 2px 0 8px; font-size: 1.05rem; }
.boxed .lt-body { max-height: none; overflow: visible; font-size: .92rem; }
.boxed .lt-body ul { margin-bottom: 4px; }
.boxed .lt-body p:last-child { margin-bottom: 0; }
.lt-bullet { position: relative; padding-left: 18px; }
.lt-bullet::before { content: "•"; position: absolute; left: 4px; color: var(--muted); }
.lt-points .lt-bullet { margin: 4px 0; }

/* Pill result cards: the drug name is the link, stretched over the whole card */
.result { position: relative; }
.result:hover { border-color: var(--brand); }
.result:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.result-link { color: inherit; text-decoration: none; }
.result-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.result-link:focus-visible { outline: none; }
.result:hover .result-link { color: var(--brand); text-decoration: underline; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Recalls of the same drug by other companies: collapsed, no badge */
details.other-recalls > summary { cursor: pointer; list-style: none; font-weight: 700; font-size: 1.05rem; }
details.other-recalls > summary::-webkit-details-marker { display: none; }
details.other-recalls > summary::after { content: "Show"; float: right; font-size: .8rem; font-weight: 650; color: var(--brand); margin-top: 3px; }
details.other-recalls[open] > summary::after { content: "Hide"; }
details.other-recalls > summary .alert-title { display: inline-flex; }

/* ---------- home ---------- */
.home-hero { padding: 18px 0 8px; }
.home-hero h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); max-width: 22ch; }
.home-hero .lede { max-width: 60ch; margin-bottom: 16px; }
.home-search { display: flex; gap: 8px; max-width: 720px; }
.home-ac { flex: 1; min-width: 0; }
.home-search .input { font-size: 1.08rem; padding: 14px 16px; }
.home-search .btn { padding-inline: 22px; }
.home-ac .ac-list li { display: flex; align-items: center; gap: 10px; }
.sug-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.home-ac .ac-list li > span { display: flex; flex-direction: column; min-width: 0; }
.sug-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.home-try { margin: 10px 0 0; color: var(--muted); }
.home-try a { text-decoration: none; font-weight: 600; }

.home-tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 26px 0 8px; }
.home-tool { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); padding: 14px 16px; }
.home-tool:hover { border-color: var(--brand); }
.home-tool > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.home-tool-icon { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.home-tool-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.home-sec { margin-top: 30px; }
.home-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.home-sec-head a { font-size: .9rem; font-weight: 600; text-decoration: none; }
.home-cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.home-cat { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--text); }
.home-cat:hover { border-color: var(--brand); }
.home-cat-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.home-cat-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.home-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.home-cols h2 { font-size: 1.05rem; }
.home-list { list-style: none; margin: 0; padding: 0; }
.home-list li { padding: 7px 0; border-bottom: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-list li:last-child { border-bottom: 0; }
.home-list a { font-weight: 600; text-decoration: none; }
.home-list a:hover { text-decoration: underline; }

.search-results { list-style: none; margin: 0; padding: 4px 16px; }
.search-results li + li { border-top: 1px solid var(--line); }
.search-results a { display: flex; align-items: center; gap: 12px; padding: 11px 0; text-decoration: none; color: var(--text); }
.search-results a > span { display: flex; flex-direction: column; min-width: 0; }
.search-results a:hover b { color: var(--brand); text-decoration: underline; }
@media (max-width: 480px) { .home-search .btn { padding-inline: 14px; } }

/* ---------- source and illustration notes ---------- */
.cmp tr.grp th .grp-note { display: block; margin-top: 3px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); font-size: .76rem; }
.cmp .na { color: var(--muted); font-style: italic; }
.cmp .src-link { display: block; margin-top: 4px; font-size: .76rem; font-weight: 600; color: var(--brand); text-decoration: none; }
.cmp .src-link:hover { text-decoration: underline; }
.pill-fig { margin: 0; display: grid; justify-items: center; gap: 3px; }
.pill-fig figcaption { font-size: .68rem; color: var(--muted); letter-spacing: .02em; }
.detail-hero .pill-fig { width: 120px; }
@media (max-width: 480px) { .detail-hero .pill-fig { width: 100%; } }
.art-warning { margin: 8px 0 0; color: var(--muted); }
.art-warning b { color: var(--text); font-weight: 650; }
details.popular-meds { margin-top: 28px; border: 1px solid var(--line); padding: 16px; }
details.popular-meds > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 10px; }
details.popular-meds > summary::-webkit-details-marker { display: none; }
details.popular-meds > summary::before { content: "▸"; color: var(--muted); font-size: .8rem; }
details.popular-meds[open] > summary::before { content: "▾"; }
details.popular-meds > summary .field-label { margin: 0; }
details.popular-meds[open] > summary { margin-bottom: 10px; }
.section-tabs, #boxed { scroll-margin-top: 72px; }
