/* ==========================================================================================================
   Exocellure CRM — light design system (signed-in workspace only)
   ----------------------------------------------------------------------------------------------------------
   HOW THIS FILE WORKS (read before editing)
   - build.mjs links this file at the END of <body>, after every legacy inline <style> block, so it is always the
     last word in the cascade. Its precedence never depends on render timing, and no script repaints colours.
   - Every rule is scoped to `html body #root .shell`. The login page has no .shell, so this file CANNOT change the
     owner-approved login (docs/LOGIN-DESIGN-LOCK.md). Login and typography live in crm-compact.css.
   - The legacy CSS in index.html was migrated to light colours at its source (tools/crm-light-migration.mjs).
     This file sets the deliberate component design on top of that; it is not a blanket override.
   - Change colours through the tokens below. Target real component classes; never wildcard selectors such as
     [class*="card"], which repaint status pills and buttons that must keep their meaning.
   - Regression tests: tests/crm/crm-theme.test.mjs (computed styles, contrast, single active tab, login lock).
   ========================================================================================================== */

:root {
  --crm-canvas: #F6F8FB;          /* application background */
  --crm-surface: #FFFFFF;         /* cards and panels */
  --crm-surface-subtle: #F1F5F9;  /* quiet nested areas, hover */
  --crm-ink: #1E2A3B;             /* headings and body text */
  --crm-muted: #526278;           /* secondary text */
  --crm-border: #DFE5EE;          /* card and table separators */
  --crm-field-border: #C9D3E0;    /* form controls: one step stronger than card borders */
  --crm-orange: #FF5A0A;          /* primary actions */
  --crm-orange-hover: #E85007;
  --crm-orange-soft: #FFF0E7;     /* selected / attention background */
  --crm-orange-border: #FFD4BB;
  --crm-orange-ink: #9A3A06;      /* text on soft orange (5.9:1) */
  --crm-track: #9DB5CC;           /* pipeline progress track */
  --crm-info-bg: #EEF3F8;         /* neutral information notices */
  --crm-danger: #B42318;
  --crm-radius: 14px;
  --crm-radius-sm: 10px;
  --crm-shadow: 0 1px 2px rgba(30, 42, 59, .05);
}

/* ---------- 1. Workspace canvas and text ---------- */
html body:has(#root .shell) { background: var(--crm-canvas) !important; color: var(--crm-ink); }
html body #root .shell,
html body #root .shell :is(.main, .content, #pagebody) { background: var(--crm-canvas) !important; color: var(--crm-ink) !important; }
html body #root .shell :is(h1, h2, h3, h4, h5, h6) { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; text-shadow: none !important; }
html body #root .shell :is(p, li, td, th, label, dd, dt, small) { -webkit-text-fill-color: currentColor; }
html body #root .shell :is(.muted, .hint, .caption, .team-sub, .eyebrow, small) { color: var(--crm-muted); }

/* One type family across the workspace (the legacy CSS gave some headings a serif face). */
html body #root .shell :is(h1, h2, h3, h4, h5, h6, .brand h1, button, input, select, textarea) { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important; }
html body #root .shell :is(h1, h2, h3, h4, h5, h6) { letter-spacing: -.02em; }

/* Compact type scale (carried over from the approved compact typography). */
html body #root .shell .mast h1 { font-size: 24px !important; }
html body #root .shell .mast h2 { font-size: 23px !important; letter-spacing: -.02em; }
html body #root .shell .crm-head h3 { font-size: 20px !important; }
@media (max-width: 780px) {
  html body #root .shell .mast h2 { font-size: 21px !important; }
  html body #root .shell :is(.exo79-hero, .mission-hero) h2 { font-size: 22px !important; }
}

/* ---------- 2. Sidebar ---------- */

html body #root .shell .sidebar { background: var(--crm-surface) !important; border-right: 1px solid var(--crm-border) !important; box-shadow: none !important; }
html body #root .shell .sidebar .brand :is(h1, small) { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }
html body #root .shell .sidebar .brand small { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
/* The legacy brand mark is a white image made for a dark sidebar: render it in ink on the light sidebar. */
html body #root .shell .sidebar .brandmark { filter: brightness(0) saturate(0) opacity(.86) !important; }
html body #root .shell .sidebar :is(.nav, .crm-side-submenu button) {
  background: transparent !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important;
  border: 1px solid transparent !important; box-shadow: none !important; border-radius: var(--crm-radius-sm) !important;
  padding: 9px 11px !important; font-size: 12.5px !important; font-weight: 550 !important; min-height: 0 !important;
}
html body #root .shell .sidebar :is(.nav, .crm-side-submenu button):hover { background: var(--crm-surface-subtle) !important; }
html body #root .shell .sidebar :is(.nav.active, .crm-side-submenu button.selected) {
  background: var(--crm-orange-soft) !important; color: var(--crm-orange-ink) !important; -webkit-text-fill-color: var(--crm-orange-ink) !important;
  border-color: var(--crm-orange-border) !important; font-weight: 700 !important;
}
/* The CRM group heading is marked active while one of its pages is open: show that with text only, so the
   selected sub-page is the single highlighted item. */
html body #root .shell .sidebar .nav.active[aria-expanded] { background: transparent !important; border-color: transparent !important; }
html body #root .shell .sidebar .crm-side-submenu { border-left: 1px solid var(--crm-border) !important; }
html body #root .shell .sidebar .sidefoot { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }

/* ---------- 3. Page header ---------- */
html body #root .shell .mast { background: var(--crm-surface) !important; border-bottom: 1px solid var(--crm-border) !important; box-shadow: none !important; }
html body #root .shell .mast :is(p, .eyebrow) { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
html body #root .shell .userbadge span { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }

/* ---------- 4. Cards and panels ---------- */
html body #root .shell :is(.panel, .crm-panel, .crm-contact-panel, .detail-panel, .intelligence-panel, .ag-block, .exo79-hero, .mission-hero, .crm55) {
  background: var(--crm-surface) !important; background-image: none !important; color: var(--crm-ink) !important;
  border: 1px solid var(--crm-border) !important; box-shadow: var(--crm-shadow) !important; border-radius: var(--crm-radius) !important;
}
/* Nested cards inside a card: keep one border level, not boxes in boxes. */
html body #root .shell :is(.panel, .crm55, .crm-panel) :is(.panel, .crm-panel) { box-shadow: none !important; }

/* ---------- 5. Dashboard: AI Command Center ---------- */
html body #root .shell .exo79-hero { position: relative; overflow: hidden; }
html body #root .shell .exo79-hero::before,
html body #root .shell .exo79-hero::after { content: none !important; display: none !important; background: none !important; }
/* Dashboard intelligence label: a compact strip (the AI Command Center text was removed at the owner's request). */
html body #root .shell .exo79-hero.exo79-hero-compact { padding: 14px 20px !important; min-height: 0 !important; margin-bottom: 16px !important; }
html body #root .shell .exo79-hero.exo79-hero-compact .exo79-kicker { margin: 0 !important; }
html body #root .shell .exo79-hero .exo79-kicker { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
html body #root .shell .exo79-hero p { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }
html body #root .shell .exo79-hero .exo79-live { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; font-size: 12px !important; }

/* Information notices */
html body #root .shell :is(.notice, .pilot-note, .exo79-note, .home-pilot-note) {
  background: var(--crm-info-bg) !important; color: var(--crm-ink) !important; border: 1px solid var(--crm-border) !important; box-shadow: none !important;
}

/* ---------- 6. Dashboard: Mission Control ---------- */
html body #root .shell .mission-hero::before,
html body #root .shell .mission-hero::after { opacity: .35 !important; }
html body #root .shell .mission-hero h2 { font-size: clamp(24px, 2.3vw, 30px) !important; line-height: 1.15 !important; }
html body #root .shell .mission-hero :is(p, .mission-eyebrow) { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }
html body #root .shell .mission-hero .mission-eyebrow { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
/* Decorative EXO orbit: smaller and quieter, never competing with the content. Hidden on phones. */
html body #root .shell .mission-orbit { transform: scale(.72); transform-origin: center; opacity: .55; filter: saturate(0); }
html body #root .shell .mission-orbit span { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
@media (max-width: 900px) { html body #root .shell .mission-orbit { display: none !important; } }

/* ---------- 7. Buttons ---------- */
/* Primary: solid orange, white text (.btn, .btn.primary, Mission Control shortcuts, Refresh data). */
html body #root .shell :is(.btn:not(.outline), .btn.primary, .mission-jump, #crm-refresh) {
  background: var(--crm-orange) !important; background-image: none !important; color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important;
  border: 1px solid var(--crm-orange) !important; box-shadow: none !important; border-radius: 12px !important;
}
html body #root .shell :is(.btn:not(.outline), .btn.primary, .mission-jump, #crm-refresh) * { color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important; }
html body #root .shell :is(.btn:not(.outline), .btn.primary, .mission-jump, #crm-refresh):hover:not(:disabled) { background: var(--crm-orange-hover) !important; border-color: var(--crm-orange-hover) !important; }
/* Secondary: white, subtle border, dark text. */
html body #root .shell .btn.outline:not(#crm-refresh) {
  background: var(--crm-surface) !important; background-image: none !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important;
  border: 1px solid var(--crm-field-border) !important; box-shadow: none !important; border-radius: 12px !important;
}
html body #root .shell .btn.outline:not(#crm-refresh):hover:not(:disabled) { background: var(--crm-surface-subtle) !important; border-color: #AEBBCC !important; }
html body #root .shell :is(.btn, .mission-jump, #crm-refresh):disabled { opacity: .55 !important; cursor: not-allowed !important; }
html body #root .shell :is(button, a, input, select, textarea, [role="button"]):focus-visible { outline: 2px solid var(--crm-orange) !important; outline-offset: 2px !important; }
/* Destructive (research deletion, injected by build.mjs) */
html body #root .shell .vr-delete { background: var(--crm-surface) !important; color: var(--crm-danger) !important; -webkit-text-fill-color: var(--crm-danger) !important; border: 1px solid #F3B8B2 !important; }
@media (max-width: 760px) { html body #root .shell :is(.btn, .mission-jump) { min-height: 42px; } }
/* Research detail header: Back / Delete / status badge wrap cleanly; the badge never breaks mid-word. */
html body #root .shell .vr-detail-top { display: flex !important; flex-wrap: wrap !important; align-items: center !important; gap: 10px !important; }
html body #root .shell .vr-detail-top .vr-delete { margin-left: 0 !important; }
html body #root .shell .vr-detail-top .vr-pill { white-space: nowrap !important; margin-left: auto !important; flex: 0 0 auto !important; }
html body #root .shell .vr-delete-status { margin: 10px 0 0 !important; padding: 10px 12px !important; border-radius: 10px !important; font-size: 13px !important; color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; background: var(--crm-surface-subtle) !important; border: 1px solid var(--crm-border) !important; }
html body #root .shell .vr-delete-status:empty { display: none !important; }
html body #root .shell .vr-delete-status[data-state="error"] { color: var(--crm-danger) !important; -webkit-text-fill-color: var(--crm-danger) !important; background: #FEF3F2 !important; border-color: #F3B8B2 !important; }

/* ---------- 8. Metric cards (Dashboard shortcuts, Sales Pipeline KPIs, task stats) ---------- */
html body #root .shell :is(.stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card) {
  background: var(--crm-surface) !important; background-image: none !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important;
  border: 1px solid var(--crm-border) !important; box-shadow: var(--crm-shadow) !important; border-radius: var(--crm-radius) !important;
}
/* No decorative corner gradients on metric cards. */
html body #root .shell :is(.stat, .dashboard-shortcut, .crm-metric, .task-stat)::before,
html body #root .shell :is(.stat, .dashboard-shortcut, .crm-metric, .task-stat)::after { content: none !important; display: none !important; }
/* Clean text hierarchy inside a card: no little boxes around labels and numbers. */
html body #root .shell :is(.stat, .dashboard-shortcut, .crm-metric, .task-stat, .mission-funnel-stage) :is(div, span, small, strong, b, p):not(.mission-stage-track):not(.mission-stage-track *) {
  background: transparent !important; border-color: transparent !important; box-shadow: none !important;
}
html body #root .shell :is(.stat, .dashboard-shortcut, .crm-metric, .task-stat) :is(b, strong) { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }
html body #root .shell :is(.stat, .dashboard-shortcut, .crm-metric, .task-stat) :is(small, span, .crm-metric-label, p) { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
html body #root .shell .crm-metric .crm-metric-label { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; font-weight: 600 !important; }
html body #root .shell .crm-metric .crm-metric-label span { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
html body #root .shell :is(.stat, .dashboard-shortcut, .crm-metric):hover { border-color: var(--crm-orange-border) !important; }

/* Decorative arrows on AI Operations metric cards: readable dark orange instead of light orange. */
html body #root .shell .ai-metric-arrow { color: var(--crm-orange-ink) !important; -webkit-text-fill-color: var(--crm-orange-ink) !important; }

/* Status pill: "Ft Lauderdale Show 2026 · 0 leads" and similar campaign indicators */
html body #root .shell :is(.home-lead-source, .ft-show-pill, .campaign-pill) {
  background: var(--crm-orange-soft) !important; color: var(--crm-orange-ink) !important; -webkit-text-fill-color: var(--crm-orange-ink) !important;
  border: 1px solid var(--crm-orange-border) !important; box-shadow: none !important;
}

/* ---------- 9. Clinic Pipeline Flow ---------- */
html body #root .shell .mission-funnel-stage {
  background: var(--crm-surface) !important; background-image: none !important; border: 1px solid var(--crm-border) !important;
  box-shadow: none !important; border-radius: 12px !important; color: var(--crm-ink) !important;
}
html body #root .shell .mission-funnel-stage .mission-stage-index { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; font-weight: 600 !important; }
html body #root .shell .mission-funnel-stage :is(.mission-stage-name, strong) { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }
html body #root .shell .mission-funnel-stage:hover { border-color: var(--crm-orange-border) !important; }
html body #root .shell .mission-stage-track { display: block; height: 6px !important; border-radius: 999px !important; background: var(--crm-track) !important; border: 0 !important; overflow: hidden; }
html body #root .shell .mission-stage-track i { display: block; height: 100% !important; background: var(--crm-orange) !important; border-radius: 999px !important; }

/* ---------- 10. Contact Pipeline Board ---------- */
html body #root .shell :is(.crm-board, .crm-lanes, .crm-pipeline-board) { background: var(--crm-canvas) !important; }
html body #root .shell .crm-lane {
  background: var(--crm-surface) !important; background-image: none !important; color: var(--crm-ink) !important;
  border: 1px solid var(--crm-border) !important; box-shadow: none !important;
}
html body #root .shell .crm-lane :is(h3, h4, strong, b, header, .crm-lane-title, .crm-lane-count) { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; background: transparent !important; }
html body #root .shell .crm-lane :is(p, small, .empty, .crm-empty) { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; }
html body #root .shell .crm-lead-card { background: var(--crm-surface) !important; border: 1px solid var(--crm-border) !important; color: var(--crm-ink) !important; box-shadow: none !important; }

/* ---------- 11. Search, filters and form fields ---------- */
html body #root .shell #pagebody :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) {
  background: var(--crm-surface) !important; background-color: var(--crm-surface) !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important;
  border: 1px solid var(--crm-field-border) !important; box-shadow: none !important; border-radius: 10px !important;
}
html body #root .shell #pagebody :is(input, textarea)::placeholder { color: #66758A !important; -webkit-text-fill-color: #66758A !important; opacity: 1; }
html body #root .shell #pagebody :is(input, select, textarea):focus { border-color: var(--crm-orange) !important; outline: 2px solid var(--crm-orange-soft) !important; outline-offset: 0 !important; }
html body #root .shell #pagebody select { font-weight: 600 !important; }

/* ---------- 11b. Inner boxes: forms and detail items inside a card ----------
   A bordered box always keeps its content at least 14-16 px from its own border, and sits clear of the card around it
   (tests/crm audit: "cramped"). */
html body #root .shell .location-editor-form {
  padding: 18px !important; margin: 16px 0 !important; border: 1px solid var(--crm-border) !important; border-radius: 12px !important;
  background: var(--crm-surface) !important; box-shadow: none !important; box-sizing: border-box;
}
html body #root .shell .detail-item { padding: 14px 16px !important; border-radius: 12px !important; box-sizing: border-box; }
@media (max-width: 780px) {
  html body #root .shell .location-editor-form { padding: 16px 14px !important; }
  html body #root .shell .crm55 { padding: 16px !important; }
}

/* ---------- 11c. Phones: no automatic zoom when a field gets focus ----------
   iPhone Safari zooms the page when a field with text smaller than 16 px is focused (for example the message box after
   picking an emoji). Fields in the signed-in CRM use 16 px on phones. The locked login page is not affected. */
@media (max-width: 780px) {
  html body #root .shell :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea) { font-size: 16px !important; }
}

/* ---------- 11d. Team Chat: "+" menu and emoji tray open inside the chat panel ----------
   The menu was anchored to the "+" button and opened leftwards past the panel edge, where it was clipped. It is now
   anchored to the whole compose area and sized to fit. */
html body #root .shell .chat-compose { position: relative !important; }
html body #root .shell .chat-plus-wrap { position: static !important; }
html body #root .shell .chat-plus-menu { left: auto !important; right: 16px !important; bottom: calc(100% + 8px) !important; width: min(240px, calc(100% - 32px)) !important; box-sizing: border-box !important; box-shadow: 0 10px 28px rgba(30, 42, 59, .14) !important; }
html body #root .shell .chat-plus-menu button { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; font-size: 15px !important; min-height: 44px !important; }
html body #root .shell .chat-plus-menu button:hover { background: var(--crm-surface-subtle) !important; }
html body #root .shell .chat-emoji-tray { left: 12px !important; right: 12px !important; width: auto !important; max-width: none !important; bottom: calc(100% + 8px) !important; box-sizing: border-box !important; }
html body #root .shell .chat-emoji-grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)) !important; }

/* ---------- 11e. Tasks & Follow-ups ----------
   Task rows were turned into bordered cards by an older override without inner padding, so titles and actions touched
   the card edge and long titles (with record IDs) ran past it. Each task is now a padded card with space between. */
html body #root .shell .task-dashboard-row {
  padding: 16px 18px !important; margin: 0 0 12px !important; border: 1px solid var(--crm-border) !important; border-radius: var(--crm-radius) !important;
  background: var(--crm-surface) !important; box-shadow: var(--crm-shadow) !important; box-sizing: border-box !important; gap: 14px !important;
}
html body #root .shell .task-dashboard-row strong { overflow-wrap: anywhere; }
html body #root .shell .task-dashboard-row .task-meta { overflow-wrap: anywhere; }
html body #root .shell .task-recommendation {
  padding: 12px 14px !important; margin-top: 12px !important; border: 1px solid var(--crm-border) !important; border-left: 1px solid var(--crm-border) !important;
  border-radius: 10px !important; background: var(--crm-surface-subtle) !important; color: var(--crm-muted) !important;
}
html body #root .shell .task-recommendation strong { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }
html body #root .shell .task-action { gap: 10px !important; }
/* Overdue: pitch-black badge with white bold text (owner request, 21:1 contrast). A status label, not a control.
   The one deliberate dark surface in the CRM (allow-listed in the regression audit). */
html body #root .shell .task-status.overdue {
  background: #000000 !important; color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important; font-weight: 700 !important;
  border: 1px solid #000000 !important; border-radius: 10px !important; padding: 9px 14px !important; font-size: 13px !important; line-height: 1.2 !important;
}
html body #root .shell .task-toolbar { display: flex !important; flex-wrap: wrap !important; gap: 10px !important; }
html body #root .shell .task-toolbar #task-search { flex: 1 1 260px !important; min-width: 0 !important; }
html body #root .shell .task-toolbar :is(select, button) { flex: 0 1 auto !important; min-width: 0 !important; }
@media (max-width: 780px) {
  /* Phones: one control per row, so placeholders and choices are never cut off. */
  html body #root .shell .task-toolbar > * { flex: 1 1 100% !important; width: 100% !important; }
  html body #root .shell .task-dashboard-row { padding: 14px !important; }
}

/* ---------- 11f. Search fields with an icon (Visual Research Library) ----------
   The wrapper is the one visible field; the input inside it has no border of its own, so the icon sits inside the
   same box. Focus shows on the whole field. */
html body #root .shell .vr-search {
  display: flex !important; align-items: center !important; gap: 10px !important; padding: 0 14px !important; min-height: 48px !important;
  background: var(--crm-surface) !important; border: 1px solid var(--crm-field-border) !important; border-radius: 12px !important; box-shadow: none !important; box-sizing: border-box !important;
}
html body #root .shell .vr-search:focus-within { border-color: var(--crm-orange) !important; outline: 2px solid var(--crm-orange-soft) !important; outline-offset: 0 !important; }
html body #root .shell .vr-search > span { font-size: 24px !important; font-weight: 700 !important; line-height: 1 !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; background: transparent !important; flex: none !important; }
html body #root .shell #pagebody .vr-search input#vr-search-input {
  flex: 1 1 auto !important; min-width: 0 !important; width: 100% !important; padding: 12px 0 !important; margin: 0 !important;
  border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; border-radius: 0 !important;
}

/* ---------- 12. Tables ---------- */
html body #root .shell :is(table, .crm-table) { background: var(--crm-surface) !important; color: var(--crm-ink) !important; }
html body #root .shell :is(th, td) { border-color: var(--crm-border) !important; }
html body #root .shell th { background: var(--crm-canvas) !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }

/* ---------- 13. Mobile navigation (exactly one active tab: the app's own .active class) ---------- */
@media (max-width: 780px) {
  html body #root .shell .mobileNav {
    background: var(--crm-surface) !important; background-image: none !important; border-top: 1px solid var(--crm-border) !important;
    box-shadow: 0 -2px 10px rgba(30, 42, 59, .06) !important; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
  }
  html body #root .shell .mobileNav button {
    background: transparent !important; background-image: none !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important;
    border: 1px solid transparent !important; box-shadow: none !important; min-height: 52px !important;
  }
  html body #root .shell .mobileNav button * { color: inherit !important; -webkit-text-fill-color: inherit !important; }
  html body #root .shell .mobileNav button.active { background: var(--crm-orange) !important; color: #FFFFFF !important; -webkit-text-fill-color: #FFFFFF !important; border-color: var(--crm-orange) !important; }
  html body #root .shell :is(.mobile-menu, .mobile-menu-sheet) { background: var(--crm-surface) !important; color: var(--crm-ink) !important; }
  html body #root .shell .mobile-menu-item { background: transparent !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; border: 1px solid var(--crm-border) !important; }
  html body #root .shell .mobile-menu-item.active { background: var(--crm-orange-soft) !important; color: var(--crm-orange-ink) !important; -webkit-text-fill-color: var(--crm-orange-ink) !important; border-color: var(--crm-orange-border) !important; }
}

/* ---------- 15. Motion preference (carried over) ---------- */
@media (prefers-reduced-motion: reduce) {
  html body #root .shell *, html body #root .shell *::before, html body #root .shell *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 16. Account menu: header badge → Profile & security / Sign out (CRM-AUTH-UI-01) ---------- */
/* The header has a backdrop-filter (its own stacking context at z-index auto); positioned page content that follows it,
   such as the dashboard hero, would otherwise paint over the open menu. Lift the header above the page content. */
html body #root .shell .mast { position: relative; z-index: 20; }
html body #root .shell .account-menu-wrap { position: relative; flex: none; }
html body #root .shell .account-menu-button { display: flex; align-items: center; gap: 10px; font: inherit; font-size: 13px; cursor: pointer;
  background: var(--crm-surface) !important; border: 1px solid var(--crm-border) !important; border-radius: 999px; padding: 4px 12px 4px 4px; min-height: 42px; color: var(--crm-ink) !important; }
html body #root .shell .account-menu-button:hover, html body #root .shell .account-menu-button[aria-expanded="true"] { border-color: var(--crm-field-border) !important; background: var(--crm-info-bg) !important; }
html body #root .shell .account-menu-button:focus-visible { outline: 2px solid var(--crm-orange); outline-offset: 2px; }
html body #root .shell .account-menu-button .circle { margin-right: 0 !important; background: var(--crm-info-bg) !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; }
html body #root .shell .account-caret { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; font-size: 11px; }
html body #root .shell .account-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 240px; max-width: min(320px, calc(100vw - 32px)); padding: 6px;
  background: var(--crm-surface) !important; border: 1px solid var(--crm-border) !important; border-radius: 14px; box-shadow: 0 12px 32px rgba(30,42,59,.14) !important; }
html body #root .shell .account-menu[hidden] { display: none !important; }
html body #root .shell .account-menu-who { display: grid; gap: 2px; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--crm-border); }
html body #root .shell .account-menu-who b { color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; font-size: 14px; }
html body #root .shell .account-menu-who small { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; font-size: 12px; overflow-wrap: anywhere; }
html body #root .shell .account-menu-role { text-transform: capitalize; }
html body #root .shell .account-menu [role="menuitem"] { display: block; width: 100%; text-align: left; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 44px; padding: 10px 12px;
  border: 0 !important; border-radius: 10px; background: transparent !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; box-shadow: none !important; }
html body #root .shell .account-menu [role="menuitem"]:is(:hover, :focus-visible) { background: var(--crm-info-bg) !important; outline: none; }
html body #root .shell .account-menu .account-signout { color: var(--crm-danger) !important; -webkit-text-fill-color: var(--crm-danger) !important; }
html body #root .shell .account-menu .account-signout:is(:hover, :focus-visible) { background: #FDECEA !important; }

/* Phase 2 — Automated Clinic Intelligence panel (crm-clinic-intel.js). */
html body #root .shell .intel-auto { border: 1px solid var(--crm-border); border-radius: 14px; padding: 16px; margin: 18px 0; background: var(--crm-surface); }
html body #root .shell .intel-auto h5 { margin: 16px 0 8px; font-size: 14px; color: var(--crm-ink); }
html body #root .shell .intel-class { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 12px 14px; border-radius: 12px; background: var(--crm-surface-subtle); }
html body #root .shell .intel-class strong { font-size: 20px; }
html body #root .shell .intel-class small { flex-basis: 100%; color: var(--crm-muted); }
html body #root .shell .intel-class-high { background: #E8F6EE; }
html body #root .shell .intel-class-medium { background: var(--crm-info-bg); }
html body #root .shell .intel-class-needs_review { background: var(--crm-orange-soft); }
html body #root .shell .intel-stale, html body #root .shell .intel-review { background: var(--crm-orange-soft); color: var(--crm-orange-ink); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
html body #root .shell .intel-review ul, html body #root .shell .intel-brief ul, html body #root .shell .intel-why ul { margin: 6px 0 0; padding-left: 18px; }
html body #root .shell .intel-meta { color: var(--crm-muted); font-size: 12px; margin: 8px 0; }
html body #root .shell .intel-why details { border-bottom: 1px solid var(--crm-border); padding: 6px 0; }
html body #root .shell .intel-why summary { display: flex; justify-content: space-between; cursor: pointer; gap: 12px; }
html body #root .shell .intel-brief { margin: 10px 0; }
html body #root .shell .intel-brief li { margin: 4px 0; overflow-wrap: anywhere; }
html body #root .shell .intel-ai { border-left: 3px solid var(--crm-orange); padding-left: 10px; }
html body #root .shell .intel-status { display: inline-block; font-size: 11px; font-weight: 650; border-radius: 999px; padding: 1px 8px; margin-right: 4px; background: var(--crm-surface-subtle); color: var(--crm-muted); }
html body #root .shell .intel-verified { background: #E8F6EE; color: #1D6B3C; }
html body #root .shell .intel-likely { background: var(--crm-info-bg); color: #2B4A6B; }
html body #root .shell .intel-visitor_provided { background: #F3EEFB; color: #5A3D86; }
html body #root .shell .intel-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 14px; }
html body #root .shell .intel-controls label { display: grid; gap: 4px; font-size: 12px; }
html body #root .shell .intel-controls .intel-reason { flex: 1 1 220px; }
html body #root .shell .intel-controls select, html body #root .shell .intel-controls input { padding: 9px; border: 1px solid var(--crm-field-border); border-radius: 9px; }
html body #root .shell .intel-msg { flex-basis: 100%; margin: 0; font-weight: 600; min-height: 1.2em; }
html body #root .shell .intel-auto a:not(.btn) { color: var(--crm-orange-ink) !important; font-weight: 600; text-decoration: underline; } /* legacy a:not(.btn) rule is !important */
html body #root .shell .intel-controls label, html body #root .shell .intel-controls select, html body #root .shell .intel-controls input { min-width: 0; max-width: 100%; box-sizing: border-box; }
html body #root .shell .intel-controls .intel-reason { flex: 1 1 200px; }

/* Priority A — official website screenshot card (replaces the old image banner / placeholder). */
html body #root .shell .site-shot { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 16px; align-items: center; margin: 0 0 16px; padding: 12px; border: 1px solid var(--crm-border); border-radius: 14px; background: var(--crm-surface); }
html body #root .shell .site-shot-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 1px solid var(--crm-border); border-radius: 10px; overflow: hidden; background: var(--crm-surface-subtle); cursor: zoom-in; }
html body #root .shell .site-shot-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
html body #root .shell .site-shot-zoom { position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(30, 42, 59, 0.86); color: #fff; font-size: 11px; font-weight: 650; }
html body #root .shell .site-shot figcaption { display: grid; gap: 4px; min-width: 0; }
html body #root .shell .site-shot figcaption strong { font-size: 17px; color: var(--crm-ink); }
html body #root .shell .site-shot figcaption span, html body #root .shell .site-shot figcaption small { color: var(--crm-muted); font-size: 13px; }
html body #root .shell .site-shot figcaption a:not(.btn), html body #root .shell .site-shot-none a:not(.btn) { color: var(--crm-orange-ink) !important; font-weight: 650; overflow-wrap: anywhere; }
html body #root .shell .site-shot-fallback { display: none; aspect-ratio: 16 / 10; border-radius: 10px; background: var(--crm-surface-subtle); align-content: center; justify-items: center; gap: 8px; padding: 12px; text-align: center; color: var(--crm-muted); font-size: 12px; }
html body #root .shell .site-shot.shot-missing .site-shot-frame { display: none; }
html body #root .shell .site-shot.shot-missing .site-shot-fallback { display: grid; }
html body #root .shell .site-shot-badge { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--crm-orange-soft); color: var(--crm-orange-ink); font-weight: 750; }
html body #root .shell .site-shot-none { display: flex; gap: 14px; align-items: center; margin: 0 0 16px; padding: 14px; border: 1px solid var(--crm-border); border-radius: 14px; background: var(--crm-surface); }
html body #root .shell .site-shot-none strong { display: block; color: var(--crm-ink); }
html body #root .shell .site-shot-none span, html body #root .shell .site-shot-none p { color: var(--crm-muted); font-size: 13px; margin: 2px 0 0; }
@media (max-width: 640px) { html body #root .shell .site-shot { grid-template-columns: minmax(0, 1fr); } }
html body #root .shell dialog.site-shot-lightbox { width: min(1100px, 96vw); max-height: 92vh; padding: 0; border: 0; border-radius: 14px; overflow: hidden; }
html body #root .shell dialog.site-shot-lightbox::backdrop { background: rgba(15, 23, 36, 0.72); }
html body #root .shell dialog.site-shot-lightbox .site-shot-lightbox-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 10px 14px; background: #fff; border-bottom: 1px solid #DFE5EE; font-size: 14px; }
html body #root .shell dialog.site-shot-lightbox .site-shot-lightbox-bar a:not(.btn) { color: #9A3A06 !important; font-weight: 650; } /* legacy a:not(.btn) rule is !important */
html body #root .shell dialog.site-shot-lightbox .site-shot-lightbox-bar button { margin-left: auto; border: 0; background: #F1F5F9; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-size: 15px; }
html body #root .shell dialog.site-shot-lightbox .site-shot-lightbox-body { max-height: calc(92vh - 48px); overflow: auto; background: #F6F8FB; }
html body #root .shell dialog.site-shot-lightbox .site-shot-lightbox-body img { display: block; width: 100%; height: auto; }

/* CRM-SIMPLIFY-01 — five-area lead profile (Clinic Overview · Market Intelligence · EXO-V Opportunity · Conversations · Management). */
html body #root .shell .lp { display: grid; gap: 14px; }
html body #root .shell .lp-sec { border: 1px solid var(--crm-border); border-radius: 14px; padding: 16px 18px; background: var(--crm-surface); min-width: 0; }
html body #root .shell .lp-sec > h4 { margin: 0 0 10px; font-size: 16px; color: var(--crm-ink); }
html body #root .shell .lp-sec h5 { margin: 12px 0 6px; font-size: 13px; color: var(--crm-ink); letter-spacing: .01em; }
html body #root .shell .lp-sec h5 small, html body #root .shell .lp-sec small { color: var(--crm-muted); font-weight: 500; font-size: 12px; }
html body #root .shell .lp-rows { display: grid; gap: 0; }
html body #root .shell .lp-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--crm-border); font-size: 14px; color: var(--crm-ink); }
html body #root .shell .lp-row:first-child { border-top: 0; }
html body #root .shell .lp-row > span { color: var(--crm-muted); font-size: 13px; }
html body #root .shell .lp-row > div { min-width: 0; overflow-wrap: anywhere; }
html body #root .shell .lp-muted { color: var(--crm-muted); }
html body #root .shell .lp-meta { color: var(--crm-muted); font-size: 13px; margin: 6px 0; }
html body #root .shell .lp-stale { color: var(--crm-orange-ink); background: var(--crm-orange-soft); border-radius: 8px; padding: 6px 10px; display: inline-block; margin: 6px 0; font-size: 13px; }
html body #root .shell .lp-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
html body #root .shell .lp-tag { border: 1px solid var(--crm-border); border-radius: 999px; padding: 3px 10px; font-size: 13px; background: var(--crm-surface-subtle); color: var(--crm-ink); }
html body #root .shell .lp-tag a:not(.btn) { color: var(--crm-ink) !important; text-decoration: none; font-weight: 600; }
html body #root .shell .lp-tag small { margin-left: 4px; }
html body #root .shell .lp-tag.lp-likely { background: var(--crm-surface); border-style: dashed; }
html body #root .shell .lp-people, html body #root .shell .lp-list, html body #root .shell .lp-pages { margin: 0; padding-left: 18px; font-size: 14px; color: var(--crm-ink); }
html body #root .shell .lp-people li, html body #root .shell .lp-list li { margin: 3px 0; overflow-wrap: anywhere; }
html body #root .shell .lp-pages li { margin: 2px 0; font-size: 12px; overflow-wrap: anywhere; }
html body #root .shell .lp-sec a:not(.btn) { color: var(--crm-orange-ink) !important; font-weight: 600; }
html body #root .shell .lp-tag a:not(.btn) { color: var(--crm-ink) !important; }
html body #root .shell .lp-more, html body #root .shell .lp-evidence { margin-top: 10px; border-top: 1px solid var(--crm-border); padding-top: 8px; font-size: 13px; }
html body #root .shell .lp-more > summary, html body #root .shell .lp-evidence > summary { cursor: pointer; color: var(--crm-ink); font-weight: 600; }
html body #root .shell .lp-table-wrap { overflow-x: auto; max-width: 100%; margin-top: 8px; }
html body #root .shell .lp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
html body #root .shell .lp-table th, html body #root .shell .lp-table td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--crm-border); vertical-align: top; color: var(--crm-ink); }
html body #root .shell .lp-next { margin: 10px 0; padding: 10px 12px; border-left: 3px solid var(--crm-orange); background: var(--crm-orange-soft); color: var(--crm-ink); border-radius: 0 10px 10px 0; font-size: 14px; }
html body #root .shell .lp-ai { border-left: 3px solid var(--crm-orange); padding-left: 10px; }
html body #root .shell .intel-class em { font-style: normal; font-weight: 700; color: var(--crm-ink); }
html body #root .shell .lp-finding { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--crm-border); font-size: 14px; }
html body #root .shell .lp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
html body #root .shell .lp-link { border: 0; background: none; padding: 0; color: var(--crm-orange-ink); font-weight: 650; cursor: pointer; font-size: 14px; text-decoration: underline; }
html body #root .shell .lp-statusbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-start; }
html body #root .shell .lp-chip-auto { background: var(--crm-info-bg); }
html body #root .shell #lp-add-finding, html body #root .shell #lp-edit-address { margin-top: 10px; }
@media (max-width: 640px) {
  html body #root .shell .lp-sec { padding: 14px; }
  html body #root .shell .lp-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}

/* Sprint 011 — territories editor, team lifecycle dialog. */
html body #root .shell .terr-h { margin: 16px 0 8px; font-size: 14px; color: var(--crm-ink); }
html body #root .shell .terr-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 8px; }
html body #root .shell .terr-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--crm-border); border-radius: 999px; padding: 3px 4px 3px 12px; background: var(--crm-surface-subtle); color: var(--crm-ink); font-size: 13px; }
html body #root .shell .terr-chip button { border: 0; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 8px; color: var(--crm-muted); border-radius: 999px; }
html body #root .shell .terr-chip.terr-overlap { border-color: var(--crm-orange-border); background: var(--crm-orange-soft); }
html body #root .shell .terr-pending .terr-chip { border-style: dashed; background: var(--crm-surface); }
html body #root .shell .terr-chip .terr-sel, html body #root .shell .area-row .terr-sel { width: 16px; height: 16px; margin: 0 2px 0 -4px; accent-color: #111; flex: none; }
html body #root .shell .area-row .terr-sel { margin: 2px 8px 0 0; align-self: flex-start; }
html body #root .shell .terr-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 8px; }
html body #root .shell .terr-bulk .terr-check { margin: 0; }
html body #root .shell .terr-list-status { margin: 4px 0 10px; font-size: 13px; min-height: 0; }
html body #root .shell .terr-list-status.err { color: #b42318; font-weight: 600; }
html body #root .shell .terr-list-status.ok { color: #1f7a4d; }
html body #root .shell .terr-add { border: 1px solid var(--crm-border); border-radius: 12px; padding: 12px 14px; margin: 10px 0; display: grid; gap: 10px; }
html body #root .shell .terr-add label, html body #root .shell .terr-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--crm-ink); }
html body #root .shell .terr-add input, html body #root .shell .terr-add select, html body #root .shell .terr-grid select { padding: 9px; border: 1px solid var(--crm-field-border); border-radius: 9px; min-width: 0; max-width: 100%; box-sizing: border-box; }
html body #root .shell .terr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
html body #root .shell .terr-check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; font-size: 13px; color: var(--crm-ink); }
html body #root .shell .terr-results { display: flex; flex-wrap: wrap; gap: 6px; }
html body #root .shell .terr-result { border: 1px solid var(--crm-border); background: var(--crm-surface); border-radius: 9px; padding: 6px 10px; cursor: pointer; font-size: 13px; color: var(--crm-ink); text-align: left; }
html body #root .shell .terr-panel { margin-top: 16px; border: 1px solid var(--crm-border); border-radius: 14px; padding: 14px 16px; background: var(--crm-surface); }
html body #root .shell .terr-panel h4 { margin: 0 0 6px; }
html body #root .shell .terr-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 10px; padding: 6px 0; border-top: 1px solid var(--crm-border); font-size: 13px; color: var(--crm-ink); }
html body #root .shell .team-lifecycle { margin-right: 8px; }
html body #root .shell dialog.team-lifecycle-dialog { width: min(720px, 96vw); max-height: 92vh; border: 0; border-radius: 14px; padding: 0; }
html body #root .shell dialog.team-lifecycle-dialog::backdrop { background: rgba(15, 23, 36, 0.62); }
html body #root .shell .tl-body { padding: 18px 20px; display: grid; gap: 10px; color: var(--crm-ink); }
html body #root .shell .tl-body h3 { margin: 0; }
html body #root .shell .tl-body label { display: grid; gap: 4px; font-size: 13px; }
html body #root .shell .tl-body input, html body #root .shell .tl-body select { padding: 9px; border: 1px solid var(--crm-field-border); border-radius: 9px; max-width: 100%; box-sizing: border-box; }
html body #root .shell .tl-table td, html body #root .shell .tl-table th { font-size: 13px; }
html body #root .shell .tl-danger { color: #9B1C1C !important; border-color: #E8B4B4 !important; }
@media (max-width: 640px) { html body #root .shell .terr-row { grid-template-columns: minmax(0, 1fr); gap: 2px; } }
html body #root .shell .terr-load { font-size: 12px; color: var(--crm-muted); white-space: nowrap; }
html body #root .shell .terr-load-blocked { color: var(--crm-orange-ink); font-weight: 600; }

/* LEAD-DELETE-01 — Delete Lead (red outline, bottom-right of the lead page) and Recycle Bin rows */
html body #root .shell .lp-delete-row { display: flex; justify-content: flex-end; margin: 18px 0 4px; }
html body #root .shell .btn.outline.lp-delete:not(#crm-refresh) { background: #fff !important; color: #b42318 !important; -webkit-text-fill-color: #b42318 !important; border: 1.5px solid #b42318 !important; }
html body #root .shell .btn.outline.lp-delete:not(#crm-refresh):hover:not(:disabled) { background: #fef3f2 !important; border-color: #912018 !important; }
html body #root .shell .lp-bin-title { margin: 18px 0 6px; }
html body #root .shell .lp-bin-row .lp-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
html body #root .shell .lp-flag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #fffaeb; color: #93370d; border: 1px solid #fec84b; font-size: 12px; }
@media (max-width: 640px) { html body #root .shell .lp-bin-row { flex-wrap: wrap; gap: 8px; } }
html body #root .shell .terr-flag { color: var(--crm-orange-ink); font-weight: 600; font-size: 12px; }
/* Stage 1 territory selector: modes, scrollable checkbox lists (cities largest first), compact on every width */
html body #root .shell .terr-modes { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--crm-border); border-radius: 999px; background: var(--crm-surface-subtle); justify-self: start; max-width: 100%; }
html body #root .shell .terr-mode { border: 0; background: transparent; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--crm-muted); cursor: pointer; }
html body #root .shell .terr-mode.active { background: var(--crm-surface); color: var(--crm-ink); font-weight: 600; box-shadow: var(--crm-shadow); }
html body #root .shell .terr-list { max-height: 260px; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--crm-border); border-radius: 10px; padding: 6px; background: var(--crm-surface); }
html body #root .shell .terr-list-short { max-height: 200px; }
html body #root .shell .terr-add label.terr-opt { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; cursor: pointer; font-size: 13px; }
html body #root .shell .terr-add label.terr-opt:hover { background: var(--crm-surface-subtle); }
html body #root .shell .terr-add .terr-opt input { padding: 0 !important; margin: 0 !important; width: 16px !important; height: 16px !important; min-height: 0 !important; flex: 0 0 auto; accent-color: var(--crm-orange); }
html body #root .shell .terr-opt span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
html body #root .shell .terr-opt small { color: var(--crm-muted); font-size: 12px; }
html body #root .shell .terr-opt-saved { opacity: .7; cursor: default; }
html body #root .shell .terr-group { margin: 6px 8px 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--crm-muted); }
html body #root .shell .terr-add .terr-check input { flex: 0 0 auto; width: 16px !important; height: 16px !important; min-height: 0 !important; padding: 0 !important; margin: 0 !important; accent-color: var(--crm-orange); }
html body #root .shell .terr-chip button { min-height: 0 !important; }
/* Stage 1 territory map (Part 2) */
html body #root .shell .terr-map-slot { min-height: 120px; }
html body #root .shell .terr-map { height: 440px; width: 100%; border: 1px solid var(--crm-border); border-radius: 12px; overflow: hidden; background: #EEF3F8; }
@media (max-width: 640px) { html body #root .shell .terr-map { height: 340px; } }
html body #root .shell .terr-map-tools { display: flex; flex-wrap: wrap; gap: 6px; }
html body #root .shell .terr-map-tools .terr-tool { min-height: 0 !important; padding: 6px 12px; font-size: 13px; }
html body #root .shell .terr-map-tools .terr-tool.active { border-color: var(--crm-orange); color: var(--crm-orange-ink); background: var(--crm-orange-soft); }
html body #root .shell .terr-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--crm-muted); }
html body #root .shell .terr-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
html body #root .shell .terr-chip-mapsel { border-color: var(--crm-orange-border); }
html body #root .shell .terr-chip-draft { border-color: #C4B5FD; background: #F5F3FF; }
html body #root .shell .terr-warn { margin: 0; padding-left: 18px; font-size: 12px; color: var(--crm-orange-ink); }
html body #root .shell .terr-map .maplibregl-ctrl-attrib { font-size: 10px; }

/* Stage 1 visual territories — geographic areas list (Team → profile → Territories) */
html body #root .shell .area-list { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 6px; }
html body #root .shell .area-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); padding: 8px 10px; background: var(--crm-surface); }
html body #root .shell .area-row > div:first-of-type { display: grid; gap: 2px; min-width: 0; }
html body #root .shell .area-row small { color: var(--crm-muted); font-size: 12px; }
html body #root .shell .area-row.terr-overlap { border-color: var(--crm-orange-border); background: var(--crm-orange-soft); }
html body #root .shell .area-row .terr-flag { color: var(--crm-orange-ink); }
html body #root .shell .area-acts { display: flex; flex-wrap: wrap; gap: 6px; }
html body #root .shell .area-btn { min-height: 0 !important; padding: 4px 10px !important; font-size: 12.5px !important; }
html body #root .shell .area-list, html body #root .shell .area-row, html body #root .shell .area-row > div:first-of-type, html body #root .shell .area-acts { min-width: 0; max-width: 100%; }
html body #root .shell .area-history { flex-basis: 100%; min-width: 0; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
html body #root .shell .area-versions td:nth-child(4) { min-width: 12em; }
html body #root .shell .area-versions { width: 100%; font-size: 12.5px; }
html body #root .shell .terr-legend i.terr-legend-overlap { background: transparent; border: 2px dashed var(--crm-danger); width: 12px; height: 8px; }
@media (max-width: 640px) { html body #root .shell .area-acts { width: 100%; } html body #root .shell .area-btn { flex: 1 1 auto; } }

/* Recycle Bin — bulk actions (select deleted leads, restore / delete permanently through the SQL 013 per-lead functions) */
html body #root .shell .bin-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; margin: 6px 0 10px; border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); background: var(--crm-info-bg); position: sticky; top: 0; z-index: 2; }
html body #root .shell .bin-btn { min-height: 0 !important; padding: 5px 12px !important; font-size: 13px !important; }
html body #root .shell .bin-btn[disabled] { opacity: .45; cursor: not-allowed; }
html body #root .shell .bin-count { font-weight: 700; color: var(--crm-ink); font-size: 13px; margin-right: auto; }
html body #root .shell .lp-bin-row { align-items: center; gap: 10px; }
html body #root .shell .bin-check { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 28px; min-height: 28px; }
html body #root .shell .bin-check input { width: 18px !important; height: 18px !important; min-height: 0 !important; margin: 0; accent-color: var(--crm-orange); cursor: pointer; }
html body #root .shell .bin-main { flex: 1 1 auto; min-width: 0; }
html body #root .shell .lp-bin-row.bin-selected { background: var(--crm-orange-soft); border-radius: var(--crm-radius-sm); }
html body #root .shell .bin-result { border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); padding: 8px 12px; margin: 0 0 10px; background: var(--crm-surface); font-size: 13px; }
html body #root .shell .bin-result p { margin: 2px 0; }
html body #root .shell .bin-result .bin-fail { color: var(--crm-danger); }
html body #root .shell .bin-result .bin-skip { color: var(--crm-orange-ink); }
html body #root .shell .bin-purge-list { max-height: 220px; overflow: auto; }
@media (max-width: 640px) {
  html body #root .shell .bin-bulk { gap: 6px; }
  html body #root .shell .bin-count { flex-basis: 100%; order: -1; margin: 0; }
  html body #root .shell .bin-btn { flex: 1 1 auto; }
  html body #root .shell .lp-bin-row .bin-main { flex-basis: calc(100% - 40px); }
}
/* Recycle Bin: why permanent deletion is blocked (RB-02) */
html body:has(#root .shell) .bin-purge-dialog .bin-tally { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 700; color: var(--crm-ink); }
html body:has(#root .shell) .bin-purge-dialog .bin-tally .bin-skip { color: var(--crm-orange-ink); }
html body:has(#root .shell) .bin-purge-dialog .bin-zero { background: var(--crm-orange-soft); border: 1px solid var(--crm-orange-border); border-radius: var(--crm-radius-sm); padding: 10px 12px; color: var(--crm-orange-ink); }
html body:has(#root .shell) .bin-purge-dialog .bin-why { margin: 10px 0; padding: 8px 12px; border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); background: var(--crm-info-bg); }
html body:has(#root .shell) .bin-purge-dialog .bin-why h4 { margin: 0 0 2px; font-size: 14px; color: var(--crm-ink); }
html body:has(#root .shell) .bin-purge-dialog .bin-why-note { margin: 0 0 4px; font-size: 13px; color: var(--crm-muted); }
html body:has(#root .shell) .bin-purge-dialog .bin-why ul { margin: 0; max-height: 180px; overflow: auto; }
html body:has(#root .shell) .bin-purge-dialog footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 640px) { html body:has(#root .shell) .bin-purge-dialog footer .btn { flex: 1 1 100%; } }
/* Bulk Lead Import (BI-1): selected summary card, clickable preview rows, pagination, view-only detail panel */
html body #root .shell .dashboard-shortcut.import-filter-selected { background: var(--crm-orange-soft) !important; border: 1px solid var(--crm-orange) !important; box-shadow: inset 0 0 0 1px var(--crm-orange) !important; }
html body #root .shell .import-preview-scroll { max-height: none; overflow-x: auto; border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); }
html body #root .shell .import-preview-table { width: 100%; border-collapse: collapse; font-size: 13px; }
html body #root .shell .import-preview-table th { padding: 7px 10px !important; text-align: left; border-bottom: 1.5px solid var(--crm-border); color: var(--crm-ink); font-size: 12.5px; white-space: nowrap; }
html body #root .shell .import-preview-table td { padding: 6px 10px !important; font-size: 13px; line-height: 1.35; border-bottom: 1px solid var(--crm-border); overflow-wrap: anywhere; }
html body #root .shell .import-row { cursor: pointer; }
html body #root .shell .import-row:hover td { background: var(--crm-info-bg); }
html body #root .shell .import-row:focus-visible { outline: 2px solid var(--crm-orange); outline-offset: -2px; }
html body #root .shell .import-showing { margin: 8px 0 6px; }
html body #root .shell .import-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 12px; font-size: 13px; }
html body #root .shell .import-page-size select { margin-left: 6px; min-height: 0 !important; padding: 4px 8px !important; font-size: 13px !important; width: auto !important; }
html body #root .shell .import-page-buttons { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
html body #root .shell .import-page-btn { min-height: 0 !important; min-width: 34px; padding: 5px 10px !important; font-size: 13px !important; }
html body #root .shell .import-page-btn[disabled] { opacity: .45; cursor: not-allowed; }
html body #root .shell .import-page-current { background: var(--crm-orange-soft) !important; border-color: var(--crm-orange) !important; color: var(--crm-orange-ink) !important; -webkit-text-fill-color: var(--crm-orange-ink) !important; font-weight: 700; }
html body #root .shell .import-page-gap { padding: 0 4px; color: var(--crm-muted); }
html body #root .shell .import-stage-note { margin-top: 6px; }
html body:has(#root .shell) .import-detail-dialog { width: min(640px, 100%); max-height: 88vh; overflow: auto; }
html body:has(#root .shell) .import-detail-dialog .import-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 14px; margin: 8px 0; }
html body:has(#root .shell) .import-detail-dialog .import-field { border-bottom: 1px solid var(--crm-border); padding: 4px 0; min-width: 0; }
html body:has(#root .shell) .import-detail-dialog .import-field dt { font-size: 11.5px; color: var(--crm-muted); text-transform: none; }
html body:has(#root .shell) .import-detail-dialog .import-field dd { margin: 2px 0 0; font-size: 13.5px; color: var(--crm-ink); overflow-wrap: anywhere; }
html body:has(#root .shell) .import-detail-dialog .import-field-missing dd { color: var(--crm-orange-ink); font-style: italic; }
html body:has(#root .shell) .import-detail-dialog .import-mapped summary { cursor: pointer; font-size: 13px; color: var(--crm-muted); }
html body:has(#root .shell) .import-detail-dialog footer { display: flex; justify-content: flex-end; margin-top: 10px; }
@media (max-width: 640px) {
  html body #root .shell .import-pager { justify-content: flex-start; }
  html body #root .shell .import-preview-table thead { display: none; }
  html body #root .shell .import-preview-table, html body #root .shell .import-preview-table tbody { display: block; width: 100%; }
  html body #root .shell .import-preview-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 10px; padding: 8px 10px; border-bottom: 1px solid var(--crm-border); }
  html body #root .shell .import-preview-table td { padding: 0 !important; border: 0 !important; min-width: 0; }
  html body #root .shell .import-preview-table td:nth-child(1) { grid-row: 1; grid-column: 1; font-weight: 700; color: var(--crm-ink); }
  html body #root .shell .import-preview-table td:nth-child(5) { grid-row: 1; grid-column: 2; color: var(--crm-muted); font-size: 12px; }
  html body #root .shell .import-preview-table td:nth-child(2), html body #root .shell .import-preview-table td:nth-child(3) { grid-column: 1 / -1; color: var(--crm-muted); font-size: 12.5px; }
  html body #root .shell .import-preview-table td:nth-child(4) { display: none; }
  html body #root .shell .import-preview-table td[colspan] { grid-column: 1 / -1; }
  html body:has(#root .shell) .import-detail-dialog .import-fields { grid-template-columns: 1fr; }
}
/* BI-02: import research progress (opened batch) */
html body #root .shell .imp-intel { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); }
html body #root .shell .imp-intel h4 { margin: 0 0 6px; }
html body #root .shell .imp-intel .btn { min-height: 0 !important; padding: 6px 14px !important; font-size: 13px !important; margin: 4px 6px 4px 0; }
html body #root .shell .imp-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; margin: 12px 0 8px; }
html body #root .shell .imp-stage { border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); padding: 6px 8px; background: var(--crm-surface); }
html body #root .shell .imp-stage b { display: block; font-size: 18px; color: var(--crm-ink); }
html body #root .shell .imp-stage span { font-size: 12px; color: var(--crm-muted); }
html body #root .shell .imp-stage-on.imp-stage-needs_review, html body #root .shell .imp-stage-on.imp-stage-failed { background: var(--crm-orange-soft); border-color: var(--crm-orange-border); }
html body #root .shell .imp-rows summary { cursor: pointer; font-size: 13px; color: var(--crm-ink); font-weight: 600; }
html body #root .shell .imp-rows ul { list-style: none; margin: 6px 0 0; padding: 0; }
html body #root .shell .imp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--crm-border); font-size: 13px; }
html body #root .shell .imp-row-main { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
html body #root .shell .imp-row small { flex-basis: 100%; color: var(--crm-muted); }
html body #root .shell .imp-badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--crm-border); background: var(--crm-info-bg); color: var(--crm-ink); white-space: nowrap; }
html body #root .shell .imp-row-needs_review .imp-badge, html body #root .shell .imp-row-failed .imp-badge { background: var(--crm-orange-soft); border-color: var(--crm-orange-border); color: var(--crm-orange-ink); }
html body #root .shell .imp-row-assigned .imp-badge, html body #root .shell .imp-row-qualified .imp-badge { font-weight: 700; }
html body #root .shell .imp-retry { padding: 3px 10px !important; font-size: 12px !important; }
html body #root .shell .imp-note { color: var(--crm-muted); }
@media (max-width: 640px) {
  html body #root .shell .imp-stages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  html body #root .shell .imp-stage { padding: 4px 6px; }
  html body #root .shell .imp-stage b { font-size: 15px; }
  html body #root .shell .imp-stage span { font-size: 11px; }
}


/* === PERMANENT CRM CARD DESIGN LOCK (docs/CRM-CARD-DESIGN-LOCK.md) ===
   Never paint all KPI cards orange. Orange signifies the actually selected
   filter/disclosure, never merely "clickable", hover, or the first item.
   This stylesheet is scoped to the signed-in CRM and never touches Sabrina. */
html body #root .shell :is(.crm-summary-card,.stat,.dashboard-shortcut,.crm-metric,.task-stat,.vr-stat-card,.mission-funnel-stage,.ai-cards > button) {
  background:var(--crm-surface)!important;
  border:1px solid var(--crm-border)!important;
  border-radius:var(--crm-radius)!important;
}
html body #root .shell :is(.crm-summary-card,.stat,.dashboard-shortcut,.crm-metric,.task-stat,.vr-stat-card,.mission-funnel-stage,.ai-cards > button):is(:hover,:focus-visible):not(.is-selected):not([aria-pressed="true"]):not([aria-expanded="true"]) {
  border-color:var(--crm-border)!important;
}
html body #root .shell :is(.crm-summary-card,.stat,.dashboard-shortcut,.crm-metric,.task-stat,.vr-stat-card,.mission-funnel-stage,.ai-cards > button):is(.is-selected,[aria-pressed="true"],[data-selected="true"]) ,
html body #root .shell .ai-cards > button[aria-expanded="true"] {
  background:var(--crm-orange-soft)!important;
  border:2px solid var(--crm-orange)!important;
}
html body #root .shell :is(.crm-summary-card,.dashboard-shortcut,.crm-metric,.task-stat,.mission-funnel-stage,.ai-cards > button):focus-visible {
  outline:2px solid var(--crm-ink)!important;
  outline-offset:3px!important;
}
/* Bulk Import's pre-existing selected state must obey the same shared tokens. */
html body #root .shell .dashboard-shortcut.import-filter-selected {
  background:var(--crm-orange-soft)!important;
  border:2px solid var(--crm-orange)!important;
  box-shadow:var(--crm-shadow)!important;
}
/* ==========================================================================================================
   CARD-01 — ONE card standard for every summary / KPI / filter card in the CRM (owner request 2026-11-13)
   - Default: white, thin neutral-grey border, same radius, padding and type. Never orange unless SELECTED.
   - Selected: 2 px #FF5A0A border + very light orange background. Driven ONLY by state that reflects the records
     shown: [aria-pressed="true"] (filters), [aria-expanded="true"] (AI Operations detail), .is-selected and the
     existing per-group classes (.import-filter-selected, .vr-stat-card.active, .team-card.selected). Never by hover.
   - Padding drops by 1 px when selected, so the 2 px border never shifts the layout.
   - Focus: a navy ring (distinct from selection). Hover: a slightly darker grey border.
   - .crm-summary-card-static: information only (not focusable, no pointer, no hover).
   - New card groups: add the class `crm-summary-card` (and aria-pressed when it filters). Do not style cards elsewhere.
   - Tests: tests/crm/card-standard.test.mjs
   ========================================================================================================== */
:root {
  --crm-card-bg: var(--crm-surface);
  --crm-card-border: var(--crm-border);
  --crm-card-border-hover: var(--crm-field-border);
  --crm-card-radius: var(--crm-radius);
  --crm-card-pad: 16px;
  --crm-card-selected-border: #FF5A0A;
  --crm-card-selected-bg: var(--crm-orange-soft);
  --crm-card-focus: #1E2A3B;
  --crm-card-value-size: 28px;
  --crm-card-label-size: 13px;
}
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card, .ai-cards > button, .ai-cards > div, .ag-stats > button) {
  background: var(--crm-card-bg) !important; background-image: none !important;
  border: 1px solid var(--crm-card-border) !important; border-radius: var(--crm-card-radius) !important;
  padding: var(--crm-card-pad) !important; box-shadow: var(--crm-shadow) !important; outline: none;
  color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important; transform: none !important; transition: none !important;
}
/* consistent typography: value + label */
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card, .ai-cards > button, .ai-cards > div, .ag-stats > button) > :is(b, strong) {
  font-size: var(--crm-card-value-size) !important; line-height: 1.1 !important; font-weight: 700 !important; color: var(--crm-ink) !important; -webkit-text-fill-color: var(--crm-ink) !important;
}
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .task-stat, .vr-stat-card, .ai-cards > button, .ai-cards > div, .ag-stats > button) > :is(small, span),
html body #root .shell .crm-metric > small {
  font-size: var(--crm-card-label-size) !important; color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important;
}
html body #root .shell .ai-cards > button > span.ai-metric-arrow { color: var(--crm-muted) !important; -webkit-text-fill-color: var(--crm-muted) !important; font-size: 19px !important; }
/* the team member card and pipeline stages keep their own inner layout, but the same border / radius / colours */
html body #root .shell :is(.team-card, .mission-funnel-stage) {
  background: var(--crm-card-bg) !important; border: 1px solid var(--crm-card-border) !important; border-radius: var(--crm-card-radius) !important; box-shadow: var(--crm-shadow) !important; transform: none !important; transition: none !important;
}
/* hover (clickable cards only): neutral, never orange */
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card, .ai-cards > button, .ag-stats > button, .team-card, .mission-funnel-stage):not(.crm-summary-card-static):not([aria-disabled="true"]):not(:disabled):not([aria-pressed="true"]):not([aria-expanded="true"]):not(.is-selected):not(.import-filter-selected):not(.active):not(.selected):hover {
  border-color: var(--crm-card-border-hover) !important; background: var(--crm-card-bg) !important; color: var(--crm-ink) !important;
}
html body #root .shell .ai-cards > button:hover :is(small, b, .ai-metric-arrow) { color: inherit; }
/* SELECTED: reflects the active filter / view only */
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card, .ai-cards > button, .ag-stats > button, .team-card, .mission-funnel-stage):is([aria-pressed="true"], .is-selected, .import-filter-selected, .active, .selected),
html body #root .shell .ai-cards > button[aria-expanded="true"],
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card, .ai-cards > button, .ag-stats > button, .team-card, .mission-funnel-stage):is([aria-pressed="true"], .is-selected, .import-filter-selected, .active, .selected):hover,
html body #root .shell .ai-cards > button[aria-expanded="true"]:hover {
  border: 2px solid var(--crm-card-selected-border) !important; background: var(--crm-card-selected-bg) !important; box-shadow: none !important;
}
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card, .ai-cards > button, .ag-stats > button):is([aria-pressed="true"], .is-selected, .import-filter-selected, .active),
html body #root .shell .ai-cards > button[aria-expanded="true"] { padding: calc(var(--crm-card-pad) - 1px) !important; }
/* keyboard focus: visible and distinct from selection */
html body #root .shell :is(.crm-summary-card, .stat, .dashboard-shortcut, .crm-metric, .task-stat, .vr-stat-card, .ai-cards > button, .ag-stats > button, .team-card, .mission-funnel-stage):focus-visible {
  outline: 2px solid var(--crm-card-focus) !important; outline-offset: 2px !important;
}
/* information-only cards: no pointer, no hover, not focusable (they are <div>s) */
html body #root .shell .crm-summary-card-static { cursor: default !important; }
html body #root .shell :is(.crm-summary-card, .ai-cards > button, .ag-stats > button, .task-stat, .crm-metric, .stat, .vr-stat-card, .team-card, .mission-funnel-stage):not(.crm-summary-card-static) { cursor: pointer; }
/* notes and tables are not cards: neutral outline (the legacy global rule painted them orange) */
html body #root .shell p.kpi { border-color: var(--crm-border) !important; }
html body #root .shell .crm-table-wrap { border-color: var(--crm-border) !important; }
/* the AI Operations detail panel is a panel, not a card: neutral (orange belongs to the selected card only) */
html body #root .shell .ai-metric-detail { border: 1px solid var(--crm-border) !important; background: var(--crm-surface) !important; }
/* TM-01 territory map legend: navigation focus (solid orange outline, light fill), unsaved selection (orange fill, dashed outline), this person's saved territories (outlined) */
html body #root .shell .terr-legend i.terr-legend-focus { background: rgba(255, 90, 10, .12); border: 2px solid #FF5A0A; width: 12px; height: 8px; }
html body #root .shell .terr-legend i.terr-legend-pending { background: rgba(255, 90, 10, .45); border: 2px dashed #FF5A0A; width: 12px; height: 8px; }
html body #root .shell .terr-legend i.terr-legend-mine { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #1F4E79; }
/* TM-02: "Selected states" (draft) directly under "Go to" — compact removable chips in the existing chip style */
html body #root .shell .terr-map-selected { margin: 2px 0 10px; }
html body #root .shell .terr-map-selected-head { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--crm-ink); }
html body #root .shell .terr-map-selected-head small { font-weight: 400; color: var(--crm-muted); }
html body #root .shell .terr-map-selected-empty { margin: 0; }
html body #root .shell .terr-chip-state { border: 1px dashed var(--crm-orange); background: var(--crm-orange-soft); color: var(--crm-orange-ink); padding: 2px 2px 2px 10px; font-size: 13px; }
html body #root .shell .terr-chip-state button { color: var(--crm-orange-ink); }
html body #root .shell .terr-chip-state button:focus-visible { outline: 2px solid var(--crm-ink); outline-offset: 1px; }

/* MI-LAUNCH step D: clinic identity, research review, budget, accuracy (SQL 024 rev 2) */
html body #root .shell .id-section { border: 1px solid var(--crm-border); border-radius: var(--crm-radius); padding: 14px 16px; margin: 0 0 14px; background: var(--crm-surface); }
html body #root .shell .id-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
html body #root .shell .id-head h4 { margin: 0 8px 0 0; }
html body #root .shell .id-badge { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; border: 1px solid; white-space: nowrap; }
html body #root .shell .id-verified { background: #E7F6F1; color: #0E5E4E; border-color: #A9DCCB; }
html body #root .shell .id-unverified { background: #FFF6E5; color: #7A4B00; border-color: #F2CF8C; }
html body #root .shell .id-notfound { background: #FDECEA; color: #8F1D14; border-color: #F3B8B1; }
html body #root .shell .id-pending { background: var(--crm-info-bg); color: var(--crm-ink); border-color: var(--crm-border); }
html body #root .shell .id-expl { margin: 8px 0; padding-left: 18px; color: var(--crm-ink); }
html body #root .shell .id-dup { background: var(--crm-orange-soft); border: 1px solid var(--crm-orange-border); color: var(--crm-orange-ink); border-radius: var(--crm-radius-sm); padding: 8px 12px; margin: 8px 0; }
html body #root .shell .id-counts { list-style: none; margin: 6px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
html body #root .shell .id-counts li { border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
html body #root .shell .id-counts li span, html body #root .shell .id-counts li small { color: var(--crm-muted); font-size: 12px; }
html body #root .shell .id-history { margin: 10px 0; }
html body #root .shell .id-history ul { list-style: none; padding: 0; margin: 8px 0; }
html body #root .shell .id-history > ul > li { border-top: 1px solid var(--crm-border); padding: 8px 0; }
html body #root .shell .id-sources, html body #root .shell .rr-run, html body #root .shell .rr-prov { font-size: 12px; color: var(--crm-muted); overflow-wrap: anywhere; }
html body #root .shell .id-tester { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; margin-top: 12px; padding: 12px; border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); background: var(--crm-surface-subtle); }
html body #root .shell .id-tester label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--crm-muted); min-width: 0; }
html body #root .shell .rr-budget { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 12px; }
html body #root .shell .rr-budget > div { border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); padding: 10px 12px; background: var(--crm-surface); }
html body #root .shell .rr-budget b { display: block; font-size: 20px; color: var(--crm-ink); }
html body #root .shell .rr-budget span { font-size: 12px; color: var(--crm-muted); }
html body #root .shell .rr-budget p { grid-column: 1 / -1; margin: 0; }
html body #root .shell .acc-list { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
html body #root .shell .acc-list li { border: 1px solid var(--crm-border); border-radius: var(--crm-radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
html body #root .shell .acc-list li b { font-size: 22px; color: var(--crm-ink); }
html body #root .shell .acc-list li span, html body #root .shell .acc-list li small { font-size: 12px; color: var(--crm-muted); }
html body #root .shell .acc-list li.acc-met { border-color: #A9DCCB; }
html body #root .shell .acc-list li.acc-miss { border-color: #F3B8B1; background: #FFF8F7; }
html body #root .shell .rr-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
html body #root .shell .rr-card { border: 1px solid var(--crm-card-border); border-radius: var(--crm-card-radius); background: var(--crm-card-bg); padding: 12px 14px; }
html body #root .shell .rr-card.selected { border-color: var(--crm-card-selected-border); background: var(--crm-card-selected-bg); }
html body #root .shell .rr-select { all: unset; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
html body #root .shell .rr-select:focus-visible { outline: 2px solid var(--crm-card-focus); outline-offset: 3px; border-radius: 6px; }
html body #root .shell .rr-title { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; color: var(--crm-ink); }
html body #root .shell .rr-decide { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
html body #root .shell .rr-decide label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--crm-muted); }
html body #root .shell .rr-decide textarea { min-height: 64px; width: 100%; box-sizing: border-box; }
html body #root .shell .rr-actions { display: flex; flex-wrap: wrap; gap: 8px; }
