/* Stratify v5.9.1 — brand palette + deterministic contrast layer.
   Loaded last on every shipped HTML surface.
   Brand: strategy green, burgundy/wine, restrained gold, ivory/white. */
:root{
  --stp-green-950:#172a08;
  --stp-green-900:#203b0a;
  --stp-green-800:#315f16;
  --stp-green-700:#3f731f;
  --stp-green-500:#6f8f50;
  --stp-green-100:#edf2e7;
  --stp-wine-900:#68141a;
  --stp-wine-800:#851c23;
  --stp-wine-700:#a1262d;
  --stp-wine-100:#f8e9e9;
  --stp-gold:#c59b2b;
  --stp-ink:#1b2117;
  --stp-muted:#6b7166;
  --stp-line:#e5e1d8;
  --stp-ivory:#fbfaf7;

  /* Retire legacy blue/cyan/violet tokens without breaking old components. */
  --brand-navy:var(--stp-green-950);
  --brand-blue:var(--stp-green-800);
  --brand-cyan:var(--stp-wine-700);
  --brand-teal:var(--stp-green-700);
  --brand-violet:var(--stp-wine-800);
  --brand-amber:var(--stp-gold);
  --premium-navy:var(--stp-green-950);
  --premium-blue:var(--stp-green-800);
  --premium-cyan:var(--stp-wine-700);
  --premium-mint:var(--stp-green-500);
  --premium-violet:var(--stp-wine-800);
  --premium-amber:var(--stp-gold);
  --premium-rose:var(--stp-wine-700);
  --stratify-blue:var(--stp-green-800);
  --stratify-indigo:var(--stp-wine-800);
  --stratify-cyan:var(--stp-green-500);
  --stratify-ink:var(--stp-ink);
  --stratify-muted:var(--stp-muted);
  --st589-ink:var(--stp-ink);
  --st589-body:#4e554a;
  --st589-muted:var(--stp-muted);
}

html,body,.production-shell.app-shell,.production-shell.enterprise-shell{
  background:
    radial-gradient(circle at 9% 2%,rgba(111,143,80,.10),transparent 28rem),
    radial-gradient(circle at 92% 5%,rgba(161,38,45,.055),transparent 31rem),
    var(--stp-ivory) !important;
  color:var(--stp-ink) !important;
}

/* Brand accents: no generic product blue remains in high-visibility controls. */
:where(a,.eyebrow,.topbar-kicker,.st-landing-kicker){color:var(--stp-green-800) !important}
:where(input,select,textarea):focus{
  border-color:rgba(49,95,22,.58) !important;
  outline:3px solid rgba(49,95,22,.12) !important;
  box-shadow:none !important;
}

/* Primary/dark buttons always carry white labels/icons. */
button:not(.ghost):not(.secondary):not(.sidebar-close):not(.password-toggle):not(.topbar-profile):not(.topbar-icon-action),
.button.primary,.auth-submit,.topbar-quick-action,.primary-action,.st587-action,.stj-primary-action,.ei-primary,
.st-assistant-composer button,.st-landing-btn-primary,.st-command-action,.execution-tabs button.active{
  color:#fff !important;
  background:linear-gradient(135deg,var(--stp-green-950),var(--stp-green-800)) !important;
  border-color:var(--stp-green-800) !important;
  box-shadow:none !important;
}
button:not(.ghost):not(.secondary):not(.sidebar-close):not(.password-toggle):not(.topbar-profile):not(.topbar-icon-action)
:where(span,strong,small,svg),
.button.primary :where(span,strong,small,svg),
.auth-submit :where(span,strong,small,svg),
.topbar-quick-action :where(span,strong,small,svg),
.primary-action :where(span,strong,small,svg),
.st587-action :where(span,strong,small,svg),
.stj-primary-action :where(span,strong,small,svg),
.ei-primary :where(span,strong,small,svg),
.st-assistant-composer button :where(span,strong,small,svg),
.st-landing-btn-primary :where(span,strong,small,svg),
.st-command-action :where(span,strong,small,svg),
.execution-tabs button.active :where(span,strong,small,svg){color:#fff !important;fill:currentColor}

/* Secondary and ghost controls are intentionally light, so their dark text remains readable. */
button.secondary,.secondary{color:var(--stp-wine-800) !important;background:#fff4f4 !important;border-color:#ead0d2 !important}
button.ghost,.ghost{color:#4d5349 !important;background:#fff !important;border-color:var(--stp-line) !important}

/* Explicit dark cards/surfaces use the Stratify brand rather than legacy blue gradients. */
:where(
  .premium-intake-page .evidence-hero,
  .evidence-hero.premium-hero,
  .premium-hero,
  .dashboard-hero,
  .budget-hero,
  .command-hero,
  .enterprise-dashboard-hero,
  .enterprise-workspace-card,
  .workspace-summary,
  .dashboard-health-card,
  .enterprise-health-card,
  .dark-card,
  [class*="card-dark"],
  .consultant-engine-page .consultant-hero,
  .auth-story-panel.enterprise-auth-story,
  .enterprise-auth-story,
  .extraction-orbit-card,
  .evidence-preview-window,
  .improvement-sequence,
  .result-box,
  .public-report > header,
  .st-final-cta,
  .ai-trust-badge,
  .ai-executive-conclusion,
  .ai-value-story,
  .ai-tool-card pre,
  .phone-frame
){
  color:#fff !important;
  background:
    radial-gradient(circle at 88% 12%,rgba(161,38,45,.20),transparent 22rem),
    linear-gradient(135deg,var(--stp-green-950) 0%,var(--stp-green-800) 68%,var(--stp-wine-900) 125%) !important;
  border-color:rgba(255,255,255,.13) !important;
}

/* Every readable descendant on a dark surface is white/light unless it owns a light surface itself. */
:where(
  .premium-intake-page .evidence-hero,
  .evidence-hero.premium-hero,
  .premium-hero,
  .dashboard-hero,
  .budget-hero,
  .command-hero,
  .enterprise-dashboard-hero,
  .enterprise-workspace-card,
  .workspace-summary,
  .dashboard-health-card,
  .enterprise-health-card,
  .dark-card,
  [class*="card-dark"],
  .consultant-engine-page .consultant-hero,
  .auth-story-panel.enterprise-auth-story,
  .enterprise-auth-story,
  .extraction-orbit-card,
  .evidence-preview-window,
  .improvement-sequence,
  .result-box,
  .public-report > header,
  .st-final-cta,
  .ai-trust-badge,
  .ai-executive-conclusion,
  .ai-value-story,
  .ai-tool-card pre,
  .phone-frame
) :where(h1,h2,h3,h4,h5,h6,p,li,dd,dt,strong,b,small,.muted,.eyebrow,label,legend,a,span:not(.pill):not(.badge),svg){
  color:#fff !important;
}
:where(
  .premium-intake-page .evidence-hero,
  .evidence-hero.premium-hero,
  .premium-hero,
  .dashboard-hero,
  .budget-hero,
  .command-hero,
  .enterprise-dashboard-hero,
  .enterprise-workspace-card,
  .workspace-summary,
  .dashboard-health-card,
  .enterprise-health-card,
  .dark-card,
  [class*="card-dark"],
  .consultant-engine-page .consultant-hero,
  .auth-story-panel.enterprise-auth-story,
  .enterprise-auth-story,
  .extraction-orbit-card,
  .evidence-preview-window,
  .improvement-sequence,
  .result-box,
  .public-report > header,
  .st-final-cta,
  .ai-trust-badge,
  .ai-executive-conclusion,
  .ai-value-story,
  .phone-frame
) :where(input,textarea,select,option){color:var(--stp-ink) !important;background:#fff !important}

/* Extracted-signal tone cards were the main black-on-dark regression. */
.signal-cluster-card[class*="tone-"]{
  color:#fff !important;
  background:linear-gradient(135deg,var(--stp-green-950),var(--stp-green-800)) !important;
  border-color:rgba(255,255,255,.12) !important;
}
.signal-cluster-card[class*="tone-"]:nth-child(even){background:linear-gradient(135deg,var(--stp-wine-900),var(--stp-wine-700)) !important}
.signal-cluster-card[class*="tone-"] :where(h1,h2,h3,h4,h5,h6,p,small,.muted,strong,b,label,span:not(.pill):not(.badge),svg){color:#fff !important}
.entity-type-pill,
.pill.tone-blue,.pill.tone-cyan,.pill.tone-violet,.pill.tone-slate{
  color:#fff !important;
  background:linear-gradient(135deg,var(--stp-green-800),var(--stp-wine-800)) !important;
  border-color:rgba(255,255,255,.12) !important;
}

/* Dark table headers and navigation selections must never inherit black text. */
.premium-table-wrap thead th{
  color:#fff !important;
  background:linear-gradient(135deg,var(--stp-green-950),var(--stp-green-800)) !important;
  border-color:rgba(255,255,255,.12) !important;
}
.enterprise-sidebar nav a.active,
.app-sidebar nav a.active{
  color:#fff !important;
  background:linear-gradient(135deg,var(--stp-green-950),var(--stp-green-800)) !important;
}
.enterprise-sidebar nav a.active :where(span,strong,small,svg),
.app-sidebar nav a.active :where(span,strong,small,svg){color:#fff !important}

/* Branded special controls/surfaces that previously exposed blue/cyan/violet. */
.upload-orb,.brand-mark,.workspace-icon{
  color:#fff !important;
  background:linear-gradient(135deg,var(--stp-green-800),var(--stp-wine-800)) !important;
}
.extraction-ring::before{background:linear-gradient(135deg,var(--stp-green-950),var(--stp-green-800)) !important}
.progress-track span,.improvement-score-track span,.health-track span,.confidence-bar span,
.map-links span,.methodology-score i,.bar{
  background:linear-gradient(90deg,var(--stp-green-700),var(--stp-gold),var(--stp-wine-700)) !important;
}
.map-node.objective{background:linear-gradient(145deg,#edf2e7,#f8faf5) !important;border-color:#d6e2cb !important}
.map-node.initiative{background:linear-gradient(145deg,#f8e9e9,#fff7f7) !important;border-color:#edd0d2 !important}
.map-node.kpi{background:linear-gradient(145deg,#fbf4de,#fffaf0) !important;border-color:#eadcac !important}
.map-node.role{background:linear-gradient(145deg,#f5f2eb,#fff) !important;border-color:#e5e1d8 !important}

.improvement-hero,.improvement-decision-card,.scenario-lab,.improvement-rewrite,
.execution-config-panel,.execution-project-card,.kpi-chart,.file-picker,.premium-table-preview,
.entity-signal-card,.premium-evidence-card,.methodology-launcher,.cross-framework-card{
  background:linear-gradient(145deg,#fff,#f7f8f3) !important;
  border-color:var(--stp-line) !important;
}
.improvement-hero::after,.consultant-engine-page .consultant-hero::after{
  background:linear-gradient(90deg,transparent,rgba(161,38,45,.24),transparent) !important;
}

/* Assistant and execution-intelligence dark controls follow the same contrast rule. */
.st-assistant-launcher,.st-assistant-message-row.user .st-assistant-bubble,.st-assistant-composer button,
.ei-launcher,.ei-mark,.ei-primary,.ei-toast{
  color:#fff !important;
  background:linear-gradient(135deg,var(--stp-green-950),var(--stp-green-800)) !important;
}
:where(.st-assistant-launcher,.st-assistant-message-row.user .st-assistant-bubble,.st-assistant-composer button,.ei-launcher,.ei-mark,.ei-primary,.ei-toast)
:where(span,strong,small,p,svg){color:#fff !important}

/* Keep all ordinary light cards explicitly dark-on-light. */
:where(.panel,.surface-card,.metric-card,.mini-metric,.dashboard-panel,.detail-panel,.form-panel,.form-card,.table-panel,.upload-box,.glass-panel,.methodology-pack-card,.methodology-score-card,.methodology-finding-card,.skill-card,.refined-section-card,.consultant-summary-card,.cross-framework-card):not(.premium-hero):not(.dashboard-hero):not(.budget-hero):not(.command-hero){
  color:var(--stp-ink) !important;
}
:where(.panel,.surface-card,.metric-card,.mini-metric,.dashboard-panel,.detail-panel,.form-panel,.form-card,.table-panel,.upload-box,.glass-panel,.methodology-pack-card,.methodology-score-card,.methodology-finding-card,.skill-card,.refined-section-card,.consultant-summary-card,.cross-framework-card):not(.premium-hero):not(.dashboard-hero):not(.budget-hero):not(.command-hero)
:where(h1,h2,h3,h4,h5,h6,strong,b,label,legend){color:var(--stp-ink) !important}

/* Evidence review statuses: the server-confirmed state is visually unmistakable. */
.pill.pending{color:#765a0a !important;background:#fff8df !important;border-color:#ead892 !important}
.pill.accepted{color:#315f16 !important;background:#edf6e6 !important;border-color:#cfe2bf !important}
.pill.corrected{color:#725a12 !important;background:#fff7db !important;border-color:#ead68c !important}
.pill.rejected{color:#851c23 !important;background:#fff0f0 !important;border-color:#efc9cc !important}

/* Accessibility: white on dark at every interaction state. */
:where(
 button:not(.ghost):not(.secondary):not(.sidebar-close):not(.password-toggle):not(.topbar-profile):not(.topbar-icon-action),
 .button.primary,.auth-submit,.topbar-quick-action,.primary-action,.st587-action,.stj-primary-action,.ei-primary,
 .st-assistant-composer button,.st-landing-btn-primary,.st-command-action,.execution-tabs button.active
):is(:hover,:focus,:focus-visible,:active){color:#fff !important}


/* Stratify v5.9.1 — runtime dark-surface contract.
   Main SPA surfaces are classified from their computed background, which closes
   gaps left by component-specific class names or late-rendered gradients. */
.st591-dark-surface{color:#fff !important}
.st591-dark-surface :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,strong,b,small,span,label,legend,a,em,code,svg){color:#fff !important}
.st591-dark-surface :where(svg){stroke:currentColor}
.st591-dark-surface :where(button,.button,[role="button"]):not(.ghost):not(.secondary){color:#fff !important}
.st591-dark-surface :where(button,.button,[role="button"]):not(.ghost):not(.secondary) :where(span,strong,small,svg){color:#fff !important}
.st591-dark-surface .st591-light-surface,
.st591-dark-surface .st591-light-surface :where(h1,h2,h3,h4,h5,h6,p,li,dt,dd,strong,b,small,span,label,legend,a,em,code,svg){color:var(--stp-ink) !important}
.st591-dark-surface :where(input,textarea,select,option){background:#fff !important;color:var(--stp-ink) !important}

/* Dedicated report download center. */
.st591-report-center{display:grid;gap:20px;padding:22px;border:1px solid rgba(49,95,22,.16);border-radius:22px;background:#fff;box-shadow:0 18px 50px rgba(31,59,10,.08)}
.st591-report-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}
.st591-report-head h2,.st591-generated-section h2{margin:.25rem 0 .45rem;color:var(--stp-green-950)}
.st591-report-head p{margin:0;color:var(--stp-muted);max-width:820px;line-height:1.6}
.st591-report-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.st591-report-card{display:flex;min-height:210px;flex-direction:column;justify-content:space-between;gap:18px;padding:18px;border-radius:18px;color:#fff !important;background:radial-gradient(circle at 90% 10%,rgba(161,38,45,.22),transparent 14rem),linear-gradient(135deg,var(--stp-green-950),var(--stp-green-800)) !important;border:1px solid rgba(255,255,255,.12);box-shadow:0 14px 32px rgba(23,42,8,.14)}
.st591-report-card :where(h3,p,span,strong,small,.eyebrow){color:#fff !important}
.st591-report-card h3{margin:.4rem 0 .55rem;font-size:20px;line-height:1.2}
.st591-report-card p{margin:0;line-height:1.55;opacity:.88}
.st591-report-card button,.st591-generated-row button{min-height:42px;border:1px solid rgba(255,255,255,.22);border-radius:11px;background:linear-gradient(135deg,var(--stp-wine-900),var(--stp-wine-700)) !important;color:#fff !important;font-weight:800;cursor:pointer}
.st591-report-card button :where(span,strong,small,svg),.st591-generated-row button :where(span,strong,small,svg){color:#fff !important}
.st591-generated-section{display:grid;gap:12px;padding-top:6px}
.st591-generated-list{display:grid;gap:10px}
.st591-generated-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:13px 14px;border:1px solid var(--stp-line);border-radius:13px;background:#fff}
.st591-generated-row strong{display:block;color:var(--stp-ink)}
.st591-generated-row small{display:block;margin-top:3px;color:var(--stp-muted)}
.st591-generated-row button{padding:9px 13px;white-space:nowrap}
.st591-report-empty{display:grid;gap:3px;padding:20px;border:1px dashed #d8d5ca;border-radius:13px;background:#fbfaf7;color:var(--stp-muted)}
@media(max-width:980px){.st591-report-grid{grid-template-columns:1fr 1fr}}
@media(max-width:640px){.st591-report-grid{grid-template-columns:1fr}.st591-generated-row{align-items:flex-start;flex-direction:column}.st591-generated-row button{width:100%}}
