/* Stratify v5.8.6 — whole-platform contrast and interaction reliability layer.
   Loaded last so legacy design layers cannot make text unreadable. */
:root{
  --st586-ink:#17220f;
  --st586-body:#3d4738;
  --st586-muted:#5f695a;
  --st586-green:#315f16;
  --st586-green-dark:#203b0a;
  --st586-burgundy:#6f1733;
  --st586-line:#dfe4d9;
  --st586-soft:#f7f8f3;
  --st586-focus:#315f16;
}

/* Reliable light surfaces */
:where(.surface-card,.panel,.card,.metric-card,.dashboard-panel,.mini-metric,.detail-panel,.form-panel,.form-card,.table-panel,.upload-box,.hc-panel,.hc-person,.hc-req,.hc-gap,.hc-match,.hc-assignment,.st-card,.metric,.panel,.st-command-panel,.st-assistant-bubble,.profile-popover){
  color:var(--st586-ink) !important;
}
:where(.surface-card,.panel,.card,.metric-card,.dashboard-panel,.mini-metric,.detail-panel,.form-panel,.form-card,.table-panel,.upload-box,.hc-panel,.hc-person,.hc-req,.hc-gap,.hc-match,.hc-assignment,.st-card,.metric,.panel) :where(p,li,dd,dt,label){
  color:var(--st586-body);
}
:where(.surface-card,.panel,.card,.metric-card,.dashboard-panel,.mini-metric,.detail-panel,.form-panel,.form-card,.table-panel,.upload-box,.hc-panel,.hc-person,.hc-req,.hc-gap,.hc-match,.hc-assignment,.st-card,.metric,.panel) :where(small,.muted,.hc-muted){
  color:var(--st586-muted) !important;
}
:where(.surface-card,.panel,.card,.metric-card,.dashboard-panel,.mini-metric,.detail-panel,.form-panel,.form-card,.table-panel,.upload-box,.hc-panel,.st-card) :where(h1,h2,h3,h4,strong){
  color:var(--st586-ink);
}

/* Do not let global light-surface rules weaken intended dark hero/card text. */
:where(.premium-hero,.dashboard-hero,.budget-hero,.command-hero,.auth-story-panel,.hc-readiness,.consultant-hero,.st-final-cta) :where(h1,h2,h3,h4,strong,p,small,span,label){
  color:inherit;
}
.premium-hero :where(h1,h2,h3,strong),
.dashboard-hero :where(h1,h2,h3,strong),
.budget-hero :where(h1,h2,h3,strong),
.command-hero :where(h1,h2,h3,strong),
.auth-story-panel :where(h1,h2,h3,strong),
.hc-readiness :where(h1,h2,h3,strong),
.consultant-hero :where(h1,h2,h3,strong),
.st-final-cta :where(h1,h2,h3,strong){color:#fff !important}
.premium-hero :where(p,small),.dashboard-hero :where(p,small),.budget-hero :where(p,small),.command-hero :where(p,small),.auth-story-panel :where(p,small),.consultant-hero :where(p,small),.st-final-cta :where(p,small){color:rgba(255,255,255,.82) !important}

/* Sidebar/navigation: guarantee readable text in normal, hover, active and focus states. */
.enterprise-sidebar .primary-nav a,
.enterprise-sidebar nav a{
  color:#4b5446 !important;
}
.enterprise-sidebar .primary-nav a > span:not(.nav-icon),
.enterprise-sidebar nav a > span:not(.nav-icon),
.enterprise-sidebar .nav-chevron{
  color:inherit !important;
}
.enterprise-sidebar .primary-nav a:hover,
.enterprise-sidebar nav a:hover,
.enterprise-sidebar .primary-nav a:focus-visible,
.enterprise-sidebar nav a:focus-visible{
  color:var(--st586-green-dark) !important;
  background:#f1f5ed !important;
  border-color:#d9e3d2 !important;
}
.enterprise-sidebar .primary-nav a:hover > span:not(.nav-icon),
.enterprise-sidebar nav a:hover > span:not(.nav-icon),
.enterprise-sidebar .primary-nav a:focus-visible > span:not(.nav-icon),
.enterprise-sidebar nav a:focus-visible > span:not(.nav-icon){color:var(--st586-green-dark) !important}
.enterprise-sidebar .primary-nav a.active,
.enterprise-sidebar nav a.active{
  color:#fff !important;
  background:linear-gradient(135deg,#203b0a,#315f16) !important;
}
.enterprise-sidebar .primary-nav a.active > span:not(.nav-icon),
.enterprise-sidebar nav a.active > span:not(.nav-icon),
.enterprise-sidebar nav a.active .nav-chevron{color:#fff !important}
.enterprise-sidebar nav a:hover .nav-icon,
.enterprise-sidebar nav a:focus-visible .nav-icon{
  color:var(--st586-green-dark) !important;
  background:#e9f0e3 !important;
  border-color:#d4dfcc !important;
}
.enterprise-sidebar nav a.active .nav-icon{color:#fff !important;background:rgba(255,255,255,.15) !important;border-color:rgba(255,255,255,.18) !important}

/* Injected product shortcuts use the same navigation language. */
.st586-product-links{margin:.2rem 0 .85rem}
.st586-product-links h2{margin:.72rem .66rem .3rem;color:#868c80;font-size:.59rem;font-weight:800;letter-spacing:.15em;text-transform:uppercase}
.st586-product-links a{min-height:42px;padding:.42rem .58rem;display:flex;align-items:center;gap:.65rem;color:#4b5446;text-decoration:none;border:1px solid transparent;border-radius:11px;font-size:.78rem;font-weight:760}
.st586-product-links a:hover,.st586-product-links a:focus-visible{color:var(--st586-green-dark);background:#f1f5ed;border-color:#d9e3d2;outline:none}
.st586-product-links .st586-nav-dot{width:31px;height:31px;display:grid;place-items:center;flex:0 0 31px;color:var(--st586-green);background:#f0f4ec;border:1px solid #e2e8dd;border-radius:9px;font-weight:900}

/* Buttons and links retain contrast on interaction. */
button,.button,.st-btn,.hc-btn,.st-tab,.hc-tab,.st-command-item,a{transition:color .15s ease,background-color .15s ease,border-color .15s ease,box-shadow .15s ease,transform .15s ease}
button:focus-visible,.button:focus-visible,.st-btn:focus-visible,.hc-btn:focus-visible,.st-tab:focus-visible,.hc-tab:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:3px solid rgba(49,95,22,.22) !important;
  outline-offset:2px;
}
.st-btn:not(.primary):hover,.hc-btn:not(.primary):not(.burg):hover,.st-tab:not(.active):hover,.hc-tab:not(.active):hover{
  color:var(--st586-green-dark) !important;
  background:#f1f5ed !important;
  border-color:#ccd9c3 !important;
}
.st-btn.primary:hover,.hc-btn.primary:hover,.hc-btn.burg:hover,.st-tab.active:hover,.hc-tab.active:hover,.topbar-quick-action:hover{
  color:#fff !important;
}
.secondary-action:hover,.secondary:hover,button.secondary:hover{color:var(--st586-burgundy) !important;background:#fff0f2 !important}
.ghost:hover,button.ghost:hover{color:var(--st586-green-dark) !important;background:#f6f8f3 !important}

/* Form/control readability */
input,select,textarea{color:var(--st586-ink) !important;background:#fff !important}
input::placeholder,textarea::placeholder{color:#697363 !important;opacity:1}
option{color:var(--st586-ink);background:#fff}

/* Tables and interactive rows */
table,th,td{color:var(--st586-ink)}
th{color:#505a4b !important;background:#f5f6f1 !important}
td{color:#293225 !important}
tbody tr:hover td{color:#1b2814 !important;background:#f3f7ef !important}
.clickable-row:hover,.selected-row{color:#1b2814 !important;background:#edf4e8 !important}

/* Correct explicit low-contrast combinations found by static contrast audit. */
.st-premium-empty{color:#5d6259 !important}
.metric-icon.amber{color:#8a5608 !important}
.metric-icon.teal{color:#056d69 !important}
.inline-money-input span{color:#4e6873 !important}
.st-attention-list > div > span.amber{color:#725507 !important}

/* Standalone enterprise pages */
.st-console,.hc-shell,.st-journey-page{color:var(--st586-ink)}
.st-card,.hc-panel,.hc-person,.hc-req,.hc-gap,.hc-match,.hc-assignment{background:#fff !important}
.st-list-item{color:var(--st586-ink);background:#fff}
.st-list-item small{color:var(--st586-muted)}
.st-json,.st-friendly-output{font-family:Inter,ui-sans-serif,system-ui,sans-serif !important;color:var(--st586-body);background:#f5f7f2;border:1px solid var(--st586-line);border-radius:12px;padding:12px;white-space:normal;overflow:auto}
.st-friendly-output{display:grid;gap:8px}
.st-friendly-row{display:grid;grid-template-columns:minmax(120px,.45fr) 1fr;gap:12px;padding:8px 0;border-bottom:1px solid #e5e9df}
.st-friendly-row:last-child{border-bottom:0}
.st-friendly-row span{color:var(--st586-muted);font-size:12px;font-weight:700}
.st-friendly-row strong{color:var(--st586-ink);overflow-wrap:anywhere}
.st-friendly-list{margin:0;padding-left:18px;color:var(--st586-body)}

/* Assistant contrast */
.st-assistant-panel,.st-assistant-history,.st-assistant-bubble{color:var(--st586-ink)}
.st-assistant-message-row:not(.user) .st-assistant-message-content{color:#293225}
.st-assistant-message-row.user .st-assistant-message-content{color:#fff}
.st-assistant-suggestion:hover{color:var(--st586-green-dark) !important}

/* Status messages remain readable and user-facing. */
.error-box,.hc-error,.stj-error,.st-alert{color:#7b1f2a !important}
.status-box,.notice{color:#294f16 !important}

@media (max-width:760px){
  .st-friendly-row{grid-template-columns:1fr;gap:3px}
}
