/*
 * Styles for the redesigned admin dashboard (#4272).
 *
 * The three-column shell (sidebar / content / TOC) is inherited wholesale from api-docs.css via shared .api-* class
 * names. This file only adds what the docs don't have: the "coming soon" nav treatment and the Coverage page's
 * map, legend, KPIs, chart, and details panel. Colors/spacing come from the design-system tokens in main.css and
 * api-docs.css — avoid hardcoding values that already exist as tokens.
 *
 * Coverage sequential color scale (ColorBrewer "Blues", colorblind-safe). Keep these in sync with
 * CoverageColors.STOPS in coverage-map.js so the map, legend, and bar chart all agree.
 */
:root {
  --coverage-c0: #eff3ff; /* ~0%   */
  --coverage-c1: #bdd7e7; /* ~33%  */
  --coverage-c2: #6baed6; /* ~66%  */
  --coverage-c3: #2171b5; /* ~100% */
  --coverage-selected: var(--color-label-surface-problem); /* High-contrast highlight against the Blues scale */

  /* Shared MiniLineChart series colors (Data Quality agreement trend, API usage trend). Blue/orange =
       colorblind-safe pair; apiDocs muted grey since it's our own traffic. */
  --dq-human: #2171b5;
  --dq-ai: var(--color-label-surface-problem);
  --api-external: #2171b5;
  --api-docs: var(--color-neutral-600);

  /* Activity colors, from the Okabe-Ito colorblind-safe qualitative palette. Volume + registered share the blue;
       anonymous uses vermillion — the blue/orange pairing is maximally distinct in both hue AND luminance (so it
       survives color-vision deficiency and grayscale), which a blue/purple pairing is not. */
  --act-accent: #0072b2;
  --act-registered: #0072b2;
  --act-anon: #d55e00;

  /* Humans vs AI series colors: Okabe-Ito blue + vermillion (colorblind-safe, distinct in hue AND luminance). */
  --hva-human: #0072b2;
  --hva-ai: #d55e00;
}

/* --- Left nav: disabled "coming soon" items ------------------------------------------------------------------ */
.api-nav-item.disabled {
  color: var(--color-neutral-600);
  cursor: default;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-soon-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--color-neutral-200);
  color: var(--color-neutral-700);
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: var(--space-xs, 8px);
}

/* --- KPIs ---------------------------------------------------------------------------------------------------- */
.coverage-kpis {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md, 16px);
  margin: var(--space-lg, 24px) 0;
}

.coverage-kpi {
  flex: 1 1 140px;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  padding: var(--space-md, 16px);
  background: var(--color-neutral-white);
}

.coverage-kpi-value {
  display: block;
  font-size: var(--font-size-xxl, 1.5rem);
  font-weight: 700;
  color: var(--color-text-heading, #263238);
  line-height: 1.1;
}

.coverage-kpi-label {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

/* --- Status / error line ------------------------------------------------------------------------------------- */
.coverage-status {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

.coverage-status.error {
  color: var(--color-accent-delete, #f93e3e);
}

.coverage-status.hidden {
  display: none;
}

/* --- Map ----------------------------------------------------------------------------------------------------- */
.coverage-map {
  width: 100%;
  height: 480px;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  overflow: hidden;
}

/* Coverage legend: a gradient bar with 0% / 100% end labels. */
.coverage-legend {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 12px);
  margin-top: var(--space-sm, 12px);
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.coverage-legend-gradient {
  flex: 0 0 220px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--coverage-c0), var(--coverage-c1), var(--coverage-c2), var(--coverage-c3));
  border: 1px solid var(--color-neutral-200);
}

/* Mapbox popup tweaks so the tooltip matches the dashboard type. */
.coverage-map .mapboxgl-popup-content {
  font-family: var(--font-sans, sans-serif);
  font-size: var(--font-size-xs, 0.8125rem);
  padding: 8px 10px;
}

.coverage-popup-name {
  font-weight: 700;
  color: var(--color-text-heading, #263238);
  margin-bottom: 4px;
}

.coverage-popup-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px var(--space-sm, 12px);
  margin: 0;
}
.coverage-popup-dl dt { color: var(--color-text-secondary, #5a7785); }

.coverage-popup-dl dd {
  margin: 0;
  color: var(--color-text-primary, #222222);
  font-weight: 600;
}

/* --- Bar chart ----------------------------------------------------------------------------------------------- */

/* No overflow-x:auto — a scrollable box lets the Vega SVG keep its natural (slightly-too-wide) size instead of
   fitting; hiding overflow lets autosize:fit-x size the chart exactly to the container with no sliver scrollbar. */
.coverage-bars {
  width: 100%;
  overflow-x: hidden;
}
.coverage-bars .vega-embed { width: 100%; }
.coverage-bars .vega-embed svg { display: block; }

/* Sort toggle above the chart. */
.coverage-sort {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 8px);
  margin-bottom: var(--space-sm, 12px);
}

.coverage-sort-label {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

.coverage-sort-btn {
  font-size: var(--font-size-sm, 0.875rem);
  padding: 4px 12px;
  border: 1px solid var(--color-neutral-400);
  background: var(--color-neutral-white);
  color: var(--color-text-primary, #222222);
  border-radius: 6px;
  cursor: pointer;
}
.coverage-sort-btn:hover { background: var(--color-neutral-100); }

.coverage-sort-btn.active {
  background: var(--color-asphalt-500, #263238);
  border-color: var(--color-asphalt-500, #263238);
  color: var(--color-neutral-white);
}

.coverage-sort-btn:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 2px;
}

/* --- View toggle (Per region / Distribution) ----------------------------------------------------------------- */
.coverage-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 8px);
  margin-bottom: var(--space-md, 16px);
}

.coverage-toggle-btn {
  font-size: var(--font-size-sm, 0.875rem);
  padding: 4px 12px;
  border: 1px solid var(--color-neutral-400);
  background: var(--color-neutral-white);
  color: var(--color-text-primary, #222222);
  border-radius: 6px;
  cursor: pointer;
}
.coverage-toggle-btn:hover { background: var(--color-neutral-100); }

.coverage-toggle-btn.active {
  background: var(--color-asphalt-500, #263238);
  border-color: var(--color-asphalt-500, #263238);
  color: var(--color-neutral-white);
}

.coverage-toggle-btn:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 2px;
}

/* --- Distribution view: histogram --------------------------------------------------------------------------- */
.coverage-histogram {
  width: 100%;
  overflow-x: hidden;
  margin-bottom: var(--space-md, 16px);
}
.coverage-histogram .vega-embed { width: 100%; }
.coverage-histogram .vega-embed svg { display: block; }

/* --- Distribution view: searchable region table ------------------------------------------------------------- */
.coverage-table-controls { margin: var(--space-sm, 12px) 0; }

.coverage-table-search {
  width: 100%;
  max-width: 320px;
  font-size: var(--font-size-sm, 0.875rem);
  padding: 6px 10px;
  border: 1px solid var(--color-neutral-400);
  border-radius: 6px;
}

.coverage-table-search:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 1px;
}

.coverage-table-wrap {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
}

.coverage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm, 0.875rem);
}

.coverage-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-neutral-100);
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  color: var(--color-text-heading, #263238);
  font-weight: 600;
  border-bottom: 1px solid var(--color-neutral-200);
}

.coverage-table thead th:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: -2px;
}
.coverage-table th:not(:first-child), .coverage-table td:not(:first-child) { text-align: right; }

.coverage-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--color-neutral-100);
}
.coverage-table tbody tr { cursor: pointer; }
.coverage-table tbody tr:hover { background: var(--color-neutral-100); }

.coverage-table tbody tr.highlighted {
  background: rgb(246 141 62 / 14%);
  box-shadow: inset 3px 0 0 var(--coverage-selected);
}


/* --- Data Quality scorecard --------------------------------------------------------------------------------- */
.dq-rows {
  display: flex;
  flex-direction: column;
}

.dq-row {
  display: grid;
  grid-template-columns: 22px 10px minmax(120px, 160px) 1fr minmax(120px, 150px);
  align-items: center;
  gap: var(--space-sm, 12px);
  padding: 6px 0;
  border-bottom: 1px solid var(--color-neutral-100);
}

.dq-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.dq-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.dq-name {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dq-chart { min-width: 0; }

.dq-value {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-heading, #263238);
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.dq-sub {
  color: var(--color-text-secondary, #5a7785);
  font-weight: 400;
}

.dq-empty {
  color: var(--color-text-secondary, #5a7785);
  font-size: var(--font-size-sm, 0.875rem);
}

/* Horizontal bars (counts + stacked agree/disagree). */
.dq-bar-track {
  height: 14px;
  background: var(--color-neutral-100);
  border-radius: 7px;
  overflow: hidden;
}

.dq-bar {
  height: 100%;
  border-radius: 7px;
}
.dq-stack { display: flex; }

.dq-bar-agree {
  height: 100%;
  background: var(--color-pine-500, #4a9d6d);
}

.dq-bar-disagree {
  height: 100%;
  background: var(--color-accent-delete, #f93e3e);
  opacity: 0.8;
}

/* Severity 1–5 track: translucent ±SD band with a marker at the mean. */
.dq-sev-track {
  position: relative;
  height: 14px;
  background: var(--color-neutral-100);
  border-radius: 7px;
}

.dq-sev-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--color-neutral-400);
  opacity: 0.45;
  border-radius: 7px;
}

.dq-sev-marker {
  position: absolute;
  top: -2px;
  width: 4px;
  height: 18px;
  border-radius: 2px;
  transform: translateX(-50%);
}

.dq-sev-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dq-sev-ends {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

/* Tag usage: per-type chip groups. */
.dq-tag-group { margin-bottom: var(--space-md, 16px); }

.dq-tag-head {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 8px);
  margin-bottom: var(--space-xs, 8px);
}

.dq-tag-head .dq-name {
  font-weight: 600;
  color: var(--color-text-heading, #263238);
}

.dq-tag-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Tag-severity heatmap: a responsive grid of compact per-label-type matrices (rows = tags, cols = severity 1–3). */
#dq-tag-severity {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg, 24px);
}

/* Size the tag-name column to its content (not a flex fraction) so the matrix stays compact and sits directly under
   its label-type header, instead of stretching across the cell and leaving the header stranded to the left. */
.dq-heat-grid {
  display: grid;
  grid-template-columns: max-content repeat(3, 30px) max-content;
  gap: 3px;
  align-items: center;
  justify-content: start;
}

.dq-heat-colhead {
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  color: var(--color-text-secondary, #5a7785);
  text-align: center;
}
.dq-heat-colhead:last-child { text-align: right; }

.dq-heat-rowlabel {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right; /* hug the cells so short tag names don't leave a big gap before the matrix */
}

.dq-heat-cell {
  height: 26px;
  border-radius: 3px;
  border: 1px solid var(--color-neutral-100);
}

.dq-heat-total {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-heading, #263238);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dq-tag-row {
  display: grid;
  grid-template-columns: minmax(110px, 180px) 1fr 56px;
  align-items: center;
  gap: var(--space-sm, 12px);
}

.dq-tag-name {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dq-tag-count {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-heading, #263238);
  font-weight: 600;
  text-align: right;
}

/* --- Data Quality: KPI denominator note, severity sub-sections, smiley legend, Validate action ---------------- */
.coverage-kpi-note {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.dq-subhead {
  font-size: var(--font-size-md, 1rem);
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  margin: var(--space-lg, 24px) 0 var(--space-xs, 8px);
}

.dq-sevlegend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md, 16px);
  margin-bottom: var(--space-sm, 12px);
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.dq-smiley {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dq-smiley img { display: block; }

/* Rows that carry a trailing action button get an extra column. */
.dq-row--action {
  grid-template-columns: 22px 10px minmax(110px, 150px) 1fr minmax(88px, 120px) auto;
}

.dq-validate-btn {
  display: inline-block;
  font-size: var(--font-size-xs, 0.8125rem);
  padding: 3px 10px;
  border: 1px solid var(--color-asphalt-500, #263238);
  border-radius: 6px;
  color: var(--color-asphalt-500, #263238);
  background: var(--color-neutral-white);
  text-decoration: none;
  white-space: nowrap;
}

.dq-validate-btn:hover {
  background: var(--color-asphalt-500, #263238);
  color: var(--color-neutral-white);
}

.dq-validate-btn:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 2px;
}

/* --- Data Quality: quality-over-time line chart (inline SVG, no charting lib) -------------------------------- */
.dq-trend { width: 100%; }

.dq-trend-caption {
  margin-top: var(--space-xs, 8px);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}
.dq-trend-caption strong { color: var(--color-text-heading, #263238); }

/* --- Shared MiniLineChart (Data Quality agreement trend, API usage trend) ----------------------------------- */

/* Charts are sized to their container's pixel width by MiniLineChart.renderInto (so text/lines/dots stay constant size
   while still filling the width); width:100% just lets the rendered SVG occupy its host. */
.mini-chart-svg {
  width: 100%;
  height: auto;
  display: block;
}
.mini-host { width: 100%; }

.mini-grid {
  stroke: var(--color-neutral-200);
  stroke-width: 1;
}

.mini-axis {
  fill: var(--color-text-secondary, #5a7785);
  font-size: 11px;
  font-family: var(--font-sans, sans-serif);
}

.mini-line {
  fill: none;
  stroke-width: 2;
}
.mini-line--human { stroke: var(--dq-human); }      .mini-pt--human { fill: var(--dq-human); }
.mini-line--ai { stroke: var(--dq-ai); }            .mini-pt--ai { fill: var(--dq-ai); }
.mini-line--external { stroke: var(--api-external); } .mini-pt--external { fill: var(--api-external); }
.mini-line--apidocs { stroke: var(--api-docs); }    .mini-pt--apidocs { fill: var(--api-docs); }

/* Activity page: a single accent for the volume small-multiples; registered/anon pair for active contributors. */
.mini-line--activity { stroke: var(--act-accent); }       .mini-pt--activity { fill: var(--act-accent); }
.mini-line--registered { stroke: var(--act-registered); } .mini-pt--registered { fill: var(--act-registered); }
.mini-line--anon { stroke: var(--act-anon); }             .mini-pt--anon { fill: var(--act-anon); }
.mini-swatch--registered { background: var(--act-registered); }
.mini-swatch--anon { background: var(--act-anon); }

.mini-legend {
  display: flex;
  gap: var(--space-md, 16px);
  margin-top: var(--space-xs, 8px);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

.mini-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mini-swatch {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.mini-swatch--human { background: var(--dq-human); }
.mini-swatch--ai { background: var(--dq-ai); }
.mini-swatch--external { background: var(--api-external); }
.mini-swatch--apidocs { background: var(--api-docs); }

/* Square swatch variant for bar-chart legends (the base .mini-swatch is a thin line for the line chart). */
.mini-swatch--block {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* API source-split stacked bars (external = blue, docs = grey; shown when a chart's "docs traffic" switch is on). */
.api-bar-external {
  height: 100%;
  background: var(--api-external, #2171b5);
}

.api-bar-docs {
  height: 100%;
  background: var(--api-docs, var(--color-neutral-600));
}

/* Per-chart "show docs traffic" control: the active date range, a switch, and a legend that appears once it's on. */
.api-docs-control {
  display: flex;
  align-items: center;
  gap: var(--space-md, 16px);
  margin-bottom: var(--space-sm, 12px);

  /* Tight line-height so the caption text's box matches the switch/dot height and align-items truly centers them. */
  line-height: 1;
}

/* Active date-range caption shown on each chart so the selected range is always explicit. */
.api-range-caption {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

.api-range-caption--block {
  display: block;
  margin-bottom: var(--space-sm, 12px);
}

/* Dot divider between the date-range caption and the docs-traffic switch (CSS circle so it centers cleanly). */
.api-control-sep {
  flex: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--color-neutral-400);
}

.api-docs-legend {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md, 16px);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}
.api-docs-legend.hidden { display: none; }

/* Accessible switch: a visually-hidden checkbox drives a sliding track + knob. */
.api-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;

  /* Reset the global Bootstrap `label` margin/weight so the switch centers in the flex row and the text isn't bold. */
  margin: 0;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 400;
  color: var(--color-text-secondary, #5a7785);
}

.api-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.api-toggle-slider {
  position: relative;
  flex: none;
  width: 34px;
  height: 18px;
  background: var(--color-neutral-300);
  border-radius: 9px;
  transition: background 0.15s ease;
}

.api-toggle-slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--color-neutral-white);
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.api-toggle input:checked + .api-toggle-slider { background: var(--api-external, #2171b5); }
.api-toggle input:checked + .api-toggle-slider::before { transform: translateX(16px); }

.api-toggle input:focus-visible + .api-toggle-slider {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 2px;
}

/* --- Contributors page -------------------------------------------------------------------------------------- */
.contrib-seg { height: 100%; }
.contrib-seg--high { background: var(--color-pine-500, #4a9d6d); }

.contrib-seg--low {
  background: var(--color-accent-delete, #f93e3e);
  opacity: 0.8;
}

.contrib-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md, 16px);
  margin-top: var(--space-sm, 12px);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
}

.contrib-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.contrib-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.contrib-swatch.contrib-seg--high { background: var(--color-pine-500, #4a9d6d); }
.contrib-swatch.contrib-seg--low { background: var(--color-accent-delete, #f93e3e); }

.contrib-row {
  display: grid;
  grid-template-columns: minmax(110px, 180px) 1fr 56px;
  align-items: center;
  gap: var(--space-sm, 12px);
  padding: 5px 0;
}

.contrib-row-label {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
}

.contrib-row-count {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  text-align: right;
}

/* --- Contributors: Top labelers / Top validators leaderboards ----------------------------------------------- */
.contrib-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm, 0.875rem);
}

.contrib-table th, .contrib-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-neutral-100);
}

.contrib-table th {
  font-weight: 600;
  color: var(--color-text-secondary, #5a7785);
  border-bottom: 2px solid var(--color-neutral-200);
  white-space: nowrap;
}

.contrib-table td.num, .contrib-table th.num {
  text-align: right;
  white-space: nowrap;
}
.contrib-table tbody tr:hover { background: var(--color-neutral-50, #fafafa); }
.contrib-table .dq-sub { font-weight: 400; }

.contrib-badge {
  display: inline-block;
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 10px;
}

.contrib-badge--high {
  background: #e3f3ea;
  color: #1f7a47;
}

.contrib-badge--low {
  background: #fde3e3;
  color: #a32020;
}

/* Label-type mix bar (canonical label-type colors). */
.contrib-typebar {
  display: inline-flex;
  width: 130px;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  background: var(--color-neutral-100);
}
.contrib-typeseg { height: 100%; }

/* Severity mini-distribution: fixed 1–3 domain (#3306), bar heights ∝ count within the row. */
.contrib-sevdist {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  width: 34px;
  vertical-align: middle;
}

.contrib-sevbar {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  background: var(--color-neutral-100);
  border-radius: 1px;
}

.contrib-sevbar > span {
  width: 100%;
  min-height: 1px;
  background: #5a7785;
  border-radius: 1px;
}

/* Validator verdict bar: agree (green) / disagree (red) / unsure (grey), with the split spelled out. */
.contrib-verdictwrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.contrib-verdictbar {
  display: inline-flex;
  width: 120px;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--color-neutral-100);
}
.contrib-verdictseg { height: 100%; }
.contrib-verdictseg.is-agree { background: #2e8b57; }
.contrib-verdictseg.is-disagree { background: #d55e00; }
.contrib-verdictseg.is-unsure { background: #999999; }

.contrib-verdictpct {
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
  white-space: nowrap;
}

/* --- API Analytics: endpoint / format rows ------------------------------------------------------------------ */
.api-ep-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr minmax(130px, 170px);
  align-items: center;
  gap: var(--space-sm, 12px);
  padding: 5px 0;
}

.api-ep-label {
  font-size: var(--font-size-sm, 0.875rem);
  font-family: var(--font-mono, monospace);
  color: var(--color-text-primary, #222222);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-ep-value {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  text-align: right;
  white-space: nowrap;
}

/* --- Activity page: controls, volume small-multiples, active-users chart, recent-activity feed ----------------- */

/* "Last activity" banner: when the deployment was last active + who, with a jump-to-all-time when window is empty. */
.activity-latest {
  margin-top: var(--space-sm, 12px);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}
.activity-latest:empty { display: none; }
.activity-latest strong { color: var(--color-text-heading, #263238); }

.activity-latest-warn {
  color: var(--color-accent-delete, #c0392b);
  font-weight: 600;
}

.activity-link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 2px;
  color: var(--color-accent-link, #0566f5);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.activity-link-btn:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 2px;
}

.activity-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md, 16px);
  margin-bottom: var(--space-md, 16px);
}

/* One card per metric; they wrap into a responsive grid so each chart keeps a readable width. */
.activity-smallmultiples {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-md, 16px);
}

.activity-card, .activity-chart-card {
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--border-radius-md, 8px);
  padding: var(--space-md, 16px);
  background: var(--color-neutral-50, #fafafa);
}

/* The active-contributors line: thinner + translucent so the two overlapping series read clearly where they cross. */
#activity-active .mini-line {
  stroke-width: 1.5;
  stroke-opacity: 0.8;
}
#activity-active .mini-pt { fill-opacity: 0.85; }

.activity-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-sm, 12px);
  margin-bottom: var(--space-xs, 8px);
}

.activity-card-title {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-text-heading, #263238);
}

.activity-card-total {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
  white-space: nowrap;
}

.activity-card-total strong {
  color: var(--color-text-heading, #263238);
  font-weight: 700;
}

/* Recent-activity feed. */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.activity-feed-item {
  display: grid;
  grid-template-columns: 104px 92px 1fr auto;
  align-items: start;
  gap: var(--space-md, 16px);
  padding: var(--space-md, 16px) 0;
  border-bottom: 1px solid var(--color-neutral-100);
}

/* Leading preview thumbnail (or an empty placeholder that holds the column so rows stay aligned). */
.activity-feed-thumb {
  width: 104px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
}

.activity-feed-thumb--none {
  background: transparent;
  border: 0;
}
.activity-feed-thumb.is-broken { visibility: hidden; }

img.activity-feed-thumb {
  cursor: pointer;
  transition: box-shadow 0.12s ease;
}
img.activity-feed-thumb:hover { box-shadow: 0 2px 6px rgb(0 0 0 / 18%); }

/* Contributor identity: a linked username, a role chip, and a quiet all-time totals line. */
.activity-feed-user {
  font-weight: 600;
  color: var(--color-accent-link, #0566f5);
}

.activity-feed-role {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  color: var(--color-text-secondary, #5a7785);
  background: var(--color-neutral-100);
  vertical-align: 1px;
}

.activity-feed-sub {
  margin-top: 3px;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-tertiary, #88a1ad);
}

.activity-feed-badge {
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-align: center;
  white-space: nowrap;
}

.activity-feed-badge.is-label {
  background: #e3eef8;
  color: #1a4e7a;
}

.activity-feed-badge.is-validate {
  background: #e9f3ec;
  color: #1f6b3b;
}

.activity-feed-badge.is-comment {
  background: #f3eefa;
  color: #5a3b86;
}
.activity-feed-body { min-width: 0; }

.activity-feed-text {
  color: var(--color-text-primary, #222222);
  font-size: var(--font-size-sm, 0.875rem);
  overflow-wrap: anywhere;
}

.activity-feed-meta {
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
  margin-top: 2px;
}
.activity-feed-meta a { color: var(--color-accent-link, #0566f5); }

.activity-feed-time {
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
  white-space: nowrap;
  text-align: right;
}

/* --- Humans vs AI ------------------------------------------------------------------------------------------- */

.hva-boundary {
  color: var(--color-text-secondary, #5a7785);
  font-size: var(--font-size-sm, 0.875rem);
}

.hva-summary {
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  margin: var(--space-sm, 12px) 0 0;
}

.hva-note {
  color: var(--color-text-secondary, #5a7785);
  font-size: var(--font-size-sm, 0.875rem);
}

.hva-empty {
  color: var(--color-text-secondary, #5a7785);
  background: var(--color-neutral-50, #fafafa);
  border: 1px dashed var(--color-neutral-200);
  border-radius: 6px;
  padding: var(--space-sm, 12px) var(--space-md, 16px);
  font-size: var(--font-size-sm, 0.875rem);
}

.hva-fill--human { background: var(--hva-human); }
.hva-fill--ai { background: var(--hva-ai); }

/* Legend atop each grouped viz. */
.hva-legend {
  display: flex;
  gap: var(--space-md, 16px);
  margin-bottom: var(--space-sm, 12px);
}

.hva-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

.hva-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* A label-type / category row with its paired human+AI bars. */
.hva-group {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  align-items: center;
  gap: var(--space-md, 16px);
  padding: 8px 0;
  border-top: 1px solid var(--color-neutral-100);
}
.hva-group:first-of-type { border-top: 0; }

.hva-group-label {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
}

.hva-group-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* One human-or-AI bar: side label, track, value. */
.hva-bar {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: var(--space-sm, 12px);
}
.hva-bar--muted { opacity: 0.45; }

.hva-bar-side {
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  color: var(--color-text-secondary, #5a7785);
}

.hva-bar-value {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  white-space: nowrap;
}

/* Label-type cell: icon/dot + name. */
.hva-type {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hva-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

/* Validator verdict rows. */
.hva-verdict-row {
  display: grid;
  grid-template-columns: 72px 1fr 64px;
  align-items: center;
  gap: var(--space-md, 16px);
  padding: 8px 0;
}

.hva-verdict-name {
  font-weight: 600;
  color: var(--color-text-heading, #263238);
}
.hva-verdict-n { text-align: right; }

/* Stretch the reused verdict bar full-width here (it's fixed-width in the Contributors tables). */
.hva-verdict-row .contrib-verdictwrap {
  display: flex;
  width: 100%;
  align-items: center;
  gap: var(--space-sm, 12px);
}

.hva-verdict-row .contrib-verdictbar {
  width: auto;
  flex: 1;
  height: 14px;
  border-radius: 7px;
}

/* Tagger: two ranked tag lists side by side. */
.hva-tags {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg, 24px);
}

.hva-taglist-title {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  margin: 0 0 var(--space-sm, 12px);
}

/* === Overview landing page (#4272) ============================================================================== */

/* The "latest activity" pulse line under the intro: a quiet, single-line read that the deployment is alive. */
.ov-pulse {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 12px);
  margin: var(--space-lg, 24px) 0 0;
  padding: var(--space-sm, 12px) var(--space-md, 16px);
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  background: var(--color-neutral-50, #f7f9fa);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

.ov-pulse strong {
  color: var(--color-text-heading, #263238);
  font-weight: 600;
}

.ov-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

/* The lens cards: a responsive grid of clickable summary tiles, each linking to its detailed page. */
.ov-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-md, 16px);
  margin: var(--space-lg, 24px) 0;
}

.ov-card {
  display: block;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  padding: var(--space-md, 16px);
  background: var(--color-neutral-white);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.ov-card:hover, .ov-card:focus-visible {
  border-color: var(--color-primary, #4a90d9);
  box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
  transform: translateY(-1px);
  text-decoration: none;
}

.ov-card:focus-visible {
  outline: 2px solid var(--color-primary, #4a90d9);
  outline-offset: 2px;
}

.ov-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ov-card-title {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-text-secondary, #5a7785);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ov-card-arrow {
  color: var(--color-neutral-300);
  font-size: 1.1rem;
  transition: color 0.12s ease;
}
.ov-card:hover .ov-card-arrow, .ov-card:focus-visible .ov-card-arrow { color: var(--color-primary, #4a90d9); }

.ov-card-value {
  display: block;
  margin-top: var(--space-sm, 12px);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
  color: var(--color-text-heading, #263238);
}

.ov-card-sub {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
  min-height: 1.2em;
}

.ov-card-desc {
  margin: var(--space-sm, 12px) 0 0;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-tertiary, #88a1ad);
  line-height: 1.35;
}

/* Week-over-week trend line under the headline value (direction-colored). */
.ov-card-trend {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  min-height: 1.1em;
  color: var(--color-text-secondary, #5a7785);
}
.ov-trend--up { color: #1f7a44; }
.ov-trend--down { color: #c0392b; }
.ov-trend--flat { color: var(--color-text-tertiary, #88a1ad); }

/* Compact line-only sparkline. */
.ov-card-spark {
  margin-top: var(--space-sm, 12px);
  height: 36px;
}

.ov-spark-svg {
  width: 100%;
  height: 36px;
  display: block;
  overflow: visible;
}

.ov-spark-line {
  fill: none;
  stroke: var(--color-primary, #4a90d9);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ov-spark-dot { fill: var(--color-primary, #4a90d9); }

/* "Needs attention" panel: deep-linked action rows with a severity dot. */
.ov-attention {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 12px);
  margin: var(--space-md, 16px) 0;
}

.ov-attention-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-sm, 12px);
  padding: var(--space-sm, 12px) var(--space-md, 16px);
  border: 1px solid var(--color-neutral-200);
  border-left-width: 4px;
  border-radius: 8px;
  background: var(--color-neutral-white);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.ov-attention-item:hover, .ov-attention-item:focus-visible {
  box-shadow: 0 2px 8px rgb(0 0 0 / 8%);
  text-decoration: none;
}

.ov-attention-item:focus-visible {
  outline: 2px solid var(--color-primary, #4a90d9);
  outline-offset: 2px;
}
.ov-attention--warn { border-left-color: #e0a800; }
.ov-attention--info { border-left-color: var(--color-primary, #4a90d9); }

.ov-attention-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}
.ov-attention--warn .ov-attention-dot { background: #e0a800; }
.ov-attention--info .ov-attention-dot { background: var(--color-primary, #4a90d9); }

.ov-attention-text {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
}
.ov-attention-text strong { color: var(--color-text-heading, #263238); }

.ov-attention-go {
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-accent-link, #0566f5);
  white-space: nowrap;
}

.ov-attention-clear {
  margin: var(--space-md, 16px) 0;
  padding: var(--space-md, 16px);
  border: 1px solid var(--color-neutral-200);
  border-left: 4px solid #1f7a44;
  border-radius: 8px;
  background: var(--color-neutral-white);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

/* Live recent-activity strip. */
.ov-recent {
  display: flex;
  flex-direction: column;
  margin: var(--space-md, 16px) 0 var(--space-sm, 12px);
}

.ov-recent-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: var(--space-md, 16px);
  padding: 10px 0;
  border-bottom: 1px solid var(--color-neutral-100);
}

.ov-recent-thumb {
  width: 72px;
  height: 50px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-200);
}

.ov-recent-thumb--none {
  background: transparent;
  border: 0;
}
.ov-recent-thumb.is-broken { visibility: hidden; }

.ov-recent-text {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
}

.ov-recent-meta {
  margin-top: 2px;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.ov-recent-more {
  display: inline-block;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  color: var(--color-accent-link, #0566f5);
  text-decoration: none;
}
.ov-recent-more:hover { text-decoration: underline; }

/* --- Management page ----------------------------------------------------------------------------------------- */

/* Toolbar above the user directory: search box + a live count of matching rows. */
.mgmt-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-md, 16px);
  margin-bottom: var(--space-sm, 12px);
}

.mgmt-search {
  flex: 0 1 320px;
  padding: 6px 12px;
  border: 1px solid var(--color-neutral-400);
  border-radius: 6px;
  font-size: var(--font-size-sm, 0.875rem);
}

.mgmt-search:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 1px;
}
.mgmt-count { white-space: nowrap; }

/* The directory is wide (13 columns); let it scroll horizontally rather than crush the cells or the page. */
.mgmt-table-scroll { overflow-x: auto; }
.mgmt-table { min-width: 100%; }
.mgmt-table th { white-space: nowrap; }

/* Sortable column headers: the whole header is a button so it's keyboard-operable; aria-sort lives on the th. */
.mgmt-th { padding: 0; }

.mgmt-sort {
  width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;

  /* Match .contrib-table th/td padding exactly so the header label aligns with the cell content below it. */
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: inherit;
}
.mgmt-th.num .mgmt-sort { justify-content: flex-end; }
.mgmt-sort:hover { color: var(--color-accent-link, #0566f5); }

.mgmt-sort:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: -2px;
}

.mgmt-arrow {
  font-size: 0.7em;
  color: var(--color-text-secondary, #5a7785);
}

/* Inline role / team selects sit quietly in their cells until focused. */
.mgmt-select {
  max-width: 160px;
  padding: 3px 6px;
  border: 1px solid var(--color-neutral-300);
  border-radius: 5px;
  background: var(--color-neutral-white);
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-primary, #222222);
  cursor: pointer;
}

.mgmt-select:disabled {
  background: var(--color-neutral-100);
  color: var(--color-text-secondary, #5a7785);
  cursor: default;
}

.mgmt-select:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 1px;
}

/* Team status / visibility toggles: a single pill that states the current value and flips on click. */
.mgmt-toggle {
  padding: 3px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  cursor: pointer;
}

.mgmt-toggle.is-on {
  background: #e3f3ea;
  color: #1f7a47;
  border-color: #bfe4cd;
}

.mgmt-toggle.is-off {
  background: var(--color-neutral-100);
  color: var(--color-text-secondary, #5a7785);
  border-color: var(--color-neutral-300);
}

.mgmt-toggle:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 2px;
}

/* Maintenance jobs: a stack of "label + Run button" rows, with a shared result line beneath. */
.mgmt-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm, 12px);
  max-width: 640px;
}

.mgmt-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md, 16px);
  padding: var(--space-sm, 12px) var(--space-md, 16px);
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
}

.mgmt-action-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mgmt-run { flex: none; }

.mgmt-run:disabled {
  opacity: 0.6;
  cursor: default;
}

.mgmt-result {
  margin-top: var(--space-sm, 12px);
  min-height: 1.2em;
}
.mgmt-result.error { color: #a32020; }

/* "manual" tag beside a quality badge when an admin set the flag by hand. */
.mgmt-manual-tag {
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
  font-style: italic;
}

/* Pagination bar beneath the user directory: page controls on the left, rows-per-page on the right. */
.mgmt-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm, 12px);
  margin-top: var(--space-sm, 12px);
}
#mgmt-pagination-top:not(:empty) { margin-bottom: var(--space-xs, 8px); }

.mgmt-page-controls {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 8px);
  flex-wrap: wrap;
}

.mgmt-page-btn {
  font-size: var(--font-size-sm, 0.875rem);
  padding: 4px 10px;
  border: 1px solid var(--color-neutral-400);
  background: var(--color-neutral-white);
  color: var(--color-text-primary, #222222);
  border-radius: 6px;
  cursor: pointer;
}
.mgmt-page-btn:hover:not(:disabled) { background: var(--color-neutral-100); }

.mgmt-page-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.mgmt-page-btn:focus-visible {
  outline: 2px solid var(--color-accent-link, #0566f5);
  outline-offset: 2px;
}

.mgmt-page-info {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
  padding: 0 var(--space-xs, 8px);
}

.mgmt-page-size-label {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mgmt-page-size {
  padding: 3px 6px;
  border: 1px solid var(--color-neutral-300);
  border-radius: 5px;
  font-size: var(--font-size-sm, 0.875rem);
}

/* --- Label Map page ------------------------------------------------------------------------------------------ */

/* The shared PSMap fills a fixed-height holder; the common map sidebar positions itself absolutely inside it
   (choropleth.css sets position:relative on .choropleth-holder). */
.label-map-holder {
  position: relative;
  width: 100%;
  min-height: 460px;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  overflow: hidden;
}

/* The holder also carries .choropleth-holder, whose `height: 100%` (choropleth.css, loaded after this
   file) ties on specificity and would win by source order — collapsing the map div's `height: 100%` to
   0. Pin the definite height via the holder's id so percentages below it resolve against a real height. */
#admin-labelmap-choropleth-holder.label-map-holder { height: 72vh; }

#admin-labelmap-choropleth {
  width: 100%;
  height: 100%;
}

/* Label-ID search row above the map. */
.label-map-search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-xs, 8px);
  margin-top: var(--space-sm, 12px);
}

.label-map-search-label {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}
.label-map-search .mgmt-search { flex: 0 1 160px; }
.label-map-search-msg { margin-left: var(--space-xs, 8px); }
.label-map-search-msg.error { color: #a32020; }

/* --- Across Cities page (#4329) -------------------------------------------------------------------------------------
 * Per-city scorecard table + anomaly chips. Reuses .ov-attention* for the "needs attention" panel and .dq-empty for
 * empty states; only the table, coverage mini-bar, and chips are new here. */
.ac-pulse {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
  margin-top: var(--space-sm, 12px);
}
.ac-pulse strong { color: var(--color-text-heading, #263238); }

.ac-table-wrap {
  overflow-x: auto;
  margin: var(--space-md, 16px) 0;
}

.ac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm, 0.875rem);
}

.ac-table thead th {
  text-align: right;
  padding: var(--space-xs, 8px) var(--space-sm, 12px);
  border-bottom: 2px solid var(--color-neutral-200);
  color: var(--color-text-secondary, #5a7785);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.ac-table thead th.ac-th-text { text-align: left; }
.ac-table thead th:hover { color: var(--color-text-heading, #263238); }
.ac-table thead th.ac-sorted { color: var(--color-text-heading, #263238); }

/* Sort-direction caret on the active column. */
.ac-table thead th.ac-sorted[data-dir="asc"]::after {
  content: " \25B2";
  font-size: 0.7em;
}

.ac-table thead th.ac-sorted[data-dir="desc"]::after {
  content: " \25BC";
  font-size: 0.7em;
}

.ac-table tbody td {
  padding: var(--space-xs, 8px) var(--space-sm, 12px);
  border-bottom: 1px solid var(--color-neutral-100);
  vertical-align: middle;
}
.ac-table tbody tr:hover { background: var(--color-neutral-100); }

.ac-num {
  text-align: right;
  white-space: nowrap;
  color: var(--color-text-primary, #222222);
}
.ac-muted { color: var(--color-text-secondary, #5a7785); }

.ac-td-city a {
  color: var(--color-accent-link, #0566f5);
  text-decoration: none;
}
.ac-td-city a:hover { text-decoration: underline; }

/* Flagged rows get a subtle warning tint + left accent so they stand out in a long table. */
.ac-row--flagged { background: #fffaf0; }
.ac-row--flagged:hover { background: #fff4e0; }
.ac-row--flagged .ac-td-city { box-shadow: inset 3px 0 0 #e0a800; }

/* Coverage mini-bar: a thin track with a filled portion and the percentage overlaid. */
.ac-bar {
  position: relative;
  width: 120px;
  height: 16px;
  background: var(--color-neutral-200);
  border-radius: 3px;
  overflow: hidden;
}

.ac-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--color-primary, #4a90d9);
  border-radius: 3px;
}

.ac-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-heading, #263238);
}

/* Anomaly chips shown inline next to a city's name. */
.ac-chips {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.ac-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  white-space: nowrap;
}

.ac-chip--warn {
  background: #fff3cd;
  color: #8a6d00;
}

.ac-chip--info {
  background: #e3f0fb;
  color: #1c5a91;
}

/* --- Across Cities: over-time charts, sparklines, patterns (#4329) ----------------------------------------- */
.ac-charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-lg, 24px);
  margin: var(--space-md, 16px) 0;
}
.ac-chart { min-width: 0; }

.ac-chart-title {
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-heading, #263238);
  margin: 0 0 var(--space-xs, 8px);
}

.ac-note {
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

/* MiniLineChart series colors for the three overview charts (one series each). */
.mini-line--aclabels {
  stroke: var(--color-primary, #4a90d9);
  fill: none;
  stroke-width: 2;
}
.mini-pt--aclabels   { fill: var(--color-primary, #4a90d9); }

.mini-line--acvals   {
  stroke: #63c0ab;
  fill: none;
  stroke-width: 2;
}
.mini-pt--acvals     { fill: #63c0ab; }

.mini-line--acusers  {
  stroke: var(--color-label-no-sidewalk);
  fill: none;
  stroke-width: 2;
}
.mini-pt--acusers    { fill: var(--color-label-no-sidewalk); }

/* Per-city activity sparkline. */
.ac-spark-cell {
  width: 100px;
  color: var(--color-primary, #4a90d9);
}

.ac-spark {
  display: block;
  width: 90px;
  height: 22px;
}

/* Data-patterns: legend + normalized stacked bars. */
.ac-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm, 12px);
  margin: var(--space-sm, 12px) 0;
}

.ac-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.ac-legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
}

.ac-pattern-row {
  display: flex;
  align-items: center;
  gap: var(--space-md, 16px);
  margin: 6px 0;
}

.ac-pattern-city {
  flex: 0 0 200px;
  font-size: var(--font-size-sm, 0.875rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ac-pattern-city a {
  color: var(--color-accent-link, #0566f5);
  text-decoration: none;
}
.ac-pattern-city a:hover { text-decoration: underline; }

.ac-stack {
  flex: 1 1 auto;
  display: flex;
  height: 18px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--color-neutral-100);
}
.ac-stack-seg { height: 100%; }

.ac-stack-empty {
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
  padding-left: 6px;
}

/* --- Across Cities: lifecycle status badges (#4329) -------------------------------------------------------------- */
.ac-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: var(--font-size-xs, 0.8125rem);
  font-weight: 600;
  white-space: nowrap;
}

.ac-badge--ok   {
  background: #e3f0fb;
  color: #1c5a91;
}  /* Active */
.ac-badge--good {
  background: #e4f4ec;
  color: #1f7a4d;
}  /* Wrapped up (success) */
.ac-badge--warn {
  background: #fff3cd;
  color: #8a6d00;
}  /* Stalled */
.ac-badge--bad  {
  background: #fbe3e3;
  color: #a32020;
}  /* Low traction */

/* --- Across Cities: over-time range toggle (#4329) --------------------------------------------------------------- */
.ac-toggle {
  display: inline-flex;
  gap: 0;
  margin: 0 0 var(--space-sm, 12px);
}

.ac-toggle-btn {
  font-size: var(--font-size-sm, 0.875rem);
  padding: 4px 12px;
  border: 1px solid var(--color-neutral-400);
  background: var(--color-neutral-white);
  color: var(--color-text-primary, #222222);
  cursor: pointer;
}
.ac-toggle-btn:first-child { border-radius: 4px 0 0 4px; }

.ac-toggle-btn:last-child {
  border-radius: 0 4px 4px 0;
  border-left: none;
}
.ac-toggle-btn:hover { background: var(--color-neutral-100); }

.ac-toggle-btn.active {
  background: var(--color-asphalt-500, #263238);
  border-color: var(--color-asphalt-500, #263238);
  color: #ffffff;
}

/* --- Across Cities: hero stat band + deployment map (#4329) ------------------------------------------------------ */
.ac-hero { margin-top: var(--space-lg, 24px); }

.ac-hero-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md, 16px);
  margin-bottom: var(--space-md, 16px);
}

.ac-hero-stat {
  flex: 1 1 120px;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  padding: var(--space-md, 16px);
  background: var(--color-neutral-white);
}

.ac-hero-value {
  display: block;
  font-size: var(--font-size-xxl, 1.5rem);
  font-weight: 700;
  color: var(--color-text-heading, #263238);
  line-height: 1.1;
}

.ac-hero-label {
  display: block;
  margin-top: 4px;
  font-size: var(--font-size-sm, 0.875rem);
  color: var(--color-text-secondary, #5a7785);
}

.ac-map {
  width: 100%;
  height: 460px;
  border: 1px solid var(--color-neutral-200);
  border-radius: 8px;
  overflow: hidden;
}

/* --- Across Cities: deployment map legend (#4329) ---------------------------------------------------------------- */
.ac-map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm, 12px) var(--space-md, 16px);
  margin-top: var(--space-sm, 12px);
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.ac-legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: -2px;
  border: 1px solid #ffffff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 12%);
}
.ac-legend-dot--nostats { background: #9aa7b0; }

/* Lifecycle status fills — keep in sync with #LIFECYCLE_COLORS in AcrossCitiesPage.js (the map circle colors). */
.ac-legend-dot--active { background: #4a90d9; }
.ac-legend-dot--wrapped-up { background: #1f7a4d; }
.ac-legend-dot--stalled { background: #e0a800; }
.ac-legend-dot--low-traction { background: #c0392b; }

/* Private marker: neutral fill with the thick dark ring used on the map. */
.ac-legend-dot--private {
  background: #9aa7b0;
  border: 2px solid #33373a;
  box-shadow: none;
}

.ac-legend-size {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: -3px;
  background: rgb(74 144 217 / 35%);
  border: 1px solid rgb(74 144 217 / 70%);
}

.ac-legend-sep {
  width: 1px;
  height: 16px;
  background: var(--color-neutral-200);
}

/* --- Across Cities: footnote marker (#4329) --------------------------------------------------------------------- */
.ac-fn {
  color: var(--color-accent-link, #0566f5);
  cursor: help;
  font-weight: 600;
}

/* --- Across Cities: effort-table sub-header (#4329) -------------------------------------------------------------- */
.ac-th-sub {
  font-weight: 400;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

/* --- Street Status page (#4331) -------------------------------------------------------------------------------
 * Reuses the Coverage page's map / KPI / table / status classes; this block only adds the categorical status
 * legend, the small status swatch (legend + popup), and the per-region 100%-stacked-bar cell. The status colors
 * are owned by StreetStatusColors.STATUSES in street-status-map.js (no canonical backend color); these tokens
 * mirror them for the CSS-only swatch borders and must be kept in sync there. */
.street-status-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm, 12px);
  margin-top: var(--space-sm, 12px);
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.street-status-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Small color chip shared by the legend and the map popup. */
.street-status-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgb(0 0 0 / 15%);
  vertical-align: middle;
  margin-right: 4px;
}

/* Per-region 100%-stacked bar: one span per status, sized by share, colored inline from the JS palette. */
.street-status-bar {
  display: flex;
  width: 120px;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--color-neutral-100);
}

.street-status-bar span {
  display: block;
  height: 100%;
}

/* The distribution cell is decorative, so keep it left-aligned and let the count columns stay right-aligned. */
.street-status-table td:last-child, .street-status-table th:last-child { text-align: left; }

/* --- Across Cities: engagement funnels (#288) ------------------------------------------------------------------- */
.ac-funnel-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md, 16px);
  margin: 0 0 var(--space-md, 16px);
}

/* Each funnel (mapping, contribution) is its own block with a heading, table, and small-multiples. */
.ac-funnel-block { margin-bottom: var(--space-lg, 24px); }

.ac-funnel-block-title {
  font-size: var(--font-size-md, 1rem);
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  margin: var(--space-md, 16px) 0 var(--space-xs, 8px);
}

/* Responsive small-multiples: one compact funnel card per city. */
.ac-funnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-md, 16px);
  margin-top: var(--space-md, 16px);
}

.ac-funnel-panel {
  border: 1px solid var(--color-neutral-200);
  border-radius: 6px;
  padding: var(--space-sm, 12px);
  background: var(--color-surface, #ffffff);
}

.ac-funnel-panel-title {
  font-weight: 600;
  color: var(--color-text-heading, #263238);
  margin-bottom: var(--space-sm, 12px);
}

.ac-funnel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm, 12px);
  margin-bottom: var(--space-sm, 12px);
}

.ac-funnel-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
}

.ac-funnel-swatch {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  display: inline-block;
}

.ac-funnel-step { margin-bottom: var(--space-xs, 8px); }

.ac-funnel-step-label {
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-secondary, #5a7785);
  margin-bottom: 2px;
}

.ac-funnel-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* A single bar: a full-width track with a left-anchored fill and a count/drop-off label that stays legible on top. */
.ac-funnel-bar {
  position: relative;
  height: 16px;
  background: var(--color-neutral-200);
  border-radius: 3px;
  overflow: hidden;
}

.ac-funnel-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-radius: 3px;
}

.ac-funnel-bar-val {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 6px;
  font-size: var(--font-size-xs, 0.8125rem);
  color: var(--color-text-heading, #263238);
}
