/* ============================================================
   Editorial Precision — Addepar × Linear visual system
   Gated behind body.ep-theme (set by ap-editorial-precision-boot.js
   only when ?ui=ep / localStorage.ap_ui_ep==='1'). Flag OFF = zero effect.
   Milestone 1: design tokens + app shell (top-nav). Research (M2) and
   briefing (M3) component styles land with their renderer forks.
   ============================================================ */

body.ep-theme{
  /* surface */
  --ep-canvas:#F3F5F8; --ep-canvas-2:#EEF1F6; --ep-card:#FFFFFF;
  /* ink */
  --ep-ink:#0D1626; --ep-body:#293341; --ep-navy:#1B2A52; --ep-navy-600:#243A6E;
  --ep-muted:#586273; --ep-muted-2:#828D9E;
  /* lines */
  --ep-field-border:#CDD5E0; --ep-line:#E1E5EC; --ep-line-2:#EDEFF4;
  /* accents (sparse) */
  --ep-red:#B22234; --ep-red-ink:#971826; --ep-red-tint:#FBECEE;
  --ep-gold:#9A7B43; --ep-green:#1E7A52; --ep-blue:#1E3A8A;
  /* radii + shadow */
  --ep-r:10px; --ep-r-lg:14px; --ep-r-sm:8px;
  --ep-sh-sm:0 1px 2px rgba(13,22,38,.06);
  --ep-sh:0 8px 26px -14px rgba(13,22,38,.20), 0 1px 2px rgba(13,22,38,.05);
  --ep-sh-lg:0 26px 56px -30px rgba(13,22,38,.30);
  /* type */
  --ep-sans:'Inter',system-ui,-apple-system,sans-serif;
  --ep-serif:'Newsreader',Georgia,serif;
  --ep-mono:'IBM Plex Mono',ui-monospace,monospace;
  /* shell metrics */
  --ep-nav-h:64px;
}

/* paint the canvas early (html gets ep-theme in the boot script head pass) */
html.ep-theme{ background:#F3F5F8; }
body.ep-theme{
  background:var(--ep-canvas) !important;
  font-family:var(--ep-sans);
  color:var(--ep-body);
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
}

/* ---------- hide the legacy left sidebar; reclaim the main column ---------- */
body.ep-theme .sidebar{ display:none !important; }
body.ep-theme .main{
  margin-left:0 !important;
  padding-top:var(--ep-nav-h) !important;   /* clear the fixed top-nav */
  background:var(--ep-canvas) !important;
}

/* ============ EP TOP NAV (injected by boot script) ============ */
#epTopnav{
  position:fixed; top:0; left:0; right:0; height:var(--ep-nav-h); z-index:1200;
  display:flex; align-items:center; gap:28px; padding:0 34px;
  background:var(--ep-card); border-bottom:1px solid var(--ep-line);
  font-family:var(--ep-sans);
}
/* editorial red signature rule across the very top edge */
#epTopnav::before{
  content:""; position:absolute; left:0; top:0; height:3px; width:100%;
  background:linear-gradient(90deg,var(--ep-red) 0,var(--ep-red) 120px,var(--ep-navy) 120px);
}
#epTopnav .ep-brand{ display:flex; align-items:center; gap:10px; text-decoration:none; }
#epTopnav .ep-mark{
  width:28px; height:28px; border-radius:7px; flex:none; position:relative;
  background:linear-gradient(150deg,var(--ep-navy),#0D1730);
}
#epTopnav .ep-mark::after{
  content:""; position:absolute; left:6.5px; top:6.5px; width:6.5px; height:6.5px;
  border-radius:50%; background:var(--ep-red); box-shadow:0 0 0 3px rgba(178,34,52,.2);
}
#epTopnav .ep-wm{ font-family:var(--ep-serif); font-size:18px; font-weight:600; letter-spacing:-.01em; color:var(--ep-ink); }
#epTopnav .ep-wm b{ color:var(--ep-navy); font-weight:600; }

#epTopnav .ep-nav{ display:flex; align-items:center; gap:2px; height:100%; }
#epTopnav .ep-nav a,
#epTopnav .ep-nav button{
  position:relative; display:inline-flex; align-items:center; height:100%;
  border:0; background:transparent; cursor:pointer;
  font-family:var(--ep-sans); font-size:14px; font-weight:500; color:var(--ep-body);
  text-decoration:none; padding:0 13px; transition:color .14s ease;
}
#epTopnav .ep-nav a:hover,
#epTopnav .ep-nav button:hover{ color:var(--ep-ink); }
#epTopnav .ep-nav a.active{ color:var(--ep-navy); font-weight:600; }
#epTopnav .ep-nav a.active::after{
  content:""; position:absolute; left:13px; right:13px; bottom:-1px; height:2px;
  background:var(--ep-red); border-radius:2px 2px 0 0;
}
#epTopnav .ep-nav .ep-caret{ font-size:10px; margin-left:5px; opacity:.6; }

/* dropdown (Discover) + account menu */
#epTopnav .ep-dd{ position:relative; height:100%; display:flex; align-items:center; }
#epTopnav .ep-dd-panel{
  position:absolute; top:calc(100% - 6px); left:0; min-width:212px;
  background:var(--ep-card); border:1px solid var(--ep-line); border-radius:var(--ep-r);
  box-shadow:var(--ep-sh); padding:7px; display:none; flex-direction:column; gap:1px;
}
#epTopnav .ep-dd.open .ep-dd-panel{ display:flex; }
#epTopnav .ep-dd-panel a{
  height:auto; padding:9px 11px; border-radius:var(--ep-r-sm); font-size:13.5px; color:var(--ep-body);
}
#epTopnav .ep-dd-panel a:hover{ background:var(--ep-canvas-2); color:var(--ep-ink); }

#epTopnav .ep-right{ margin-left:auto; display:flex; align-items:center; gap:18px; }
#epTopnav .ep-cycle{ display:flex; align-items:center; gap:13px; font-family:var(--ep-mono); font-size:11.5px; color:var(--ep-body); }
#epTopnav .ep-cycle b{ color:var(--ep-ink); }
#epTopnav .ep-cycle .ep-dot{ width:6px; height:6px; border-radius:50%; background:var(--ep-red); display:inline-block; margin-right:6px; }
#epTopnav .ep-acct{ position:relative; }
#epTopnav .ep-av{
  width:34px; height:34px; border-radius:50%; cursor:pointer;
  background:var(--ep-canvas); border:1px solid var(--ep-line);
  display:grid; place-items:center; font-size:12.5px; font-weight:700; color:var(--ep-navy);
}
#epTopnav .ep-acct-menu{
  position:absolute; top:calc(100% + 8px); right:0; min-width:188px;
  background:var(--ep-card); border:1px solid var(--ep-line); border-radius:var(--ep-r);
  box-shadow:var(--ep-sh); padding:7px; display:none; flex-direction:column; gap:1px;
}
#epTopnav .ep-acct.open .ep-acct-menu{ display:flex; }
#epTopnav .ep-acct-menu a,
#epTopnav .ep-acct-menu button{
  height:auto; width:100%; justify-content:flex-start; text-align:left;
  padding:9px 11px; border-radius:var(--ep-r-sm); font-size:13.5px; color:var(--ep-body);
}
#epTopnav .ep-acct-menu a:hover,
#epTopnav .ep-acct-menu button:hover{ background:var(--ep-canvas-2); color:var(--ep-ink); }
#epTopnav .ep-acct-menu .ep-sep{ height:1px; background:var(--ep-line); margin:5px 4px; }
#epTopnav .ep-acct-menu .ep-signout{ color:var(--ep-red-ink); }

/* ---------- restyle the legacy contextual header to sit under the top-nav ---------- */
body.ep-theme .page-header{
  background:var(--ep-card) !important;
  border-bottom:1px solid var(--ep-line) !important;
  box-shadow:none !important;
  padding:11px 34px !important;
}
body.ep-theme .page-header #pageTitle{
  font-family:var(--ep-serif) !important; color:var(--ep-ink) !important; font-weight:600 !important;
  letter-spacing:-.01em !important;
}
/* avoid duplicate chrome: top-nav already carries identity + counters */
body.ep-theme .page-header .topbar-clock,
body.ep-theme .page-header .topbar-user{ display:none !important; }
body.ep-theme .page-header .global-search{
  background:var(--ep-canvas) !important; border:1px solid var(--ep-field-border) !important;
  border-radius:var(--ep-r-sm) !important; color:var(--ep-ink) !important;
}
body.ep-theme .page-header .back-btn,
body.ep-theme .page-header .refresh-btn{
  background:var(--ep-card) !important; border:1px solid var(--ep-field-border) !important;
  border-radius:var(--ep-r-sm) !important; color:var(--ep-navy) !important; box-shadow:none !important;
}

/* ---------- shared EP primitives ---------- */
body.ep-theme .ep-wrap{ max-width:1120px; margin:0 auto; padding:40px 34px 80px; }
body.ep-theme .ep-btn{
  display:inline-flex; align-items:center; justify-content:center; gap:9px; min-height:44px;
  border:1px solid var(--ep-field-border); background:var(--ep-card); color:var(--ep-navy);
  font-family:var(--ep-sans); font-size:14px; font-weight:600; padding:11px 18px;
  border-radius:var(--ep-r-sm); cursor:pointer; text-decoration:none;
  transition:border-color .14s ease, background .14s ease, transform .14s ease;
}
body.ep-theme .ep-btn:hover{ border-color:var(--ep-navy); background:#FAFBFD; }
body.ep-theme .ep-btn.primary{ background:var(--ep-navy); color:#fff; border-color:var(--ep-navy); box-shadow:0 12px 26px -16px rgba(27,42,82,.55); }
body.ep-theme .ep-btn.primary:hover{ background:var(--ep-navy-600); transform:translateY(-1px); }
body.ep-theme .ep-btn:focus-visible{ outline:2px solid var(--ep-red); outline-offset:2px; }

/* Discover dropdown button active state (when on a discover sub-section) */
#epTopnav .ep-dd > button.active{ color:var(--ep-navy); font-weight:600; }
#epTopnav .ep-dd > button.active::after{ content:""; position:absolute; left:13px; right:24px; bottom:-1px; height:2px; background:var(--ep-red); border-radius:2px 2px 0 0; }

/* burger + mobile menu — hidden on desktop */
#epTopnav .ep-burger{ display:none; }
#epTopnav .ep-mobile-menu{ display:none; }

/* ---------- responsive ---------- */
@media (max-width:860px){
  #epTopnav{ gap:12px; padding:0 16px; }
  /* desktop horizontal nav + cycle counters hidden; navigation moves to the burger menu */
  #epTopnav .ep-nav{ display:none; }
  #epTopnav .ep-cycle{ display:none; }
  #epTopnav .ep-burger{
    display:inline-flex; flex-direction:column; justify-content:center; gap:4px;
    width:40px; height:38px; padding:0 9px; cursor:pointer;
    border:1px solid var(--ep-line); border-radius:var(--ep-r-sm); background:var(--ep-card);
  }
  #epTopnav .ep-burger span{ display:block; height:2px; background:var(--ep-navy); border-radius:2px; }
  #epTopnav.ep-mm-open .ep-mobile-menu{
    display:flex; flex-direction:column; gap:1px;
    position:fixed; top:var(--ep-nav-h); left:0; right:0;
    max-height:calc(100vh - var(--ep-nav-h)); overflow-y:auto; z-index:1199;
    background:var(--ep-card); border-bottom:1px solid var(--ep-line);
    box-shadow:var(--ep-sh); padding:8px 12px 18px;
  }
  #epTopnav .ep-mobile-menu .ep-mm-h{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.16em; text-transform:uppercase; color:var(--ep-muted-2); padding:13px 10px 5px; }
  #epTopnav .ep-mobile-menu a{ display:block; padding:12px; border-radius:var(--ep-r-sm); color:var(--ep-body); text-decoration:none; font-size:15px; font-weight:500; height:auto; }
  #epTopnav .ep-mobile-menu a::after{ display:none; }
  #epTopnav .ep-mobile-menu a.active{ background:var(--ep-navy); color:#fff; }
  #epTopnav .ep-mm-signout{ margin-top:8px; padding:12px; border:0; border-top:1px solid var(--ep-line); background:transparent; text-align:left; color:var(--ep-red-ink); font-weight:600; font-size:15px; cursor:pointer; }
  body.ep-theme .ep-wrap{ padding:24px 16px 70px; }
}

@media (prefers-reduced-motion: reduce){
  body.ep-theme *{ transition:none !important; }
}

/* ============================================================
   M2 — Research intake (Editorial Precision)
   Restyles the existing amx research markup into the EP intake panel and
   adds the two-column grid + Subject Briefing rail (rail injected by JS).
   All selectors scoped to body.ep-theme; reuses existing ids untouched.
   ============================================================ */

/* page frame — only when the research view is mounted */
body.ep-theme #content.ep-research-view{ max-width:1120px; margin:0 auto; padding:38px 34px 80px; }

/* masthead → editorial serif */
body.ep-theme .amx-research-masthead h1{ font-family:var(--ep-serif) !important; font-size:44px !important; font-weight:600 !important; letter-spacing:-.02em !important; color:var(--ep-ink) !important; }
body.ep-theme .amx-research-masthead .sub{ color:var(--ep-body) !important; font-size:16.5px !important; }
body.ep-theme .amx-research-masthead .amx-eyebrow{ font-family:var(--ep-mono) !important; color:var(--ep-navy) !important; }
body.ep-theme .amx-research-masthead .amx-eyebrow .accent{ color:var(--ep-red-ink) !important; }

/* two-column grid (wrapper inserted by JS) */
body.ep-theme .ep-research-grid{ display:grid; grid-template-columns:minmax(0,1fr) 372px; gap:26px; align-items:start; }

/* the workbench card → EP intake panel */
body.ep-theme .amx-research-workbench{
  background:var(--ep-card) !important; border:1px solid var(--ep-line) !important;
  border-radius:var(--ep-r-lg) !important; box-shadow:var(--ep-sh) !important;
  padding:26px !important; overflow:visible !important;
}
body.ep-theme .amx-research-workbench::before{ display:none !important; } /* drop amx accent stripe */

/* subject field */
body.ep-theme .amx-act1-hero .amx-act1-q,
body.ep-theme #researchNameLabel{ font-family:var(--ep-serif) !important; font-size:23px !important; font-weight:600 !important; color:var(--ep-ink) !important; letter-spacing:-.01em !important; }
body.ep-theme .amx-act1-name,
body.ep-theme #researchName{
  border:1px solid var(--ep-field-border) !important; border-radius:var(--ep-r-sm) !important;
  font-size:18px !important; font-weight:500 !important; padding:14px 15px !important;
  color:var(--ep-ink) !important; background:#fff !important;
}
body.ep-theme #researchName:focus{ border-color:var(--ep-navy) !important; box-shadow:0 0 0 3px rgba(27,42,82,.1) !important; outline:0 !important; }
body.ep-theme .amx-act1-hint{ color:var(--ep-muted) !important; font-size:12.5px !important; }

/* ALL anchor fields visible — force the <details> open, hide the toggle */
body.ep-theme details.amx-anchors > summary{ display:none !important; }
body.ep-theme details.amx-anchors > .amx-anchors-body,
body.ep-theme details.amx-anchors[open] > .amx-anchors-body{ display:block !important; }
body.ep-theme .amx-anchors{ margin-top:20px !important; padding-top:18px !important; border-top:1px solid var(--ep-line-2) !important; }
body.ep-theme .amx-anchors::before{
  content:"Anchors — optional, each one improves accuracy"; display:block;
  font-family:var(--ep-mono); font-size:10.5px; letter-spacing:.13em; text-transform:uppercase;
  color:var(--ep-navy); font-weight:600; margin-bottom:14px;
}
body.ep-theme .amx-anchors-grid{ display:grid !important; grid-template-columns:1fr 1fr !important; gap:15px 16px !important; margin-bottom:15px !important; }
body.ep-theme .amx-anchors-grid.amx-single{ grid-template-columns:1fr !important; }
body.ep-theme .amx-fld-label{ font-size:12.5px !important; font-weight:600 !important; color:var(--ep-navy) !important; }
body.ep-theme .amx-fld{
  border:1px solid var(--ep-field-border) !important; border-radius:var(--ep-r-sm) !important;
  font-size:14.5px !important; padding:11px 13px !important; color:var(--ep-ink) !important; background:#fff !important;
}
body.ep-theme .amx-fld:focus{ border-color:var(--ep-navy) !important; box-shadow:0 0 0 3px rgba(27,42,82,.1) !important; outline:0 !important; }

/* notes panel */
body.ep-theme .amx-research-context{
  background:var(--ep-canvas) !important; border:1px solid var(--ep-line) !important;
  border-radius:var(--ep-r) !important; padding:16px 18px !important; margin-top:6px !important;
}
body.ep-theme .amx-research-context label{ color:var(--ep-navy) !important; }
body.ep-theme #researchNotes{
  border:1px solid var(--ep-field-border) !important; border-radius:var(--ep-r-sm) !important;
  background:#fff !important; color:var(--ep-ink) !important; font-size:13.5px !important;
}
body.ep-theme #researchNotes:focus{ border-color:var(--ep-navy) !important; box-shadow:0 0 0 3px rgba(27,42,82,.1) !important; outline:0 !important; }

/* quota row → quiet */
body.ep-theme #researchQuotaRow{ background:#fff !important; border:1px solid var(--ep-line) !important; border-radius:var(--ep-r-sm) !important; box-shadow:var(--ep-sh-sm) !important; }

/* research depth */
body.ep-theme .amx-research-depth{ margin-top:24px !important; padding-top:22px !important; border-top:1px solid var(--ep-line-2) !important; }
body.ep-theme .amx-research-depth-head label{ font-family:var(--ep-mono) !important; font-size:10.5px !important; letter-spacing:.14em !important; text-transform:uppercase !important; color:var(--ep-navy) !important; font-weight:600 !important; }
body.ep-theme .amx-tier-grid{ grid-template-columns:1fr 1fr !important; gap:13px !important; }
body.ep-theme .amx-tier-card{
  border:1px solid var(--ep-field-border) !important; border-radius:var(--ep-r-lg) !important;
  box-shadow:var(--ep-sh-sm) !important; padding:18px 20px !important; min-height:90px !important;
}
body.ep-theme .amx-tier-card [data-tier-title]{ font-family:var(--ep-serif) !important; }
body.ep-theme #researchTierExplainer{ background:#fff !important; border-left-color:var(--ep-navy) !important; box-shadow:var(--ep-sh-sm) !important; }

/* run button */
body.ep-theme #researchBtn{
  background:var(--ep-navy) !important; border:1px solid var(--ep-navy) !important;
  border-radius:var(--ep-r) !important; min-height:46px !important; padding:13px 26px !important;
  box-shadow:0 14px 28px -16px rgba(27,42,82,.6) !important; font-weight:600 !important;
}
body.ep-theme #researchBtn:hover{ background:var(--ep-navy-600) !important; }

/* ---------- Subject Briefing rail (injected) ---------- */
body.ep-theme .ep-dossier{
  position:sticky; top:calc(var(--ep-nav-h) + 60px);
  background:linear-gradient(180deg,#13213F,#0D1730); color:#fff;
  border-radius:var(--ep-r-lg); overflow:hidden; box-shadow:var(--ep-sh-lg);
  border:1px solid rgba(255,255,255,.06);
}
body.ep-theme .ep-dossier::before{
  content:""; position:absolute; inset:0; opacity:.5; pointer-events:none;
  background-image:
    repeating-radial-gradient(circle at 86% -8%, rgba(255,255,255,.05) 0 1px, transparent 1px 9px),
    repeating-radial-gradient(circle at 10% 110%, rgba(178,34,52,.06) 0 1px, transparent 1px 11px);
  -webkit-mask-image:linear-gradient(180deg,#000,transparent 80%); mask-image:linear-gradient(180deg,#000,transparent 80%);
}
body.ep-theme .ep-dossier > *{ position:relative; }
body.ep-theme .ep-dos-tab{ display:flex; align-items:center; justify-content:space-between; padding:14px 20px; border-bottom:1px solid rgba(255,255,255,.08); }
body.ep-theme .ep-dos-tab .lab{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.2em; text-transform:uppercase; color:rgba(255,255,255,.62); }
body.ep-theme .ep-dos-tab .case{ font-family:var(--ep-mono); font-size:10px; color:var(--ep-gold); letter-spacing:.08em; }
body.ep-theme .ep-dos-body{ padding:20px; }
body.ep-theme .ep-dos-name{ font-family:var(--ep-serif); font-size:24px; font-weight:600; letter-spacing:-.01em; line-height:1.1; color:#fff; }
body.ep-theme .ep-dos-name.empty{ color:rgba(255,255,255,.4); font-style:italic; font-size:19px; }
body.ep-theme .ep-dos-sub{ font-size:12.5px; color:rgba(255,255,255,.66); margin-top:5px; min-height:16px; }
body.ep-theme .ep-readiness{ margin:20px 0 6px; }
body.ep-theme .ep-readiness .rhead{ display:flex; align-items:baseline; justify-content:space-between; margin-bottom:8px; }
body.ep-theme .ep-readiness .rk{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:rgba(255,255,255,.55); }
body.ep-theme .ep-readiness .rv{ font-family:var(--ep-serif); font-size:15px; font-weight:600; color:#fff; }
body.ep-theme .ep-meter{ display:flex; gap:4px; }
body.ep-theme .ep-meter i{ flex:1; height:6px; border-radius:3px; background:rgba(255,255,255,.12); transition:background .2s ease; }
body.ep-theme .ep-meter i.on{ background:linear-gradient(90deg,var(--ep-red),#D9534F); }
body.ep-theme .ep-readiness .rnote{ font-size:11.5px; color:rgba(255,255,255,.55); margin-top:9px; line-height:1.5; }
body.ep-theme .ep-readiness .rnote b{ color:#fff; }
body.ep-theme .ep-anchorlist{ margin-top:18px; border-top:1px solid rgba(255,255,255,.08); padding-top:16px; }
body.ep-theme .ep-anchorlist .alh{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:rgba(255,255,255,.55); margin-bottom:11px; }
body.ep-theme .ep-arow{ display:flex; align-items:center; gap:10px; padding:5px 0; font-size:13px; }
body.ep-theme .ep-arow .ck{ width:17px; height:17px; border-radius:50%; flex:none; display:grid; place-items:center; font-size:10px; transition:background .2s ease, border-color .2s ease; }
body.ep-theme .ep-arow.on .ck{ background:rgba(178,34,52,.95); color:#fff; }
body.ep-theme .ep-arow.off .ck{ border:1.5px solid rgba(255,255,255,.22); }
body.ep-theme .ep-arow.on .at{ color:#fff; }
body.ep-theme .ep-arow.off .at{ color:rgba(255,255,255,.45); }
body.ep-theme .ep-arow .av{ margin-left:auto; font-family:var(--ep-mono); font-size:11px; color:rgba(255,255,255,.7); max-width:168px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
body.ep-theme .ep-sources{ margin-top:18px; border-top:1px solid rgba(255,255,255,.08); padding-top:15px; display:flex; gap:11px; align-items:flex-start; }
body.ep-theme .ep-sources .si{ width:26px; height:26px; border-radius:6px; flex:none; background:rgba(154,123,67,.16); border:1px solid rgba(154,123,67,.4); display:grid; place-items:center; color:var(--ep-gold); font-size:13px; }
body.ep-theme .ep-sources .st{ font-size:11.5px; color:rgba(255,255,255,.66); line-height:1.5; }
body.ep-theme .ep-sources .st b{ color:#fff; font-weight:600; }

@media (max-width:960px){
  body.ep-theme .ep-research-grid{ grid-template-columns:1fr; }
  body.ep-theme .ep-dossier{ position:static; }
  body.ep-theme .amx-anchors-grid{ grid-template-columns:1fr !important; }
  body.ep-theme .amx-tier-grid{ grid-template-columns:1fr !important; }
}

/* ============================================================
   M3 — Briefing output (Editorial Precision)
   Emitted by the EP branch in ap-bloomberg-briefing.js (container carries
   both .ap-brief-v2 and .ep-doc). All scoped to body.ep-theme.
   ============================================================ */

/* hide the redundant profile hero chrome above the EP briefing (the default
   renderer did this via a <style> block we skip on the EP branch) */
body.ep-theme:has(.ep-doc) .detail-header-card .fit-score-badge,
body.ep-theme:has(.ep-doc) .detail-header-card .tier-pill,
body.ep-theme:has(.ep-doc) .ai-profile-header,
body.ep-theme:has(.ep-doc) #advisorMatchArea{ display:none !important; }

body.ep-theme .ep-doc{
  background:var(--ep-card); border:1px solid var(--ep-line); border-radius:var(--ep-r-lg);
  box-shadow:var(--ep-sh); overflow:hidden; margin-bottom:20px; font-family:var(--ep-sans);
}
/* header */
body.ep-theme .ep-doc-head{ position:relative; padding:28px 32px 24px; border-bottom:1px solid var(--ep-line-2); }
body.ep-theme .ep-doc-head::before{ content:""; position:absolute; left:0; top:0; right:0; height:3px; background:linear-gradient(90deg,var(--ep-navy) 0,var(--ep-navy) 60%,var(--ep-red) 60%); }
body.ep-theme .ep-ticker{ font-family:var(--ep-mono); font-size:11.5px; letter-spacing:.12em; color:var(--ep-red-ink); font-weight:600; margin-bottom:9px; }
body.ep-theme .ep-doc-name{ font-family:var(--ep-serif); font-size:36px; font-weight:600; letter-spacing:-.02em; color:var(--ep-ink); line-height:1.05; }
body.ep-theme .ep-doc-sub{ font-size:13.5px; color:var(--ep-muted); margin-top:6px; font-weight:500; }
body.ep-theme .ep-doc-meta{ position:absolute; top:26px; right:32px; text-align:right; }
body.ep-theme .ep-status{ display:inline-flex; align-items:center; gap:7px; font-family:var(--ep-mono); font-size:10.5px; letter-spacing:.12em; text-transform:uppercase; color:var(--ep-green); font-weight:600; }
body.ep-theme .ep-status .d{ width:7px; height:7px; border-radius:50%; background:var(--ep-green); box-shadow:0 0 0 3px rgba(30,122,82,.16); }
body.ep-theme .ep-doc-stamp{ font-family:var(--ep-mono); font-size:10.5px; color:var(--ep-muted); margin-top:8px; letter-spacing:.04em; }
/* metrics */
body.ep-theme .ep-metrics{ display:grid; grid-template-columns:repeat(4,1fr); border-bottom:1px solid var(--ep-line-2); }
body.ep-theme .ep-metric{ padding:18px 22px; border-right:1px solid var(--ep-line-2); min-width:0; }
body.ep-theme .ep-metric:last-child{ border-right:0; }
body.ep-theme .ep-metric .k{ font-family:var(--ep-mono); font-size:9.5px; letter-spacing:.13em; text-transform:uppercase; color:var(--ep-muted); margin-bottom:8px; }
body.ep-theme .ep-metric .v{ font-family:var(--ep-serif); font-size:26px; font-weight:600; color:var(--ep-ink); line-height:1.05; letter-spacing:-.01em; word-break:break-word; }
body.ep-theme .ep-metric .v.sm{ font-size:18px; }
body.ep-theme .ep-metric .sub{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.06em; color:var(--ep-muted); margin-top:5px; text-transform:uppercase; }
body.ep-theme .ep-metric .tag{ display:inline-block; font-family:var(--ep-mono); font-size:9px; letter-spacing:.08em; text-transform:uppercase; font-weight:600; padding:2px 7px; border-radius:999px; margin-left:7px; vertical-align:middle; background:var(--ep-red-tint); color:var(--ep-red-ink); }
/* body grid */
body.ep-theme .ep-doc-body{ display:grid; grid-template-columns:minmax(0,1fr) 268px; }
body.ep-theme .ep-narr{ padding:30px 32px; border-right:1px solid var(--ep-line-2); min-width:0; }
/* fit reason */
body.ep-theme .ep-fitreason{ display:flex; gap:13px; align-items:flex-start; background:var(--ep-red-tint); border-radius:var(--ep-r); padding:14px 16px; margin-bottom:26px; }
body.ep-theme .ep-fitreason .fi{ font-family:var(--ep-serif); font-size:20px; color:var(--ep-red-ink); line-height:1; }
body.ep-theme .ep-fitreason .ft{ font-size:13.5px; color:var(--ep-ink); line-height:1.55; }
/* contact directory */
body.ep-theme .ep-contact{ border:1px solid var(--ep-line); border-radius:var(--ep-r); background:var(--ep-canvas); padding:16px 18px; margin-bottom:26px; }
body.ep-theme .ep-contact-h{ display:flex; align-items:center; gap:8px; font-family:var(--ep-mono); font-size:10px; letter-spacing:.14em; text-transform:uppercase; color:var(--ep-navy); font-weight:600; margin-bottom:12px; padding-bottom:9px; border-bottom:1px solid var(--ep-line); }
body.ep-theme .ep-cslot{ padding:6px 0; }
body.ep-theme .ep-cslot.relative{ padding-left:14px; border-left:2px solid var(--ep-line); margin:8px 0 0 2px; }
body.ep-theme .ep-cslot-head{ display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:6px; }
body.ep-theme .ep-cslot-head .nm{ font-size:14px; font-weight:700; color:var(--ep-ink); }
body.ep-theme .ep-cslot-head .tag{ font-family:var(--ep-mono); font-size:9px; letter-spacing:.14em; color:var(--ep-muted); text-transform:uppercase; font-weight:600; }
body.ep-theme .ep-crow{ display:grid; grid-template-columns:96px 1fr; gap:10px; padding:3px 0; font-size:13px; line-height:1.55; }
body.ep-theme .ep-crow .cl{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.1em; text-transform:uppercase; color:var(--ep-muted); font-weight:600; }
body.ep-theme .ep-crow .cv{ color:var(--ep-ink); word-break:break-word; }
body.ep-theme .ep-cdiv{ height:1px; background:var(--ep-line); margin:8px 0; }
/* narrative */
body.ep-theme .ep-nsec{ margin-bottom:26px; }
body.ep-theme .ep-nsec-h{ font-family:var(--ep-mono); font-size:10.5px; letter-spacing:.14em; text-transform:uppercase; color:var(--ep-navy); font-weight:600; margin-bottom:10px; padding-bottom:6px; border-bottom:1px solid var(--ep-line); }
body.ep-theme .ep-nsec p{ font-family:var(--ep-serif); font-size:16.5px; line-height:1.62; color:#1E2733; margin:0 0 11px; }
body.ep-theme .ep-nsec p .src{ font-family:var(--ep-mono); font-size:10px; color:var(--ep-muted); vertical-align:super; }
/* backing */
body.ep-theme .ep-backing{ border-top:1px solid var(--ep-line-2); margin-top:26px; padding-top:22px; }
body.ep-theme .ep-backing > summary{ font-family:var(--ep-mono); font-size:10.5px; letter-spacing:.13em; text-transform:uppercase; color:var(--ep-navy); font-weight:600; cursor:pointer; list-style:none; }
body.ep-theme .ep-backing > summary::-webkit-details-marker{ display:none; }
body.ep-theme .ep-ki-h{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.13em; text-transform:uppercase; color:var(--ep-navy); font-weight:600; margin:20px 0 4px; }
body.ep-theme .ep-ki-row{ display:flex; gap:13px; padding:10px 0; border-top:1px solid var(--ep-line-2); }
body.ep-theme .ep-ki-row .n{ font-family:var(--ep-mono); font-size:11px; color:var(--ep-red-ink); font-weight:600; flex:none; padding-top:2px; }
body.ep-theme .ep-ki-row .kt{ font-size:13.5px; line-height:1.5; color:var(--ep-body); }
body.ep-theme .ep-approach{ margin-top:22px; background:var(--ep-canvas); border:1px solid var(--ep-line); border-left:3px solid var(--ep-navy); border-radius:var(--ep-r); padding:16px 18px; }
body.ep-theme .ep-approach .ah{ font-family:var(--ep-mono); font-size:10px; letter-spacing:.13em; text-transform:uppercase; color:var(--ep-navy); font-weight:600; margin-bottom:8px; }
body.ep-theme .ep-approach .at{ font-size:15px; font-weight:700; color:var(--ep-ink); margin-bottom:7px; }
body.ep-theme .ep-approach p{ font-family:var(--ep-serif); font-size:15px; line-height:1.55; color:#1E2733; }
body.ep-theme .ep-approach .pill{ display:inline-block; font-family:var(--ep-mono); font-size:9px; letter-spacing:.06em; background:var(--ep-navy); color:#fff; border-radius:999px; padding:3px 9px; margin-top:11px; }
/* footer */
body.ep-theme .ep-doc-foot{ background:var(--ep-navy); color:rgba(255,255,255,.8); padding:13px 32px; display:flex; align-items:center; justify-content:space-between; font-family:var(--ep-mono); font-size:10.5px; letter-spacing:.08em; }
body.ep-theme .ep-doc-foot .cf{ color:rgba(255,255,255,.6); }

/* ---------- briefing dark confidence rail (carried forward) ---------- */
body.ep-theme .ep-brief-rail{ position:relative; background:linear-gradient(180deg,#13213F,#0D1730); color:#fff; overflow:hidden; }
body.ep-theme .ep-brief-rail::before{ content:""; position:absolute; inset:0; opacity:.5; pointer-events:none; background-image:repeating-radial-gradient(circle at 88% -8%, rgba(255,255,255,.05) 0 1px, transparent 1px 9px), repeating-radial-gradient(circle at 10% 108%, rgba(178,34,52,.06) 0 1px, transparent 1px 11px); -webkit-mask-image:linear-gradient(180deg,#000,transparent 85%); mask-image:linear-gradient(180deg,#000,transparent 85%); }
body.ep-theme .ep-brief-rail > *{ position:relative; }
body.ep-theme .ep-rail-sec{ padding:20px 22px; border-bottom:1px solid rgba(255,255,255,.08); }
body.ep-theme .ep-rail-sec:last-child{ border-bottom:0; }
body.ep-theme .ep-rail-k{ font-family:var(--ep-mono); font-size:9.5px; letter-spacing:.16em; text-transform:uppercase; color:rgba(255,255,255,.55); margin-bottom:13px; }
body.ep-theme .ep-fitwid{ display:flex; align-items:baseline; gap:10px; }
body.ep-theme .ep-fitwid .big{ font-family:var(--ep-serif); font-size:46px; font-weight:600; color:#fff; line-height:.9; }
body.ep-theme .ep-fitwid .of{ font-family:var(--ep-mono); font-size:12px; color:rgba(255,255,255,.5); }
body.ep-theme .ep-fitwid .tier{ margin-left:auto; align-self:center; font-family:var(--ep-mono); font-size:10px; letter-spacing:.1em; text-transform:uppercase; font-weight:600; color:#fff; background:var(--ep-red); padding:3px 9px; border-radius:999px; }
body.ep-theme .ep-fitbar{ height:6px; border-radius:3px; background:rgba(255,255,255,.12); margin-top:14px; overflow:hidden; }
body.ep-theme .ep-fitbar i{ display:block; height:100%; background:linear-gradient(90deg,var(--ep-red),#D9534F); }
body.ep-theme .ep-tp{ display:flex; gap:11px; padding:8px 0; }
body.ep-theme .ep-tp .tn{ font-family:var(--ep-mono); font-size:10px; color:var(--ep-gold); font-weight:600; flex:none; padding-top:2px; }
body.ep-theme .ep-tp .tt{ font-size:12.5px; line-height:1.45; color:rgba(255,255,255,.86); }
body.ep-theme .ep-conf{ display:flex; flex-direction:column; gap:9px; }
body.ep-theme .ep-conf .crow{ display:flex; align-items:center; gap:10px; font-size:12.5px; }
body.ep-theme .ep-conf .cl{ color:rgba(255,255,255,.82); }
body.ep-theme .ep-conf .cv{ margin-left:auto; font-family:var(--ep-mono); font-size:9px; letter-spacing:.08em; text-transform:uppercase; font-weight:600; padding:2px 8px; border-radius:999px; }
body.ep-theme .ep-conf .cv.ver{ background:rgba(30,122,82,.22); color:#7BE0AE; border:1px solid rgba(30,122,82,.5); }
body.ep-theme .ep-conf .cv.found{ background:rgba(30,58,138,.28); color:#9DB6F0; border:1px solid rgba(30,58,138,.6); }
body.ep-theme .ep-conf .cv.unk{ background:rgba(255,255,255,.07); color:rgba(255,255,255,.45); border:1px solid rgba(255,255,255,.14); }
body.ep-theme .ep-ask{ margin-top:14px; padding:10px 12px; background:rgba(154,123,67,.13); border:1px solid rgba(154,123,67,.34); border-radius:var(--ep-r-sm); font-size:11.5px; color:rgba(255,255,255,.72); line-height:1.5; }
body.ep-theme .ep-ask b{ color:#fff; }

@media (max-width:820px){
  body.ep-theme .ep-doc-body{ grid-template-columns:1fr; }
  body.ep-theme .ep-narr{ border-right:0; border-bottom:1px solid var(--ep-line-2); }
  body.ep-theme .ep-metrics{ grid-template-columns:repeat(2,1fr); }
  body.ep-theme .ep-doc-meta{ position:static; text-align:left; margin-top:10px; }
}

/* ============================================================
   M4 — carry EP across the amx-based screens (Dashboard, My People,
   Pipeline, Discover). They already share the amx primitives and sit well
   on the EP canvas; the one EP signature to add everywhere is the serif
   masthead. Light touch — anchor to existing layout, don't rebuild.
   ============================================================ */
body.ep-theme .amx-masthead h1{
  font-family:var(--ep-serif) !important;
  font-weight:600 !important;
  letter-spacing:-.02em !important;
  color:var(--ep-ink) !important;
}
body.ep-theme .amx-masthead .sub{ color:var(--ep-body) !important; }
/* section headers + chips already read as EP (mono/navy/red); leave them.
   Gently align shared cards to the EP card surface for cross-screen consistency. */
body.ep-theme .amx-card{ border-radius:var(--ep-r-lg) !important; box-shadow:var(--ep-sh-sm) !important; border-color:var(--ep-line) !important; }

/* M4b — close the last gaps found in the full-screen sweep */
/* My Profile tab strip: the active tab computed white-on-transparent (a
   pre-existing bug, invisible). Give it the EP navy pill so it reads. */
body.ep-theme .profile-tab-btn{ border-radius:var(--ep-r-sm) !important; }
body.ep-theme .profile-tab-btn.active{ background:var(--ep-navy) !important; color:#fff !important; border-color:var(--ep-navy) !important; }
/* Power Prospects + Referral use a bespoke h2 page title (not amx-masthead);
   give those the EP serif so every screen's headline is consistent. */
body.ep-theme #content h2.apx-text-22.apx-font-800{
  font-family:var(--ep-serif) !important; font-weight:600 !important;
  letter-spacing:-.02em !important; color:var(--ep-ink) !important;
}

/* ============================================================
   Mobile Research density — MUST come after the base Research rules above
   (M2). Media queries add no specificity, so source order breaks ties;
   placed last + !important so these win at mobile width.
   ============================================================ */
@media (max-width:640px){
  body.ep-theme .amx-research-masthead h1{ font-size:30px !important; }
  body.ep-theme #content.ep-research-view{ padding:22px 16px 70px !important; }
  body.ep-theme .amx-act1-hero .amx-act1-q,
  body.ep-theme #researchNameLabel{ font-size:20px !important; }
  body.ep-theme .amx-research-workbench{ padding:18px !important; }
}

/* Clickable source chips — a source host we surface is now a link to the source.
   Navy text + hover lift so it reads as interactive in the Editorial system. */
body.ep-theme .apwr-source-chip-link{
  color:var(--ep-navy) !important;
  border-color:#C3CDDF !important;
  transition:background .12s ease, border-color .12s ease, color .12s ease;
}
body.ep-theme .apwr-source-chip-link:hover{
  background:#EAF0F8 !important;
  border-color:var(--ep-navy) !important;
  color:var(--ep-ink) !important;
}
body.ep-theme .apwr-source-chip-link:focus-visible{
  outline:2px solid var(--ep-navy);
  outline-offset:2px;
}
