/* ConstructNav v0.9.9.9 — global readability and contrast completion.
   Loaded last so every module follows one readable visual standard. */
:root{
  --cn994-ink:#0a2945;
  --cn994-text:#1f3d59;
  --cn994-muted:#576f84;
  --cn994-soft:#f4f8fb;
  --cn994-line:#cbd9e5;
  --cn994-dark:#071f38;
  --cn994-dark-2:#0d4f7f;
  --cn994-on-dark:#ffffff;
  --cn994-on-dark-muted:#d9e8f4;
  --cn994-link:#075f9d;
  --cn994-focus:#1e78b5;
}

/* ---------- Light surfaces ---------- */
body,.content,.view,.card,.cnx-card,.to-panel,.cn-fi-kpi,.cn-fi-finding,
.cn-msg-main,.cn-msg-sidebar,.cn-project-admin-card,.cn-meeting-kpi,
.cn-portal-action,.cn-portal-office-tools,.cn-portal-estimate{
  color:var(--cn994-text);
}
.card :where(h1,h2,h3,h4,h5,h6),
.cnx-card :where(h1,h2,h3,h4,h5,h6),
.to-panel :where(h1,h2,h3,h4,h5,h6){color:var(--cn994-ink)}
:where(.muted,.cnx-muted,.helper,.hint,.field-note,.receipt-meta,.xe-ai-status){color:var(--cn994-muted)}
a:not(.btn):not([role="button"]){color:var(--cn994-link)}

input,select,textarea{
  color:var(--cn994-ink)!important;
  background:#fff!important;
  border-color:#b9cad8!important;
}
input::placeholder,textarea::placeholder{color:#667d91!important;opacity:1!important}
input:disabled,select:disabled,textarea:disabled,input[readonly],textarea[readonly]{
  color:#405a70!important;
  background:#e9f0f5!important;
  opacity:1!important;
}
label{color:#294761}
option{color:#102d49!important;background:#fff!important}

/* ---------- Table and data readability ---------- */
table{color:var(--cn994-text)}
thead th{
  color:#173d5d!important;
  background:#eaf1f6!important;
  border-color:#c5d4e0!important;
  font-weight:900!important;
}
tbody td{color:#1f3d59}
tbody td strong{color:#0a2945}
.table-wrap tbody tr:hover{background:#f0f6fa}

/* Dark table headers that intentionally use a dark background. */
.cn-buyout-grid thead th,
.cn-buyout-grid thead .cn-buyout-freeze-1,
.cn-buyout-grid thead .cn-buyout-freeze-2,
.cn-buyout-grid thead .cn-buyout-freeze-3,
.cn-commission-table th{
  color:#fff!important;
  background:#173f64!important;
}

/* ---------- Button and focus readability ---------- */
.btn,.icon-btn,.card-link{font-weight:800}
.btn:not(.primary):not(.green):not(.danger){color:#123f65;background:#fff;border-color:#b9cad8}
.btn:not(.primary):not(.green):not(.danger):hover{color:#082d4b;background:#eaf3f9;border-color:#8fafc6}
.btn.primary{color:#fff!important;background:#145f94!important;border-color:#145f94!important}
.btn.primary:hover{background:#0b4e7c!important;border-color:#0b4e7c!important}
.btn.green{color:#fff!important;background:#167a55!important;border-color:#167a55!important}
.btn.danger{color:#9d2532!important;background:#fff8f8!important;border-color:#d5a9b0!important}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{
  outline:3px solid rgba(30,120,181,.42)!important;
  outline-offset:2px!important;
}

/* ---------- Canonical dark surfaces ---------- */
:where(
  .cn-admin-company-banner,
  .cn-estimator-hero,
  .cn-ew-toolbar,
  .cn-exec-head,
  .cn-precon-hero,
  .cn-buyout-topbar,
  .cn-portal-hero,
  .cn-external-guest-session,
  .cn-live-proposal-head,
  .cn-auth-brand,
  .cn-signature-guest-banner,
  .project-top,
  .ai-head,
  #passThroughs .pt-portfolio-main,
  #passThroughs .pt-detail-hero,
  .cn-readability-dark-surface
){
  --ink:var(--cn994-on-dark);
  --text:var(--cn994-on-dark);
  --muted:var(--cn994-on-dark-muted);
  color:var(--cn994-on-dark)!important;
}

:where(
  .cn-admin-company-banner,
  .cn-estimator-hero,
  .cn-ew-toolbar,
  .cn-exec-head,
  .cn-precon-hero,
  .cn-buyout-topbar,
  .cn-portal-hero,
  .cn-external-guest-session,
  .cn-live-proposal-head,
  .cn-auth-brand,
  .cn-signature-guest-banner,
  .project-top,
  .ai-head,
  #passThroughs .pt-portfolio-main,
  #passThroughs .pt-detail-hero,
  .cn-readability-dark-surface
) :where(h1,h2,h3,h4,h5,h6,strong,b,label,dt,dd,li,a:not(.btn),.label,.value,.big,.billing-total,.cn-auto-dark-text,.cn-text-on-dark){
  color:var(--cn994-on-dark)!important;
  opacity:1!important;
  text-shadow:none!important;
}

:where(
  .cn-admin-company-banner,
  .cn-estimator-hero,
  .cn-ew-toolbar,
  .cn-exec-head,
  .cn-precon-hero,
  .cn-buyout-topbar,
  .cn-portal-hero,
  .cn-external-guest-session,
  .cn-live-proposal-head,
  .cn-auth-brand,
  .cn-signature-guest-banner,
  .project-top,
  .ai-head,
  #passThroughs .pt-portfolio-main,
  #passThroughs .pt-detail-hero,
  .cn-readability-dark-surface
) :where(p,span,small,.muted,.helper,.hint,.sub,.trend,.field-note,.kicker,.eyebrow,.cn-auto-dark-text,.cn-text-on-dark){
  color:var(--cn994-on-dark-muted)!important;
  opacity:1!important;
}

/* Restore stronger primary text when the same element matches a secondary selector. */
:where(
  .cn-admin-company-banner,
  .cn-estimator-hero,
  .cn-ew-toolbar,
  .cn-exec-head,
  .cn-precon-hero,
  .cn-buyout-topbar,
  .cn-portal-hero,
  .cn-external-guest-session,
  .cn-live-proposal-head,
  .cn-auth-brand,
  .cn-signature-guest-banner,
  .project-top,
  .ai-head,
  #passThroughs .pt-portfolio-main,
  #passThroughs .pt-detail-hero,
  .cn-readability-dark-surface
) :where(h1,h2,h3,h4,h5,h6,strong,b,.value,.big){color:#fff!important}

/* Light buttons inside dark banners remain readable. */
:where(.cn-admin-company-banner,.cn-estimator-hero,.cn-ew-toolbar,.cn-exec-head,.cn-precon-hero,.cn-buyout-topbar,.cn-portal-hero,.project-top,#passThroughs .pt-detail-hero) .btn:not(.primary):not(.green):not(.danger){
  color:#0a3558!important;
  background:#fff!important;
  border-color:#fff!important;
}

/* ---------- Explicit corrections for reported screens ---------- */
.cn-admin-company-kicker{color:#f8d885!important}
.cn-admin-company-banner strong{color:#fff!important}
.cn-admin-company-banner p{color:#dceaf5!important}

.cn-estimator-hero .cn-estimator-kicker{color:#f5d88e!important}
.cn-estimator-hero h2{color:#fff!important}
.cn-estimator-hero p,.cn-estimator-hero .muted{color:#d9e8f4!important}

.cn-exec-head .cn-exec-eyebrow{color:#a9d8f7!important}
.cn-exec-head h2{color:#fff!important}
.cn-exec-head p{color:#dbeaf6!important}

#passThroughs .pt-portfolio-main :where(.pt-overline,.pt-portfolio-total small,.pt-portfolio-total p,.pt-allocation-head,.pt-allocation-values small){color:#d2e3ef!important}
#passThroughs .pt-portfolio-main :where(.pt-portfolio-total strong,.pt-allocation-head strong,.pt-allocation-values strong){color:#fff!important}
#passThroughs .pt-detail-hero :where(h2,strong){color:#fff!important}
#passThroughs .pt-detail-hero :where(p,small){color:#d2e3ef!important}

/* ---------- Runtime contrast classes ---------- */
.cn-text-on-dark,.cn-auto-light-text{color:#fff!important;opacity:1!important}
.muted.cn-text-on-dark,small.cn-text-on-dark,p.cn-text-on-dark,.field-note.cn-text-on-dark{color:#d9e8f4!important}
.cn-text-on-light,.cn-auto-dark-text{color:#102d49!important;opacity:1!important}

/* ---------- Cards, modals, portals, and messages ---------- */
.modal,.modal-card,.cnx-modal,.cnx-card,.cn-msg-main,.cn-msg-sidebar,.cn-portal-shell .cnx-card{
  color:var(--cn994-text);
}
.modal :where(h1,h2,h3,h4,h5,h6),.modal-card :where(h1,h2,h3,h4,h5,h6),.cnx-modal :where(h1,h2,h3,h4,h5,h6){color:var(--cn994-ink)}
.cn-msg-thread:not(.active) strong{color:#173a59!important}
.cn-msg-thread:not(.active) small{color:#5a7287!important}
.cn-msg-thread.active strong{color:#082f4d!important}
.cn-msg-thread.active small{color:#405f77!important}

/* ---------- KPI and chart labels ---------- */
.stat .label,.finance-kpi .kicker,.cn-exec-kpis span,.cn-kpi small{color:#4f687e!important}
.stat .value,.finance-kpi .big,.cn-exec-kpis strong,.cn-kpi strong{color:#0a2945!important}
.stat .sub,.stat .trend,.finance-kpi .hint,.cn-exec-kpis small,.cn-kpi span{color:#5c7388!important}

/* ---------- Mobile ---------- */
html.cn-mobile-mode body{color:#183650}
html.cn-mobile-mode :where(.cn-simple-card,.cn-mobile-pane,.cn-mobile-message-panel){color:#183650}
html.cn-mobile-mode input,html.cn-mobile-mode select,html.cn-mobile-mode textarea{font-size:16px}

@media print{
  .cn-admin-company-banner,.cn-estimator-hero,.cn-exec-head,.cn-precon-hero,.cn-portal-hero,#passThroughs .pt-portfolio-main{
    background:#fff!important;color:#111!important;border:1px solid #999!important;
  }
  .cn-admin-company-banner *, .cn-estimator-hero *, .cn-exec-head *, .cn-precon-hero *, .cn-portal-hero *, #passThroughs .pt-portfolio-main *{
    color:#111!important;text-shadow:none!important;
  }
}

/* Final safeguard when the legacy audit previously attached a dark-text class. */
.cn-readability-dark-surface .cn-auto-dark-text,
.cn-readability-dark-surface .cn-text-on-dark{color:#fff!important;opacity:1!important}
.cn-readability-dark-surface :is(p,small,.muted,.helper,.hint,.sub,.trend,.field-note).cn-auto-dark-text,
.cn-readability-dark-surface :is(p,small,.muted,.helper,.hint,.sub,.trend,.field-note).cn-text-on-dark{color:#d9e8f4!important}

/* Button descendants inherit the button contrast, not the surrounding banner. */
:where(.cn-admin-company-banner,.cn-estimator-hero,.cn-ew-toolbar,.cn-exec-head,.cn-precon-hero,.cn-buyout-topbar,.cn-portal-hero,.project-top,#passThroughs .pt-detail-hero)
  .btn:not(.primary):not(.green):not(.danger) *{color:#0a3558!important}
:where(.cn-admin-company-banner,.cn-estimator-hero,.cn-ew-toolbar,.cn-exec-head,.cn-precon-hero,.cn-buyout-topbar,.cn-portal-hero,.project-top,#passThroughs .pt-detail-hero)
  :is(.btn.primary,.btn.green) *{color:#fff!important}


/* v0.9.9.9 — Messenger and dynamic light-surface contrast completion */
#messenger .cn-msg-sidebar,
#messenger .cn-msg-main,
#messenger .cn-msg-sidebar-head,
#messenger .cn-msg-main-head,
#messenger .cn-msg-body,
#messenger .cn-msg-compose{color:#102b45!important}
#messenger .cn-msg-sidebar-head,
#messenger .cn-msg-main-head{background:#f4f8fb!important;border-color:#cbd9e5!important}
#messenger .cn-msg-sidebar-head :is(h1,h2,h3,h4,strong,span,div,p,small),
#messenger .cn-msg-main-head :is(h1,h2,h3,h4,strong,span,div,p,small){color:#102b45!important;opacity:1!important}
#messenger .cn-msg-sidebar-head .muted,
#messenger .cn-msg-main-head .muted{color:#4c6579!important}
#messenger .cn-msg-thread.active{background:#dceffc!important;color:#082f4d!important;border-color:#4383ad!important}
#messenger .cn-msg-thread.active strong{color:#082f4d!important}
#messenger .cn-msg-thread.active small{color:#405f77!important}
#messenger .cn-msg-empty{color:#506a80!important}
#messenger .cn-msg-bubble:not(.mine),
#messenger .cn-msg-bubble:not(.mine) :is(strong,div,small){color:#173650!important}
#messenger .cn-msg-bubble.mine,
#messenger .cn-msg-bubble.mine :is(strong,div,small){color:#fff!important}
#messenger textarea{color:#102b45!important;background:#fff!important}
#messenger textarea::placeholder{color:#647b8d!important;opacity:1!important}
