/* BAFUquery — deep forest surfaces with a living green accent */
:root {
  --bg: #0f1729;            /* page background base */
  --card: #1d283a;           /* solid surface fallback (opaque form controls) */
  --surface-2: #232f45;      /* opaque form-control surface */
  --accent-surface: #293851; /* hover / elevated (opaque controls) */
  --line: #384252;           /* border for opaque controls */
  --ink: #f8fafc;            /* primary text */
  --muted: #94a3b8;          /* secondary text */
  --primary: #fb923c;        /* fresh green accent */
  --primary-strong: #f97316;
  --primary-ink: #0f1729;    /* text on green */
  --accent: #fb923c;        /* links reuse the brand accent */
  --chip: #26334a;          /* neutral chip background */
  --danger: #ef4343;
  --radius: 12px;
  /* glass: the Card surface recipe — bg-white/[0.06] backdrop-blur-md
     border-white/10 shadow-lg shadow-black/20 — used on every panel/box so
     the page's gradient glow shows through instead of a flat opaque fill. */
  --glass-bg: rgba(255,255,255,.06);
  --glass-border: rgba(255,255,255,.10);
  --glass-shadow: 0 10px 30px rgba(0,0,0,.35);

  /* ---- tokens added for the LCIA/Search/Exchanges redesign (design handoff
     in /TL/bafuq_ux) — layered onto the tokens above rather than replacing
     them: same dark-navy/orange system, same glass cards, just the values
     that system genuinely has no equivalent for yet. */
  --surface-deep: #050a12;              /* code / reproduce snippet block */
  --accent-wash: rgba(251,146,60,.12); /* open accordion row / active state fill */
  --accent-wash-strong: rgba(251,146,60,.16);
  --accent-edge: rgba(251,146,60,.4);
  --hairline: rgba(255,255,255,.07);
  --hairline-row: rgba(255,255,255,.05);
  /* flow-category colours — used identically for the category dot, the
     waterfall segment and that row's bar */
  --cat-raw: #5b8ac9;
  --cat-energy: #3fa8a0;
  --cat-infra: #8b7fc4;
  --cat-emission: #f2994a;
  --cat-resource: #6fd39b;
  /* Three hues added for the clusters split out of `infra` and `raw`.
     Chosen to sit apart from the five above: ochre away from emission orange,
     terracotta away from both, cyan lighter than energy teal and cooler than
     raw blue. Small marks, so hue separation matters more than exact value. */
  --cat-transport: #d9a53b;
  --cat-infrastructure: #8b7fc4;
  --cat-waste: #a8766a;
  --cat-water: #6ec9e8;
  --cat-cutoff: rgba(255,255,255,.16);
  /* pedigree scale, 1 (best) .. 5 (worst) */
  --ped-1: #3fae6f;
  --ped-2: #8fc45c;
  --ped-3: #e8c250;
  --ped-4: #e2853c;
  --ped-5: #c9503f;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  font-size: 14px;
  min-height: 100vh;
  /* Soft forest gradient keeps the page's depth without competing with cards. */
  background: linear-gradient(to bottom right, #171e2d, var(--bg) 45%, #0f1521);
  background-attachment: fixed;
}
h1, h2, .serif { font-family: "Playfair Display", Georgia, serif; }

/* ---------- header ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: rgba(12,17,27,.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  color: var(--ink); padding: 0 20px; height: 56px;
  border-bottom: 1px solid var(--glass-border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: baseline; gap: 10px; cursor: pointer; }
.brand-mark { height: 30px; width: auto; display: block; align-self: center; }
.brand-name { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.brand-name em { font-style: normal; font-weight: 300; color: var(--primary); }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.mainnav { display: flex; gap: 4px; }
.mainnav a {
  color: var(--muted); text-decoration: none; padding: 8px 14px; border-radius: 8px;
  font-size: 14px;
}
.mainnav a:hover { background: rgba(255,255,255,.06); color: var(--ink); }
.mainnav a.active { background: rgba(251,146,60,.14); color: var(--primary); font-weight: 600; }

/* ---------- layout ---------- */
main#app { max-width: 1240px; margin: 22px auto; padding: 0 16px; min-height: 60vh; }
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 18px; align-items: start; }
.card {
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--glass-shadow);
}
.loading { padding: 60px; text-align: center; color: var(--muted); font-size: 16px; }

/* ---------- filters ---------- */
.filters h3, .sidebox h3 {
  margin: 0 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); font-weight: 700;
}
.filters label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 3px; }
.filters input, .filters select {
  width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; background: var(--surface-2); color: var(--ink);
}
.filters button {
  margin-top: 14px; width: 100%; padding: 9px; border: 0; border-radius: 8px;
  background: var(--primary); color: var(--primary-ink); font-weight: 700; cursor: pointer; font-size: 14px;
}
.filters button:hover { background: var(--primary-strong); }
.filters .reset { background: var(--accent-surface); color: var(--ink); margin-top: 8px; }
.filters .reset:hover { background: var(--chip); }

/* ---------- search box on top of results ---------- */
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  background: var(--surface-2); color: var(--ink);
}
.searchbar button {
  padding: 10px 18px; border: 0; border-radius: 8px; background: var(--primary);
  color: var(--primary-ink); font-weight: 700; cursor: pointer;
}
.searchbar button:hover { background: var(--primary-strong); }

/* ---------- tables ---------- */
.result-meta { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 8px 10px; background: var(--surface-2);
  border-bottom: 2px solid var(--line); font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); white-space: nowrap; font-weight: 700;
}
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: var(--accent-surface); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data a { color: var(--primary); text-decoration: none; }
table.data a:hover { text-decoration: underline; }
.chip {
  display: inline-block; background: var(--chip); border-radius: 999px;
  padding: 1px 9px; font-size: 11.5px; color: var(--muted); white-space: nowrap;
  border: 1px solid var(--line);
}
.chip.geo { background: rgba(56,132,255,.12); color: #7db3ff; border-color: rgba(56,132,255,.25); }
.chip.bio { background: rgba(239,67,67,.12); color: #f3a1a1; border-color: rgba(239,67,67,.25); }
/* Subcompartment of an elementary flow -- where an emission actually goes
   ("low. pop.", "stratosphere + troposphere", "groundwater, long-term").
   BAFU carries no geography on elementary exchanges, so this is the whole of
   the destination. */
.chip.subcomp { background: rgba(250,204,21,.10); color: #e8c766; border-color: rgba(250,204,21,.22); }

/* Heading above the per-compartment exchange tables. */
.ex-group {
  font-size: 14px; font-weight: 700; color: var(--ink);
  margin: 26px 0 2px; padding-top: 14px; border-top: 1px solid var(--line);
}
.ex-group + .section-title { margin-top: 10px; }

/* ---------- pagination ---------- */
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 14px 0 4px; }
.pager button {
  padding: 6px 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.pager button:disabled { opacity: .4; cursor: default; }
.pager button:not(:disabled):hover { background: var(--accent-surface); border-color: var(--primary); }

/* ---------- detail pages ---------- */
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
h1.title { font-size: 26px; margin: 0 0 4px; font-weight: 600; letter-spacing: -.2px; }
.subtitle { color: var(--muted); margin-bottom: 14px; }
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 20px; margin-bottom: 18px;
}
.meta-grid .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.meta-grid .v { font-size: 14.5px; margin-top: 2px; }
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 0; flex-wrap: wrap; }
.tabs button {
  border: 0; background: none; padding: 9px 16px; font-size: 14px; cursor: pointer;
  color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tabpanel { padding-top: 12px; }
.section-title {
  font-size: 13px; font-weight: 700; color: var(--muted);
  margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .6px;
}

/* ---------- source documentation on detail pages ---------- */
.doc {
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--glass-shadow);
}
.doc-text { margin: 0; font-size: 14px; line-height: 1.55; max-width: 78ch; white-space: pre-wrap; color: var(--ink); }
.doc-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 20px; margin-top: 14px;
}
.doc-grid .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.doc-grid .v { font-size: 13.5px; margin-top: 2px; line-height: 1.45; }
.doc summary { cursor: pointer; margin-top: 4px; color: var(--muted); }
.doc details[open] { margin-top: 4px; line-height: 1.5; }

/* ---------- stats / home ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.stat {
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 14px 16px; text-align: center; box-shadow: var(--glass-shadow);
}
.stat .n { font-size: 28px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- impact method group headings in LCIA tables ---------- */
tr.impact-method td {
  background: rgba(251,146,60,.08); font-weight: 650; color: var(--primary);
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px;
}

.footer {
  text-align: center; color: var(--muted); font-size: 12px; padding: 18px 0 26px;
}
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); }
.cas-link { text-decoration: none; border-bottom: 1px dotted var(--line); }
.cas-link:hover { color: var(--primary); border-bottom-color: var(--primary); }
.empty { color: var(--muted); font-style: italic; padding: 12px 4px; }

/* ---------- LCIA (bw2calc) ---------- */
.engine-note {
  font-size: 12.5px; color: var(--muted); margin: 2px 0 12px;
  padding: 8px 12px; background: var(--glass-bg); backdrop-filter: blur(10px); border-radius: 8px;
  border: 1px solid var(--glass-border);
}
.hl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.hl-card {
  border: 1px solid var(--glass-border); border-radius: var(--radius); padding: 12px 14px;
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--glass-shadow);
}
.hl-card .hl-cat { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.hl-card .hl-val {
  font-size: 26px; font-weight: 800; color: var(--primary); margin: 4px 0 2px;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px;
  display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap;
}
.hl-card .hl-unit { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: normal; }
.hl-card .hl-method { color: var(--muted); }
.hl-card .hl-unc {
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* ---------- risk scores ---------- */
.score { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 700; }
.score.hi { background: rgba(239,67,67,.16); color: #f5a3a3; }
.score.mid { background: rgba(251,146,60,.16); color: var(--primary); }
.score.lo { background: rgba(74,222,128,.14); color: #86efac; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }

/* ============================================================ research screen */

.research { display: flex; flex-direction: column; gap: 18px; }

.hero {
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 32px 28px 26px; box-shadow: var(--glass-shadow);
  /* .research is a flex container, so .hero and .layout are flex items — that
     alone elevates .layout's paint order above .hero's in-flow content
     (Appendix E step 5 vs step 3), so the .suggest dropdown (position:
     absolute; z-index:40) gets painted behind the results/filters card
     below it despite its z-index. Giving .hero its own stacking context
     ranked above .layout fixes it. */
  position: relative; z-index: 2;
}
/* a short brand tagline, not an instruction sentence — what the box accepts
   lives in .search-hint below instead, discreetly */
.hero-title {
  font-family: "Playfair Display", Georgia, serif; font-weight: 500; font-size: 34px;
  margin: 0 0 18px; letter-spacing: -.3px; line-height: 1.2; color: var(--ink);
}

.searchbox { position: relative; display: flex; gap: 8px; }
.searchbox input {
  flex: 1; padding: 13px 16px; border: 2px solid var(--line); border-radius: 10px;
  font-size: 16px; background: var(--surface-2); color: var(--ink);
}
.searchbox input::placeholder { color: var(--muted); }
.searchbox input:focus { outline: 0; border-color: var(--primary); }
.searchbox button {
  padding: 13px 26px; border: 0; border-radius: 10px; background: var(--primary);
  color: var(--primary-ink); font-weight: 700; cursor: pointer; font-size: 15px;
}
.searchbox button:hover { background: var(--primary-strong); }

/* the discreet "you can also search by CAS/HS" hint: a plain caption
   sentence, plus one small CTA link instead of four dotted-underline
   buttons competing for attention inside the sentence itself */
.search-hint { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.hint-link {
  background: none; border: 0; padding: 0; margin-left: 7px; font: inherit; cursor: pointer;
  color: var(--primary); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.hint-link::after { content: '\2192'; margin-left: 3px; }
.hint-link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* typeahead */
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 110px; z-index: 40;
  /* Opaque, not glass. .hero carries backdrop-filter, which makes it a
     backdrop root: a blur inside it can only sample .hero's own background,
     never the results/filters cards the dropdown actually overlaps. The 15%
     transparency therefore let those rows read straight through the
     suggestions, which looks exactly like the dropdown being painted under
     them. */
  background: #1d283a;
  border: 1px solid var(--glass-border); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.4); overflow: hidden;
}
.sg {
  padding: 9px 14px; cursor: pointer; display: flex; align-items: center;
  gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line);
}
.sg:last-child { border-bottom: 0; }
.sg:hover, .sg.on { background: var(--accent-surface); }
.sg-name { font-size: 14px; color: var(--ink); }

/* ---------- facet rail ---------- */
.facet-top { display: flex; align-items: baseline; justify-content: space-between; }
.facet-clear { font-size: 11.5px; color: var(--primary); text-decoration: none; }
.facet-clear:hover { text-decoration: underline; }
.fchips { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; }
.fchip {
  background: rgba(56,132,255,.12); color: #7db3ff; border-radius: 999px; padding: 2px 8px;
  font-size: 11.5px; white-space: nowrap; border: 1px solid rgba(56,132,255,.25);
}
.fchip a { color: #7db3ff; text-decoration: none; font-weight: 700; margin-left: 3px; }

.facet { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.facet-h {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); font-weight: 700; margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.facet-find {
  width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 12px; margin-bottom: 6px; background: var(--surface-2); color: var(--ink);
}
.facet-opts { display: flex; flex-direction: column; }
/* .filters label/input already set display:block and width:100%, which would
   stack the control above its text — these override for facet rows only. */
.filters .fopt, .fopt {
  display: flex; align-items: center; gap: 7px; padding: 3px 4px; border-radius: 5px;
  cursor: pointer; font-size: 13px; line-height: 1.35; margin: 0; color: var(--ink);
}
.fopt:hover { background: var(--accent-surface); }
.fopt.on { background: rgba(251,146,60,.12); font-weight: 600; color: var(--primary); }
.filters .fopt input, .fopt input {
  margin: 0; accent-color: var(--primary); flex: none; width: auto;
}
.fopt-l { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fopt-c { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
/* collapsed by default; "Show all" or an in-facet filter reveals the rest */
.facet:not(.open) .fopt[data-extra] { display: none; }
.facet.searching .fopt[data-extra] { display: flex; }
.fopt.hide { display: none !important; }
.facet-more { font-size: 11.5px; color: var(--primary); text-decoration: none; margin-top: 4px; display: inline-block; }
.facet-more:hover { text-decoration: underline; }

/* ---------- result list ---------- */
.result-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-meta strong { color: var(--ink); }
.sortbar { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sortbar select { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; background: var(--surface-2); color: var(--ink); }

.tablewrap { overflow-x: auto; }
.rname { font-size: 14.5px; font-weight: 550; }
.rmeta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; align-items: center; }
.nowrap { white-space: nowrap; }
.dim { color: var(--muted); }
.subtle { font-size: 11.5px; color: var(--muted); line-height: 1.4; }

/* why a row matched — the payoff of searching synonyms and codes */
.why {
  display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 11px;
  background: rgba(167,139,250,.14); color: #c4b5fd; white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; border: 1px solid rgba(167,139,250,.25);
}
.why.cas { background: rgba(45,212,191,.14); color: #7dd3c8; border-color: rgba(45,212,191,.25); }
.why.hs, .why.hs_chapter, .why.hs_description { background: rgba(251,146,60,.14); color: var(--primary); border-color: rgba(251,146,60,.3); }
.why.synonym { background: rgba(167,139,250,.14); color: #c4b5fd; border-color: rgba(167,139,250,.25); }
.why.category { background: var(--chip); color: var(--muted); border-color: var(--line); }

.chip.kind { font-weight: 700; }
.chip.kind.activity { background: rgba(74,222,128,.12); color: #86efac; border-color: rgba(74,222,128,.25); }
.chip.kind.product { background: rgba(167,139,250,.12); color: #c4b5fd; border-color: rgba(167,139,250,.25); }

/* ============================================================ result screen */

.idline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tabn {
  background: var(--chip); border-radius: 9px; padding: 0 6px; font-size: 11px;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.tabs button.active .tabn { background: var(--primary); color: var(--primary-ink); }
.hint.warn {
  background: rgba(251,146,60,.1); border: 1px solid rgba(251,146,60,.3); border-radius: 8px;
  padding: 8px 12px; color: var(--primary); margin-bottom: 14px;
}
.searchbar select.grow, .searchbar .grow {
  flex: 1; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink);
}

/* reference page collapsibles */
details.ref { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 10px; }
details.ref > summary {
  cursor: pointer; font-size: 14px; font-weight: 650; color: var(--muted);
  padding: 4px 0;
}
details.ref > summary:hover { color: var(--primary); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .suggest { right: 0; }
}

/* documentation disclosure — keeps the five sheets above the fold */
details.doc-more { margin-top: 10px; }
details.doc-more > summary {
  cursor: pointer; font-size: 12px; color: var(--primary); list-style: revert;
}
details.doc-more > summary:hover { text-decoration: underline; }
details.doc-more[open] > summary { margin-bottom: 4px; }

/* ---------- persistent top-bar search ---------- */
.topsearch { position: relative; flex: 1; max-width: 460px; margin: 0 24px; }
.topsearch input {
  width: 100%; padding: 7px 12px; border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; font-size: 13.5px; background: rgba(255,255,255,.06);
  color: var(--ink);
}
.topsearch input::placeholder { color: var(--muted); }
.topsearch input:focus {
  outline: 0; background: var(--card); color: var(--ink); border-color: var(--primary);
}
.topsearch input:focus::placeholder { color: var(--muted); }
.topsearch .suggest { right: 0; }
.topbar { gap: 8px; }

.hero-n { font-variant-numeric: tabular-nums; color: var(--primary); font-weight: 600; }
.fchip.term { background: rgba(251,146,60,.12); color: var(--primary); border-color: rgba(251,146,60,.3); }
.fchip.term a { color: var(--primary); }

/* ---------- fact strip, method caption, share bars ---------- */
.factstrip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px 22px; margin-bottom: 16px; padding: 14px 16px;
  border: 1px solid var(--glass-border); border-radius: var(--radius);
  background: var(--glass-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.factstrip .k {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); font-weight: 600;
}
.factstrip .v { font-size: 14.5px; margin-top: 3px; color: var(--ink); }

.hl-card .hl-method {
  font-size: 11px; color: var(--muted); margin-top: 6px;
  padding-top: 6px; border-top: 1px solid var(--line);
}

.barwrap { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 74px; }
.barval { font-variant-numeric: tabular-nums; color: var(--ink); }
.bartrack { width: 100%; height: 4px; background: var(--chip); border-radius: 2px; overflow: hidden; }
.barfill { display: block; height: 100%; background: var(--primary); border-radius: 2px; }

/* ---------- hover tooltip (data-tip) — auxiliary info that doesn't need
   permanent on-page space: HS/CAS classification detail, etc.
   NOTE: this used to be a pure-CSS ::after on the trigger itself, but every
   glass panel (.card, .doc, ...) has `backdrop-filter`, which establishes
   its own CSS stacking context -- so the tooltip's z-index only ranked
   within ITS card, and the next glass card in DOM order (painted as a
   sibling stacking context) still drew on top of it regardless. Rendered
   into one shared node appended to <body> instead (positioned by JS in
   app.js), which has no ancestor stacking context to get trapped inside. */
[data-tip] { cursor: help; }
.tip-ic {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 999px; margin-left: 5px;
  background: var(--chip); color: var(--muted); font-size: 10px; font-style: normal;
  vertical-align: middle;
}
[data-tip]:hover .tip-ic, [data-tip].tip-active .tip-ic { background: var(--primary); color: var(--primary-ink); }
.global-tip {
  position: fixed; z-index: 9999; top: 0; left: 0;
  width: max-content; max-width: 300px; white-space: normal;
  background: rgba(24,32,48,.97); color: var(--ink); font-size: 12px; line-height: 1.5;
  padding: 9px 11px; border-radius: 9px; border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.global-tip.show { opacity: 1; transform: translateY(0); }

/* ---------------------------------------------- temporal (scenario year) */
/* The year control sits above the numbers rather than beside them: it changes
   what every figure below it means, so it reads as a condition on the panel
   and not as one more filter. */
.vintage-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}
.vintage-label { color: var(--muted); font-size: 13px; }
.vintage-select {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font: inherit;
}
.vintage-year { display: flex; align-items: center; gap: 8px; }
.vintage-year input[type=range] { accent-color: var(--primary); width: 180px; }
.vintage-yearout {
  font-variant-numeric: tabular-nums; font-weight: 700;
  color: var(--primary); min-width: 4ch; text-align: right;
}
.vintage-note {
  margin: 10px 0 14px; padding: 10px 12px; font-size: 13px; color: var(--muted);
  background: var(--chip); border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
}
.vintage-note strong { color: var(--ink); }
/* Caveats are part of the result, not a footnote: a projected number without
   its coverage and its frozen imports invites a conclusion it cannot support. */
.vintage-warn { margin-top: 6px; color: var(--ink); opacity: .82; }

/* ------------------------------------ session context (when + where) */
/* Sits above the search field because it frames every impact the session will
   show. On a result page the same context appears as a stated line, not a
   second set of controls: repeating them there invites setting the framing per
   page, which is exactly what moving it here replaces. */
.context-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: center; margin: 0 auto 16px; padding: 10px 14px;
  max-width: 780px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}
.context-label { color: var(--muted); font-size: 13px; white-space: nowrap; }
.context-select {
  background: var(--card); color: var(--ink); font: inherit;
  border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
  max-width: 320px;
}
.context-year { display: flex; align-items: center; gap: 8px; }
.context-year input[type=range] { accent-color: var(--primary); width: 150px; }
.context-yearout {
  font-variant-numeric: tabular-nums; font-weight: 700;
  color: var(--primary); min-width: 4ch; text-align: right;
}
.context-clear {
  background: none; color: var(--muted); font: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px;
}
.context-clear:hover { color: var(--ink); border-color: var(--primary); }
.context-summary {
  margin-bottom: 14px; padding: 9px 12px; font-size: 13px; color: var(--muted);
  background: var(--chip); border-left: 3px solid var(--primary);
  border-radius: 0 8px 8px 0;
}
.context-summary strong { color: var(--ink); }
.context-edit { margin-left: 8px; color: var(--accent); }
.context-note {
  margin: 10px 0 14px; padding: 10px 12px; font-size: 13px; color: var(--muted);
  background: var(--chip); border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.context-note strong { color: var(--ink); }
.context-warn { margin-top: 6px; color: var(--ink); opacity: .82; }

/* -------------------------------------------- weighted supply origins */
/* Collapsed by default: it is evidence you go looking for, not something the
   result page owes every reader. Opening it is what pays for its request. */
.origins { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.origins > summary {
  cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0;
  list-style: none;
}
.origins > summary::before { content: '▸ '; }
.origins[open] > summary::before { content: '▾ '; }
.origins > summary:hover { color: var(--primary-strong); }
.origin-pick {
  background: none; color: var(--accent); font: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: 7px; padding: 3px 9px;
  white-space: nowrap;
}
.origin-pick:hover { color: var(--primary-ink); background: var(--primary); border-color: var(--primary); }

/* ================================================================
   LCIA tab redesign — calculation bar, headline band, indicator
   accordion, contribution panel, provenance rail.
   Design handoff: /TL/bafuq_ux (README.md, screens 3a/2a).
   ================================================================ */

.calcbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px;
  padding: 11px 16px; margin: -2px 0 14px;
  background: var(--glass-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius);
}
.calcbar-field { display: flex; align-items: baseline; gap: 8px; }
.calcbar-label {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}
.calcbar select.calcbar-method {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--accent-edge);
  border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 12.5px;
}
.calcbar-fu {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 10px;
  background: var(--accent-wash); border: 1px solid var(--accent-edge); border-radius: 6px;
}
.calcbar-fu b { font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: var(--primary); font-size: 13.5px; }
.calcbar-fu span { font-size: 11.5px; color: var(--ink); opacity: .85; }
.calcbar-scope { font-size: 12.5px; color: var(--ink); }
.calcbar-scope a { color: var(--accent); text-decoration: none; margin-left: 6px; }
.calcbar-scope a:hover { text-decoration: underline; }
.calcbar-note { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.hdlband {
  display: flex; align-items: center; gap: 26px; padding: 20px 4px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.hdlband.open {
  background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--primary);
  border-bottom-color: var(--accent-edge); padding-left: 14px; border-radius: 8px 8px 0 0;
}
.hdlband-left { min-width: 0; }
.hdlband-badge {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
  color: var(--muted);
}
.hdlband.open .hdlband-badge {
  color: var(--primary); background: var(--accent-wash-strong); border: 1px solid var(--accent-edge);
  border-radius: 9px; padding: 2px 8px; display: inline-block;
}
.hdlband-row2 { display: flex; align-items: flex-end; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.hdlband-val {
  font-family: ui-monospace, Consolas, monospace; font-weight: 700; font-size: 38px;
  color: var(--primary); line-height: 1; font-variant-numeric: tabular-nums;
}
.hdlband-unit { font-size: 14px; color: var(--muted); align-self: flex-end; padding-bottom: 3px; }
.hdlband-scope { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.hdlband-scope .geo { color: #7db3ff; }
.hdlband-ci {
  border-left: 1px solid var(--line); padding-left: 22px; flex: none;
}
.hdlband.open .hdlband-ci { border-left-color: var(--accent-edge); }
.hdlband-ci-label { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.hdlband-ci-val {
  font-family: ui-monospace, Consolas, monospace; font-weight: 600; font-size: 15px;
  color: var(--ink); margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.hdlband-ci-note { font-size: 11px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.hdlband-ci-note a { color: var(--accent); text-decoration: none; cursor: pointer; }

.indtable { border-top: 1px solid var(--line); margin-top: 8px; }
.indtable-head, .indrow-grid {
  display: grid; grid-template-columns: 22px minmax(0,1fr) 100px 84px 170px 74px;
  gap: 12px; align-items: center;
}
.indtable-head {
  padding: 8px 6px; background: var(--surface-2); border-radius: 6px 6px 0 0;
  font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.indtable-head span:nth-child(3), .indtable-head span:nth-child(6) { text-align: right; }
.indrow { border-bottom: 1px solid var(--hairline-row); cursor: pointer; }
.indrow.open { background: var(--accent-wash); border-bottom-color: transparent; }
.indrow .indrow-grid { padding: 10px 6px; }
.indrow-caret {
  font-size: 9px; color: rgba(248,250,252,.32); transition: transform .14s ease; display: inline-block;
}
.indrow.open .indrow-caret { transform: rotate(90deg); color: var(--primary); }
.indrow-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.indrow.reference .indrow-name { font-weight: 700; color: var(--primary); }
.indrow.open .indrow-name { font-weight: 700; color: #fff; }
.indrow-amount {
  text-align: right; font-family: ui-monospace, Consolas, monospace; font-weight: 500;
  font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink);
}
.indrow-unit { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.indrow-detail { text-align: right; font-size: 11px; color: var(--muted); }
.indrow.open .indrow-detail { color: var(--primary); }

.contrib-panel {
  padding: 4px 6px 18px; background: var(--accent-wash); border-top: 1px solid var(--accent-edge);
}
.contrib-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 14px 0 12px; flex-wrap: wrap;
}
.contrib-title { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); }
.contrib-split { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.contrib-split b { font-family: ui-monospace, Consolas, monospace; font-weight: 600; color: var(--ink); }
.contrib-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.contrib-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.contrib-actions { display: flex; gap: 8px; flex: none; }
.contrib-actions span {
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px;
  color: rgba(248,250,252,.85); cursor: pointer;
}
.contrib-actions span:hover { border-color: var(--primary); color: var(--ink); }
.catdot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.catdot.raw { background: var(--cat-raw); } .catdot.energy { background: var(--cat-energy); }
.catdot.infra { background: var(--cat-infra); } .catdot.emission { background: var(--cat-emission); }
.catdot.resource { background: var(--cat-resource); } .catdot.cutoff { background: var(--cat-cutoff); }
.catdot.transport { background: var(--cat-transport); }
.catdot.infrastructure { background: var(--cat-infrastructure); }
.catdot.waste { background: var(--cat-waste); }
.catdot.water { background: var(--cat-water); }

.waterfall {
  display: flex; height: 26px; border-radius: 3px; overflow: hidden; border: 1px solid var(--line);
  margin-top: 4px;
}
.waterfall-seg { height: 100%; }
.waterfall-foot {
  display: flex; justify-content: space-between; align-items: center; margin-top: 8px;
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
}

.contrib-rows { margin-top: 14px; }
.contrib-row-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.contrib-row-head .cutoff-slider { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.contrib-row-head input[type=range] { width: 90px; accent-color: var(--primary); }
.contrib-row {
  display: grid; grid-template-columns: 22px minmax(0,1fr) 92px 100px 150px 62px;
  gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--hairline-row);
}
.contrib-row .rank { font-size: 10px; color: rgba(248,250,252,.3); text-align: center; }
.contrib-name-wrap { min-width: 0; }
.contrib-name { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contrib-meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contrib-amount { text-align: right; font-family: ui-monospace, Consolas, monospace; font-weight: 500;
  font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.contrib-unit { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.contrib-action { text-align: right; font-size: 11px; color: var(--accent); cursor: pointer; white-space: nowrap; }
.contrib-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 10px; margin-top: 6px; font-size: 11.5px; color: var(--muted);
}
.contrib-sample-note {
  margin-top: 10px; padding: 7px 10px; font-size: 11px; color: var(--muted);
  background: rgba(255,255,255,.04); border: 1px dashed var(--line); border-radius: 6px;
}

.provrail {
  background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: var(--radius);
  padding: 16px; align-self: start;
}
.provrail-h { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); margin-bottom: 4px; }
.provrail-sub { font-size: 11px; color: var(--muted); line-height: 1.5; margin-bottom: 14px; }
.provrail-kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--hairline); font-size: 11.5px; }
.provrail-kv:first-of-type { border-top: none; }
.provrail-kv .k { color: var(--muted); }
.provrail-kv .v { font-family: ui-monospace, Consolas, monospace; color: var(--ink); text-align: right; word-break: break-all; }
.provrail-snip {
  margin-top: 14px; padding: 10px 11px; background: var(--surface-deep); border-radius: 8px;
  font-family: ui-monospace, Consolas, monospace; font-size: 10.5px; line-height: 1.65; color: rgba(248,250,252,.75);
  overflow-x: auto; white-space: pre;
}
.provrail-snip .ok { color: #6fd39b; }
.provrail-copy {
  margin-top: 8px; background: none; border: 1px solid var(--line); color: var(--ink);
  border-radius: 6px; padding: 5px 10px; font-size: 11.5px; cursor: pointer; width: 100%;
}
.provrail-copy:hover { border-color: var(--primary); }
.provrail-docs { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 6px; }
.provrail-docs a { color: var(--accent); font-size: 11.5px; text-decoration: none; }
.provrail-docs a:hover { text-decoration: underline; }

.lcia2-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; align-items: start; }
@media (max-width: 980px) { .lcia2-layout { grid-template-columns: 1fr; } }

/* ================================================================
   Exchanges tab — merged technosphere + biosphere, grouped, with a
   5-square pedigree indicator per row. Screen 3c.
   ================================================================ */

.exfilter {
  display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
}
.exfilter button {
  background: none; border: 0; padding: 7px 13px; font-size: 12px; color: var(--muted); cursor: pointer;
  border-right: 1px solid var(--line);
}
.exfilter button:last-child { border-right: 0; }
.exfilter button.active { background: var(--accent-wash-strong); color: var(--primary); font-weight: 600; }
.exfilter-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 10px 0 4px; }
.exfilter-note { font-size: 11px; color: var(--muted); }

.exgroup-head {
  display: flex; align-items: baseline; gap: 8px; padding: 8px 10px; margin-top: 14px;
  background: var(--surface-2); border-radius: 6px;
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.exrow2 {
  display: grid; grid-template-columns: minmax(0,1fr) 100px 84px 150px 82px;
  gap: 12px; align-items: center; padding: 9px 10px; border-bottom: 1px solid var(--hairline-row);
}
.exrow2-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.exrow2-name a { color: var(--primary); text-decoration: none; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exrow2-name a:hover { text-decoration: underline; }
.exrow2-meta { display: block; font-size: 10.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exrow2-amount { text-align: right; font-family: ui-monospace, Consolas, monospace; font-weight: 500; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.exrow2-unit { font-size: 11px; color: var(--muted); }

.pedigree5 { display: inline-flex; gap: 2px; align-items: center; }
.pedigree5 span { width: 7px; height: 11px; border-radius: 1px; background: var(--line); display: inline-block; }
.pedigree5 span.p1 { background: var(--ped-1); } .pedigree5 span.p2 { background: var(--ped-2); }
.pedigree5 span.p3 { background: var(--ped-3); } .pedigree5 span.p4 { background: var(--ped-4); }
.pedigree5 span.p5 { background: var(--ped-5); }

.exlegend {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px;
  border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted);
}
.exlegend b { text-transform: uppercase; letter-spacing: .08em; color: var(--primary); font-size: 10px; margin-right: 4px; }
.exlegend .sw { width: 7px; height: 11px; border-radius: 1px; display: inline-block; margin-right: 5px; vertical-align: middle; }

.badge-risk {
  background: rgba(201,80,63,.18); border: 1px solid rgba(201,80,63,.5); color: #e07a68;
  font-size: 10px; font-weight: 700; border-radius: 8px; padding: 0 6px; margin-left: 5px;
  font-family: ui-monospace, Consolas, monospace;
}

/* ================================================================
   Search redesign — collapsed sticky hero, filter chips, geography
   grouping, compare footer. Screen 3b.
   ================================================================ */

.hero.compact {
  position: sticky; top: 56px; z-index: 30; padding: 12px 18px; display: flex;
  align-items: center; gap: 10px 16px; flex-wrap: wrap;
}
.hero.compact .hero-title, .hero.compact .search-hint { display: none; }
.hero.compact .searchbox { flex: 1 1 320px; min-width: 220px; order: 1; }
.hero.compact #context-bar-slot { flex: 1 1 100%; order: 2; min-width: 0; }
.hero.compact #context-bar-slot .context-bar {
  margin: 0; max-width: none; justify-content: flex-start; padding: 6px 0 0;
  background: none; border: 0;
}

.geo-toggle-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.geo-toggle { position: relative; width: 30px; height: 16px; border-radius: 8px; background: var(--line); cursor: pointer; border: 0; flex: none; }
.geo-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .14s ease; }
.geo-toggle.on { background: var(--primary); }
.geo-toggle.on::after { left: 16px; }

.result-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.result-controls-l { font-size: 12px; color: var(--muted); }

.cmp-footer {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 14px;
  padding-top: 14px; border-top: 1px solid var(--line);
}
.cmp-btn {
  border: 0; border-radius: 8px; padding: 9px 18px; font-weight: 700; font-size: 13px; cursor: pointer;
  background: var(--primary); color: var(--primary-ink);
}
.cmp-btn:disabled { background: rgba(255,255,255,.07); color: var(--muted); cursor: default; }
.cmp-btn:not(:disabled):hover { background: var(--primary-strong); }
.cmp-basket { font-size: 11.5px; color: var(--muted); }

.rowsel { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.geo-pill-row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.geo-pill-row .chip.geo.dim2 { opacity: .55; }
.unit-hatch {
  background-image: repeating-linear-gradient(115deg, rgba(255,255,255,.14) 0 3px, transparent 3px 7px);
}
.notice-unavailable {
  font-size: 10.5px; color: var(--muted); font-style: italic;
}

/* ============================================================ research home */
.topbar {
  height: 66px;
  padding-inline: clamp(18px, 4vw, 56px);
  border-bottom-color: rgba(255,255,255,.12);
}
.brand { align-items: center; gap: 11px; }
.brand-mark { height: 32px; }
.brand-name { letter-spacing: -.35px; }
.brand-sub {
  border-left: 1px solid var(--line);
  padding-left: 11px;
  margin-left: 1px;
}
.mainnav { gap: 7px; }
.mainnav a { padding: 9px 14px; border-radius: 9px; }
.mainnav a.active {
  background: rgba(251,146,60,.12);
  color: var(--primary);
}

main#app { max-width: 1360px; margin: 30px auto 42px; padding: 0 24px; }
.research { gap: 22px; }
.hero {
  overflow: hidden;
  padding: clamp(28px, 4.5vw, 52px) clamp(24px, 5vw, 58px) 25px;
  border-color: rgba(255,255,255,.13);
  border-radius: 18px;
  background:
    radial-gradient(ellipse at 87% 14%, rgba(251,146,60,.12), transparent 34%),
    linear-gradient(118deg, #151c2d 0%, #131a2a 58%, #171e30 100%);
  box-shadow: 0 18px 48px rgba(0,0,0,.24);
}
.hero::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: 400px;
  height: 400px;
  right: -210px;
  top: -245px;
  border: 1px solid rgba(251,146,60,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(251,146,60,.025), 0 0 0 72px rgba(251,146,60,.02);
  pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero.compact .hero-kicker,
.hero.compact .hero-title,
.hero.compact .hero-deck,
.hero.compact .hero-bottom { display: none; }
.hero-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: #b7c8b7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
}
.hero-kicker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(251,146,60,.6);
}
.hero-kicker-divider { color: #65796b; }
.hero-title {
  max-width: 820px;
  margin: 0;
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: 1.04;
}
.hero-title em {
  color: var(--primary);
  font-style: normal;
}
.hero-deck {
  max-width: 620px;
  margin: 16px 0 26px;
  color: #b4c1b6;
  font-size: 15px;
  line-height: 1.65;
}
.hero .context-bar {
  justify-content: flex-start;
  max-width: none;
  margin: 0 0 14px;
  padding: 9px 12px;
  background: rgba(6,9,17,.25);
}
.searchbox { gap: 10px; }
.searchbox input {
  min-width: 0;
  padding: 17px 19px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 11px;
  background: #0d121d;
  font-size: 15px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
}
.searchbox input::placeholder { color: #809086; }
.searchbox input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(251,146,60,.12);
}
.searchbox button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 126px;
  padding: 15px 20px;
  border-radius: 11px;
  background: var(--primary);
  font-size: 14px;
  transition: background .15s ease, transform .15s ease;
}
.searchbox button:hover { transform: translateY(-1px); }
.searchbox button span { font-size: 18px; font-weight: 400; line-height: 1; }
.hero-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.search-hint { margin: 0; color: #9bab9f; font-size: 12px; }
.hero-n { color: #d7dfea; font-weight: 700; }
.hero-hint-divider { padding: 0 5px; color: #5f7064; }
.example-links {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.examples-label {
  margin-right: 3px;
  color: #849589;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .13em;
}
.example-links button {
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 7px;
  background: rgba(6,9,17,.18);
  color: #c3d0c4;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.example-links button:hover {
  border-color: rgba(251,146,60,.5);
  background: rgba(251,146,60,.08);
  color: var(--primary);
}
.layout { grid-template-columns: 252px minmax(0,1fr); gap: 20px; }
.layout > .card {
  border-color: rgba(255,255,255,.1);
  border-radius: 14px;
  background: rgba(20,26,39,.76);
  box-shadow: 0 10px 28px rgba(0,0,0,.16);
}
.layout > .filters { padding: 18px 17px; }
.layout > .card:not(.filters) { padding: 20px; }
.filters h3 { color: #dbe2ec; font-size: 12px; letter-spacing: .1em; }
.facet { border-color: rgba(255,255,255,.1); }
.facet-h { color: #a4b2a7; }
.result-meta { margin: 0; color: #a3b2a6; }
.result-meta strong { color: #ebeff4; }
.result-controls { margin: 13px 0 10px; }
.tablewrap { border: 1px solid rgba(255,255,255,.09); border-radius: 9px; }
table.data th {
  background: #1a2233;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
table.data td { border-bottom-color: rgba(255,255,255,.08); }
table.data tr:hover td { background: rgba(251,146,60,.055); }
.rname { color: #eaeef3; text-decoration: none; }
.rname:hover { color: var(--primary); }
.footer { color: #849389; }
.empty a { color: var(--accent); text-underline-offset: 2px; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  main#app { margin-top: 22px; padding-inline: 18px; }
  .layout { grid-template-columns: 1fr; }
  .hero { padding: 34px 28px 22px; }
  .hero-bottom { align-items: flex-start; flex-direction: column; }
  .layout > .filters { order: 0; }
}
@media (max-width: 600px) {
  .topbar { height: auto; min-height: 62px; padding: 10px 16px; flex-wrap: wrap; }
  .brand { gap: 8px; }
  .brand-mark { height: 28px; }
  .brand-name { font-size: 17px; }
  .brand-sub { font-size: 10px; padding-left: 8px; }
  .mainnav { gap: 1px; }
  .mainnav a { padding: 8px 10px; font-size: 12px; }
  main#app { margin: 16px auto 30px; padding-inline: 12px; }
  .research { gap: 14px; }
  .hero { padding: 27px 19px 19px; border-radius: 14px; }
  .hero-kicker { font-size: 9px; letter-spacing: .1em; }
  .hero-title { font-size: clamp(35px, 10vw, 48px); }
  .hero-deck { margin: 12px 0 19px; font-size: 13.5px; }
  .searchbox { flex-wrap: wrap; }
  .searchbox input { flex-basis: 100%; padding: 14px; font-size: 14px; }
  .searchbox button { width: 100%; min-height: 46px; }
  .hero-bottom { margin-top: 15px; padding-top: 13px; }
  .example-links { gap: 6px; }
  .example-links button { font-size: 10.5px; }
  .layout > .card:not(.filters) { padding: 15px 12px; }
  .layout > .filters { padding: 15px; }
  .result-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* typeahead overlay: .hero clipped the dropdown (overflow:hidden) and `.hero > *` gave
   .hero-bottom the same z-index as .searchbox, painting its text over the suggestions. */
.hero > .searchbox { z-index: 3; }
.hero:has(.suggest:not([hidden])) { overflow: visible; }
.hero:has(.suggest:not([hidden]))::before { display: none; }

/* tdc-doc report (Documentation tab), ported from bafuquery-temporal 2026-11-19 */
.tdcdoc { overflow-x: auto; line-height: 1.5; font-size: 14px; }
.tdcdoc h1 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; }
.tdcdoc h2 { font-size: 1rem; margin: 1.1rem 0 .4rem; }
.tdcdoc table { border-collapse: collapse; margin: .5rem 0 1rem; font-size: .82rem; }
.tdcdoc th, .tdcdoc td { border: 1px solid var(--line); padding: .25rem .45rem; vertical-align: top; }
.tdcdoc blockquote { margin: .6rem 0; padding: .4rem .8rem; border-left: 3px solid var(--line); }
.tdcdoc img { max-width: 100%; }
.doc-wiki { margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid var(--line); }
#it-doc .hint a { color: var(--accent); }

/* OpenData hero: wordmark + tagline (as on the Transdata landing page) */
.hero-title { max-width: none; margin: 4px 0 0; text-align: center; font-size: clamp(46px, 7vw, 84px); letter-spacing: -.04em; line-height: 1.05; }
.hero-title em { color: var(--primary); font-style: normal; }
.hero-tagline { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0 30px;
  color: var(--ink); font-size: clamp(14px, 2vw, 21px); letter-spacing: .01em; }
.hero-tagline span { flex: 0 1 70px; height: 1px; background: var(--ink); opacity: .7; }
.hero.compact .hero-tagline { display: none; }
@media (max-width: 640px) { .hero-tagline { gap: 10px; } .hero-tagline span { flex-basis: 24px; } }
