/* ================================================================
   UIX Design System — VBP Biodiversity Tool revamp
   Coexists with Bootstrap 5. All custom classes are prefixed `uix-`.
   Tokens live in :root so the whole system is themeable.
================================================================ */

:root {
  /* ── Brand & chrome ─────────────────────────────────────────── */
  --uix-navy-900: #0f1f3d;
  --uix-navy-800: #16284a;
  --uix-navy-700: #1f3461;

  --uix-blue:       #2563eb;
  --uix-blue-600:   #1d4ed8;
  --uix-blue-50:    #eff6ff;

  /* ── Surfaces ───────────────────────────────────────────────── */
  --uix-bg:        #f6f7f9;
  --uix-surface:   #ffffff;
  --uix-border:    #e5e7eb;
  --uix-border-strong: #d1d5db;

  /* ── Text ───────────────────────────────────────────────────── */
  --uix-text:        #1f2937;
  --uix-text-on-dark:#ffffff;
  --uix-muted:       #6b7280;
  --uix-faint:       #9ca3af;

  /* ── KPI / Comparison tints ─────────────────────────────────── */
  --uix-tint-warm:    #fff6e0;
  --uix-tint-warm-ink:#a8580a;
  --uix-tint-cool:    #e8f5e9;
  --uix-tint-cool-ink:#1f7a2c;
  --uix-tint-neutral: #f3f4f6;
  --uix-tint-neutral-ink: #374151;

  /* ── Ranking scale (5 levels) ───────────────────────────────── */
  --uix-rank-critical:    #dc2626;
  --uix-rank-high:        #f59e0b;
  --uix-rank-moderate:    #fcd34d;
  --uix-rank-low:         #22c55e;
  --uix-rank-negligible:  #9ca3af;

  /* Tinted backgrounds (10% mix with white) and text-on-tint */
  --uix-rank-critical-bg:    #fde2e2;
  --uix-rank-high-bg:        #feefd0;
  --uix-rank-moderate-bg:    #fff5d4;
  --uix-rank-low-bg:         #d9f5e1;
  --uix-rank-negligible-bg:  #eceff3;

  /* ── Spacing scale ──────────────────────────────────────────── */
  --uix-s-1: 4px;
  --uix-s-2: 8px;
  --uix-s-3: 12px;
  --uix-s-4: 16px;
  --uix-s-5: 20px;
  --uix-s-6: 24px;
  --uix-s-8: 32px;
  --uix-s-10: 40px;
  --uix-s-12: 48px;

  /* ── Radii ──────────────────────────────────────────────────── */
  --uix-r-sm: 6px;
  --uix-r-md: 10px;
  --uix-r-lg: 14px;
  --uix-r-xl: 18px;
  --uix-r-pill: 999px;

  /* ── Shadows ────────────────────────────────────────────────── */
  --uix-shadow-sm: 0 1px 2px rgba(15,31,61,0.06);
  --uix-shadow:    0 2px 4px rgba(15,31,61,0.06), 0 1px 2px rgba(15,31,61,0.04);
  --uix-shadow-md: 0 4px 12px rgba(15,31,61,0.08);

  /* ── Type ───────────────────────────────────────────────────── */
  --uix-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --uix-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Consolas, monospace;
}

/* ================================================================
   Base
================================================================ */

.uix-body {
  font-family: var(--uix-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--uix-text);
  background: var(--uix-bg);
  -webkit-font-smoothing: antialiased;
}

.uix-body * { box-sizing: border-box; }

/* Caps label (used everywhere for section headings) */
.uix-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--uix-muted);
}

/* Title / numeric prominence */
.uix-num-xl { font-size: 32px; font-weight: 700; line-height: 1.1; letter-spacing: -0.01em; }
.uix-num-lg { font-size: 24px; font-weight: 700; line-height: 1.2; }
.uix-num-md { font-size: 18px; font-weight: 600; }

/* Utility */
.uix-mt-4 { margin-top: var(--uix-s-4); }
.uix-mt-6 { margin-top: var(--uix-s-6); }
.uix-mt-8 { margin-top: var(--uix-s-8); }
.uix-mb-4 { margin-bottom: var(--uix-s-4); }
.uix-mb-6 { margin-bottom: var(--uix-s-6); }

/* ================================================================
   Top tab navigation (dark navy chrome)
================================================================ */

.uix-topnav {
  background: var(--uix-navy-900);
  border-bottom: 1px solid var(--uix-navy-800);
  padding: 0 var(--uix-s-6);
  display: flex; align-items: center;
  gap: var(--uix-s-6);
}
.uix-topnav-tabs {
  display: flex; align-items: stretch;
  list-style: none; padding: 0; margin: 0;
  gap: 0;
  flex: 1;
}
.uix-topnav-tabs a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 14px 18px;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: color .12s, border-color .12s;
}
.uix-topnav-tabs a:hover { color: #fff; }
.uix-topnav-tabs a.is-active {
  color: #fff;
  border-bottom-color: var(--uix-blue);
}
.uix-topnav-action {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--uix-s-2);
}
.uix-topnav-action .uix-btn {
  background: transparent;
  border-color: rgba(255,255,255,0.3);
  color: #fff;
}
.uix-topnav-action .uix-btn:hover {
  background: rgba(255,255,255,0.08);
}
/* Calibration-mode toggle (admin only) in the topnav */
.uix-cal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #fff;
}
.uix-cal-toggle-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
/* Calibration warning banner under the topnav */
.uix-cal-banner {
  background: #fff3cd;
  border-bottom: 1px solid #f0c040;
  color: #6b4e00;
  font-size: 13px;
  padding: 8px var(--uix-s-8);
  text-align: center;
}
/* Calibration detail tab — only shown when calibration mode is on */
.uix-cal-tab-link { display: none; }
body.uix-calibration .uix-cal-tab-link { display: block; }
.uix-cal-table td { padding: 6px 8px; vertical-align: middle; }
.uix-cal-formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  background: var(--uix-navy-900);
  color: #e6edf6;
  padding: var(--uix-s-3) var(--uix-s-4);
  border-radius: var(--uix-r-sm);
  white-space: pre-wrap;
  word-break: break-word;
}
.uix-cal-working {
  margin-top: var(--uix-s-3);
  padding: var(--uix-s-3);
  background: var(--uix-bg);
  border-radius: var(--uix-r-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}
/* "With current values" — light surface, dark text */
.uix-cal-formula.is-values {
  background: var(--uix-bg);
  color: var(--uix-text);
  border: 1px solid var(--uix-border);
}
/* Excel formula — green tint, selectable for copy */
.uix-cal-formula.is-excel {
  background: #0c3b2e;
  color: #d7f5e6;
  user-select: all;
}
.uix-cal-status { font-size: 12px; margin-top: 6px; min-height: 16px; }
.uix-cal-status.is-saving { color: var(--uix-muted); }
.uix-cal-status.is-saved  { color: var(--uix-rank-low); }
.uix-cal-status.is-error  { color: var(--uix-rank-critical); }
.uix-cal-aiw:focus, .uix-cal-mitopts:focus {
  outline: none; border-color: var(--uix-blue);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.18);
}

/* ================================================================
   Page hero (dark navy band with title + KPI cards)
================================================================ */

.uix-hero {
  background: var(--uix-navy-900);
  color: var(--uix-text-on-dark);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--uix-s-6);
  padding: var(--uix-s-6) var(--uix-s-8);
  align-items: stretch;
}
.uix-hero-title {
  display: flex; align-items: center; gap: var(--uix-s-4);
}
.uix-hero-logo {
  width: 48px; height: 48px;
  background: rgba(34,197,94,0.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #22c55e;
}
.uix-hero h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.uix-hero .uix-hero-sub {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255,255,255,0.7);
}

.uix-hero-kpis {
  display: flex;
  gap: 1px; /* visual divider */
  background: rgba(255,255,255,0.08);
  border-radius: var(--uix-r-md);
  overflow: hidden;
}
.uix-hero-kpi {
  background: var(--uix-tint-warm);
  color: var(--uix-tint-warm-ink);
  padding: var(--uix-s-3) var(--uix-s-6);
  text-align: center;
  min-width: 200px;
  display: flex; flex-direction: column; justify-content: center;
}
.uix-hero-kpi.is-cool {
  background: var(--uix-tint-cool);
  color: var(--uix-tint-cool-ink);
}
.uix-hero-kpi .uix-eyebrow {
  color: inherit;
  opacity: 0.85;
  font-size: 10px;
}
.uix-hero-kpi .uix-hero-kpi-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.1;
}
.uix-hero-kpi .uix-hero-kpi-note {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}

/* ================================================================
   Cards
================================================================ */

.uix-card {
  background: var(--uix-surface);
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-5);
}
.uix-card-tight { padding: var(--uix-s-4); }
.uix-card-header {
  display: flex; align-items: center; gap: var(--uix-s-2);
  margin: 0 0 var(--uix-s-4);
}
.uix-card-header .uix-eyebrow { flex: 1; }
.uix-card + .uix-card { margin-top: var(--uix-s-4); }
/* In grid contexts the grid's `gap` already handles spacing, so the
   adjacent-sibling margin above must NOT push the second card down
   inside its cell (which throws off align-items: stretch). */
.uix-grid .uix-card + .uix-card,
.uix-services-layout .uix-card + .uix-card,
.uix-ra-grid .uix-card + .uix-card { margin-top: 0; }

/* Soft tinted card (KPI variants) */
.uix-stat-card {
  background: var(--uix-surface);
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-4) var(--uix-s-5);
  display: flex; align-items: center; gap: var(--uix-s-4);
}
.uix-stat-card .uix-stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--uix-r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--uix-tint-neutral);
  color: var(--uix-tint-neutral-ink);
}
.uix-stat-card .uix-stat-body { flex: 1; }
.uix-stat-card .uix-stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.1;
}
.uix-stat-card .uix-stat-label {
  color: var(--uix-muted);
  font-size: 13px;
  margin-top: 2px;
}
.uix-stat-card .uix-stat-note { color: var(--uix-faint); font-size: 11px; }

/* Colour variants for stat cards */
.uix-stat-card.is-warning  .uix-stat-icon { background: var(--uix-rank-high-bg);     color: var(--uix-rank-high); }
.uix-stat-card.is-danger   .uix-stat-icon { background: var(--uix-rank-critical-bg); color: var(--uix-rank-critical); }
.uix-stat-card.is-moderate .uix-stat-icon { background: var(--uix-rank-moderate-bg); color: #b45309; }
.uix-stat-card.is-success  .uix-stat-icon { background: var(--uix-rank-low-bg);      color: var(--uix-rank-low); }
.uix-stat-card.is-info     .uix-stat-icon { background: var(--uix-blue-50);          color: var(--uix-blue); }

/* ================================================================
   Summary tiles (shared)
   Body-level summary panel: icon + eyebrow + big value + band.
   Used by the Ecological Values report and the Ecosystem Services report;
   the Ecological Values page adds its own grid + gauge on top of these.
================================================================ */

.uix-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--uix-s-3);
  align-items: stretch;
}
/* Neutralise the global `.uix-card + .uix-card` top-margin inside the grid,
   which would otherwise shorten and offset tiles after the first. */
.uix-summary-grid .uix-card { margin-top: 0; }

.uix-sum-tile { height: 100%; padding: var(--uix-s-4); display: flex; flex-direction: column; gap: var(--uix-s-2); }
/* Fixed header zone so every tile's value starts on the same line. */
.uix-sum-head { display: flex; align-items: flex-start; gap: var(--uix-s-2); min-height: 48px; }
.uix-sum-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: var(--uix-r-sm, 8px);
  display: inline-flex; align-items: center; justify-content: center;
}
.uix-sum-icon.is-red    { background: var(--uix-rank-critical-bg); color: var(--uix-rank-critical); }
.uix-sum-icon.is-orange { background: var(--uix-rank-high-bg);     color: var(--uix-rank-high); }
.uix-sum-icon.is-green  { background: var(--uix-rank-low-bg);      color: var(--uix-rank-low); }
.uix-sum-icon.is-purple { background: rgba(139,92,246,0.12);       color: #8b5cf6; }
.uix-sum-icon.is-blue   { background: var(--uix-blue-50);          color: var(--uix-blue); }
.uix-sum-eyebrow-note { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--uix-muted); }

.uix-sum-value { font-size: 28px; font-weight: 600; line-height: 1.1; }
.uix-sum-value.is-asset { text-decoration: none; }
.uix-sum-value.is-asset:hover { text-decoration: underline; }
.uix-sum-band { font-size: 14px; font-weight: 600; color: var(--uix-muted); }
.uix-sum-sub  { font-size: 12px; color: var(--uix-muted); line-height: 1.4; }

/* Summary tile with a gauge: number on the left, gauge on the right.
   Shared by the Ecological Values hub and the Ecosystem Services summary. */
.uix-sum-split { display: flex; align-items: flex-start; gap: var(--uix-s-4); }
.uix-sum-primary { display: flex; flex-direction: column; gap: var(--uix-s-2); flex: 1; min-width: 0; }
.uix-sum-gauge { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-left: auto; }
.uix-gauge { width: 150px; height: auto; display: block; }
.uix-sum-gauge-meta { font-size: 12px; color: var(--uix-muted); text-align: center; line-height: 1.5; }
.uix-sum-gauge-meta strong { color: var(--uix-text); }

/* ================================================================
   Info banner
================================================================ */

.uix-banner {
  background: var(--uix-blue-50);
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-4) var(--uix-s-5);
  display: flex; align-items: flex-start; gap: var(--uix-s-3);
  color: var(--uix-text);
  font-size: 13px;
}
.uix-banner .uix-banner-icon {
  flex-shrink: 0;
  color: var(--uix-blue);
  margin-top: 1px;
}
.uix-banner .uix-banner-body { flex: 1; }
.uix-banner .uix-banner-aside {
  font-family: var(--uix-mono);
  background: rgba(255,255,255,0.7);
  padding: var(--uix-s-2) var(--uix-s-3);
  border-radius: var(--uix-r-sm);
  font-size: 12px;
}
/* For the few notices that are about losing something, rather than about
   how a thing works. Deliberately a different colour from the ordinary
   banner: on a page carrying several of them, this one has to be the one
   that gets read. */
.uix-banner.is-warning {
  background: var(--uix-rank-high-bg);
  box-shadow: inset 3px 0 0 var(--uix-rank-high);
}
.uix-banner.is-warning .uix-banner-icon { color: var(--uix-rank-high); }

/* Footer info bar (neutral grey) */
.uix-footnote {
  background: #f1f5f9;
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-3) var(--uix-s-4);
  display: flex; align-items: flex-start; gap: var(--uix-s-2);
  font-size: 12px;
  color: var(--uix-muted);
}
.uix-footnote .uix-footnote-icon { color: var(--uix-blue); flex-shrink: 0; }

/* ================================================================
   Sub-tab navigation (in-page tabs, uppercase, blue underline)
================================================================ */

.uix-subtabs {
  display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--uix-border);
  padding: 0;
  margin: 0;
  list-style: none;
}
.uix-subtabs li { margin: 0; }
.uix-subtabs a {
  display: inline-block;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--uix-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.uix-subtabs a:hover { color: var(--uix-text); }

/* The one tab that asks for input, against four that only report. Bigger,
   darker and on a tinted panel, so the eye lands there first. */
.uix-subtabs a.is-input-tab {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--uix-text);
  background: var(--uix-tint-blue, #eef4ff);
  border-radius: var(--uix-r-sm, 4px) var(--uix-r-sm, 4px) 0 0;
  padding: 11px 18px;
}
.uix-subtabs a.is-input-tab.is-active { color: var(--uix-blue); }

/* "i" marking a reference-only tab. Inside the label text, so the wording
   and the marker are edited together. */
.uix-tab-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 13px; height: 13px; margin-left: 5px;
  border: 1px solid currentColor; border-radius: 50%;
  font-size: 9px; font-weight: 700; font-style: italic;
  line-height: 1; text-transform: none; opacity: .75;
  vertical-align: 1px;
}

/* What the two Management boxes are for. */
.uix-mgmt-intro {
  margin: 0 0 var(--uix-s-4);
  padding: 10px 14px;
  background: var(--uix-tint-blue, #eef4ff);
  border-left: 3px solid var(--uix-blue);
  border-radius: 0 var(--uix-r-sm, 4px) var(--uix-r-sm, 4px) 0;
  font-size: 13px; line-height: 1.6; color: var(--uix-text);
}

/* Which driver slot a row fills — temporary, for confirming the order. */
.uix-driver-role {
  display: inline-block; margin-left: 8px; padding: 1px 7px;
  border-radius: 10px; background: var(--uix-bg); border: 1px solid var(--uix-border);
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--uix-muted); vertical-align: 1px;
}
.uix-subtabs a.is-active {
  color: var(--uix-blue);
  border-bottom-color: var(--uix-blue);
  background: var(--uix-blue-50);
  border-top-left-radius: var(--uix-r-sm);
  border-top-right-radius: var(--uix-r-sm);
}

/* ================================================================
   Buttons
================================================================ */

.uix-btn {
  display: inline-flex; align-items: center; gap: var(--uix-s-2);
  padding: 7px 14px;
  border-radius: var(--uix-r-sm);
  border: 1px solid var(--uix-border-strong);
  background: var(--uix-surface);
  color: var(--uix-text);
  font: inherit; font-weight: 500; font-size: 13px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.uix-btn:hover { background: var(--uix-bg); border-color: var(--uix-faint); }
.uix-btn.is-primary {
  background: var(--uix-blue);
  color: #fff;
  border-color: var(--uix-blue);
}
.uix-btn.is-primary:hover { background: var(--uix-blue-600); border-color: var(--uix-blue-600); }
.uix-btn.is-ghost {
  background: transparent;
  border-color: transparent;
}
.uix-btn.is-ghost:hover { background: var(--uix-bg); }
.uix-btn.is-sm { padding: 4px 10px; font-size: 12px; }

/* ================================================================
   Icon badge (coloured circle holding an SVG icon)
================================================================ */

.uix-icon-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--uix-rank-low-bg);
  color: var(--uix-rank-low);
  flex-shrink: 0;
}
.uix-icon-badge.is-sm { width: 24px; height: 24px; }
.uix-icon-badge.is-lg { width: 40px; height: 40px; }

/* Variants by ranking */
.uix-icon-badge.is-critical    { background: var(--uix-rank-critical-bg);    color: var(--uix-rank-critical); }
.uix-icon-badge.is-high        { background: var(--uix-rank-high-bg);        color: var(--uix-rank-high); }
.uix-icon-badge.is-moderate    { background: var(--uix-rank-moderate-bg);    color: #b45309; }
.uix-icon-badge.is-low         { background: var(--uix-rank-low-bg);         color: var(--uix-rank-low); }
.uix-icon-badge.is-negligible  { background: var(--uix-rank-negligible-bg);  color: var(--uix-faint); }
.uix-icon-badge.is-blue        { background: var(--uix-blue-50);             color: var(--uix-blue); }

/* ================================================================
   Score pill — filled (mitigated) and outlined (residual class)
================================================================ */

.uix-pill {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border-radius: var(--uix-r-pill);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
/* Filled (used for Mitigated Score values) */
.uix-pill.is-critical   { background: var(--uix-rank-critical);   color: #fff; }
.uix-pill.is-high       { background: var(--uix-rank-high);       color: #fff; }
.uix-pill.is-moderate   { background: var(--uix-rank-moderate);   color: #78410f; }
.uix-pill.is-low        { background: var(--uix-rank-low);        color: #fff; }
.uix-pill.is-negligible { background: var(--uix-rank-negligible); color: #fff; }

/* Outlined (used for Residual Risk class) */
.uix-pill.is-outlined { background: transparent; border-width: 1px; }
.uix-pill.is-outlined.is-critical   { color: var(--uix-rank-critical);   border-color: var(--uix-rank-critical);   background: var(--uix-rank-critical-bg); }
.uix-pill.is-outlined.is-high       { color: var(--uix-rank-high);       border-color: var(--uix-rank-high);       background: var(--uix-rank-high-bg); }
.uix-pill.is-outlined.is-moderate   { color: #92400e;                    border-color: var(--uix-rank-moderate);   background: var(--uix-rank-moderate-bg); }
.uix-pill.is-outlined.is-low        { color: var(--uix-rank-low);        border-color: var(--uix-rank-low);        background: var(--uix-rank-low-bg); }
.uix-pill.is-outlined.is-negligible { color: var(--uix-faint);           border-color: var(--uix-border-strong);   background: var(--uix-rank-negligible-bg); }

/* ================================================================
   Rank circle (numbered, ranking-coloured)
================================================================ */

.uix-rank-dot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--uix-rank-low);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.uix-rank-dot.is-critical   { background: var(--uix-rank-critical); }
.uix-rank-dot.is-high       { background: var(--uix-rank-high); }
.uix-rank-dot.is-moderate   { background: var(--uix-rank-moderate); color: #78410f; }
.uix-rank-dot.is-low        { background: var(--uix-rank-low); }
.uix-rank-dot.is-negligible { background: var(--uix-rank-negligible); }

/* ================================================================
   Progress bar (track + fill + trailing number)
================================================================ */

.uix-bar {
  display: inline-flex; align-items: center; gap: var(--uix-s-3);
  width: 100%;
}
.uix-bar-track {
  display: block;
  flex: 1;
  height: 7px;
  background: #e5e7eb;
  border-radius: var(--uix-r-pill);
  overflow: hidden;
  min-width: 80px;
}
.uix-bar-fill {
  display: block;
  height: 100%;
  background: var(--uix-rank-low);
  border-radius: inherit;
  transition: width .3s ease;
}
.uix-bar-label {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 50px;
  text-align: right;
}
.uix-bar.is-critical   .uix-bar-fill { background: var(--uix-rank-critical); }
.uix-bar.is-high       .uix-bar-fill { background: var(--uix-rank-high); }
.uix-bar.is-moderate   .uix-bar-fill { background: var(--uix-rank-moderate); }
.uix-bar.is-low        .uix-bar-fill { background: var(--uix-rank-low); }
.uix-bar.is-negligible .uix-bar-fill { background: var(--uix-rank-negligible); }
.uix-bar.is-blue       .uix-bar-fill { background: var(--uix-blue); }

/* Compact variant inside table cells */
.uix-bar.is-compact .uix-bar-track { height: 5px; min-width: 60px; }
.uix-bar.is-compact .uix-bar-label { font-size: 12px; min-width: 42px; }

/* ================================================================
   Legend strip
================================================================ */

.uix-legend {
  display: inline-flex; align-items: center; flex-wrap: wrap;
  gap: var(--uix-s-4);
  font-size: 12px;
  color: var(--uix-muted);
}
.uix-legend-chip {
  display: inline-flex; align-items: center; gap: 6px;
}
.uix-legend-dot {
  display: inline-block;
  vertical-align: middle;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--uix-rank-low);
  flex-shrink: 0;
}
.uix-legend-dot.is-critical   { background: var(--uix-rank-critical); }
.uix-legend-dot.is-high       { background: var(--uix-rank-high); }
.uix-legend-dot.is-moderate   { background: var(--uix-rank-moderate); }
.uix-legend-dot.is-low        { background: var(--uix-rank-low); }
.uix-legend-dot.is-very-low   { background: #15803d; } /* darker green for "Very Low" */
.uix-legend-dot.is-negligible { background: var(--uix-rank-negligible); }

/* ================================================================
   Tables
================================================================ */

.uix-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.uix-table thead th {
  background: var(--uix-navy-900);
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: left;
  padding: 10px var(--uix-s-4);
}
.uix-table thead th:first-child { border-top-left-radius: var(--uix-r-md); }
.uix-table thead th:last-child  { border-top-right-radius: var(--uix-r-md); }
.uix-table tbody td {
  padding: var(--uix-s-3) var(--uix-s-4);
  border-bottom: 1px solid var(--uix-border);
  vertical-align: middle;
}
.uix-table tbody tr:last-child td { border-bottom: none; }
.uix-table tbody tr.is-total {
  background: var(--uix-tint-neutral);
  font-weight: 600;
}

/* Subtle hover on every table data row. Stateful rows (totals, expanded,
   active) keep their own backgrounds, so the :not() filters skip them. */
.uix-table tbody tr { transition: background-color .15s ease; }
.uix-table tbody tr:hover:not(.is-total):not(.is-expanded):not(.is-active) {
  background: var(--uix-bg);
}
.uix-table tbody tr.is-expandable { cursor: pointer; }
.uix-table tbody tr.is-expandable:hover { background: var(--uix-bg); }
.uix-table tbody tr.is-expandable .uix-row-chevron { transition: transform .12s, color .12s; }
.uix-table tbody tr.is-expandable.is-open .uix-row-chevron { transform: rotate(90deg); color: var(--uix-blue); }
.uix-table tbody tr.is-expandable.is-open { background: var(--uix-blue-50); }
.uix-table tbody tr.uix-row-link { cursor: pointer; }
.uix-table tbody tr.uix-row-link:hover { background: var(--uix-bg); }
.uix-table tbody tr.uix-row-link:hover .uix-row-chevron { color: var(--uix-blue); transform: translateX(2px); }
.uix-row-chevron { color: var(--uix-faint); transition: color .12s, transform .12s; }

/* ── Info-tip popover (small ⓘ button reveals a click-toggle tooltip) */
.uix-info-tip {
  position: relative;
  display: inline-block;
  line-height: 0;
}
.uix-info-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--uix-blue-50);
  background: var(--uix-blue-50);
  color: var(--uix-blue);
  cursor: pointer;
  border-radius: var(--uix-r-sm);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: color .12s, background .12s, border-color .12s;
}
.uix-info-btn:hover,
.uix-info-btn.is-open {
  background: var(--uix-blue);
  border-color: var(--uix-blue);
  color: #fff;
}
.uix-info-btn svg { flex-shrink: 0; }
.uix-info-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;            /* anchor to the right so the popover doesn't drift off-screen */
  left: auto;
  z-index: 100;
  width: 300px;
  background: var(--uix-surface);
  border: 1px solid var(--uix-border-strong);
  box-shadow: var(--uix-shadow-md);
  padding: var(--uix-s-3) var(--uix-s-4);
  border-radius: var(--uix-r-md);
  font-size: 12px;
  line-height: 1.55;
  color: var(--uix-text);
  font-weight: 400;
  font-style: normal;
  text-align: left;
  /* Hidden by default; show on hover. Visibility-based hide allows hovering
     the popover itself to keep it open while still preventing interaction
     in the hidden state. */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: visibility 0s linear .15s, opacity .12s linear;
}
.uix-info-tip:hover .uix-info-popover,
.uix-info-popover:hover {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: visibility 0s linear, opacity .12s linear;
}
.uix-info-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 6px;          /* arrow on the right to match the popover anchor */
  width: 10px; height: 10px;
  background: var(--uix-surface);
  border-top: 1px solid var(--uix-border-strong);
  border-left: 1px solid var(--uix-border-strong);
  transform: rotate(45deg);
}
/* If popover would overflow the right edge, mirror it. Auto-detection
   is hard in pure CSS; use a manual modifier when needed. */
.uix-info-popover.is-right { left: auto; right: 0; }
.uix-info-popover.is-right::before { left: auto; right: 6px; }

/* ── Info card (used for Activity / Pressure detail tabs) ──────────── */
.uix-info-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--uix-s-3);
}
.uix-info-card {
  display: flex;
  align-items: flex-start;
  gap: var(--uix-s-3);
  background: var(--uix-surface);
  border: 1px solid var(--uix-border);
  border-left: 4px solid var(--uix-blue);
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-4) var(--uix-s-5);
}
.uix-info-card-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  background: var(--uix-blue-50);
  border-radius: var(--uix-r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--uix-blue);
}
.uix-info-card-body { flex: 1; min-width: 0; }
.uix-info-card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--uix-muted);
  margin: 0 0 6px;
}
.uix-info-card-content {
  font-size: 13px;
  line-height: 1.55;
  color: var(--uix-text);
  word-wrap: break-word;
}

.uix-info-card.is-blue   { border-left-color: var(--uix-blue); }
.uix-info-card.is-blue   .uix-info-card-icon { background: var(--uix-blue-50);          color: var(--uix-blue); }
.uix-info-card.is-green  { border-left-color: var(--uix-rank-low); }
.uix-info-card.is-green  .uix-info-card-icon { background: var(--uix-rank-low-bg);      color: var(--uix-rank-low); }
.uix-info-card.is-orange { border-left-color: var(--uix-rank-high); }
.uix-info-card.is-orange .uix-info-card-icon { background: var(--uix-rank-high-bg);     color: var(--uix-rank-high); }
.uix-info-card.is-red    { border-left-color: var(--uix-rank-critical); }
.uix-info-card.is-red    .uix-info-card-icon { background: var(--uix-rank-critical-bg); color: var(--uix-rank-critical); }
.uix-info-card.is-yellow { border-left-color: var(--uix-rank-moderate); }
.uix-info-card.is-yellow .uix-info-card-icon { background: var(--uix-rank-moderate-bg); color: #b45309; }
.uix-info-card.is-purple { border-left-color: #8b5cf6; }
.uix-info-card.is-purple .uix-info-card-icon { background: #f3e8ff;                     color: #7c3aed; }

/* ── Expandable pressure-row detail (Pressures & Activities page) ─── */
.uix-table tbody tr.uix-pressure-row { cursor: pointer; }
.uix-table tbody tr.uix-pressure-row:hover { background: var(--uix-bg); }
.uix-table tbody tr.uix-pressure-row:hover .uix-row-chevron {
  color: var(--uix-blue);
  transform: translateX(2px);
}
.uix-table tbody tr.uix-pressure-row.is-expanded .uix-row-chevron {
  transform: rotate(90deg);
  color: var(--uix-blue);
}
.uix-table tbody tr.uix-pressure-row.is-expanded { background: var(--uix-blue-50); }
.uix-detail-panel {
  padding: var(--uix-s-5) var(--uix-s-6);
  background: var(--uix-bg);
  border-top: 2px solid var(--uix-blue);
}
.uix-detail-section-head {
  display: flex; align-items: center; gap: 8px;
  margin: var(--uix-s-3) 0 var(--uix-s-3);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--uix-text);
}
.uix-tab-content { padding-top: var(--uix-s-4); }
.uix-mit-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--uix-border-strong);
  border-radius: var(--uix-r-sm);
  font: inherit; font-size: 13px;
  background: var(--uix-surface);
  cursor: pointer;
}
.uix-mit-select:focus { outline: 2px solid var(--uix-blue); outline-offset: -1px; }
.uix-mit-select.is-saving  { background: #fff7d6; }
.uix-mit-select.is-saved   { background: #d9f5e1; transition: background .8s ease; }
.uix-mit-select.is-error   { background: #fde2e2; }

/* ── Focus mode — body class set when a row is expanded ─────────── */
/* The page header, table header, toolbar and the two "Show" buttons stay
   visible. We just hide the filter sidebar, pagination, footnote, and
   every pressure row except the one that's expanded. */
body.uix-row-expanded #uix-pressures-filters,
body.uix-row-expanded #uix-pagination-info,
body.uix-row-expanded #uix-pagination-controls,
body.uix-row-expanded .uix-footnote {
  display: none !important;
}
body.uix-row-expanded .uix-pressure-row:not(.is-expanded) { display: none !important; }
body.uix-row-expanded .uix-service-row:not(.is-expanded)  { display: none !important; }
/* Both Pressures and Services tables keep their header visible in focus
   mode so the user still sees the column meaning above the expanded row.
   (The old main-page dependency aside was removed; its "About Dependency
   Scores" content now lives inside the expanded detail, so it must NOT be
   hidden in focus mode.) */
/* Services page — hide the summary in focus mode, show the back button */
body.uix-row-expanded #uix-services-summary { display: none !important; }
body.uix-row-expanded #uix-services-back    { display: inline-flex !important; }
/* Sort dropdown is irrelevant when viewing a single row */
body.uix-row-expanded #uix-sort-select { display: none !important; }

/* Service-row hover + expanded state (mirrors the pressure-row pattern) */
.uix-table tbody tr.uix-service-row { cursor: pointer; }
.uix-table tbody tr.uix-service-row:hover { background: var(--uix-bg); }
.uix-table tbody tr.uix-service-row:hover .uix-row-chevron {
  color: var(--uix-blue);
  transform: translateX(2px);
}
.uix-table tbody tr.uix-service-row.is-expanded .uix-row-chevron {
  transform: rotate(90deg);
  color: var(--uix-blue);
}
.uix-table tbody tr.uix-service-row.is-expanded { background: var(--uix-blue-50); }

/* Clickable state selector rows inside the service detail (same look as
   zone-selector rows in the pressure detail) */
.uix-table tbody tr.uix-svc-state-row { cursor: pointer; }
.uix-table tbody tr.uix-svc-state-row:hover { background: var(--uix-bg); }
.uix-table tbody tr.uix-svc-state-row.is-active { background: var(--uix-blue-50); }
.uix-table tbody tr.uix-svc-state-row.is-active td:first-child {
  box-shadow: inset 3px 0 0 var(--uix-blue);
}

/* Filter button labels (three states):
     normal + sidebar open   → "Hide filters"
     normal + sidebar closed → "Show filters"
     focus mode (any state)  → "Back"
   Body classes uix-sidebar-closed and uix-row-expanded drive which span shows. */
#uix-filters-show .uix-btn-label { display: none; }
#uix-filters-show .uix-lbl-hide { display: inline; }                                  /* default: sidebar open */
body.uix-sidebar-closed #uix-filters-show .uix-lbl-hide { display: none; }
body.uix-sidebar-closed #uix-filters-show .uix-lbl-show { display: inline; }
body.uix-row-expanded #uix-filters-show .uix-btn-label { display: none !important; }
body.uix-row-expanded #uix-filters-show .uix-lbl-back { display: inline !important; }

/* Zone-selector row (Pressure Summary > By Zone table — click to change Within-Zone panel) */
.uix-table tbody tr.uix-zone-selector-row { cursor: pointer; }
.uix-table tbody tr.uix-zone-selector-row:hover { background: var(--uix-bg); }
.uix-table tbody tr.uix-zone-selector-row.is-active { background: var(--uix-blue-50); }
.uix-table tbody tr.uix-zone-selector-row.is-active td:first-child {
  box-shadow: inset 3px 0 0 var(--uix-blue);
}

/* ── Segmented control (pill-style toggle between two/three options) ─ */
.uix-seg {
  display: inline-flex;
  background: var(--uix-tint-neutral);
  border-radius: var(--uix-r-sm);
  padding: 2px;
  width: 100%;
  margin-bottom: var(--uix-s-3);
}
.uix-seg-btn {
  flex: 1;
  padding: 5px 8px;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--uix-muted);
  border-radius: calc(var(--uix-r-sm) - 2px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background .12s, color .12s;
}
.uix-seg-btn:hover { color: var(--uix-text); }
.uix-seg-btn.is-active {
  background: var(--uix-surface);
  color: var(--uix-text);
  box-shadow: 0 1px 2px rgba(15,31,61,0.08);
}

/* ── Risk-class checkboxes (used in the legend / filter panel) ─────── */
.uix-risk-chips {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.uix-risk-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--uix-r-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--uix-text);
  transition: background .12s;
}
.uix-risk-chip:hover { background: var(--uix-bg); }
.uix-risk-chip input[type="checkbox"] { margin: 0; cursor: pointer; }
/* When the box is unchecked the row's label dims so the user can see
   at a glance which bands are excluded. */
.uix-risk-chip:has(input:not(:checked)) { opacity: 0.4; }
.uix-risk-chip-label { font-weight: 500; }

/* Sort indicator chevron — shown on sortable column headers */
.uix-sort-ind {
  display: inline-block;
  vertical-align: middle;
  width: 0; height: 0;
  margin-left: 4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid rgba(255,255,255,0.25);
  border-bottom: 4px solid transparent;
  transition: opacity .12s, transform .12s;
}
.uix-sort-ind.is-active { border-top-color: #fff; }
.uix-sort-ind.is-asc {
  border-top: 4px solid transparent;
  border-bottom: 4px solid #fff;
}
.uix-table.is-soft .uix-sort-ind { border-top-color: var(--uix-faint); }
.uix-table.is-soft .uix-sort-ind.is-active { border-top-color: var(--uix-blue); }
.uix-table.is-soft .uix-sort-ind.is-asc { border-bottom-color: var(--uix-blue); }
th.uix-sortable { user-select: none; }
th.uix-sortable:hover { background: var(--uix-navy-800); }
.uix-table.is-soft th.uix-sortable:hover { background: var(--uix-bg); }

/* Soft variant (no dark header) — used in nested tables */
.uix-table.is-soft thead th {
  background: transparent;
  color: var(--uix-muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--uix-border);
}
.uix-table.is-soft thead th:first-child,
.uix-table.is-soft thead th:last-child  { border-radius: 0; }

/* Gridded variant — adds vertical separators between columns */
.uix-table.is-gridded thead th,
.uix-table.is-gridded tbody td {
  border-right: 1px solid var(--uix-border);
}
.uix-table.is-gridded thead th:last-child,
.uix-table.is-gridded tbody td:last-child {
  border-right: none;
}

/* Column types */
.uix-col-warm   { color: var(--uix-rank-high); font-weight: 600; }
.uix-col-cool   { color: var(--uix-rank-low); font-weight: 600; }
.uix-col-num    { text-align: right;  font-variant-numeric: tabular-nums; }
.uix-col-center { text-align: center; font-variant-numeric: tabular-nums; }
.uix-col-icon   { width: 40px; }
/* The above utilities need extra specificity to win over `.uix-table thead th { text-align: left }` */
.uix-table thead th.uix-col-num    { text-align: right; }
.uix-table thead th.uix-col-center { text-align: center; }

/* Pressure name cell — icon + text inline */
/* Named cell: icon + label (+ badges). Kept as a normal table cell — NOT
   display:flex — so it stretches to the full row height and its bottom border
   lines up with the neighbouring cells even when one of them wraps to multiple
   lines. Children sit inline and vertically centred; the old flex gap is
   replaced by a left margin on every child after the first. */
.uix-cell-named > * { vertical-align: middle; }
.uix-cell-named > * + * { margin-left: var(--uix-s-3); }
/* Opt-in horizontal flex for named cells that push a trailing chevron/pill to
   the right (e.g. the Ecosystem Services drill-down). Plain named cells stay
   table-cells so they still stretch to the row height. */
/* Row hidden by an expand-focus toggle (only the expanded row stays visible). */
.uix-focus-hidden { display: none !important; }
/* Compact inline scale chip (Ecosystem Services "About Dependency Scores" band) */
.uix-dep-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.uix-dep-chip strong { font-variant-numeric: tabular-nums; }
.uix-cell-flex { display: flex; align-items: center; gap: var(--uix-s-3); }
.uix-cell-flex > * + * { margin-left: 0; }   /* gap handles spacing under flex */

/* Collapsible section toggle — show one label or the other based on state */
.uix-when-open  { display: inline; }
.uix-when-closed { display: none; }
.is-closed .uix-when-open  { display: none; }
.is-closed .uix-when-closed { display: inline; }
.is-closed .uix-summary-body,
.is-closed #uix-risk-filter { display: none !important; }

/* Zone cell — icon + name per zone, stacked when multiple */
.uix-cell-zones {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.uix-zone-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--uix-text);
}
.uix-zone-item svg { color: var(--uix-rank-low); flex-shrink: 0; }

/* Trend arrow */
.uix-arrow-down { color: var(--uix-rank-low); }
.uix-arrow-up   { color: var(--uix-rank-critical); }

/* Ecosystem Services page — two-column layout (table + side info panel) */
.uix-services-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--uix-s-4);
  align-items: start;
}
@media (max-width: 1100px) {
  .uix-services-layout { grid-template-columns: 1fr; }
}

/* "Understanding Dependency Risk" side panel */
.uix-dep-info { padding: var(--uix-s-5); }
.uix-dep-info-head {
  margin: 0 0 var(--uix-s-3);
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--uix-text);
}
.uix-dep-info-row {
  display: flex;
  align-items: flex-start;
  gap: var(--uix-s-3);
  margin-bottom: var(--uix-s-4);
}
.uix-dep-info-sep {
  border: none;
  border-top: 1px solid var(--uix-border);
  margin: var(--uix-s-2) 0 var(--uix-s-4);
}
.uix-dep-scale {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}
.uix-dep-scale > div {
  display: grid;
  grid-template-columns: 14px 78px 1fr;
  align-items: center;
  gap: 8px;
}
.uix-dep-scale-range {
  font-family: var(--uix-mono);
  font-size: 12px;
  color: var(--uix-muted);
}

/* Rank label — coloured text used by the Risk Ranking column on the
   Ecosystem Services Report. */
.uix-rank-text { font-weight: 600; }
.uix-rank-text.is-critical { color: var(--uix-rank-critical); }
.uix-rank-text.is-high     { color: var(--uix-rank-high); }
.uix-rank-text.is-moderate { color: #b45309; }
.uix-rank-text.is-low      { color: var(--uix-rank-low); }
.uix-rank-text.is-very-low { color: #15803d; }   /* darker green, matches the legend dot */
.uix-rank-text.is-none     { color: var(--uix-muted); }
.uix-rank-text.is-na       { color: var(--uix-faint); }

/* "Not applicable" pill / bar variants for null values */
.uix-pill.is-na { background: var(--uix-rank-negligible); color: #fff; }
.uix-bar.is-na  .uix-bar-fill { background: var(--uix-rank-negligible); }

/* Text colour utilities */
.uix-text-muted { color: var(--uix-muted); }
.uix-text-faint { color: var(--uix-faint); }

/* ================================================================
   Filter sidebar
================================================================ */

.uix-filters {
  background: var(--uix-surface);
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-4);
  width: 260px;
  flex-shrink: 0;
}
.uix-filters-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--uix-s-3);
}
.uix-filters-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.uix-filters-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-sm);
  font: inherit; font-size: 13px;
  margin-bottom: var(--uix-s-4);
}
.uix-filter-group {
  margin-bottom: var(--uix-s-4);
  padding-bottom: var(--uix-s-4);
  border-bottom: 1px solid var(--uix-border);
}
.uix-filter-group:last-child { border-bottom: none; padding-bottom: 0; }
.uix-filter-group-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--uix-s-2);
  font-weight: 600;
  font-size: 13px;
}
.uix-filter-option {
  display: flex; align-items: center; gap: var(--uix-s-2);
  padding: 4px 0;
  font-size: 13px;
}
.uix-filter-option input { margin: 0; }

/* ================================================================
   TNFD tags panel (replaces 'Key Takeaways' in the screenshots)
================================================================ */

.uix-tnfd-panel {
  background: var(--uix-tint-cool);
  border: 1px solid #c8e6cb;
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-4) var(--uix-s-5);
}
.uix-tnfd-panel h3 {
  margin: 0 0 var(--uix-s-3);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--uix-tint-cool-ink);
}
.uix-tnfd-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.uix-tnfd-tag {
  background: rgba(255,255,255,0.7);
  border: 1px solid #c8e6cb;
  color: var(--uix-tint-cool-ink);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--uix-r-pill);
  font-weight: 500;
}

/* ================================================================
   Improvement panel (the bottom band on Ecological State Overview)
================================================================ */

.uix-improvement {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: var(--uix-s-6);
  align-items: center;
  background: var(--uix-tint-neutral);
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-5) var(--uix-s-6);
}
.uix-improvement-arrow {
  display: flex; align-items: center; gap: var(--uix-s-4);
  font-size: 22px;
}
.uix-improvement-arrow .uix-num-lg.is-warm { color: var(--uix-rank-high); }
.uix-improvement-arrow .uix-num-lg.is-cool { color: var(--uix-tint-cool-ink); }
.uix-improvement-callout {
  background: var(--uix-tint-cool);
  border: 1px solid #c8e6cb;
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-3) var(--uix-s-4);
  display: flex; align-items: center; gap: var(--uix-s-2);
  color: var(--uix-tint-cool-ink);
  font-weight: 600;
}

/* ================================================================
   Layout helpers
================================================================ */

.uix-layout {
  display: flex;
  gap: var(--uix-s-5);
  padding: var(--uix-s-5) var(--uix-s-8);
}
.uix-layout-main {
  flex: 1;
  min-width: 0;
}
.uix-grid {
  display: grid;
  gap: var(--uix-s-4);
}
.uix-grid-3 { grid-template-columns: repeat(3, 1fr); }
.uix-grid-2 { grid-template-columns: repeat(2, 1fr); }
.uix-grid-1-2 { grid-template-columns: 1fr 2fr; }
.uix-grid-2-1 { grid-template-columns: 2fr 1fr; }
.uix-grid-auto { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Toolbar above tables */
.uix-toolbar {
  display: flex; align-items: center; gap: var(--uix-s-3);
  margin-bottom: var(--uix-s-3);
}
.uix-toolbar .uix-toolbar-spacer { flex: 1; }

/* Pagination */
.uix-pagination {
  display: flex; align-items: center; gap: var(--uix-s-2);
  font-size: 13px;
  color: var(--uix-muted);
}
.uix-pagination .uix-page-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--uix-r-sm);
  border: 1px solid var(--uix-border);
  background: var(--uix-surface);
  color: var(--uix-text);
  text-decoration: none;
  font-size: 13px;
}
.uix-pagination .uix-page-btn.is-active {
  background: var(--uix-blue);
  color: #fff;
  border-color: var(--uix-blue);
}

/* ── Modal ────────────────────────────────────────────────────────────
   Markup:
     <div class="uix-modal" hidden>
       <div class="uix-modal-backdrop" data-uix-modal-close></div>
       <div class="uix-modal-dialog">…</div>
     </div>
   Open with [data-uix-modal-open="<modal-id>"]; close with [data-uix-modal-close].
*/
.uix-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.uix-modal[hidden] { display: none; }
.uix-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 31, 61, 0.55);
}
.uix-modal-dialog {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: var(--uix-surface);
  border-radius: var(--uix-r-md);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.uix-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--uix-s-4) var(--uix-s-5);
  border-bottom: 1px solid var(--uix-border);
}
.uix-modal-body { padding: var(--uix-s-5); overflow-y: auto; }
.uix-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--uix-s-2);
  padding: var(--uix-s-3) var(--uix-s-5) var(--uix-s-4);
  border-top: 1px solid var(--uix-border);
  background: var(--uix-bg);
}
.uix-modal-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--uix-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--uix-r-sm);
}
.uix-modal-close:hover { background: var(--uix-bg); color: var(--uix-text); }

/* Form bits used inside modals */
.uix-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--uix-muted);
  margin: 0 0 6px;
}
.uix-input {
  width: 100%;
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-sm);
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  background: var(--uix-surface);
}
.uix-input:focus { outline: none; border-color: var(--uix-blue); box-shadow: 0 0 0 3px rgba(13,110,253,0.18); }
.uix-form-status { margin-top: var(--uix-s-3); font-size: 13px; min-height: 18px; }
.uix-form-status.is-success { color: var(--uix-rank-low); }
.uix-form-status.is-error   { color: var(--uix-rank-critical); }
.uix-form-status.is-info    { color: var(--uix-muted); }

/* ── Dashboard topbar ────────────────────────────────────────────── */
.uix-topnav-brand { display: inline-flex; align-items: center; padding: 12px 0; }

/* ── Dashboard sidebar list ──────────────────────────────────────── */
.uix-list { list-style: none; margin: 0; padding: 0; }
.uix-list-item {
  display: block;
  padding: 8px 10px;
  border-radius: var(--uix-r-sm);
  color: var(--uix-text);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 2px;
}
.uix-list-item:hover { background: var(--uix-bg); }
.uix-list-item.is-active {
  background: var(--uix-blue-50);
  color: var(--uix-blue);
  font-weight: 600;
}

/* ── Dashboard site rows ─────────────────────────────────────────── */
.uix-table tbody tr.uix-site-row { cursor: pointer; }
.uix-table tbody tr.uix-site-row:hover { background: var(--uix-bg); }
.uix-table tbody tr.uix-site-row .uix-row-chevron {
  transition: transform .12s, color .12s;
}
.uix-table tbody tr.uix-site-row:hover .uix-row-chevron {
  color: var(--uix-blue);
  transform: translateX(2px);
}
.uix-table tbody tr.uix-site-row.is-open { background: var(--uix-blue-50); }
.uix-table tbody tr.uix-site-row.is-open .uix-row-chevron {
  transform: rotate(90deg);
  color: var(--uix-blue);
}

/* ── Reports list rendered inside the expanded row ──────────────── */
.uix-reports-content table.uix-table { font-size: 13px; }
.uix-reports-content .uix-report-empty {
  padding: var(--uix-s-4);
  color: var(--uix-muted);
  font-size: 13px;
  font-style: italic;
}

/* Contributions page — map + right panel layout */
#uix-contrib-wrapper {
  display: flex;
  height: 640px;
  gap: 0;
  border-radius: var(--uix-r-md);
  overflow: hidden;
}
#uix-contrib-map { flex: 1 1 60%; height: 100%; }
#uix-contrib-panel {
  flex: 0 0 38%;
  height: 100%;
  overflow-y: auto;
  background: var(--uix-bg);
  padding: var(--uix-s-4);
  border-left: 1px solid var(--uix-border);
}
.uix-contrib-empty { text-align: center; padding: var(--uix-s-7) var(--uix-s-4); }
.uix-area-card {
  background: var(--uix-surface);
  border: 2px solid var(--uix-border);
  border-radius: var(--uix-r-md);
  padding: var(--uix-s-3) var(--uix-s-4);
  margin-bottom: var(--uix-s-3);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.uix-area-card:hover { border-color: var(--uix-faint); }
.uix-area-card.is-active {
  border-color: var(--uix-blue);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.18);
}
.uix-area-swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 3px;
  border: 1px solid var(--uix-border);
  vertical-align: middle;
  margin-right: 6px;
}
.uix-area-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--uix-s-2);
}
.uix-area-card-head-right {
  display: flex;
  align-items: center;
  gap: var(--uix-s-3);
  flex-shrink: 0;
}
/* Dim a card when its polygon is toggled off the map */
.uix-area-card.is-hidden-on-map { opacity: 0.55; }
.uix-area-card.is-hidden-on-map .uix-area-swatch { filter: grayscale(1); }

/* ── Toggle switch ────────────────────────────────────────────────── */
.uix-switch { position: relative; display: inline-flex; cursor: pointer; }
.uix-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.uix-switch-track {
  width: 34px; height: 18px;
  background: var(--uix-faint);
  border-radius: 999px;
  transition: background .15s;
  position: relative;
}
.uix-switch-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  transition: transform .15s;
}
.uix-switch input:checked + .uix-switch-track { background: var(--uix-blue); }
.uix-switch input:checked + .uix-switch-track::after { transform: translateX(16px); }
.uix-switch input:focus-visible + .uix-switch-track {
  box-shadow: 0 0 0 3px rgba(13,110,253,0.25);
}
.uix-area-card-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.uix-area-card-id { display: flex; align-items: center; gap: 4px; }
.uix-area-card-subtitle {
  font-size: 12px;
  color: var(--uix-muted);
  line-height: 1.25;
  word-break: break-word;
}
/* Collapsible body — hidden by default, revealed when the card is active */
.uix-area-card-body { display: none; margin-top: var(--uix-s-3); }
.uix-area-card.is-active .uix-area-card-body { display: block; }
.uix-area-card-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px 10px;
  font-size: 12px;
}
.uix-area-card-meta dt { color: var(--uix-muted); font-weight: 600; margin: 0; }
.uix-area-card-meta dd { margin: 0; color: var(--uix-text); }
.uix-area-inputs {
  margin-top: var(--uix-s-3);
  padding-top: var(--uix-s-3);
  border-top: 1px solid var(--uix-border);
  display: grid;
  gap: var(--uix-s-2);
}
.uix-area-inputs label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--uix-muted);
  margin-bottom: 2px;
}
.uix-area-inputs input, .uix-area-inputs textarea, .uix-area-inputs select {
  width: 100%;
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-sm);
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  background: var(--uix-surface);
}
.uix-area-inputs textarea { min-height: 56px; resize: vertical; }
.uix-area-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--uix-s-2); }

/* Condition rating — segmented 1..5 buttons */
.uix-rate {
  display: inline-flex;
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-sm);
  overflow: hidden;
  background: var(--uix-surface);
}
.uix-rate-btn {
  flex: 1;
  min-width: 36px;
  padding: 6px 0;
  background: transparent;
  border: none;
  border-right: 1px solid var(--uix-border);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--uix-muted);
  transition: background .12s, color .12s;
}
.uix-rate-btn:last-child { border-right: none; }
.uix-rate-btn:hover { background: var(--uix-bg); color: var(--uix-text); }
.uix-rate-btn.is-active { background: var(--uix-blue); color: #fff; }

/* Calculated values readout */
.uix-area-calc {
  margin-top: var(--uix-s-3);
  padding-top: var(--uix-s-3);
  border-top: 1px dashed var(--uix-border);
}
.uix-area-calc dd { font-variant-numeric: tabular-nums; font-weight: 600; }
.uix-area-save-status {
  font-size: 11px;
  color: var(--uix-muted);
  margin-top: 2px;
  min-height: 14px;
}
.uix-area-save-status.is-saved { color: var(--uix-rank-low); }
.uix-area-save-status.is-error { color: var(--uix-rank-critical); }

/* ── Reporting Alignment tab — 4-column card grid ────────────────── */
.uix-ra-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--uix-s-3);
  align-items: start;
}
.uix-ra-card {
  padding: var(--uix-s-4);
  display: flex;
  flex-direction: column;
  gap: var(--uix-s-3);
}
.uix-ra-card-head {
  display: flex;
  align-items: center;
  gap: var(--uix-s-2);
  margin: 0;
}
.uix-ra-card-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}
.uix-ra-table { margin: 0; font-size: 13px; }
.uix-ra-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.uix-ra-table td { vertical-align: top; }
.uix-ra-placeholder { justify-content: center; align-items: center; min-height: 200px; }

/* LEAP timeline (TNFD) — column 2 of the Reporting Alignment tab */
.uix-leap {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}
.uix-leap-step {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: var(--uix-s-3);
  padding-bottom: var(--uix-s-4);
}
.uix-leap-step:last-child { padding-bottom: 0; }
/* Vertical connector line — runs from below this step's marker
   down through the next step's marker. */
.uix-leap-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--uix-rank-low);
  opacity: 0.4;
}
.uix-leap-step.is-pending:not(:last-child)::after,
.uix-leap-step:not(:last-child).is-pending::after {
  background: var(--uix-border-strong);
  opacity: 1;
}
.uix-leap-marker {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.uix-leap-step.is-complete .uix-leap-marker {
  background: var(--uix-rank-low);
  color: #fff;
}
.uix-leap-step.is-pending .uix-leap-marker {
  background: transparent;
  border: 2px dashed var(--uix-muted);
}
.uix-leap-body { min-width: 0; padding-top: 1px; }
.uix-leap-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}
.uix-leap-text {
  font-size: 12px;
  color: var(--uix-muted);
  line-height: 1.4;
}

/* Framework Linkages — column 3 */
.uix-framework-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.uix-framework-list li {
  display: grid;
  grid-template-columns: 40px 110px 1fr;
  gap: var(--uix-s-3);
  align-items: center;
  padding: var(--uix-s-3) 0;
  border-bottom: 1px solid var(--uix-border);
}
.uix-framework-list li:last-child { border-bottom: none; }
.uix-framework-logo { width: 40px; height: 40px; flex-shrink: 0; }
.uix-framework-logo svg { display: block; width: 100%; height: 100%; }
.uix-framework-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--uix-text);
}
.uix-framework-desc {
  font-size: 13px;
  color: #5a6e92;
  line-height: 1.3;
}

/* Potential Disclosure Relevance — column 4 */
.uix-disclosure-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--uix-s-3);
}
.uix-disclosure-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--uix-s-3);
  font-size: 13px;
  line-height: 1.4;
}
.uix-disclosure-check {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--uix-rank-low);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
@media (max-width: 1200px) {
  .uix-ra-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .uix-ra-grid { grid-template-columns: 1fr; }
}

/* ── Collapsible card (Activities accordion) ─────────────────────── */
.uix-collapsible {
  background: var(--uix-surface);
  border: 1px solid var(--uix-border);
  border-radius: var(--uix-r-md);
  margin-bottom: var(--uix-s-3);
  overflow: hidden;
}
.uix-collapsible-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--uix-s-3);
  padding: var(--uix-s-4) var(--uix-s-5);
  background: var(--uix-surface);
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  color: var(--uix-text);
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.uix-collapsible-head:hover { background: var(--uix-bg); }
.uix-collapsible-head.is-open { background: var(--uix-blue-50); color: var(--uix-blue); }
.uix-collapsible-head::after {
  content: '›';
  font-size: 20px;
  line-height: 1;
  color: var(--uix-muted);
  transition: transform .12s, color .12s;
}
.uix-collapsible-head.is-open::after { transform: rotate(90deg); color: var(--uix-blue); }
.uix-collapsible-body {
  padding: var(--uix-s-5);
  border-top: 1px solid var(--uix-border);
}

/* ── Edit page — field complete/incomplete states ────────────────── */
.uix-table tbody tr.field-incomplete {
  background: #fff8e6;
  box-shadow: inset 3px 0 0 #d97706;
}
.uix-table tbody tr.field-incomplete td:first-child::before {
  content: '\25CF'; color: #d97706; margin-right: 8px; font-size: 0.8em;
}
.uix-table tbody tr.field-complete td:first-child::before {
  content: '\2713'; color: var(--uix-rank-low); margin-right: 8px; font-size: 0.9em;
}
.uix-table tbody tr.field-incomplete input,
.uix-table tbody tr.field-incomplete select {
  border-color: #d97706;
  background: #fffef5;
}

/* Contributions Report — summary band (3 KPI tiles) */
.uix-contrib-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-bottom: var(--uix-s-4);
  padding: 0;
  overflow: hidden;
}
.uix-contrib-sum-item {
  display: flex;
  align-items: flex-start;
  gap: var(--uix-s-4);
  padding: var(--uix-s-5);
  border-right: 1px solid var(--uix-border);
}
.uix-contrib-sum-item:last-child { border-right: none; }
.uix-contrib-sum-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: var(--uix-r-md);
  display: flex; align-items: center; justify-content: center;
}
.uix-contrib-sum-icon.is-green  { background: var(--uix-rank-low-bg); color: var(--uix-rank-low); }
.uix-contrib-sum-icon.is-teal   { background: rgba(14,116,144,0.12); color: #0e7490; }
.uix-contrib-sum-icon.is-purple { background: rgba(109,40,217,0.12); color: #6d28d9; }
.uix-contrib-sum-value {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.uix-contrib-sum-value small { font-size: 14px; font-weight: 600; color: var(--uix-muted); }
.uix-contrib-sum-value.is-green  { color: #1f8f4e; }
.uix-contrib-sum-value.is-teal   { color: #0e7490; }
.uix-contrib-sum-value.is-purple { color: #6d28d9; }
/* Small parenthetical sub-line inside a table cell (e.g. band under the index) */
.uix-cell-sub { font-size: 11px; font-weight: 500; color: var(--uix-muted); margin-top: 1px; }
/* Info icon inside a table heading — native title tooltip on hover */
.uix-th-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  vertical-align: middle;
  cursor: help;
  opacity: 0.65;
}
.uix-th-info:hover { opacity: 1; }

/* Reusable info icon (uix_info_icon) → opens the shared #uix-info-modal.
   A <button>, so the table row/expand handlers (which skip `button`) ignore it. */
.uix-info-icon-wrap { display: inline-flex; vertical-align: middle; }
.uix-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
  color: var(--uix-muted);
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}
.uix-info-icon:hover,
.uix-info-icon:focus-visible { opacity: 1; color: var(--uix-blue); }
/* On the dark hero, tint the info icon light so it stays legible. */
.uix-hero .uix-info-icon { color: rgba(255, 255, 255, 0.8); }
.uix-hero .uix-info-icon:hover,
.uix-hero .uix-info-icon:focus-visible { color: #fff; }
/* Pill variant — a small labelled trigger (e.g. "Drivers", "Mitigations") */
.uix-info-icon.is-pill {
  width: auto; height: auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Body blocks inside the shared info modal (uix_info_sections) */
.uix-info-section { margin-bottom: var(--uix-s-4); }
.uix-info-section:last-child { margin-bottom: 0; }
.uix-info-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--uix-muted); margin-bottom: 4px;
}
.uix-info-section p { margin: 0; color: var(--uix-text); line-height: 1.6; }
/* Definitions written in the admin's rich-text editor: tame the markup it
   emits (nested divs, its own spacing) so a pasted definition still reads
   like the rest of the modal. */
.uix-info-rich { color: var(--uix-text); line-height: 1.6; }
.uix-info-rich p { margin: 0 0 var(--uix-s-2); }
.uix-info-rich p:last-child { margin-bottom: 0; }
.uix-info-rich ul, .uix-info-rich ol { margin: var(--uix-s-2) 0; padding-left: 20px; }
.uix-info-rich li { margin-bottom: 2px; }
.uix-info-rich div:empty { display: none; }
.uix-info-rich code {
  background: var(--uix-bg); padding: 1px 4px; border-radius: 3px; font-size: 12.5px;
}
.uix-info-rich table { width: 100%; border-collapse: collapse; margin: var(--uix-s-2) 0; }
.uix-info-rich td, .uix-info-rich th {
  border: 1px solid var(--uix-border); padding: 4px 8px; text-align: left;
}
.uix-info-section p + .uix-info-section-label { margin-top: var(--uix-s-3); }

/* Driver / mitigation list inside the info modal */
.uix-info-list { list-style: none; margin: 0; padding: 0; }
.uix-info-list > li {
  padding: var(--uix-s-2) 0;
  border-bottom: 1px solid var(--uix-border);
}
.uix-info-list > li:last-child { border-bottom: none; }
.uix-info-list .uix-info-item-name { font-weight: 600; color: var(--uix-text); }
.uix-info-list .uix-info-item-val  { color: var(--uix-blue); font-weight: 600; }
.uix-info-list .uix-info-item-note { display: block; font-size: 12px; color: var(--uix-muted); margin-top: 2px; }
/* Calibration-only content: hidden unless calibration mode is active */
.uix-cal-only { display: none; }
body.uix-calibration .uix-cal-only { display: block; }
/* Calibration-only table column (th/td) — table-cell-safe so it doesn't break
   the table layout. Used to reveal the raw (unweighted) score columns. */
.uix-cal-col { display: none; }
body.uix-calibration .uix-cal-col { display: table-cell; }
/* Calibration-only inline text (e.g. a "(Weighted)" note on a header). */
.uix-cal-inline { display: none; }
body.uix-calibration .uix-cal-inline { display: inline; }
/* Inverse of .uix-cal-col — a table column shown to normal users and hidden in
   calibration mode (e.g. rank pills that the numeric score columns replace). */
.uix-noncal-col { display: table-cell; }
body.uix-calibration .uix-noncal-col { display: none; }
/* Compact "how this was calculated" working under a summary index figure */
.uix-contrib-sum-cal {
  margin-top: var(--uix-s-2);
  padding: var(--uix-s-2) var(--uix-s-3);
  font-size: 11.5px;
  line-height: 1.65;
  max-width: 320px;
}
.uix-contrib-sum-cal .uix-cal-eyebrow {
  font-family: var(--uix-font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--uix-muted);
  margin-bottom: 3px;
}
.uix-contrib-sum-cal .uix-cal-result { font-weight: 700; }
/* Small secondary line under a summary value (e.g. the numeric index below its band) */
.uix-contrib-sum-sub {
  margin-top: 3px;
  font-size: 13px;
  font-weight: 600;
  color: var(--uix-muted);
  font-variant-numeric: tabular-nums;
}
.uix-contrib-sum-desc {
  margin: var(--uix-s-2) 0 0;
  font-size: 12px;
  color: var(--uix-muted);
  line-height: 1.45;
  max-width: 320px;
}
@media (max-width: 900px) {
  .uix-contrib-summary { grid-template-columns: 1fr; }
  .uix-contrib-sum-item { border-right: none; border-bottom: 1px solid var(--uix-border); }
  .uix-contrib-sum-item:last-child { border-bottom: none; }
}

/* Contributions Report table — dense, tabular-numeric, sticky-friendly */
.uix-contrib-report-table { font-size: 13px; }
.uix-contrib-report-table th, .uix-contrib-report-table td {
  padding: 8px 10px;
  vertical-align: top;
}
.uix-contrib-report-table td { font-variant-numeric: tabular-nums; }
.uix-contrib-report-table tfoot tr.is-total td {
  background: var(--uix-bg);
  border-top: 2px solid var(--uix-border-strong);
  font-size: 14px;
  padding: 10px;
}
/* Clickable A-ref cell — jumps to the map */
.uix-area-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--uix-blue);
  text-decoration: none;
}
.uix-area-jump:hover { text-decoration: underline; }
.uix-area-jump strong { color: inherit; }

/* Leaflet hides its attribution badge to match the legacy view */
.leaflet-control-attribution { display: none !important; }

/* Spinner used during loading states */
.uix-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--uix-border);
  border-top-color: var(--uix-blue);
  border-radius: 50%;
  margin: 0 auto;
  animation: uix-spin 0.8s linear infinite;
}
@keyframes uix-spin { to { transform: rotate(360deg); } }

/* Responsive — best-effort */
@media (max-width: 960px) {
  .uix-layout { flex-direction: column; padding: var(--uix-s-4); }
  .uix-filters { width: 100%; }
  .uix-hero { grid-template-columns: 1fr; }
  .uix-hero-kpis { flex-wrap: wrap; }
  .uix-grid-1-2, .uix-grid-2-1, .uix-grid-3, .uix-grid-2 { grid-template-columns: 1fr; }
  .uix-improvement { grid-template-columns: 1fr; }
  #uix-contrib-wrapper { flex-direction: column; height: auto; }
  #uix-contrib-map { height: 380px; flex: 0 0 380px; }
  #uix-contrib-panel { flex: 1; border-left: none; border-top: 1px solid var(--uix-border); }
}

/* ── Conditional questions ───────────────────────────────────────────────
   Site Information questions hidden by an admin-configured visibility rule
   (activity_impact_driver_conditions). Needs !important so it beats the
   table's own row display rules when toggled live. */
.uix-cond-hidden { display: none !important; }

/* ── Getting Started (dashboard) ─────────────────────────────────────────
   Teaches the reporting process on the page users land on. Collapsible so it
   stops competing for attention once someone knows the way around. */
.uix-gs { margin-bottom: var(--uix-s-4); }
.uix-gs-head {
  display: flex; align-items: flex-start; gap: var(--uix-s-4);
}
.uix-gs-head > div:first-child { flex: 1; }
.uix-gs-intro {
  margin: 6px 0 0; color: var(--uix-muted); font-size: 13px; max-width: 70ch;
}
.uix-gs-steps {
  list-style: none; margin: var(--uix-s-4) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--uix-s-4);
}
.uix-gs-step { display: flex; gap: var(--uix-s-3); align-items: flex-start; }
.uix-gs-step strong { display: block; font-size: 13px; line-height: 1.35; }
.uix-gs-step p {
  margin: 4px 0 0; font-size: 12px; line-height: 1.55; color: var(--uix-muted);
}
.uix-gs-num {
  flex: 0 0 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--uix-blue, #1d4ed8); color: #fff;
  font-size: 12px; font-weight: 700;
}
.uix-gs.is-collapsed .uix-gs-steps,
.uix-gs.is-collapsed .uix-gs-intro { display: none; }
@media (max-width: 1100px) {
  .uix-gs-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .uix-gs-steps { grid-template-columns: 1fr; }
}

/* Per-report progress in the dashboard report list. */
.uix-report-progress { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.uix-report-next { color: var(--uix-muted); }
.uix-report-next a { color: var(--uix-blue, #1d4ed8); text-decoration: none; }
.uix-report-next a:hover { text-decoration: underline; }

/* ── Page intro ──────────────────────────────────────────────────────────
   A short "what am I looking at" banner under each page's hero. Dismissible;
   once hidden it collapses to the small "About this page" button so the
   explanation is always one click away. */
.uix-intro { margin-bottom: var(--uix-s-4); }
.uix-intro .uix-intro-full { display: flex; align-items: flex-start; }
.uix-intro .uix-intro-full .uix-banner-body { flex: 1; }
.uix-intro .uix-intro-hide { flex: 0 0 auto; margin-left: var(--uix-s-3); }
.uix-intro .uix-intro-show { display: none; }
.uix-intro.is-hidden .uix-intro-full { display: none; }
.uix-intro.is-hidden .uix-intro-show { display: inline-flex; }

/* ── Empty states ────────────────────────────────────────────────────────
   An empty table is a teaching moment, not an error. Centred, muted, with the
   next action offered where there is one. */
.uix-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--uix-s-3);
  padding: var(--uix-s-7) var(--uix-s-5); text-align: center;
}
.uix-empty-icon { color: var(--uix-muted); line-height: 0; }
.uix-empty-body {
  margin: 0; color: var(--uix-muted); font-size: 13px; line-height: 1.6; max-width: 60ch;
}

/* ── View toggles row ────────────────────────────────────────────────────
   "Hide filters" and "Hide summary" share a row so they read as a matched
   pair: same button styling, aligned on the same baseline, one at each end. */
.uix-view-toggles {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--uix-s-3);
  margin-bottom: var(--uix-s-3);
}

/* Brief highlight on the section a save returned the user to. */
.uix-section-flash {
  animation: uix-section-flash 1.8s ease-out 1;
}
@keyframes uix-section-flash {
  0%   { box-shadow: 0 0 0 3px var(--uix-blue, #1d4ed8); }
  100% { box-shadow: 0 0 0 3px rgba(29, 78, 216, 0); }
}

/* ── GIS driver map ──────────────────────────────────────────────────────
   Opens over Edit Site Information rather than navigating away. Everything
   drawn is read from the stored GIS result — no intersect at view time. */
.uix-gis-map-modal .uix-modal-dialog {
  max-width: 1080px;
  width: 94vw;
}
/* Full screen: the map is the point of this modal, so let it have the lot. */
.uix-gis-map-modal.is-fullscreen .uix-modal-dialog {
  max-width: none;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
}
.uix-gis-map-modal.is-fullscreen .uix-gis-map-body { flex: 1; min-height: 0; }
.uix-gis-map-modal.is-fullscreen .uix-gis-map-canvas { min-height: 0; }
.uix-gis-map-modal.is-fullscreen .uix-gis-map-side { max-height: none; flex-basis: 380px; }

.uix-gis-map-actions { display: flex; align-items: center; gap: 4px; }
.uix-gis-map-expand {
  background: none; border: none; cursor: pointer;
  font-size: 17px; line-height: 1; padding: 2px 6px;
  color: var(--uix-muted);
}
.uix-gis-map-expand:hover { color: var(--uix-text); }
.uix-gis-map-expand[aria-pressed="true"] { color: var(--uix-blue, #1d4ed8); }
.uix-gis-map-body {
  display: flex;
  gap: 0;
  padding: 0;
  min-height: 460px;
}
.uix-gis-map-canvas {
  flex: 1 1 62%;
  min-height: 460px;
  background: var(--uix-bg);
}
.uix-gis-map-side {
  flex: 0 0 38%;
  padding: var(--uix-s-4);
  border-left: 1px solid var(--uix-border);
  overflow-y: auto;
  max-height: 560px;
  font-size: 13px;
}
.uix-gis-figs { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; }
.uix-gis-figs dt { color: var(--uix-muted); }
.uix-gis-figs dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.uix-gis-breakdown { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.uix-gis-breakdown td {
  padding: 5px 0; border-bottom: 1px solid var(--uix-border); vertical-align: top;
}
.uix-gis-breakdown td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.uix-gis-map-foot { justify-content: flex-start; font-size: 12px; }

/* The layers prepared for this site, to switch on and off over the map. */
.uix-gis-layers { display: flex; flex-direction: column; gap: 4px; }
.uix-gis-layer {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 6px; border-radius: var(--uix-r-sm, 4px); cursor: pointer;
}
.uix-gis-layer:hover { background: var(--uix-bg); }
.uix-gis-layer input { margin: 0; flex: none; }
.uix-gis-layer input:disabled { cursor: progress; }
.uix-gis-swatch {
  width: 12px; height: 12px; flex: none;
  display: inline-block; vertical-align: middle;   /* also used in headings */
  border-radius: 3px; border: 1px solid rgba(0,0,0,.25);
}
/* Which attribute a layer is coloured by, and what those colours mean. */
.uix-gis-colourby {
  display: flex; align-items: center; gap: 6px;
  margin: 12px 0 0; color: var(--uix-muted); font-size: 12px;
}
.uix-gis-colourby select {
  flex: 1 1 auto; min-width: 0;
  padding: 3px 6px; font: inherit; color: var(--uix-text);
  border: 1px solid var(--uix-border); border-radius: var(--uix-r-sm, 4px);
  background: var(--uix-surface, #fff);
}
.uix-gis-measured { margin: 6px 0 0; font-size: 11.5px; color: var(--uix-muted); }
.uix-gis-breakdown td .uix-gis-swatch { margin-right: 6px; }

/* A value in the breakdown, ticked on or off the map. The whole row label is
   the hit area — these are small targets and there are often a dozen of them. */
.uix-gis-cat {
  display: flex; align-items: center; gap: 7px;
  cursor: pointer; line-height: 1.35;
}
.uix-gis-cat input { margin: 0; flex: none; }
.uix-gis-cat .uix-gis-swatch { margin: 0; }
.uix-gis-breakdown thead td {
  font-weight: 600;
  border-bottom-color: var(--uix-text, #111);
}
/* Unticking a value should read as "not on the map", not as struck out. */
.uix-gis-cat input:not(:checked) ~ span { color: var(--uix-muted); }
.uix-gis-cat input:not(:checked) ~ .uix-gis-swatch { opacity: .35; }
.uix-gis-pop-cat { margin: 2px 0 6px; font-weight: 600; }

.uix-gis-layer-info { border-top: 1px solid var(--uix-border); margin-top: 8px; }
.uix-gis-layer-q + .uix-gis-layer-q { margin-top: 14px; }
.uix-gis-layer-qname { font-weight: 600; margin: 0 0 6px; }


/* The icon that opens it, beside a GIS-backed question. */
.uix-gis-map-btn {
  background: none; border: none; cursor: pointer;
  color: var(--uix-blue, #1d4ed8);
  padding: 0 2px; margin-left: 6px; line-height: 1;
}
.uix-gis-map-btn:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .uix-gis-map-body { flex-direction: column; min-height: 0; }
  .uix-gis-map-canvas { flex: none; height: 320px; min-height: 320px; }
  .uix-gis-map-side { flex: none; border-left: none; border-top: 1px solid var(--uix-border); max-height: none; }
}
