/* ExposomeAtlas design system: theme tokens and all shared component styles (teal accent,
   system fonts only). Light by default; dark via html[data-theme="dark"].

   `html:not([data-theme])` covers the moment before the inline <head> script sets the attribute,
   so a page never flashes the wrong palette. The dark selector outranks the bare `:root`, so it
   wins whenever the attribute says dark. */
:root, html:not([data-theme]), html[data-theme="light"] {
  --c-bg: #f5f7f9;
  --c-surface: #ffffff;
  --c-card: #ffffff;
  --c-card-2: #f7f9fa;
  --c-ink: #161a1f;
  --c-strong: #000;
  --c-muted: #5b636e;
  --c-faint: #98a0aa;
  --c-grid: #e7ebee;
  --c-line: #e1e6ea;
  --c-active: #e9f3f1;
  --c-accent: #0d9488;
  --c-accent-2: #0b8276;
  --c-accent-ink: #ffffff;
  --c-accent-soft: #e2f3f0;
  --c-tip-bg: #15181c;
  --c-tip-ink: #fff;
  --c-tip-muted: #b9bdc4;
  --shadow: 0 10px 30px rgba(20, 30, 40, .10);
  --shadow-sm: 0 1px 4px rgba(20, 30, 40, .08);
  /* effect direction: increase / decrease / no clear effect (colour-blind-safe) */
  --pos: #D9480F;
  --neg: #1864ab;
  --nul: #868e96;
  --c-danger: #c92a2a;
  --c-warn: #9a5b00;
  --c-warn-bg: #fff6e6;
  --c-warn-line: #f1d29b;
  color-scheme: light;
}
html[data-theme="dark"] {
  --c-bg: #0e1115;
  --c-surface: #14181d;
  --c-card: #181d23;
  --c-card-2: #1d232a;
  --c-ink: #e9ecef;
  --c-strong: #fff;
  --c-muted: #959ca6;
  --c-faint: #5e6671;
  --c-grid: #272d35;
  --c-line: #2b323a;
  --c-active: #202830;
  --c-accent: #1cc4ae;
  --c-accent-2: #13a896;
  --c-accent-ink: #04130f;
  --c-accent-soft: #0f2a28;
  --c-tip-bg: #000;
  --c-tip-ink: #fff;
  --c-tip-muted: #aab0b8;
  --shadow: 0 10px 34px rgba(0, 0, 0, .45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
  /* effect direction: increase / decrease / no clear effect (colour-blind-safe) */
  --pos: #E8590C;
  --neg: #1f78c4;
  --nul: #8a929c;
  --c-danger: #ff7b7b;
  --c-warn: #f2c46d;
  --c-warn-bg: #2a2214;
  --c-warn-line: #5a4520;
  color-scheme: dark;
}
/* Theme colour: green (the tokens above) or blue. <html data-brand> is set before first paint by each
   page's inline <head> script and switched from the account menu. Only the brand colour and its tints
   move; direction, category, evidence and status colours stay as they are. */
html[data-brand="blue"],
html[data-brand="blue"][data-theme="light"] {
  --c-active: #e8f0fb;
  --c-accent: #1765cc;
  --c-accent-2: #1254ae;
  --c-accent-ink: #ffffff;
  --c-accent-soft: #e3eefc;
}
html[data-brand="blue"][data-theme="dark"] {
  --c-active: #1c2633;
  --c-accent: #5aa0f0;
  --c-accent-2: #3f86d6;
  --c-accent-ink: #06162b;
  --c-accent-soft: #11304f;
}

:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --r: 12px;
  --r-sm: 8px;
}

/* --- Base elements --- */
* {
  box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
}
body {
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
}
::selection {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.mono {
  font-family: var(--font-mono);
}
.muted {
  color: var(--c-muted);
}

/* --- Brand and shell controls --- */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--c-ink);
}
.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -.03em;
}
.brand .bn {
  font-weight: 700;
  letter-spacing: -.01em;
  font-size: 15px;
}
.brand .ver {
  font: 600 10px/1 var(--font-mono);
  color: var(--c-muted);
  border: 1px solid var(--c-grid);
  padding: 3px 5px;
  border-radius: 5px;
  margin-left: 2px;
}
/* text for screen readers only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--c-grid);
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: .12s;
}
.icon-btn:hover {
  color: var(--c-ink);
  background: var(--c-active);
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}

/* --- Left sidebar nav --- */
:root {
  --sb-w: 236px;
  --sb-cw: 64px;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sb-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-right: 1px solid var(--c-grid);
  transition: width .18s ease, transform .2s ease;
}
.sb-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 56px;
  padding: 0 10px 0 16px;
  border-bottom: 1px solid var(--c-grid);
}
.sb-head .brand {
  gap: 9px;
  min-width: 0;
  overflow: hidden;
}
.sb-head .brand .bn {
  white-space: nowrap;
}
.sb-toggle {
  flex: none;
  width: 30px;
  height: 30px;
}
.sb-toggle svg {
  transition: transform .18s ease;
}

.sb-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
}
.nav-group {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--c-faint);
  padding: 13px 10px 4px;
  white-space: nowrap;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--c-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-item:hover {
  color: var(--c-ink);
  background: var(--c-active);
}
.nav-item.on {
  color: var(--c-accent);
  background: var(--c-accent-soft);
  font-weight: 600;
}
.nav-item .ic {
  flex: none;
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-item .ic svg {
  width: 19px;
  height: 19px;
}
.nav-item .lbl {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* arrow on links that open in a new tab */
.nav-item .nav-ext {
  margin-left: auto;
  font-size: 11px;
  color: var(--c-faint);
}
.nav-item:hover .nav-ext {
  color: var(--c-muted);
}

.sb-foot {
  flex: none;
  border-top: 1px solid var(--c-grid);
  padding: 10px 12px;
}
.sb-foot .topbar-right {
  width: 100%;
  flex-wrap: wrap;
  gap: 10px;
}
.sb-foot #ea-userchip {
  order: -1;
  flex: 1 1 auto;
  min-width: 0;
}

/* The header bar: on a phone the menu button and the name; on every screen the account menu */
.apptop {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  padding: 0 24px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-grid);
}
.apptop .burger,
.apptop .brand {
  display: none;
}
.apptop .topbar-right {
  margin-left: auto;
}
.acct {
  position: relative;
}
.acct-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--c-grid);
  border-radius: 99px;
  background: var(--c-card);
  color: var(--c-ink);
  font: 600 13px var(--font-sans);
  cursor: pointer;
}
.acct-btn:hover,
.acct-btn[aria-expanded="true"] {
  border-color: var(--c-accent);
}
.acct-btn:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
}
.acct-av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font: 700 12px var(--font-sans);
  letter-spacing: .02em;
}
.acct-av.big {
  width: 52px;
  height: 52px;
  font-size: 18px;
}
.acct-who {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: left;
}
.acct-who small {
  font: 500 11px var(--font-sans);
  color: var(--c-muted);
}
.acct-chev {
  color: var(--c-muted);
  font-size: 11px;
}
.acct-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 90;
  width: 280px;
  padding: 6px;
  background: var(--c-card);
  border: 1px solid var(--c-grid);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.acct-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--c-grid);
  font-size: 14px;
}
.acct-head span {
  font-size: 12px;
  color: var(--c-muted);
  overflow-wrap: anywhere;
}
.acct-menu > button,
.acct-menu > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--c-ink);
  font: 500 13.5px var(--font-sans);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.acct-menu > button:hover,
.acct-menu > a:hover,
.acct-menu > button:focus-visible,
.acct-menu > a:focus-visible {
  background: var(--c-active);
  outline: none;
}
.acct-menu .acct-ext {
  color: var(--c-muted);
  font-size: 12px;
}
.acct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  font-size: 13.5px;
}
.acct-swatches {
  display: inline-flex;
  gap: 8px;
}
.acct-sw {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid var(--c-card);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--c-line);
  cursor: pointer;
}
.acct-sw-green {
  background: #0d9488;
}
.acct-sw-blue {
  background: #1765cc;
}
.acct-sw.on {
  box-shadow: 0 0 0 2px var(--c-ink);
}
.acct-switch {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 99px;
  background: var(--c-line);
  transition: background .15s;
}
.acct-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: left .15s;
}
.acct-switch.on {
  background: var(--c-accent);
}
.acct-switch.on::after {
  left: 16px;
}
.acct-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--c-grid);
}
.acct-menu .acct-out {
  color: var(--c-danger);
}
.acct-prof {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.acct-prof dl {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 13.5px;
}
.acct-prof dt {
  color: var(--c-muted);
}
.acct-prof dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.acct-prof p {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  font-size: 12.5px;
}
@media (max-width: 640px) {
  .acct-prof,
  .acct-prof dl {
    grid-template-columns: minmax(0, 1fr);
  }
  .acct-prof dl {
    gap: 2px;
  }
  .acct-prof dd {
    margin-bottom: 8px;
  }
}

/* desktop: the fixed rail shifts the page; collapsed, it becomes an icon-only rail.
   .has-sidebar / .nav-collapsed are set on <html> by an inline <head> script before first paint,
   so the gutter is reserved up front and only a collapse animates. */
@media (min-width: 901px) {
  html.has-sidebar body {
    padding-left: var(--sb-w);
    transition: padding-left .18s ease;
  }
  html.nav-collapsed body {
    padding-left: var(--sb-cw);
  }
  html.nav-collapsed .sidebar {
    width: var(--sb-cw);
  }
  html.nav-collapsed .sb-head {
    justify-content: center;
    padding: 0;
  }
  html.nav-collapsed .sb-head .brand {
    display: none;
  }
  html.nav-collapsed .sb-toggle svg {
    transform: rotate(180deg);
  }
  html.nav-collapsed .nav-item .lbl,
  html.nav-collapsed .nav-item .nav-ext,
  html.nav-collapsed .nav-group,
  html.nav-collapsed .sb-foot #ea-userchip {
    display: none;
  }
  html.nav-collapsed .nav-item {
    justify-content: center;
    padding: 9px 0;
  }
  html.nav-collapsed .sb-foot {
    display: flex;
    justify-content: center;
    padding: 10px 0;
  }
}

/* mobile: off-canvas drawer + hamburger top bar */
@media (max-width: 900px) {
  html.has-sidebar body, html.nav-collapsed body {
    padding-left: 0;
  }
  .sidebar {
    transform: translateX(-100%);
    width: var(--sb-w);
    box-shadow: none;
  }
  html.nav-collapsed .sidebar {
    width: var(--sb-w);
  }
  body.nav-open .sidebar {
    transform: none;
    box-shadow: var(--shadow);
  }
  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .42);
    z-index: 55;
  }
  .apptop {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 52px;
    padding: 0 14px;
  }
  .apptop .burger,
  .apptop .brand {
    display: inline-flex;
  }
  .apptop .brand .bn {
    font-size: 14px;
  }
  .acct-who,
  .acct-chev {
    display: none;
  }
  .acct-btn {
    padding: 3px;
  }
}

/* --- Page scaffold --- */
.page {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px 24px 64px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.page-head .desc {
  margin: 5px 0 0;
  color: var(--c-muted);
  font-size: 13.5px;
  max-width: 620px;
}
.page-head .actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.crumb {
  font: 600 11px/1 var(--font-mono);
  color: var(--c-muted);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  gap: 7px;
  align-items: center;
}
.crumb svg {
  width: 13px;
  height: 13px;
}
.crumb a {
  color: var(--c-accent);
  text-decoration: none;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 12.5px/1 var(--font-sans);
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid var(--c-grid);
  background: var(--c-card);
  color: var(--c-ink);
  cursor: pointer;
  transition: .12s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  background: var(--c-active);
  border-color: var(--c-line);
}
.btn svg {
  width: 14px;
  height: 14px;
}
.btn-primary {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-accent-ink);
}
.btn-primary:hover {
  background: var(--c-accent-2);
  border-color: var(--c-accent-2);
}
.btn-sm {
  padding: 6px 10px;
  font-size: 11.5px;
}

/* --- Cards --- */
.card {
  background: var(--c-card);
  border: 1px solid var(--c-grid);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-pad {
  padding: 16px 18px;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px 0;
}
.card-head h3, .card-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.card-head .sub {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--c-muted);
}
.card-body {
  padding: 14px 18px 16px;
}
.grid {
  display: grid;
  gap: 16px;
}
.chart {
  width: 100%;
}

/* --- KPI cards --- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--c-card);
  border: 1px solid var(--c-grid);
  border-radius: var(--r);
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: .12s;
}
a.kpi:hover {
  border-color: var(--c-accent);
  transform: translateY(-1px);
}
.kpi .v {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -.025em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi .l {
  font: 600 10.5px/1.2 var(--font-mono);
  color: var(--c-muted);
  margin-top: 8px;
  letter-spacing: .02em;
}
.kpi .spark {
  margin-top: 10px;
}
.kpi.accent .v {
  color: var(--c-accent);
}

/* --- Filter bar --- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 13px 16px;
  background: var(--c-card);
  border: 1px solid var(--c-grid);
  border-radius: var(--r);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.fl {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.fl > label {
  font: 600 10px/1 var(--font-mono);
  color: var(--c-muted);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.fl select, .fl input[type=text], .fl input[type=search] {
  background: var(--c-bg);
  border: 1px solid var(--c-grid);
  color: var(--c-ink);
  border-radius: 7px;
  padding: 7px 9px;
  font: 500 12.5px/1 var(--font-sans);
  min-width: 130px;
  cursor: pointer;
}
.fl input[type=text], .fl input[type=search] {
  cursor: text;
}
.fl select:hover {
  border-color: var(--c-line);
}
.filters .spacer {
  flex: 1;
}
.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--c-ink);
  padding: 7px 11px;
  border: 1px solid var(--c-grid);
  border-radius: 7px;
  background: var(--c-bg);
  cursor: pointer;
  user-select: none;
}
.toggle-chip input {
  accent-color: var(--c-accent);
  width: 14px;
  height: 14px;
  margin: 0;
}
.toggle-chip.on {
  border-color: var(--c-accent);
  background: var(--c-accent-soft);
  color: var(--c-accent);
}
.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range-row input[type=range] {
  accent-color: var(--c-accent);
}
.range-val {
  font: 600 11.5px/1 var(--font-mono);
  color: var(--c-accent);
  min-width: 34px;
}

/* segmented control */
.seg {
  display: inline-flex;
  background: var(--c-bg);
  border: 1px solid var(--c-grid);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: none;
  background: transparent;
  color: var(--c-muted);
  font: 600 12px/1 var(--font-sans);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: .12s;
}
.seg button.on {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}
.seg button:not(.on):hover {
  color: var(--c-ink);
}

/* --- Tables --- */
.table-wrap {
  background: var(--c-card);
  border: 1px solid var(--c-grid);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-scroll {
  overflow: auto;
  max-height: none;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--c-card-2);
  text-align: left;
  font: 600 10.5px/1.3 var(--font-mono);
  color: var(--c-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--c-grid);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
table.data thead th.sortable:hover {
  color: var(--c-ink);
}
table.data thead th .arr {
  opacity: .35;
  margin-left: 3px;
}
table.data thead th.sorted .arr {
  opacity: 1;
  color: var(--c-accent);
}
table.data tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--c-grid);
  vertical-align: middle;
}
table.data tbody tr {
  transition: background .1s;
}
table.data tbody tr:hover {
  background: var(--c-active);
}
/* the association sub-row: full-width caption belonging to the record above it */
table.data tbody tr.rowmain td {
  border-bottom: none;
}
table.data tbody tr.subrow td {
  border-top: 0;
  padding-top: 0;
  padding-bottom: 10px;
  color: var(--c-muted);
  font-size: 11.5px;
  line-height: 1.5;
}
table.data tbody tr.subrow td b {
  font-weight: 600;
  color: var(--c-faint);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 4px;
}
table.data tbody tr.clickable {
  cursor: pointer;
}
table.data .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.t-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-top: 1px solid var(--c-grid);
  font-size: 12px;
  color: var(--c-muted);
  background: var(--c-card-2);
}
.pager {
  display: flex;
  gap: 6px;
  align-items: center;
}
.pager button {
  border: 1px solid var(--c-grid);
  background: var(--c-card);
  color: var(--c-ink);
  border-radius: 6px;
  padding: 5px 10px;
  font: 600 12px/1 var(--font-sans);
  cursor: pointer;
}
.pager button:disabled {
  opacity: .4;
  cursor: default;
}

/* --- Badges and chips --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 600 11px/1 var(--font-sans);
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 600 10.5px/1 var(--font-mono);
  padding: 3px 7px;
  border-radius: 5px;
  border: 1px solid var(--c-grid);
  color: var(--c-muted);
  white-space: nowrap;
}
.tag.solid {
  background: var(--c-accent-soft);
  color: var(--c-accent);
  border-color: transparent;
}
/* Ontology terms: the mark of a term (confirmed / exact match / suggested) and the inline term line */
.term-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: help;
}
.term-mark.sm { font-size: 10.5px; padding: 2px 6px; }
.term-mark.t-confirmed { background: var(--c-accent); color: var(--c-accent-ink); }
.term-mark.t-confirmed::before { content: "\2713"; font-weight: 700; }
.term-mark.t-exact { background: var(--c-accent-soft); color: var(--c-accent); border-color: var(--c-accent-soft); }
.term-mark.t-suggested { background: var(--c-warn-bg); color: var(--c-warn); border-color: var(--c-warn-line); }
.term-inline { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 12.5px; }
.term-inline.sm { font-size: 11.5px; }
.term-inline .term-label { color: var(--c-ink); }
.term-curie { font: 600 11px/1 var(--font-mono); color: var(--c-accent); text-decoration: none; white-space: nowrap; }
.term-curie svg { width: 11px; height: 11px; vertical-align: -1px; }
a.term-curie:hover { text-decoration: underline; }
.term-strip {
  margin: -4px 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--c-line);
  border-left: 3px solid var(--c-accent);
  border-radius: 8px;
  background: var(--c-card);
  display: grid;
  gap: 6px;
}
.term-strip .ts-main, .term-strip .ts-groups, .term-strip .ts-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.term-strip .ts-k { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--c-muted); min-width: 108px; }
.term-strip .ts-def, .term-strip .ts-note { margin: 0; font-size: 12px; color: var(--c-muted); line-height: 1.45; }
.term-strip .ts-def { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ts-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--c-line); color: var(--c-ink); text-decoration: none; background: var(--c-card-2);
}
.ts-chip b { font-weight: 600; color: var(--c-accent); }
.ts-chip:hover { border-color: var(--c-accent); }
@media (max-width: 640px) { .term-strip .ts-k { min-width: 0; width: 100%; } }
/* the term column of the exposure and phenotype tables */
.tc-label { font-size: 12.5px; color: var(--c-ink); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.via-term { display: block; font-size: 11px; color: var(--c-muted); margin-top: 2px; }
.group-chip { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 6px 4px 11px; border-radius: 999px; background: var(--c-accent-soft); color: var(--c-ink); }
.group-chip button { border: 0; background: transparent; color: var(--c-muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 0 4px; }
.group-chip button:hover { color: var(--c-ink); }
.chip-cat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--c-ink);
}
.chip-cat .sw {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}
.strength {
  display: inline-flex;
  gap: 2px;
  align-items: center;
}
.strength i {
  width: 5px;
  height: 11px;
  border-radius: 1px;
  background: var(--c-grid);
  display: inline-block;
}
.strength i.on {
  background: var(--c-accent);
}
.qflag {
  font: 600 10px/1 var(--font-mono);
  padding: 2px 6px;
  border-radius: 4px;
}
.qflag.q {
  background: var(--c-accent-soft);
  color: var(--c-accent);
}
.qflag.d {
  background: var(--c-active);
  color: var(--c-muted);
}
.verified {
  color: var(--c-accent);
}

/* --- Legend --- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  font-size: 12px;
  color: var(--c-muted);
}
.legend .it {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: default;
}
.legend .sw {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: none;
}
.legend .ln {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  flex: none;
}

/* --- Drawer (provenance and details) --- */
.drawer-bd {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  visibility: hidden;
  transition: .2s;
  z-index: 80;
}
.drawer-bd.open {
  opacity: 1;
  visibility: visible;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(520px, 94vw);
  background: var(--c-surface);
  border-left: 1px solid var(--c-grid);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.2, .7, .2, 1);
  z-index: 81;
  display: flex;
  flex-direction: column;
}
.drawer.open {
  transform: none;
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--c-grid);
}
.drawer-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.drawer-head .x {
  cursor: pointer;
  color: var(--c-muted);
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  padding: 0;
}
.drawer-body {
  padding: 18px 20px;
  overflow: auto;
  flex: 1;
}
.dl {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 14px;
  font-size: 13px;
}
.dl dt {
  color: var(--c-muted);
  font-size: 12px;
}
.dl dd {
  margin: 0;
  color: var(--c-ink);
}
.prov {
  background: var(--c-card);
  border: 1px solid var(--c-grid);
  border-radius: var(--r-sm);
  padding: 14px;
  margin-top: 14px;
}
.prov h4 {
  margin: 0 0 10px;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.section-label {
  font: 600 11px/1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin: 22px 0 10px;
}

/* --- Miscellaneous --- */
.empty {
  padding: 40px;
  text-align: center;
  color: var(--c-muted);
  font-size: 13px;
}
.split-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--c-muted);
}
.split-row b {
  color: var(--c-ink);
  font-variant-numeric: tabular-nums;
}
.note {
  font-size: 12px;
  color: var(--c-faint);
  display: flex;
  gap: 7px;
  align-items: flex-start;
}
.note svg {
  width: 14px;
  height: 14px;
  flex: none;
  margin-top: 1px;
}
.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
@media (max-width: 1100px) {
  .cols-3, .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 740px) {
  .cols-2, .cols-3, .cols-4 {
    grid-template-columns: 1fr;
  }
  .page {
    padding: 16px 14px 48px;
  }
}
.hl {
  color: var(--c-accent);
  text-decoration: none;
  font-weight: 600;
}
.hl:hover {
  text-decoration: underline;
}
/* inline external-link icon; an unsized inline SVG would render at its default size */
.hl svg {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
}

/* --- Modal --- */
.modal-bd {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  opacity: 0;
  visibility: hidden;
  transition: .18s;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
/* Visibility switches at once on open (only opacity fades), so a dialog opened a second time is
   visible when dialog.js focuses its first field; closing still fades through the base rule. */
.modal-bd.open {
  opacity: 1;
  visibility: visible;
  transition-property: opacity;
}
.modal {
  background: var(--c-surface);
  border: 1px solid var(--c-grid);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  width: min(640px, 96vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  transform: translateY(8px);
  transition: transform .18s;
}
.modal-bd.open .modal {
  transform: none;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--c-grid);
}
.modal-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.modal-head .x {
  cursor: pointer;
  color: var(--c-muted);
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  padding: 0;
}
.modal-body {
  padding: 8px 12px 14px;
  overflow: auto;
}

/* --- Dialogs --- */
/* Themed replacements for alert/confirm/prompt (js/dialog.js), built on the .modal primitives. */
.modal.sm {
  width: min(460px, 96vw);
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 20px;
  border-top: 1px solid var(--c-grid);
}
.dlg-text {
  margin: 6px 8px 10px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--c-ink);
}
.dlg-text .muted {
  color: var(--c-muted);
}
.dlg-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px 8px 4px;
}
.dlg-fields .fl > label {
  margin-bottom: 1px;
}
.dlg-fields .fl input[type=text] {
  min-width: 0;
  width: 100%;
  padding: 9px 11px;
  font-size: 13.5px;
}
.dlg-fields .hint {
  font-size: 11.5px;
  color: var(--c-faint);
  line-height: 1.45;
}
.dlg-err {
  margin: 2px 8px 0;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  background: color-mix(in srgb, var(--pos) 12%, transparent);
  border: 1px solid var(--pos);
  color: var(--pos);
}
.dlg-err[hidden] {
  display: none;
}
.btn-danger {
  background: var(--pos);
  border-color: var(--pos);
  color: #fff;
}
.btn-danger:hover {
  background: var(--pos);
  border-color: var(--pos);
  filter: brightness(.92);
}

/* colour picker: swatch grid for a category's chart colour */
.sw-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 7px;
  padding: 2px 0;
}
.sw-grid button {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform .1s;
}
.sw-grid button:hover {
  transform: scale(1.12);
}
.sw-grid button.on {
  border-color: var(--c-ink);
  box-shadow: 0 0 0 2px var(--c-surface) inset;
}
.sw-grid button.taken {
  opacity: .32;
  cursor: not-allowed;
}
.sw-grid button.taken:hover {
  transform: none;
}
.sw-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--c-grid);
  border-radius: 8px;
  background: var(--c-card-2);
  font-size: 13px;
}
.sw-preview .dot {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  flex: none;
}

/* toast: a confirmation that does not need a click */
.toast-wrap {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--c-surface);
  border: 1px solid var(--c-grid);
  border-left: 3px solid var(--c-accent);
  border-radius: 9px;
  box-shadow: var(--shadow);
  padding: 11px 15px;
  font-size: 13px;
  max-width: min(560px, 92vw);
  opacity: 0;
  transform: translateY(8px);
  transition: .2s;
}
.toast.in {
  opacity: 1;
  transform: none;
}
.toast.err {
  border-left-color: var(--pos);
}
.toast .ic {
  flex: none;
  font-weight: 700;
  color: var(--c-accent);
}
.toast.err .ic {
  color: var(--pos);
}

/* ranked "view all" list (EAApp.rankModal) */
.rank-list {
  display: flex;
  flex-direction: column;
}
.rank-list a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.rank-list a:hover {
  background: var(--c-active);
}
.rank-list .rl-n {
  font: 700 11px/1 var(--font-mono);
  color: var(--c-faint);
  width: 26px;
  text-align: right;
  flex: none;
}
.rank-list .rl-sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}
.rank-list .rl-label {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-list .rl-val {
  font: 600 12px/1 var(--font-mono);
  color: var(--c-muted);
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* --- Paper viewer (PDF panel beside the provenance drawer) --- */
.paper-viewer {
  position: fixed;
  top: 0;
  right: min(520px, 94vw);
  height: 100%;
  width: min(920px, calc(100vw - min(520px, 94vw)));
  background: var(--c-surface);
  border-left: 1px solid var(--c-grid);
  box-shadow: -10px 0 30px rgba(0, 0, 0, .16);
  transform: translateX(24px);
  opacity: 0;
  visibility: hidden;
  transition: .22s;
  z-index: 81;
  display: flex;
  flex-direction: column;
}
.paper-viewer.solo {
  right: 0;
  width: min(900px, 58vw);
  border-left: 1px solid var(--c-grid);
  box-shadow: var(--shadow);
}
.paper-viewer.open {
  transform: none;
  opacity: 1;
  visibility: visible;
}
.paper-viewer .pv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--c-grid);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink);
}
.paper-viewer .pv-head .x {
  cursor: pointer;
  color: var(--c-muted);
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}
.pv-scroll {
  flex: 1;
  overflow: auto;
  background: var(--c-active);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: safe center;   /* a zoomed page wider than the pane scrolls instead of clipping */
  overflow-anchor: none;      /* createPdfView keeps the view steady itself as pages take their size */
  gap: 14px;
}
.pv-page-wrap {
  position: relative;
  background: #fff;
  box-shadow: 0 1px 7px rgba(0, 0, 0, .2);
  flex: none;
  max-width: 100%;
}
.pv-page-wrap canvas {
  display: block;
}
.pv-hl {
  position: absolute;
  background: rgba(255, 210, 0, .45);
  border-radius: 2px;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.pv-msg {
  margin: auto;
  color: var(--c-muted);
  font-size: 13px;
  text-align: center;
  padding: 26px;
  line-height: 1.6;
}
/* Evidence for a curated value, outlined on the page (createPdfView). Colours by how it was found. */
.pv-ev {
  position: absolute;
  border-radius: 3px;
  border: 1.5px solid rgba(13, 148, 136, .55);
  background: rgba(13, 148, 136, .10);
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.pv-ev.m-quote {
  border-color: rgba(24, 100, 171, .55);
  background: rgba(24, 100, 171, .10);
}
.pv-ev.m-caption {
  border-color: rgba(154, 91, 0, .55);
  background: rgba(241, 210, 155, .25);
  border-style: dashed;
}
.pv-ev:hover {
  background: rgba(13, 148, 136, .2);
}
.pv-ev.on {
  border-width: 2.5px;
  border-color: #e8590c;
  background: rgba(255, 196, 0, .30);
  box-shadow: 0 0 0 4px rgba(232, 89, 12, .18);
  z-index: 2;
}
.pv-ev.flash {
  animation: pv-flash 1.1s ease-out 1;
}
@keyframes pv-flash {
  0% { box-shadow: 0 0 0 14px rgba(232, 89, 12, .35); }
  100% { box-shadow: 0 0 0 4px rgba(232, 89, 12, .18); }
}
.pv-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
}
.pv-title #pvTitle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pv-acts {
  display: flex;
  align-items: center;
  flex: none;
}
.ev-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font: 600 11px/1 var(--font-sans);
  padding: 4px 8px;
  border-radius: 20px;
  white-space: nowrap;
  color: #087f5b;
  background: #e6f6ef;
}
.ev-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
}
.ev-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.ev-chip.m-quote { color: #1864ab; background: #e7f0fa; }
.ev-chip.m-caption { color: var(--c-warn); background: var(--c-warn-bg); }
.ev-chip.m-page, .ev-chip.m-none { color: var(--c-muted); background: var(--c-card-2); }
html[data-theme="dark"] .ev-chip { background: #10261f; color: #63e6be; }
html[data-theme="dark"] .ev-chip.m-quote { background: #12223a; color: #74c0fc; }

/* too narrow to sit beside the drawer */
@media (max-width: 880px) {
  .paper-viewer {
    display: none;
  }
}

/* --- Loading indicators (EAApp.spinner, EAApp.busy) --- */
.ea-load {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  padding: 46px 20px;
  color: var(--c-muted);
  font-size: 13px;
}
.ea-sp {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--c-grid);
  border-top-color: var(--c-accent);
  animation: ea-spin .7s linear infinite;
  flex: none;
}
.ea-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  z-index: 6;
  color: var(--c-muted);
  font-size: 13px;
  background: color-mix(in srgb, var(--c-card) 68%, transparent);
}
@keyframes ea-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .ea-sp {
    animation-duration: 1.7s;
  }
}

/* --- Public-page chrome (landing, register) --- */
/* One header and footer for every page a signed-out visitor sees. */
.lp-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
  padding: 0 28px;
  background: color-mix(in srgb, var(--c-surface) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--c-grid);
}
.lp-header .links {
  display: flex;
  gap: 4px;
  flex: 1;
}
.lp-header .links a {
  font-size: 13px;
  color: var(--c-muted);
  text-decoration: none;
  padding: 7px 11px;
  border-radius: 8px;
}
.lp-header .links a:hover {
  color: var(--c-ink);
  background: var(--c-active);
}
.lp-header .spacer {
  flex: 1;
}
.lp-header .topbar-right {
  margin-left: auto;
}
@media (max-width: 900px) {
  .lp-header .links {
    display: none;
  }
}
@media (max-width: 640px) {
  .lp-header {
    padding: 0 16px;
    gap: 12px;
  }
  .lp-header .brand .ver {
    display: none;
  }
  .lp-header .hide-sm {
    display: none;
  }
}
.lp {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}
.lp-footer {
  border-top: 1px solid var(--c-grid);
  padding: 26px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--c-muted);
  font-size: 12.5px;
}
.lp-footer .brand-sm {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--c-ink);
  font-weight: 700;
}
.lp-footer .logo-sm {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
}

/* --- Auth component (sign-in dialog, registration) --- */
/* Shared by both account surfaces. Colours come only from the theme tokens. */
.auth-card {
  position: relative;
  width: 100%;
  background: var(--c-card);
  border: 1px solid var(--c-grid);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 32px 24px;
  color: var(--c-ink);
  font-family: var(--font-sans);
  text-align: left;
}
.auth-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -.03em;
  margin-bottom: 18px;
}
.auth-title {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 720;
  letter-spacing: -.02em;
  color: var(--c-ink);
}
.auth-sub {
  margin: 0 0 24px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--c-muted);
}
.auth-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  font: 600 10.5px/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-muted);
}
.auth-section::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--c-grid);
}
.auth-section + .auth-field {
  margin-top: 0;
}
.auth-gap {
  height: 10px;
}
.auth-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 520px) {
  .auth-row {
    grid-template-columns: 1fr;
  }
}
.auth-field {
  margin-bottom: 16px;
  min-width: 0;
}
.auth-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--c-ink);
}
.auth-input-wrap {
  position: relative;
}
.auth-input {
  display: block;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--c-line);
  border-radius: 9px;
  background: var(--c-surface);
  color: var(--c-ink);
  font: 400 14px/1.2 var(--font-sans);
  transition: border-color .12s, box-shadow .12s;
  -webkit-appearance: none;
  appearance: none;
}
.auth-input::placeholder {
  color: var(--c-faint);
}
.auth-input:hover {
  border-color: color-mix(in srgb, var(--c-accent) 35%, var(--c-line));
}
.auth-input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-accent) 20%, transparent);
}
.auth-input[aria-invalid="true"] {
  border-color: var(--c-danger);
}
.auth-input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c-danger) 18%, transparent);
}
.auth-input.has-icon {
  padding-right: 42px;
}
.auth-input-btn {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--c-faint);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.auth-input-btn:hover {
  color: var(--c-ink);
  background: var(--c-active);
}
.auth-input-btn svg {
  width: 17px;
  height: 17px;
}
.auth-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--c-muted);
}
.auth-ferr {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--c-danger);
}
.auth-ferr:empty {
  display: none;
}
.auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  margin: 8px 0 0;
  padding: 0 16px;
  border: 1px solid var(--c-accent);
  border-radius: 10px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font: 600 14.5px/1 var(--font-sans);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.auth-btn:hover {
  background: var(--c-accent-2);
  border-color: var(--c-accent-2);
}
.auth-btn:disabled {
  opacity: .65;
  cursor: default;
}
.auth-btn .ea-sp {
  width: 16px;
  height: 16px;
  border-width: 2px;
  border-color: color-mix(in srgb, var(--c-accent-ink) 35%, transparent);
  border-top-color: var(--c-accent-ink);
}
.auth-fine {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--c-muted);
  text-align: center;
}
.auth-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid;
}
.auth-alert svg {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 2px;
}
.auth-alert[hidden] {
  display: none;
}
.auth-alert.err {
  color: var(--c-danger);
  background: color-mix(in srgb, var(--c-danger) 8%, var(--c-card));
  border-color: color-mix(in srgb, var(--c-danger) 28%, transparent);
}
.auth-alert.warn {
  color: var(--c-warn);
  background: var(--c-warn-bg);
  border-color: var(--c-warn-line);
}
.auth-alert.in-form {
  margin: 4px 0 14px;
}
.auth-foot {
  margin: 24px -32px 0;
  padding: 18px 32px 0;
  border-top: 1px solid var(--c-grid);
  text-align: center;
  font-size: 13px;
  color: var(--c-muted);
}
.auth-foot a {
  color: var(--c-accent);
  font-weight: 600;
  text-decoration: none;
}
.auth-foot a:hover {
  text-decoration: underline;
}
.auth-x {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--c-faint);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.auth-x:hover {
  color: var(--c-ink);
  background: var(--c-active);
}
.auth-x svg {
  width: 18px;
  height: 18px;
}
@media (max-width: 480px) {
  .auth-card {
    padding: 26px 20px 20px;
    border-radius: 14px;
  }
  .auth-foot {
    margin: 22px -20px 0;
    padding: 16px 20px 0;
  }
}

/* combobox (searchable, type-to-add) */
.auth-combo-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 248px;
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.auth-combo-list[hidden] {
  display: none;
}
.auth-combo-list li {
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  line-height: 1.35;
  color: var(--c-ink);
  cursor: pointer;
}
.auth-combo-list li mark {
  background: none;
  color: var(--c-accent);
  font-weight: 650;
}
.auth-combo-list li.on {
  background: var(--c-active);
}
.auth-combo-list li.add {
  border-top: 1px solid var(--c-grid);
  margin-top: 4px;
  padding-top: 11px;
  border-radius: 0 0 7px 7px;
  color: var(--c-muted);
}
.auth-combo-list li.add b {
  color: var(--c-ink);
  font-weight: 600;
}
.auth-combo-list li.add:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 9px;
  border-radius: 7px;
}
.auth-combo-list li.empty {
  cursor: default;
  color: var(--c-muted);
}

/* sign-in dialog: a modal with a soft scrim. The scrim is not scrollable, so wheel and touch still
   scroll the page beneath; a click on it, the close button or Esc dismisses the dialog. */
#ea-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: color-mix(in srgb, var(--c-bg) 55%, rgba(10, 14, 18, .38));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: auth-fade .16s ease-out;
}
#ea-auth-gate .auth-card {
  max-width: 400px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  animation: auth-rise .2s ease-out;
}
@keyframes auth-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes auth-rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  #ea-auth-gate, #ea-auth-gate .auth-card {
    animation: none;
  }
}

/* --- Signed-in state --- */
/* Prompts for signed-out visitors (data-anon) are hidden after sign-in. The :root prefix keeps the
   specificity above .btn and other one- or two-class rules that set display. */
:root [data-anon][hidden] {
  display: none;
}
