/* Opportunity Intelligence Portal — v4 Monochromatic Green Design System (M1 Production)
   White + Deep Green tonal hierarchy + Terminal Red ONLY (WCAG 2.2 AA validated).
   Full CSS logical properties for seamless Arabic RTL and English LTR mirroring. */

:root {
  color-scheme: light;
  --bg-canvas: #F5F9F6;
  --bg-surface: #FFFFFF;
  --bg-elevated: #EDF5EF;
  --bg-subtle: #E6EFE8;
  --bg-neutral-pill: #EFF4F0;
  --bg-sidebar: #14532D;
  --bg-sidebar-hover: #196136;
  --bg-sidebar-active: #1E6B3E;
  --sidebar-divider: #24683E;
  --sidebar-text: #E6F3EA;
  --sidebar-muted: #A1BBA8;
  --sidebar-indicator: #86EFAC;

  --border-subtle: #DCE8DF;
  --border-strong: #BBD4C2;
  --border-accent: #C3DFCB;
  --accent-primary: #14532D;
  --accent-primary-hover: #166534;
  --accent-interactive: #228B50;
  --accent-on-primary: #FFFFFF;

  --text-primary: #172B24;
  --text-muted: #4E6857;
  --text-inverse: #FFFFFF;

  /* Terminal Negative Red ONLY */
  --red-fg: #B91C1C;
  --red-bg: #FEF2F2;
  --red-bd: #FECACA;

  /* Charts & Map */
  --chart-1: #14532D;
  --chart-2: #228B50;
  --chart-3: #4E8C65;
  --chart-4: #86A891;
  --chart-grid: #DCE8DF;

  --map-bg: #ECF3EE;
  --map-ring-primary: #14532D;
  --map-ring-alt: #228B50;
  --login-grad: linear-gradient(155deg, #14532D 0%, #0D3A20 62%, #0B1710 100%);
  --shadow-float: 0 6px 20px -4px rgba(11, 23, 16, 0.12);

  /* Typography */
  --font-ar: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  --font-en: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, monospace;

  --fs-page: clamp(1.125rem, 1.35vw, 1.25rem);
  --fs-section: clamp(0.9375rem, 1.05vw, 1rem);
  --fs-kpi: clamp(1.375rem, 1.8vw, 1.6rem);
  --fs-body: clamp(0.8125rem, 0.9vw, 0.875rem);
  --fs-table: clamp(0.75rem, 0.85vw, 0.8125rem);
  --fs-label: 0.75rem;

  /* Radii & Spacing */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 10px;
  --r-pill: 9999px;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #0B1710;
  --bg-surface: #12231A;
  --bg-elevated: #1B3525;
  --bg-subtle: #183022;
  --bg-neutral-pill: #16261D;
  --bg-sidebar: #0F2418;
  --bg-sidebar-hover: #163122;
  --bg-sidebar-active: #1B3525;
  --sidebar-divider: #294333;
  --sidebar-text: #E6F3EA;
  --sidebar-muted: #A1BBA8;
  --sidebar-indicator: #42B875;

  --border-subtle: #294333;
  --border-strong: #375A45;
  --border-accent: #2D5A3F;
  --accent-primary: #42B875;
  --accent-primary-hover: #52C984;
  --accent-interactive: #42B875;
  --accent-on-primary: #0B1710;

  --text-primary: #E6F3EA;
  --text-muted: #A1BBA8;
  --text-inverse: #0B1710;

  --red-fg: #F87171;
  --red-bg: #2A1517;
  --red-bd: #7F1D1D;

  --chart-1: #42B875;
  --chart-2: #2E8B57;
  --chart-3: #86EFAC;
  --chart-4: #6E917A;
  --chart-grid: #294333;

  --map-bg: #0E1D14;
  --map-ring-primary: #42B875;
  --map-ring-alt: #86EFAC;
  --login-grad: linear-gradient(155deg, #143D24 0%, #0E2919 55%, #08120C 100%);
  --shadow-float: 0 10px 28px -6px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }

/* Sleek custom scrollbars across desktop and dropdown menus */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 7px; height: 7px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--accent-interactive);
  background-clip: content-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

html[lang="ar"] body { font-family: var(--font-ar); }
html[lang="en"] body { font-family: var(--font-en); }

button, input, select, textarea { font: inherit; color: inherit; }
a {
  color: var(--accent-interactive); text-decoration: none;
  transition: color 0.14s ease, background-color 0.14s ease, border-color 0.14s ease;
}
a:hover, a:focus, a:active { text-decoration: none; }
a:hover { color: var(--accent-primary); }
[data-theme="dark"] a:hover { color: #6EE7B7; }

:focus-visible {
  outline: 3px solid var(--accent-interactive);
  outline-offset: 2px;
}
.sidebar :focus-visible, .m-header :focus-visible { outline-color: #FFFFFF; }

.skip-link {
  position: absolute; inset-block-start: -48px; inset-inline-start: 12px; z-index: 100;
  background: var(--accent-primary); color: var(--accent-on-primary);
  padding: 8px 14px; border-radius: var(--r-sm); font-size: var(--fs-label); font-weight: 600;
}
.skip-link:focus { inset-block-start: 12px; }

.sr-only {
  position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.nowrap { white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.clamp-2 {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; overflow-wrap: anywhere;
}

/* =========================================================================
   App Shell (Desktop Sidebar + Sticky Topbar / Mobile Header + Bottom Nav)
   ========================================================================= */
.v4-shell { display: flex; min-block-size: 100vh; }

.sidebar {
  flex: 0 0 240px; inline-size: 240px;
  background: var(--bg-sidebar); color: var(--sidebar-text);
  border-inline-end: 1px solid var(--sidebar-divider);
  display: flex; flex-direction: column;
  position: sticky; inset-block-start: 0; block-size: 100vh;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 16px; border-block-end: 1px solid var(--sidebar-divider);
}
.sb-emblem {
  inline-size: 36px; block-size: 36px; flex: 0 0 auto; color: var(--sidebar-indicator);
  display: grid; place-items: center;
}
.sb-nav-ico {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  opacity: 0.92;
}
.sb-brand-name { font-size: 1rem; font-weight: 700; color: #FFFFFF; line-height: 1.25; }
.sb-brand-sub { font-size: 0.72rem; color: var(--sidebar-muted); line-height: 1.25; letter-spacing: 0.01em; }

.sb-nav { padding: 12px 10px; display: grid; gap: 4px; flex: 1; align-content: start; }
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; min-block-size: 40px; border-radius: var(--r-sm);
  color: var(--sidebar-text); font-size: 0.85rem; font-weight: 500;
  white-space: nowrap; position: relative; text-decoration: none;
  transition: background 0.12s;
}
.sb-link:hover { background: var(--bg-sidebar-hover); text-decoration: none; color: #FFFFFF; }
.sb-link[aria-current="page"] {
  background: var(--bg-sidebar-active); color: #FFFFFF; font-weight: 600;
}
[data-theme="dark"] .sb-link[aria-current="page"] { color: var(--sidebar-indicator); }
.sb-link[aria-current="page"]::before {
  content: ""; position: absolute; inset-inline-start: 0; inset-block: 6px;
  inline-size: 3px; border-radius: 2px; background: var(--sidebar-indicator);
}

.sb-foot {
  padding: 12px 14px; border-block-start: 1px solid var(--sidebar-divider);
  display: grid; gap: 8px;
}
.sb-user { display: flex; align-items: center; gap: 9px; min-inline-size: 0; }
.sb-avatar {
  inline-size: 30px; block-size: 30px; flex: 0 0 auto; border-radius: 50%;
  background: var(--bg-sidebar-active); color: #FFFFFF;
  display: grid; place-items: center; font-size: 0.76rem; font-weight: 700;
  border: 1px solid var(--sidebar-divider);
}
.sb-user-meta { min-inline-size: 0; }
.sb-user-name {
  font-size: 0.8rem; font-weight: 600; color: #FFFFFF;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-user-role { font-size: 0.72rem; color: var(--sidebar-muted); white-space: nowrap; }
.sb-signout-form { margin: 0; }
.sb-signout {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent;
  color: var(--sidebar-muted); font-size: 0.78rem; padding: 6px 2px; cursor: pointer;
}
.sb-signout:hover { color: #FFFFFF; }

.workspace { flex: 1; min-inline-size: 0; display: flex; flex-direction: column; }

.topbar {
  min-block-size: 56px; background: var(--bg-surface);
  border-block-end: 1px solid var(--border-subtle);
  padding: 8px 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  position: sticky; inset-block-start: 0; z-index: 40;
}
.tb-start, .tb-end { display: flex; align-items: center; gap: 8px; min-inline-size: 0; }
.page-h1 {
  margin: 0; font-size: var(--fs-page); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meta-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  font-size: 0.75rem; color: var(--text-muted); white-space: nowrap;
}
.meta-pill-current { color: var(--accent-primary); border-color: var(--border-accent); font-weight: 600; }
[data-theme="dark"] .meta-pill-current { color: var(--accent-interactive); }
.meta-pill-stale { border-style: dashed; border-color: var(--accent-interactive); color: var(--text-primary); }

.v4-main {
  padding: 20px 24px 36px; display: grid; gap: 16px;
  max-inline-size: 1380px; inline-size: 100%; margin-inline: auto; align-content: start;
}
.v4-foot {
  margin-block-start: auto; padding: 12px 24px;
  border-block-start: 1px solid var(--border-subtle);
  font-size: 0.75rem; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between;
}

/* Mobile Header & Fixed Bottom Nav (Hidden on Desktop) */
.m-header, .m-bottom-nav { display: none; }

/* =========================================================================
   Buttons, Controls, Badges & Notices
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 12px; min-block-size: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle); background: var(--bg-surface);
  color: var(--text-primary); font-size: var(--fs-label); font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background 0.14s, border-color 0.14s;
}
.btn:hover { background: var(--bg-elevated); border-color: var(--border-strong); text-decoration: none; }
.btn-primary {
  background: var(--accent-primary); border-color: var(--accent-primary);
  color: var(--accent-on-primary); font-weight: 600;
}
.btn-primary:hover { background: var(--accent-primary-hover); border-color: var(--accent-primary-hover); color: var(--accent-on-primary); }
.btn-sm { min-block-size: 32px; padding: 0 10px; font-size: 0.75rem; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-pill);
  font-size: 0.75rem; font-weight: 600; line-height: 1.45;
  white-space: nowrap; border: 1px solid transparent;
}
.badge-primary {
  background: var(--bg-elevated); color: var(--accent-primary);
  border-color: var(--border-accent);
}
[data-theme="dark"] .badge-primary { color: #42B875; }
.badge-alternative {
  background: var(--bg-surface); color: var(--text-primary);
  border-color: var(--accent-interactive);
}
.badge-verify {
  background: var(--bg-subtle); color: var(--text-primary);
  border: 1px dashed var(--accent-interactive);
}
.badge-excluded {
  background: var(--red-bg); color: var(--red-fg); border-color: var(--red-bd);
}
.badge-neutral {
  background: var(--bg-neutral-pill); color: var(--text-muted); border-color: var(--border-subtle);
}

.notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  font-size: var(--fs-table); color: var(--text-primary);
}
.notice-dashed { border-style: dashed; border-color: var(--accent-interactive); }
.notice-error { background: var(--red-bg); border-color: var(--red-bd); color: var(--red-fg); }

/* =========================================================================
   Cards, Provenance Strip, KPI Grids & Charts
   ========================================================================= */
.card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: var(--sp-4); min-inline-size: 0;
}
.card-flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-block-end: var(--sp-3); flex-wrap: wrap;
}
.card-title { margin: 0; font-size: var(--fs-section); font-weight: 600; color: var(--text-primary); }
.card-sub { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-muted); }

.provenance-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 20px; padding: 12px 16px;
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
}
.prov-items { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0; }
.prov-items > div { display: grid; gap: 2px; }
.prov-items dt { font-size: 0.75rem; color: var(--text-muted); }
.prov-items dd { margin: 0; font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  padding: 14px 16px; display: grid; gap: 6px; text-decoration: none; color: inherit;
  transition: border-color 0.14s, background 0.14s;
}
.kpi-card:hover { border-color: var(--accent-interactive); background: var(--bg-elevated); text-decoration: none; }
.kpi-card-verify { border-style: dashed; }
.kpi-card-red { border-color: var(--red-bd); }
.kpi-card-red .kpi-val { color: var(--red-fg); }
.kpi-card-static { cursor: default; }
.kpi-card-static:hover { border-color: var(--red-bd); background: var(--bg-surface); }
.kpi-label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-val { font-size: var(--fs-kpi); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-hint { font-size: 0.75rem; color: var(--text-muted); }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-map { display: grid; grid-template-columns: minmax(0, 13fr) minmax(0, 7fr); gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; align-content: start; }

/* Horizontal Bars (Funnel & Municipality Breakdown) */
.bar-list { display: grid; gap: 10px; }
.bar-row {
  display: grid; gap: 5px; padding: 6px 8px; margin-inline: -8px;
  border-radius: var(--r-sm); text-decoration: none; color: inherit;
  transition: background 0.12s;
}
.bar-row:hover { background: var(--bg-elevated); text-decoration: none; }
.bar-row-static { cursor: default; }
.bar-row-static:hover { background: transparent; }
.bar-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-table); }
.bar-track { block-size: 8px; border-radius: 4px; background: var(--bg-elevated); overflow: hidden; }
.bar-fill { block-size: 100%; border-radius: 4px; background: var(--chart-1); }
.bar-fill-alt { background: var(--chart-2); }
.bar-fill-dashed {
  background: repeating-linear-gradient(-45deg, var(--chart-4), var(--chart-4) 5px, transparent 5px, transparent 8px);
  border: 1px solid var(--chart-3);
}
.bar-fill-red { background: var(--red-fg); }

/* =========================================================================
   Filters, Outcome Pills, Data Table & Mobile Opportunity Cards
   ========================================================================= */
.pill-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; min-block-size: 32px; border-radius: var(--r-pill);
  border: 1px solid var(--border-subtle); background: var(--bg-surface);
  color: var(--text-muted); font-size: 0.75rem; font-weight: 500;
  white-space: nowrap; text-decoration: none;
}
.filter-pill:hover { background: var(--bg-elevated); color: var(--text-primary); text-decoration: none; }
.filter-pill.active {
  background: var(--accent-primary); border-color: var(--accent-primary);
  color: var(--accent-on-primary); font-weight: 600;
}
.filter-pill-red { border-color: var(--red-bd); color: var(--red-fg); background: var(--red-bg); }
.filter-pill-red.active { background: var(--red-fg); border-color: var(--red-fg); color: #FFFFFF; }

.filter-form {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px;
}
.field { display: grid; gap: 4px; min-inline-size: 0; }
.field label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.input, .select {
  block-size: 40px; padding: 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-subtle); background-color: var(--bg-surface);
  color: var(--text-primary); font-size: var(--fs-table); min-inline-size: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  cursor: pointer; font-weight: 500;
  padding-inline-start: 13px; padding-inline-end: 36px;
  box-shadow: 0 1px 2px rgba(11, 23, 16, 0.04);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%234E6857' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 16px 16px;
  background-position: right 11px center;
}
[dir="rtl"] .select { background-position: left 11px center; }
[data-theme="dark"] .input, [data-theme="dark"] .select { background-color: var(--bg-canvas); }
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A1BBA8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.select:hover { border-color: var(--border-strong); background-color: var(--bg-elevated); }
.input:hover { border-color: var(--border-strong); }
.input:focus, .select:focus {
  border-color: var(--accent-interactive);
  box-shadow: 0 0 0 3px rgba(34, 139, 80, 0.16);
  outline: none;
}
[data-theme="dark"] .input:focus, [data-theme="dark"] .select:focus {
  box-shadow: 0 0 0 3px rgba(66, 184, 117, 0.22);
}
.select option, .select optgroup {
  background-color: var(--bg-surface); color: var(--text-primary); font-weight: 500;
}
.select::picker-icon { display: none; }

/* Custom Progressive-Enhancement Dropdown Component (.oi-select) */
.oi-select { position: relative; min-inline-size: 160px; }
.oi-select-native {
  position: absolute !important; inline-size: 1px !important; block-size: 1px !important;
  opacity: 0 !important; pointer-events: none !important; overflow: hidden !important;
}
.oi-select-trigger {
  inline-size: 100%; block-size: 40px; padding-inline: 13px 11px;
  border-radius: var(--r-md); border: 1px solid var(--border-subtle);
  background: var(--bg-surface); color: var(--text-primary);
  font-size: var(--fs-table); font-weight: 500;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer; text-align: start;
  box-shadow: 0 1px 2px rgba(11, 23, 16, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
[data-theme="dark"] .oi-select-trigger {
  background: var(--bg-canvas); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.oi-select-trigger:hover {
  border-color: var(--border-strong); background: var(--bg-elevated);
}
.oi-select.open .oi-select-trigger,
.oi-select-trigger:focus-visible {
  border-color: var(--accent-interactive);
  box-shadow: 0 0 0 3px rgba(34, 139, 80, 0.16);
  outline: none;
}
[data-theme="dark"] .oi-select.open .oi-select-trigger,
[data-theme="dark"] .oi-select-trigger:focus-visible {
  box-shadow: 0 0 0 3px rgba(66, 184, 117, 0.22);
}
.oi-select-label {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-inline-size: 0;
}
.oi-select-chev {
  flex: 0 0 auto; color: var(--text-muted);
  transition: transform 0.18s ease, color 0.15s ease;
}
.oi-select.open { z-index: 900; }
.oi-select.open .oi-select-chev { transform: rotate(180deg); color: var(--accent-interactive); }
@keyframes oiMenuDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.oi-select-menu {
  position: absolute; inset-block-start: calc(100% + 6px); inset-inline-start: 0;
  min-inline-size: max(100%, 240px); max-inline-size: 340px;
  overflow: hidden;
  z-index: 950;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(11, 23, 16, 0.2), 0 4px 12px -4px rgba(11, 23, 16, 0.08);
  display: flex; flex-direction: column;
  animation: oiMenuDrop 0.14s ease-out;
}
.oi-select-menu[hidden] { display: none; }
[data-theme="dark"] .oi-select-menu {
  box-shadow: 0 22px 44px -10px rgba(0, 0, 0, 0.6);
}
.oi-select-search-wrap {
  padding: 8px 8px 7px;
  border-block-end: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
}
.oi-select-search {
  inline-size: 100%; block-size: 34px; padding-inline: 10px;
  border-radius: var(--r-sm); border: 1px solid var(--border-subtle);
  background: var(--bg-surface); color: var(--text-primary);
  font-size: 0.78rem;
}
.oi-select-search:focus {
  outline: none; border-color: var(--accent-interactive);
  box-shadow: 0 0 0 2px rgba(34, 139, 80, 0.16);
}
.oi-select-list {
  max-block-size: 260px; overflow-y: auto; overflow-x: hidden;
  padding: 5px; display: grid; gap: 2px;
}
.oi-select-empty {
  padding: 14px 10px; text-align: center; font-size: 0.78rem; color: var(--text-muted);
}
.oi-select-empty[hidden] { display: none; }
.oi-select-group {
  position: sticky; inset-block-start: -5px; z-index: 1;
  padding: 6px 10px 4px; font-size: 0.69rem; font-weight: 700;
  color: var(--text-muted); letter-spacing: 0.02em;
  background: var(--bg-surface);
  border-block-start: 1px solid var(--border-subtle); margin-block-start: 4px;
}
.oi-select-group:first-child { border-block-start: 0; margin-block-start: 0; }
.oi-select-group[hidden] { display: none; }
.oi-select-opt {
  inline-size: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-primary);
  font-size: var(--fs-table); font-weight: 500; text-align: start;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; transition: background-color 0.12s ease, color 0.12s ease;
  min-inline-size: 0;
}
.oi-select-opt[hidden] { display: none; }
.oi-select-opt:hover { background: var(--bg-elevated); color: var(--accent-primary); }
[data-theme="dark"] .oi-select-opt:hover { color: #6EE7B7; }
.oi-select-opt.selected {
  background: var(--bg-elevated); color: var(--accent-primary); font-weight: 600;
}
[data-theme="dark"] .oi-select-opt.selected { color: var(--accent-interactive); }
.oi-select-opt-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-inline-size: 0; }
.oi-select-check {
  opacity: 0; color: var(--accent-interactive); font-weight: 700; font-size: 0.8rem; flex: 0 0 auto;
}
.oi-select-opt.selected .oi-select-check { opacity: 1; }

.table-wrap { overflow-x: auto; inline-size: 100%; }
table.data-table {
  inline-size: 100%; border-collapse: collapse; text-align: start; font-size: var(--fs-table);
}
table.data-table th {
  background: var(--bg-elevated); color: var(--text-muted); font-weight: 600;
  padding: 10px 12px; border-block-end: 1px solid var(--border-subtle);
  white-space: nowrap; text-align: start; font-size: 0.75rem;
}
table.data-table td {
  padding: 11px 12px; border-block-end: 1px solid var(--border-subtle);
  vertical-align: middle; text-align: start;
}
table.data-table tbody tr:last-child td { border-block-end: 0; }
table.data-table tbody tr:hover { background: var(--bg-elevated); }

.opp-id-link { color: var(--accent-interactive); font-weight: 700; white-space: nowrap; }
.mobile-cards { display: none; }

/* =========================================================================
   Screening Funnel Banner, Exclusion Breakdown & Executive Opportunity Cards
   ========================================================================= */
.funnel-banner {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 10px;
}
.funnel-banner-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px;
}
.funnel-stats {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
}
.funnel-stat { display: inline-flex; align-items: baseline; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.funnel-stat strong { font-size: 1.02rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.funnel-stat-red strong { color: var(--red-fg); }
.funnel-stat-green strong { color: var(--accent-primary); }
[data-theme="dark"] .funnel-stat-green strong { color: var(--accent-interactive); }
.funnel-note { font-size: 0.75rem; color: var(--text-muted); margin: 0; }

details.excl-details {
  border-block-start: 1px solid var(--border-subtle); padding-block-start: 10px;
}
details.excl-details summary {
  cursor: pointer; font-size: 0.78rem; font-weight: 600; color: var(--red-fg);
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
}
details.excl-details summary::-webkit-details-marker { display: none; }
details.excl-details summary::before { content: "\25B8"; font-size: 0.7rem; transition: transform 0.14s; }
details.excl-details[open] summary::before { transform: rotate(90deg); }
[dir="rtl"] details.excl-details summary::before { content: "\25C2"; }
[dir="rtl"] details.excl-details[open] summary::before { transform: rotate(-90deg); }
.excl-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 10px;
}
.excl-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--r-pill); background: var(--red-bg);
  border: 1px solid var(--red-bd); font-size: 0.74rem; color: var(--red-fg);
}
.excl-chip strong { font-variant-numeric: tabular-nums; font-weight: 700; }

/* View Switcher (Cards / Table) */
.dir-toolbar-top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.view-switch {
  display: inline-flex; align-items: center; padding: 2px; border-radius: var(--r-sm);
  background: var(--bg-elevated); border: 1px solid var(--border-subtle); gap: 2px;
}
.view-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; min-block-size: 30px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text-muted); font-size: 0.75rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.12s, color 0.12s;
}
.view-btn:hover { color: var(--text-primary); }
.view-btn.active {
  background: var(--accent-primary); color: var(--accent-on-primary);
}

/* Executive Opportunity Cards Grid */
.opp-exec-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 14px; padding: 16px;
}
.opp-exec-card {
  display: flex; flex-direction: column; gap: 12px; padding: 16px;
  border-radius: var(--r-md); border: 1px solid var(--border-subtle);
  border-inline-start: 4px solid var(--accent-interactive);
  background: var(--bg-surface);
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
}
.opp-exec-card:hover {
  border-color: var(--accent-interactive); box-shadow: var(--shadow-float);
}
.opp-exec-card[data-band="primary"] { border-inline-start-color: var(--accent-primary); }
.opp-exec-card[data-screening-state="excluded"] { border-inline-start-color: var(--red-fg); }
.opp-exec-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.opp-exec-title {
  margin: 0; font-size: 0.94rem; font-weight: 600; line-height: 1.45; color: var(--text-primary);
}
.opp-exec-title a { color: inherit; text-decoration: none; }
.opp-exec-title a:hover { color: var(--accent-interactive); text-decoration: none; }

/* Unified Command Bar & Overview Spotlight */
.command-bar {
  position: relative; z-index: 15;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: 14px 16px; display: grid; gap: 12px;
}
.command-bar-divider {
  border-block-start: 1px solid var(--border-subtle); padding-block-start: 12px;
}
.map-hero-bar {
  position: relative; z-index: 14;
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: 12px 14px; display: grid; gap: 10px;
}
.map-inspector-sticky { position: sticky; inset-block-start: 72px; }
.provenance-footer {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px 20px; opacity: 0.94;
}
.opp-exec-sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 0.76rem; color: var(--text-muted);
}
.doc-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.doc-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--bg-elevated); border: 1px solid var(--border-accent);
  color: var(--accent-primary); font-size: 0.73rem; font-weight: 600;
  text-decoration: none; white-space: nowrap; transition: background 0.12s;
}
[data-theme="dark"] .doc-chip { color: var(--accent-interactive); }
.doc-chip:hover { background: var(--accent-primary); color: var(--accent-on-primary); text-decoration: none; }

.opp-exec-reason {
  font-size: 0.75rem; color: var(--text-muted); margin: 0;
  padding-block-start: 2px;
}
.opp-exec-actions {
  margin-block-start: auto; padding-block-start: 10px;
  border-block-start: 1px solid var(--border-subtle);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}

[data-opp-directory][data-view="cards"] .desktop-table-wrap,
[data-opp-directory][data-view="map"] .desktop-table-wrap,
[data-opp-directory][data-view="table"] .opp-exec-grid,
[data-opp-directory][data-view="map"] .opp-exec-grid,
[data-opp-directory] [hidden],
[data-opp-directory][hidden],
[data-unified-map-section][hidden] { display: none !important; }
.unified-map-wrap { display: grid; gap: 14px; }
.grid-map { position: relative; z-index: 1; }

.pages-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; border-block-start: 1px solid var(--border-subtle);
  font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap;
}
.pages-nav { display: flex; align-items: center; gap: 8px; }

/* =========================================================================
   Opportunity Detail (Fact Grid, 5-Rule Matrix, Booklet Evidence)
   ========================================================================= */
.fact-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fact-box {
  padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--bg-canvas); border: 1px solid var(--border-subtle);
}
.fact-k { font-size: 0.75rem; color: var(--text-muted); margin-block-end: 3px; }
.fact-v { font-size: 0.86rem; font-weight: 600; color: var(--text-primary); overflow-wrap: anywhere; }

.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rule-card {
  padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--bg-canvas); border: 1px solid var(--border-subtle);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}
.rule-card-verify { border-style: dashed; border-color: var(--accent-interactive); }
.rule-card-fail { border-color: var(--red-bd); background: var(--red-bg); }
.rule-body { min-inline-size: 0; display: grid; gap: 3px; }
.rule-name { font-size: 0.82rem; font-weight: 600; }
.rule-obs { font-size: 0.76rem; color: var(--text-muted); overflow-wrap: anywhere; }

.quote-card {
  margin: 10px 0 0; padding: 12px 14px; border-radius: var(--r-sm);
  background: var(--bg-canvas); border: 1px solid var(--border-subtle);
  border-inline-start: 3px solid var(--accent-interactive);
  font-size: var(--fs-body);
}
.quote-card cite {
  display: block; margin-block-start: 6px; font-style: normal;
  font-size: 0.75rem; color: var(--text-muted);
}

/* =========================================================================
   Interactive Leaflet Map Workspace & In-Map Icon Controls
   ========================================================================= */
.map-stage { position: relative; z-index: 1; isolation: isolate; }
/* Keep controls opposite Leaflet's physical top-left zoom buttons in both LTR and RTL. */
.map-icon-controls {
  position: absolute; z-index: 450; top: 12px; right: 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.map-ico-btn {
  position: relative;
  inline-size: 36px; block-size: 36px; padding: 0; border-radius: var(--r-md);
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-float);
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}
.map-ico-btn:hover:not(:disabled) {
  background: var(--bg-elevated); color: var(--accent-primary);
  border-color: var(--accent-interactive);
}
[data-theme="dark"] .map-ico-btn:hover:not(:disabled) { color: #6EE7B7; }
.map-ico-btn:focus-visible {
  outline: 3px solid var(--accent-interactive); outline-offset: 2px;
  border-color: var(--accent-interactive);
}
.map-ico-btn.is-satellite {
  background: var(--accent-primary); color: var(--accent-on-primary);
  border-color: var(--accent-primary);
}
.map-ico-btn:disabled {
  opacity: 0.45; cursor: not-allowed; box-shadow: none;
}
.map-ico-btn .map-ico-sat { display: none; }
.map-ico-btn.is-satellite .map-ico-streets { display: none; }
.map-ico-btn.is-satellite .map-ico-sat { display: block; }
.map-ico-btn::after {
  content: attr(data-tooltip);
  position: absolute; right: calc(100% + 8px); top: 50%;
  transform: translateY(-50%);
  padding: 5px 9px; border-radius: var(--r-sm);
  background: var(--bg-sidebar); color: #FFFFFF;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
  pointer-events: none; opacity: 0;
  box-shadow: var(--shadow-float);
  transition: opacity 0.12s ease;
  z-index: 460;
}
.map-ico-btn:hover::after,
.map-ico-btn:focus-visible::after { opacity: 1; }
.map-insp-title { font-weight: 600; font-size: 0.9rem; line-height: 1.45; }
.map-insp-meta { font-size: 0.76rem; color: var(--text-muted); }

/* Overview Hero Heading & Full-Span Insight Card */
.overview-hero-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 4px 2px;
}
.overview-hero-title {
  margin: 0; font-size: clamp(1.22rem, 1.8vw, 1.48rem); font-weight: 800;
  color: var(--text-primary); letter-spacing: -0.015em; line-height: 1.3;
}
.card-span-full { grid-column: 1 / -1; }

/* Time-Series Trend SVG */
.trend-chart-wrap {
  inline-size: 100%; overflow: hidden;
  padding: 6px 4px 0;
  border-radius: var(--r-md);
  background: var(--bg-canvas);
  border: 1px solid var(--border-subtle);
}
.trend-svg { display: block; inline-size: 100%; block-size: auto; max-block-size: 210px; }
.trend-grid { stroke: var(--chart-grid); stroke-width: 1; stroke-dasharray: 3 4; }
.trend-baseline { stroke: var(--border-strong); stroke-width: 1.2; }
.trend-line { stroke: var(--accent-primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.trend-bar-solo { opacity: 0.92; }
.trend-bar-multi { opacity: 0.28; }
.trend-halo { fill: var(--accent-interactive); opacity: 0.18; }
.trend-dot { fill: var(--accent-primary); stroke: var(--bg-surface); stroke-width: 2.2; }
.trend-val-pill {
  fill: var(--accent-primary); stroke: var(--bg-surface); stroke-width: 1.5;
}
.trend-val-txt { fill: #FFFFFF; font-size: 12px; font-weight: 700; font-family: inherit; }
.trend-axis-txt { fill: var(--text-muted); font-size: 11px; font-family: var(--font-mono); }

/* Admin Dynamic Excluded Activities Rows & Searchable Combobox (matches .oi-select) */
.excl-items-list { display: grid; gap: 8px; }
.excl-item-row { display: flex; align-items: center; gap: 8px; }
.excl-combo { position: relative; flex: 1 1 auto; min-inline-size: 0; }
.excl-combo-input { inline-size: 100%; padding-inline-end: 36px; }
.excl-combo-toggle {
  position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  transition: transform 0.14s ease, color 0.14s ease;
}
.excl-combo.is-open .excl-combo-toggle { transform: rotate(180deg); color: var(--accent-primary); }
.excl-combo-menu {
  position: absolute; inset-block-start: calc(100% + 4px); inset-inline: 0; z-index: 60;
  max-block-size: 240px; overflow-y: auto; padding: 5px;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-float);
  display: grid; gap: 2px;
}
.excl-combo-menu[hidden] { display: none; }
.excl-combo-opt {
  display: flex; align-items: center; inline-size: 100%; text-align: start;
  padding: 8px 10px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-primary);
  font: inherit; font-size: var(--fs-table); cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.excl-combo-opt:hover,
.excl-combo-opt:focus-visible {
  background: var(--bg-elevated); color: var(--accent-primary); outline: none;
}
.excl-combo-opt.is-selected {
  background: var(--green-bg); color: var(--accent-primary); font-weight: 600;
}
.excl-combo-empty { padding: 8px 10px; font-size: 0.78rem; color: var(--text-muted); }
.excl-del-btn { flex: 0 0 auto; min-block-size: 38px; padding-inline: 12px; gap: 6px; }

/* Accessible iframe Modal for PDF Preview & Furas Listing Preview */
.oi-modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(7, 23, 14, 0.62); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.oi-modal-backdrop[hidden],
.btn[hidden],
[hidden] { display: none !important; }
.opportunity-view-switch { inline-size: fit-content; max-inline-size: 100%; }
.oi-modal-dialog {
  inline-size: min(1080px, 100%); block-size: min(88vh, 860px);
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
  display: flex; flex-direction: column; overflow: hidden;
}
.oi-modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--bg-elevated);
  border-block-end: 1px solid var(--border-subtle);
}
.oi-modal-title {
  margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--text-primary);
  min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.oi-modal-close-btn { padding-inline: 8px; min-inline-size: 34px; }
.oi-modal-hint {
  padding: 8px 16px; font-size: 0.78rem; color: var(--text-muted);
  background: var(--bg-canvas); border-block-end: 1px solid var(--border-subtle);
}
.oi-modal-hint[hidden] { display: none; }
.oi-modal-body { flex: 1 1 auto; min-block-size: 0; background: var(--bg-canvas); }
.oi-modal-iframe { display: block; inline-size: 100%; block-size: 100%; border: 0; background: #FFFFFF; }

/* Enhanced Collection Health Diagnostics Card */
.op-diag-box {
  border: 1px solid var(--border-subtle); border-radius: var(--r-md);
  background: var(--bg-canvas); overflow: hidden;
}
.op-diag-summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; cursor: pointer; font-size: var(--fs-table); font-weight: 600;
  color: var(--text-primary); user-select: none;
  transition: background-color 0.14s ease;
}
.op-diag-summary::-webkit-details-marker { display: none; }
.op-diag-summary:hover { background: var(--bg-elevated); }
.op-diag-chev { color: var(--text-muted); transition: transform 0.16s ease; }
.op-diag-box[open] .op-diag-chev { transform: rotate(180deg); color: var(--accent-primary); }
.diag-meta-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 12px 14px; border-block-start: 1px solid var(--border-subtle);
}
.doc-card-actions { flex: 0 0 auto; }

.map-canvas {
  block-size: 520px; inline-size: 100%; border-radius: var(--r-md);
  border: 1px solid var(--border-subtle); background: var(--map-bg); z-index: 1;
}
.map-coord-pill {
  position: absolute; inset-block-end: 12px; inset-inline-start: 12px; z-index: 420;
  padding: 5px 11px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.92); color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  box-shadow: var(--shadow-float); backdrop-filter: blur(6px);
  pointer-events: none;
}
[data-theme="dark"] .map-coord-pill { background: rgba(18, 35, 26, 0.9); }
.workspace-options { flex-basis: 100%; }
.workspace-options .filter-form { margin-block: 12px; }
.map-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.map-legend {
  display: flex; flex-wrap: wrap; gap: 10px 16px; padding-block-start: 10px;
  font-size: 0.75rem; color: var(--text-muted);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lg-swatch { display: inline-block; inline-size: 12px; block-size: 12px; flex: 0 0 auto; }
.lg-ref { background: var(--bg-sidebar); border: 1.5px solid var(--sidebar-indicator); border-radius: 2px; }
.lg-primary { background: var(--accent-primary); border-radius: 50%; }
.lg-alt { background: var(--bg-surface); border: 2px solid var(--accent-interactive); border-radius: 50%; }
.lg-verify { background: var(--bg-subtle); border: 2px dashed var(--accent-interactive); border-radius: 50%; }
.lg-excluded { background: var(--red-fg); border-radius: 50%; opacity: 0.85; }

/* Leaflet Dark/Light Surface Harmonization (native CARTO Voyager / Dark Matter tiles) */
.leaflet-container { font-family: inherit; background: var(--map-bg); }
/* Leaflet positions tooltips with physical offsets in both page directions. */
.map-canvas .leaflet-tooltip {
  left: 0; top: 0; transition: none;
  inline-size: max-content; max-inline-size: min(180px, 34vw); white-space: normal; overflow-wrap: anywhere;
}
input[type="checkbox"] { accent-color: var(--accent-primary); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border-subtle); box-shadow: var(--shadow-float);
}
.leaflet-control-zoom a {
  background: var(--bg-surface) !important; color: var(--text-primary) !important;
  border-color: var(--border-subtle) !important;
}
.leaflet-control-zoom a:hover { background: var(--bg-elevated) !important; }
.oi-cluster {
  background: var(--bg-elevated); border: 2px solid var(--accent-interactive);
  color: var(--text-primary); border-radius: 50%; font-weight: 700; font-size: 0.75rem;
  display: grid; place-items: center; box-shadow: var(--shadow-float);
}
.oi-cluster-excluded {
  background: var(--red-bg); border-color: var(--red-fg); color: var(--red-fg);
}

/* =========================================================================
   Settings Page
   ========================================================================= */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.activity-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
  border: 0; padding: 0; margin: 0;
}
.activity-opt {
  display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--border-subtle); border-radius: var(--r-sm);
  background: var(--bg-canvas); cursor: pointer; font-size: var(--fs-table);
}
.activity-opt input { margin-block-start: 3px; accent-color: var(--accent-primary); }
.diff-list { display: flex; flex-wrap: wrap; gap: 6px; }
.diff-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: var(--r-sm); background: var(--bg-elevated);
  border: 1px solid var(--border-subtle); font-size: 0.75rem;
}
.field-errors { color: var(--red-fg); font-size: 0.75rem; margin: 2px 0 0; padding: 0; list-style: none; }

/* =========================================================================
   Branded Hero-Top Sign-In (Matches Emerald Radar Hero + Floating Card)
   ========================================================================= */
.login-page {
  min-block-size: 100vh; display: flex; flex-direction: column; background: var(--bg-canvas);
}
.login-hero {
  position: relative; overflow: hidden; color: #E6F3EA;
  background: linear-gradient(155deg, #0D4B28 0%, #09351C 56%, #072112 100%);
  border-block-end: 1px solid rgba(110, 231, 183, 0.18);
  padding: 22px 24px 56px;
}
.login-hero-bg {
  position: absolute; inset: 0; inline-size: 100%; block-size: 100%;
  pointer-events: none; z-index: 1;
}
.login-hero-inner {
  position: relative; z-index: 2; max-inline-size: 980px; inline-size: 100%;
  margin-inline: auto; display: grid; gap: 28px;
}
.login-hero-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.login-brand-lockup { display: flex; align-items: center; gap: 12px; }
.login-brand-logo { flex: 0 0 auto; display: block; }
.login-brand-titles { display: grid; gap: 2px; }
.login-brand-primary { font-size: 1.25rem; font-weight: 800; color: #FFFFFF; line-height: 1.2; }
.login-brand-secondary { font-size: 0.78rem; color: #A7D7BA; line-height: 1.2; letter-spacing: 0.01em; }
.login-hero-actions { display: flex; align-items: center; gap: 8px; }
.login-glass-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 14px; min-block-size: 36px; border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(167, 243, 208, 0.28);
  color: #FFFFFF; font-size: 0.8rem; font-weight: 500;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  text-decoration: none; white-space: nowrap;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.login-glass-btn:hover {
  background: rgba(255, 255, 255, 0.16); border-color: rgba(167, 243, 208, 0.5);
  color: #FFFFFF; text-decoration: none;
}
.login-hero-copy { display: grid; gap: 12px; max-inline-size: 680px; }
.login-hero-title {
  margin: 0; font-size: clamp(1.4rem, 2.5vw, 1.95rem); font-weight: 800;
  line-height: 1.35; color: #FFFFFF;
}
.login-hero-sub {
  margin: 0; font-size: clamp(0.88rem, 1.15vw, 0.98rem); line-height: 1.55; color: #C2DEC9;
}
.login-scope-wrap { padding-block-start: 4px; }
.login-scope-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-md);
  background: rgba(14, 58, 33, 0.72);
  border: 1px solid rgba(134, 239, 172, 0.28);
  color: #E6F7EC; font-size: 0.85rem; font-weight: 500;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

.login-body {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 0 20px 32px; gap: 20px; position: relative; z-index: 3;
}
.login-card {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 16px; padding: 32px 28px 26px;
  max-inline-size: 460px; inline-size: 100%;
  margin-block-start: -28px;
  box-shadow: 0 20px 44px -16px rgba(10, 38, 22, 0.15), 0 4px 12px -4px rgba(10, 38, 22, 0.06);
  display: grid; gap: 20px;
}
[data-theme="dark"] .login-card {
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.55);
}
.login-card-head { display: grid; gap: 4px; }
.login-card-title { margin: 0; font-size: 1.38rem; font-weight: 800; color: var(--text-primary); }
.login-card-sub { margin: 0; font-size: 0.86rem; color: var(--text-muted); }
.login-form { display: grid; gap: 16px; }
.login-form .field label { font-size: 0.84rem; font-weight: 600; color: var(--text-primary); }

.input-icon-wrap { position: relative; display: flex; align-items: center; }
.input-icon {
  position: absolute; left: 14px; color: var(--text-muted);
  display: inline-flex; align-items: center; pointer-events: none;
}
.input-icon-wrap .input {
  inline-size: 100%; block-size: 46px; border-radius: 10px;
  direction: ltr; text-align: left; padding-left: 42px; padding-right: 14px;
  font-size: 0.92rem;
}
.input-icon-wrap.pw-wrap .input { padding-right: 84px; }
.pw-eye {
  position: absolute; right: 8px; border: 0; background: transparent;
  color: var(--text-muted); cursor: pointer; block-size: 34px; padding-inline: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm); font-size: 0.82rem; font-weight: 600; white-space: nowrap;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.pw-eye:hover { background: var(--bg-elevated); color: var(--text-primary); }
.login-submit {
  block-size: 48px; inline-size: 100%; border-radius: 10px;
  font-size: 0.96rem; font-weight: 700; margin-block-start: 4px;
}

.login-forgot { text-align: center; margin: 0; }
.login-forgot a {
  font-size: 0.84rem; font-weight: 500; color: var(--text-muted);
  display: inline-block; padding: 2px 8px; border-radius: var(--r-sm);
  transition: color 0.14s ease;
}
.login-forgot a:hover, .login-forgot a:focus-visible { color: var(--accent-primary); }
[data-theme="dark"] .login-forgot a:hover,
[data-theme="dark"] .login-forgot a:focus-visible { color: var(--accent-interactive); }
.reset-copy { margin: 0; font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; }

.login-foot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; color: var(--text-muted); margin-block-start: auto; padding-block-start: 4px;
}

/* =========================================================================
   Compact Executive KPI Tiles, Detail Facts & Document Cards
   ========================================================================= */
.exec-kpi-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px;
}
.exec-kpi-tile {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 11px; min-inline-size: 0;
  color: inherit; text-decoration: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
.exec-kpi-tile:not(.exec-kpi-static):hover {
  border-color: var(--accent-interactive); box-shadow: var(--shadow-float);
  transform: translateY(-1px); color: inherit;
}
.exec-kpi-body { display: grid; gap: 2px; min-inline-size: 0; }
.exec-kpi-verify { border-style: dashed; border-color: var(--accent-interactive); }
.exec-kpi-excluded { border-color: var(--red-bd); }
.exec-kpi-label {
  font-size: 0.74rem; font-weight: 600; color: var(--text-muted); line-height: 1.25;
}
.exec-kpi-ico {
  inline-size: 34px; block-size: 34px; border-radius: 50%; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--bg-elevated); color: var(--accent-primary);
  border: 1px solid var(--border-accent);
}
[data-theme="dark"] .exec-kpi-ico { color: #6EE7B7; }
.exec-kpi-ico-excluded {
  background: var(--red-bg); color: var(--red-fg); border-color: var(--red-bd);
}
.exec-kpi-val {
  font-size: clamp(1.25rem, 1.6vw, 1.5rem); font-weight: 800; line-height: 1.1;
  color: var(--text-primary); letter-spacing: -0.02em;
}
.exec-kpi-excluded .exec-kpi-val { color: var(--red-fg); }

/* Opportunity Details Hero, Compact Facts & Document Distinction */
.detail-hero-card { display: grid; gap: 16px; }
.detail-header-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.detail-title-col { display: grid; gap: 6px; min-inline-size: 0; flex: 1 1 320px; }
.detail-title { margin: 0; font-size: 1.06rem; font-weight: 700; line-height: 1.45; }
.detail-primary-actions { flex: 0 0 auto; }
.fact-s { font-size: 0.72rem; color: var(--text-muted); margin-block-start: 2px; overflow-wrap: anywhere; }
.doc-card {
  padding: 13px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle); background: var(--bg-canvas);
}
.doc-card-booklet {
  border-color: var(--border-accent);
  border-inline-start: 4px solid var(--accent-primary);
  background: var(--bg-elevated);
}
.doc-card-supporting { background: var(--bg-canvas); }
.doc-card-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.doc-card-info { display: grid; gap: 4px; min-inline-size: 0; }
.doc-card-meta { font-size: 0.74rem; }
.doc-subhead {
  margin: 4px 0 0; font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
}

.card-title-wrap { display: grid; gap: 2px; min-inline-size: 0; }
.card-title { display: inline-flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.title-dot {
  inline-size: 8px; block-size: 8px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent-interactive);
}
.pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-inline-size: 20px; padding: 1px 7px; border-radius: var(--r-pill);
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  font-size: 0.72rem; font-weight: 700; color: var(--text-primary);
  line-height: 1.35;
}
.filter-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.2); border-color: rgba(255, 255, 255, 0.28);
  color: var(--accent-on-primary);
}
.pill-count-red {
  background: var(--red-bg); border-color: var(--red-bd); color: var(--red-fg);
}

.bar-title-col { display: grid; gap: 1px; min-inline-size: 0; }
.bar-sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }
.bar-nums { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.bar-track-sm { block-size: 6px; }

.excl-bars { display: grid; gap: 8px; margin-block-start: 10px; }
.excl-bar-row { display: grid; gap: 4px; }
.excl-bar-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 0.75rem; color: var(--text-primary);
}

/* Admin Panel: Review Undecided Lands & Criteria Unit Tags */
.review-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px;
}
.review-card {
  display: flex; flex-direction: column; gap: 10px; padding: 15px;
  border-radius: var(--r-md); border: 1px solid var(--border-subtle);
  border-inline-start: 4px solid var(--accent-interactive);
  background: var(--bg-canvas);
}
.review-card[data-screening-state="primary"] { border-inline-start-color: var(--accent-primary); }
.review-card[data-screening-state="excluded"] { border-inline-start-color: var(--red-fg); }
.review-current-note {
  padding: 8px 10px; border-radius: var(--r-sm); font-size: 0.76rem;
  background: var(--bg-elevated); border: 1px solid var(--border-accent);
  color: var(--text-primary);
}
.review-current-rejected {
  background: var(--red-bg); border-color: var(--red-bd); color: var(--red-fg);
}
.review-form {
  display: grid; gap: 10px; margin-block-start: auto;
  padding-block-start: 10px; border-block-start: 1px solid var(--border-subtle);
}
.review-inputs { display: grid; gap: 8px; }
.review-inputs .input { block-size: 36px; font-size: 0.78rem; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-danger {
  background: var(--red-bg); color: var(--red-fg); border-color: var(--red-bd);
}
.btn-danger:hover {
  background: var(--red-fg); color: #FFFFFF; border-color: var(--red-fg);
}
.label-with-unit {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.unit-tag {
  display: inline-flex; align-items: center; padding: 1px 7px;
  border-radius: var(--r-pill); font-size: 0.7rem; font-weight: 600;
  background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

/* Operator Technical Collapsible */
details.op-diag {
  background: var(--bg-surface); border: 1px solid var(--border-subtle);
  border-radius: var(--r-md); padding: 10px 14px; font-size: var(--fs-table);
}
details.op-diag summary { cursor: pointer; font-weight: 600; color: var(--text-muted); }

/* =========================================================================
   Responsive Breakpoints (Tablet & Mobile 360px / 390px)
   ========================================================================= */
@media (max-width: 1240px) {
  .exec-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1120px) {
  .kpi-grid, .exec-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-map, .fact-grid, .rule-grid { grid-template-columns: 1fr; }
  .fact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .map-inspector-sticky { position: static; }
}

@media (max-width: 767px) {
  .v4-shell { flex-direction: column; padding-block-end: 62px; }
  .sidebar, .topbar { display: none; }
  .m-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    block-size: 52px; padding-inline: 12px;
    background: var(--bg-sidebar); color: #FFFFFF;
    border-block-end: 1px solid var(--sidebar-divider);
    position: sticky; inset-block-start: 0; z-index: 30;
  }
  .m-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
  .m-brand-text { display: grid; line-height: 1.15; }
  .m-brand-text small { font-size: 0.64rem; font-weight: 500; color: var(--sidebar-muted); }
  .m-hdr-actions { display: flex; align-items: center; gap: 6px; }
  .m-hdr-btn {
    min-block-size: 36px; min-inline-size: 36px; padding: 0 9px; border-radius: var(--r-sm);
    border: 1px solid var(--sidebar-divider); background: var(--bg-sidebar-active);
    color: #FFFFFF; font-size: 0.75rem; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  }
  .m-bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; inset-block-end: 0; inset-inline: 0; block-size: 58px; z-index: 30;
    background: var(--bg-surface); border-block-start: 1px solid var(--border-subtle);
  }
  [data-theme="dark"] .m-bottom-nav { background: var(--bg-sidebar); border-block-start-color: var(--sidebar-divider); }
  .m-nav-link {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 0.75rem; font-weight: 500; color: var(--text-muted); text-decoration: none;
    padding: 4px 2px; min-block-size: 44px; white-space: nowrap;
  }
  .m-nav-link[aria-current="page"] { color: var(--accent-primary); font-weight: 700; }
  [data-theme="dark"] .m-nav-link[aria-current="page"] { color: #42B875; }

  .v4-main { padding: 14px 12px 24px; gap: 12px; min-inline-size: 0; max-inline-size: 100%; }
  .v4-main > *, .card, .provenance-bar { min-inline-size: 0; max-inline-size: 100%; }
  .provenance-bar { padding: 12px; gap: 10px; }
  .prov-items { gap: 10px 16px; }
  .prov-items dd { overflow-wrap: anywhere; }
  .view-switch:not(.opportunity-view-switch) { display: none !important; }
  [data-opp-directory][data-view="cards"] .opp-exec-grid {
    grid-template-columns: 1fr; padding: 12px; gap: 10px;
  }
  .opp-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .filter-form { display: grid; grid-template-columns: 1fr; }
  .filter-form .input, .filter-form .select, .filter-form .oi-select, .filter-form .oi-select-trigger, .filter-form .btn { inline-size: 100%; min-block-size: 44px; }
  .settings-grid, .activity-grid, .fact-grid { grid-template-columns: 1fr; }
  .map-canvas { block-size: 380px; }

  .review-grid, .exec-kpi-grid { grid-template-columns: 1fr; }
  .map-coord-pill { font-size: 0.65rem; padding: 4px 8px; }
  .login-hero { padding: 18px 16px 46px; }
  .login-hero-inner { gap: 22px; }
  .login-hero-title { font-size: 1.38rem; }
  .login-body { padding: 0 14px 24px; }
  .login-card { padding: 24px 18px 20px; margin-block-start: -22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

a.m-brand, a.sb-brand { color: inherit; text-decoration: none; }
.profile-crumb { color: var(--accent-interactive); font-weight: 600; text-decoration: none; }
.profile-crumb:hover { color: var(--text-primary); }
.profile-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; margin-block-start: 1rem; }
.profile-sections h3 { font-size: 1rem; margin-block: 0 0.5rem; }
.profile-sections ul { padding-inline-start: 1.25rem; }
.profile-sections dd { margin-inline-start: 0; color: var(--text-muted); }
