.portal-appearance-controls{padding:4px 2px 14px;margin-bottom:12px;border-bottom:1px solid var(--border)}
.portal-appearance-controls [role=group]{display:flex;gap:6px;margin:10px 0;flex-wrap:wrap}
.portal-appearance-controls button{padding:9px 12px;border:1px solid var(--border);border-radius:20px;background:var(--surface);color:var(--text);cursor:pointer;font:inherit}
.portal-appearance-controls button[aria-pressed=true]{background:#1a2f5e;color:white;border-color:#4dc8ef;box-shadow:0 0 0 2px #4dc8ef55}
.portal-appearance-controls button:focus-visible{outline:3px solid #e8397d;outline-offset:3px}
/* Screen-only: exporting and email HTML never inherit dark appearance. */
@media screen{
html[data-portal-theme=dark]{color-scheme:dark;--text:#e5edf9;--text-mid:#c1cee0;--text-light:#aabbcf;--border:#354963;--bg:#101b2d;--surface:#18263b;--surface2:#1c2d44;--green:#a1e3a9;--green-bg:#203e31;--red:#ffb0cf;--red-bg:#42283c;--amber:#ffd276;--amber-bg:#40351e;--blue:#a2e4ff;--blue-bg:#173c52;--fs-green:#a1e3a9;--fs-green-bg:#203e31;--fs-pink:#ffb0cf;--fs-pink-bg:#42283c;--fs-amber:#ffd276;--fs-amber-bg:#40351e;--fs-sky:#a2e4ff;--fs-sky-bg:#173c52;--fs-purple:#d2bbff;--fs-purple-bg:#32294d;--fs-yellow:#e1e994;--fs-yellow-bg:#353b22}
html[data-portal-theme=dark] body{color:var(--text)}
html[data-portal-theme=dark] :is(.main,.content,.page,.modal,.modal-body,dialog,.auth-card){background-color:var(--surface);color:var(--text)}
html[data-portal-theme=dark] :is(.topbar,.portal-header,.sidebar,.card,.stat-card,.modal-hdr,.modal-footer,.table-wrap,.etable-wrap){background-color:var(--surface);color:var(--text);border-color:var(--border)}
html[data-portal-theme=dark] :is(h1,h2,h3,h4,.topbar-title,.portal-nav-group,.portal-nav-panel,.portal-display,.portal-tools){color:var(--text)}
html[data-portal-theme=dark] :is(.portal-nav-panel .sb-item,.portal-nav-panel .sb-entity){color:var(--text)!important}
html[data-portal-theme=dark] :is(.portal-current>summary,.portal-nav-group[open]>summary,.portal-nav-group>summary:hover){background:#173c52;color:#a2e4ff}
html[data-portal-theme=dark] :is(input,textarea,select){background-color:var(--surface2);color:var(--text);border-color:var(--border)}
html[data-portal-theme=dark] input::placeholder,html[data-portal-theme=dark] textarea::placeholder{color:var(--text-light);opacity:1}
html[data-portal-theme=dark] :is(.btn:not(.primary):not(.danger):not(.success),.modal-close){background-color:var(--surface2);color:var(--text);border-color:var(--border)}
html[data-portal-theme=dark] :is(.btn.primary,.badge,.pill,.acct-pill){border-color:var(--border)}
html[data-portal-theme=dark] :is(table,td){border-color:var(--border)}
html[data-portal-theme=dark] :is(.etable th,.data-table th){background-color:#1a2f5e;color:#e5edf9}
html[data-portal-theme=dark] :is(a,.link){color:#a2e4ff}
html[data-portal-theme=dark] :is(.spe-panel,.spe-summary,.spe-table-wrap){background:var(--surface);color:var(--text)}
html[data-portal-theme=dark] #special-projects-estimating{--spe-main:#2b2e67;--spe-brand-soft:#282f49}
/* Legacy inline white surfaces. Exclude editable/output documents completely. */
html[data-portal-theme=dark] [style*="background:#fff" i]:not(:is([contenteditable],.spe-paper,.spe-paper *,[contenteditable] *,#crqc-preview,#crqc-preview *)),
html[data-portal-theme=dark] [style*="background: #fff" i]:not(:is([contenteditable],.spe-paper,.spe-paper *,[contenteditable] *,#crqc-preview,#crqc-preview *)),
html[data-portal-theme=dark] [style*="background:white" i]:not(:is([contenteditable],.spe-paper,.spe-paper *,[contenteditable] *,#crqc-preview,#crqc-preview *)){background-color:var(--surface)!important;color:var(--text)}
/* These are actual documents, not the portal chrome. Keep preview/editor light. */
html[data-portal-theme=dark] :is([contenteditable=true],.spe-paper,#crqc-preview){color-scheme:light;background:#fff!important;color:#1a2f5e!important;--text:#1a2f5e;--text-mid:#3d5472;--text-light:#6b7f9e;--surface:#fff;--surface2:#f8f9fb;--border:#d4dce6;--spe-text:#1a2f5e;--spe-border:#d4dce6;--spe-bg:#fff;--spe-alt:#f4f6f9;--fs-amber-bg:#fef6e4;--fs-sky-bg:#eaf8fd;--fs-green-bg:#eef7e9;--fs-pink-bg:#fdeef5;--fs-purple-bg:#f2edfe}
html[data-portal-theme=dark] :is(.spe-paper,[contenteditable=true],#crqc-preview) a{color:#0066a6}
html[data-portal-theme=dark] :is(.clean,.badge.clean){background:var(--green-bg);color:var(--green)}
html[data-portal-theme=dark] :is(.review,.badge.review){background:var(--amber-bg);color:var(--amber)}
}
/* Contrast corrections for controls and dynamically styled status dashboards. */
@media screen {
html[data-portal-theme=dark] .btn.primary{background:#a2e4ff;color:#10243b!important;border-color:#a2e4ff}
html[data-portal-theme=dark] .btn.primary:hover{background:#c6efff;color:#10243b!important}
html[data-portal-theme=dark] .btn.success{background:#a1e3a9;color:#102c20!important;border-color:#a1e3a9}
html[data-portal-theme=dark] .btn.danger{background:#ffb0cf;color:#3b1225!important;border-color:#ffb0cf}
html[data-portal-theme=dark] .btn:disabled{opacity:.65}
html[data-portal-theme=dark] .portal-nav-panel :is(.sb-item.active,.sb-item:hover,.sb-entity.active,.sb-entity:hover){background:#24465b!important;color:#d9f3ff!important}
html[data-portal-theme=dark] .portal-nav-panel :is(.sb-section,.sb-holding,.sb-urole){color:#aabbcf!important}
html[data-portal-theme=dark] .portal-nav-panel :is(.sb-user,.sb-uname,.sb-signout){color:#e5edf9!important}
html[data-portal-theme=dark] .portal-company-search{background:#18263b}
html[data-portal-theme=dark] .portal-display :is(button,select){background:#1c2d44;color:#e5edf9;border-color:#354963}
html[data-portal-theme=dark] .portal-display p{color:#aabbcf}
html[data-portal-theme=dark] .portal-appearance-controls button[aria-pressed=true]{background:#24465b;color:#d9f3ff}
html[data-portal-theme=dark] body.portal-topnav #portal-pin-menu{background:#1c2d44;color:#e5edf9;border-color:#354963}
html[data-portal-theme=dark] body.portal-topnav #portal-pin-menu[aria-pressed=true]{background:#24465b;color:#d9f3ff;border-color:#a2e4ff}
html[data-portal-theme=dark] :is(#btn-menu,#btn-back,.back-btn){color:#e5edf9!important;border-color:#354963}
html[data-portal-theme=dark] .wdb-total td{background:#234358!important;color:#e5edf9}
html[data-portal-theme=dark] .wdb-grand td{background:#2c4568!important;color:#f0f5ff;border-top-color:#a2e4ff}
html[data-portal-theme=dark] .wdb-total small{color:#c1cee0}
html[data-portal-theme=dark] .wdb-group td{background:#2b324b!important;color:#e5defa}
html[data-portal-theme=dark] .wdb-negative{color:#ffb0cf!important}
html[data-portal-theme=dark] .wdb-t td.wdb-ref{background:#32294d!important;color:#dac6ff!important;border-color:#9f81d1}
html[data-portal-theme=dark] .wdb-t tr.go:hover td,html[data-portal-theme=dark] .wdb-t td.wdb-yc:hover{background:#24465b!important}
html[data-portal-theme=dark] .wdb-chip{background:#173c52;color:#a2e4ff}
html[data-portal-theme=dark] :is(.wdb-go:hover,.wdb-pz:hover){background:#24465b;color:#d9f3ff}
html[data-portal-theme=dark] .wdb-ch{background:#1c2d44;color:#c1cee0}
html[data-portal-theme=dark] .wdb-ch.on{background:#203e31;color:#a1e3a9;border-color:#73b780}
html[data-portal-theme=dark] .wdb-ch.re{background:#40351e;color:#ffd276;border-color:#d2a747}
html[data-portal-theme=dark] .wdb-kpi-flag small{color:#ffb0cf}
html[data-portal-theme=dark] .wdb-st{background:#1c2d44;color:#e5edf9!important;border-color:#aabbcf!important}
html[data-portal-theme=dark] .wdb-st[style*="#b42318"]{color:#ffb0cf!important;border-color:#ffb0cf!important;background:#42283c}
html[data-portal-theme=dark] .wdb-st[style*="#6c4bb6"]{color:#d2bbff!important;border-color:#d2bbff!important;background:#32294d}
html[data-portal-theme=dark] .wdb-st[style*="#2f77ae"]{color:#a2e4ff!important;border-color:#a2e4ff!important;background:#173c52}
html[data-portal-theme=dark] .wdb-st[style*="#2f6b2a"]{color:#a1e3a9!important;border-color:#a1e3a9!important;background:#203e31}
html[data-portal-theme=dark] .wdb-st[style*="#e0a100"]{color:#ffd276!important;border-color:#ffd276!important;background:#40351e}
}
/* Portfolio and Financials review surfaces use fixed light colors in legacy markup. */
@media screen {
html[data-portal-theme=dark] .entity-link{color:#a2e4ff!important}
html[data-portal-theme=dark] .kpi-val[style*="var(--navy)"]{color:#e5edf9!important}
html[data-portal-theme=dark] #financial-saved-drafts{background:#173347!important;color:#e5edf9;border-color:#354963!important}
html[data-portal-theme=dark] [data-fr-dash-stage=owner],
html[data-portal-theme=dark] .fr-tr td[style*="#fffaf0"],
html[data-portal-theme=dark] #fr-strip section[aria-label="Your review"]{background:#383122!important;color:#e5edf9}
html[data-portal-theme=dark] [data-fr-dash-stage=staff],
html[data-portal-theme=dark] .fr-tr td[style*="#f0f8fb"],
html[data-portal-theme=dark] #fr-strip section[aria-label="Staff review"]{background:#173347!important;color:#e5edf9}
html[data-portal-theme=dark] [data-fr-dash-stage=planning],
html[data-portal-theme=dark] .fr-tr td[style*="#f6f1fc"],
html[data-portal-theme=dark] #fr-strip section[aria-label=Planning]{background:#32294d!important;color:#e5edf9}
html[data-portal-theme=dark] :is(#fr-strip,#fr-top,.fr-tr,[data-fr-dash-entity]) [style*="color:#637b95"]{color:#b9cbe0!important}
html[data-portal-theme=dark] :is(#fr-strip,#fr-top,.fr-tr,[data-fr-dash-entity]) [style*="color:#b42318"]{color:#ffb0cf!important}
html[data-portal-theme=dark] :is(#fr-strip,#fr-top,.fr-tr,[data-fr-dash-entity]) [style*="color:#9a6700"]{color:#ffd276!important}
html[data-portal-theme=dark] #fr-top [style*="background:#fff8e8"]{background:#383122!important;color:#e5edf9}
html[data-portal-theme=dark] #fr-top [style*="background:#eef8fc"]{background:#173347!important;color:#e5edf9}
html[data-portal-theme=dark] #fr-top [style*="background:#f6f1fc"]{background:#32294d!important;color:#e5edf9}
}
/* Planning actuals, reviewed lines and editable projected amounts. */
@media screen {
html[data-portal-theme=dark] .tpj-grid tr[data-tpt-rev="1"]{background:#20392f!important}
html[data-portal-theme=dark] .tpj-grid tr[style*="background: rgb(253, 240, 239)"],
html[data-portal-theme=dark] .tpj-grid tr[style*="background:#fdf0ef"]{background:#42283c!important}
html[data-portal-theme=dark] .tpj-grid input{background:#26364b!important;color:#f0f5ff!important;border-color:#879bb3!important;caret-color:#a2e4ff}
html[data-portal-theme=dark] .tpj-grid input[readonly]{background:#203e31!important;color:#c8efcf!important;border-color:#73b780!important}
html[data-portal-theme=dark] .tpj-grid thead th[style*="var(--fs-amber)"],
html[data-portal-theme=dark] .tpj-grid thead th[style*="var(--fs-sky)"]{color:#10243b!important}
html[data-portal-theme=dark] .tpj-grid .tpj-actual-link{color:inherit}
html[data-portal-theme=dark] .tpj-grid span[style*="color:var(--border)"]{color:#aabbcf!important}
html[data-portal-theme=dark] .tpj-grid .tpj-hover-row>td{background:#24465b!important}
html[data-portal-theme=dark] .tpj-grid td.tpj-hover-col{background:#294962!important}
html[data-portal-theme=dark] .tpj-grid td.tpj-hover-cell{background:#325c76!important;color:#f0f5ff!important;box-shadow:inset 0 0 0 2px #a2e4ff!important}
html[data-portal-theme=dark] #page-taxplan .tpt-flag{color:#ffb0cf!important}
}

/* Follow-up screen contrast: live clocks, completed tasks and planning locks. */
@media screen {
html[data-portal-theme=dark] #page-tasks h2,
html[data-portal-theme=dark] #page-tasks h3{color:#e5edf9!important}
html[data-portal-theme=dark] .tw-live{background:linear-gradient(125deg,#173b48,#20392f);border-color:#438299}
html[data-portal-theme=dark] .tw-live-card{background:#1c2d44;color:#e5edf9;border-color:#526981;border-left-color:#91d99c}
html[data-portal-theme=dark] .tw-live-head p,
html[data-portal-theme=dark] .tw-live-card small{color:#c1cee0}
html[data-portal-theme=dark] .tw-live-card>b{color:#a1e3a9}
html[data-portal-theme=dark] .tw-live-card.paused>b{color:#ffd276}
html[data-portal-theme=dark] #tk-list tr[style*="opacity: 0.5"],
html[data-portal-theme=dark] #tk-list tr[style*="opacity:.5"]{opacity:.85!important}
html[data-portal-theme=dark] #page-tasks a,
html[data-portal-theme=dark] #page-tasks [style*="color:var(--navy)"]{color:#a2e4ff!important}
html[data-portal-theme=dark] #tpt-closeall{color:#a1e3a9!important}
html[data-portal-theme=dark] .tvl-chip.on,
html[data-portal-theme=dark] .tvl-stamp{background:#203e31!important;color:#c8efcf!important;border-color:#73b780!important}
html[data-portal-theme=dark] .tvl-warn{background:#40351e!important;color:#ffd276!important}
}

@media screen {
html[data-portal-theme=dark] .tpj-grid thead th{color:#e5edf9!important}
html[data-portal-theme=dark] #page-tasks .tab.active{background:#173c52;color:#a2e4ff!important}
}
@media screen {
html[data-portal-theme=dark] #tk-list tr[style*="opacity:0.5"]{opacity:.85!important}
}

/* Tasks and CPA review cards: explicit screen-only semantic surfaces. */
@media screen {
html[data-portal-theme=dark] #page-tasks :is(.kpi-val,.ttd-number,.ttd-member-total b,.ttd-text-blue,.ttd-table-time,.ttd-table details summary,.ttd-member-avatar,.ttd-metric-icon){color:#a2e4ff!important}
html[data-portal-theme=dark] #page-tasks :is(.ttd-nav-button.active,.ttd-view-tab.active,.ttd-blue,.ttd-detail-tabs [data-tab].active){background:#173c52!important;color:#c7efff!important}
html[data-portal-theme=dark] #page-tasks :is(.tw-live,.tw-live-card){background:#1c2d44!important;color:#e5edf9!important;border-color:#536f8f!important}
html[data-portal-theme=dark] #page-tasks .tw-live{background:linear-gradient(120deg,#173b48,#20392f)!important}
html[data-portal-theme=dark] #page-tasks .tw-live :is(h3,span,small,p){color:#d0deef!important}
html[data-portal-theme=dark] #page-tasks :is(.tw-live-card>b,.tw-live-card .tw-elapsed){color:#a1e3a9!important}
html[data-portal-theme=dark] #page-tasks .tw-live-card.paused>b{color:#ffd276!important}
html[data-portal-theme=dark] #page-tasks :is(h2,h3,a){color:#e5edf9!important}
html[data-portal-theme=dark] #page-tasks :is([style*="color:var(--navy)"],[style*="color: var(--navy)"],[style*="color:#1a2f5e"],[style*="color: #1a2f5e"]){color:#bcecff!important}
html[data-portal-theme=dark] #tk-list tr[style*="opacity"]{opacity:.88!important}
html[data-portal-theme=dark] #page-tasks :is(.badge,.pill,.tag){background-color:#263e52;color:#e5edf9;border-color:#67869c}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone]{background:#1c2d44!important;color:#e5edf9!important;--cpa-panel:#233750}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone=answered]{background:#203e31!important;border-color:#70ac80!important;--cpa-panel:#294e3d}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone=waiting]{background:#42283c!important;border-color:#cb7b9e!important;--cpa-panel:#51334a}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone=reviewed]{background:#32294d!important;border-color:#a48ad2!important;--cpa-panel:#40345f}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone=needs_review]{background:#40351e!important;border-color:#c69947!important;--cpa-panel:#4d4028}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone=added]{background:#153e3c!important;border-color:#4fa49b!important;--cpa-panel:#204d49}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone=blocked],html[data-portal-theme=dark] #page-cpaq [data-cpa-tone=standby]{background:#263247!important;border-color:#8799b2!important;--cpa-panel:#31435d}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone] :is(label,b,strong,summary){color:#e5edf9}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone] :is(input,textarea,select){background:#182b42!important;color:#e5edf9!important;border-color:#69809a!important}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone] :is(.btn,[role=button]){color:#e5edf9!important;background-color:#233750!important;border-color:#7890ad!important}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone] [style*="color:var(--navy)"],html[data-portal-theme=dark] #page-cpaq [data-cpa-tone] [style*="color: var(--navy)"]{color:#c7efff!important}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone] :is([style*="background:#eef2fb"],[style*="background:#e9f5fd"],[style*="background:#e3f6f3"],[style*="background:#f3f6fb"],[style*="background: #eef2fb"]){background:var(--cpa-panel)!important;color:#e5edf9!important}
html[data-portal-theme=dark] #page-cpaq [data-cpa-tone] :is([style*="color:#1a2f5e"],[style*="color: #1a2f5e"],[style*="color:#0d9488"]){color:#bcecff!important}
}
/* Client chooser: readable brand titles on dark cards. */
@media screen {
html[data-portal-theme=dark] #client-grid > :is(div[onclick],button){background:#1c2d44!important;color:#e5edf9!important}
html[data-portal-theme=dark] #client-grid > :is(div[onclick],button) > :is(div[style*="font-weight:700"],b){color:#d7edff!important}
html[data-portal-theme=dark] #client-grid > button[onclick="openOwnerPrivateWorkspace()"] > b{color:#d2bbff!important}
html[data-portal-theme=dark] #client-grid > :is(div[onclick],button) > div[style*="text-light"]{color:#c1cee0!important}
html[data-portal-theme=dark] #client-grid > :is(div[onclick],button):hover{background:#263e52!important;box-shadow:0 0 0 2px #a2e4ff}
html[data-portal-theme=dark] #client-grid > :is(div[onclick],button):focus-visible{outline:3px solid #a2e4ff;outline-offset:3px}
}

/* Financial monthly flags: maintain readable contrast on every flagged cell. */
@media screen {
html[data-portal-theme=dark] #fin-monthly{--fin-open-flag-bg:#42283c}
html[data-portal-theme=dark] #fin-monthly .fin-has-open-flags>td{color:#e5edf9}
html[data-portal-theme=dark] #fin-monthly .fin-has-open-flags>td [style*="color:var(--border)"]{color:#b9cbe0!important}
}

/* Correction workflow is a body-level dialog, outside the Pivot theme host. */
@media screen {
html[data-portal-theme=dark] .pc-workflow-dialog{background:#18263b!important;color:#e5edf9!important;border-color:#69809a!important}
html[data-portal-theme=dark] .pc-workflow-dialog :is(p,label,table,thead,tbody,tr,td,th,strong,small,details,summary){color:#e5edf9!important}
html[data-portal-theme=dark] .pc-workflow-dialog th{background:#233750}
html[data-portal-theme=dark] .pc-workflow-dialog tr{border-color:#536b89!important}
html[data-portal-theme=dark] .pc-workflow-dialog textarea{background:#1c2d44!important;color:#e5edf9!important;border-color:#69809a!important}
html[data-portal-theme=dark] .pc-workflow-dialog textarea::placeholder{color:#b9cbe0}
}

/* Flagged transaction popup: keep flag and selection states readable. */
@media screen {
html[data-portal-theme=dark] #txp-modal{--txp-flag-bg:#42283c;--txp-flag-border:#cb7b9e;--txp-flag-text:#ffb0cf}
html[data-portal-theme=dark] #txp-body tr[data-txp-flag] > td{background:transparent;color:#e5edf9}
html[data-portal-theme=dark] #txp-body tr[data-txp-flag][aria-selected=true]{background:#4a3559!important;box-shadow:inset 4px 0 0 #ff8dba,inset 0 0 0 2px #a2e4ff!important}
html[data-portal-theme=dark] #txp-body tr[data-txp-flag]:hover{background:#51334a!important}
html[data-portal-theme=dark] #txp-body tr[data-txp-flag][aria-selected=true]:hover{background:#4a3559!important}
html[data-portal-theme=dark] #txp-body tr[data-txp-flag]:focus-visible{outline:2px solid #a2e4ff;outline-offset:-2px}
}

/* Projects & Pay Apps: dark surfaces must pair with readable text. */
@media screen {
html[data-portal-theme=dark] :is(.pa-maxcard,.pa-how,.pa-empty,.pa-warn){background:#1c2d44!important;color:#e5edf9!important}
html[data-portal-theme=dark] .pa-t tbody td{background-color:#1c2d44;color:#e5edf9!important;border-color:#354963!important}
html[data-portal-theme=dark] .pa-t tbody tr.pa-pc.pa-pc td{background:color-mix(in srgb,var(--pc) 16%,#18263b)!important}
html[data-portal-theme=dark] .pa-mxs tbody tr[class*="pa-cat-"]:not(.pa-mx-sec):not(.pa-mx-gap) td{background:color-mix(in srgb,var(--pa-cat) 12%,#18263b)!important}
html[data-portal-theme=dark] .pa-mxs tr.pa-mx-sec td,html[data-portal-theme=dark] .pa-t tr.pa-gl-cat td,html[data-portal-theme=dark] .pa-t tr.pa-gl-par td{background:#273e59!important;color:#f1f6ff!important}
html[data-portal-theme=dark] .pa-t td:is(.pa-mx-asm,.pa-mx-pend,.pa-wip-in){background:#493a17!important;color:#ffe8a6!important}
html[data-portal-theme=dark] .pa-t td:is(.pa-wip-fix,.pa-mx-tp){background:#174151!important;color:#b9efff!important}
html[data-portal-theme=dark] .pa-t tbody td :is(a,.pa-name,.pa-go){color:#9fe0f7!important}
html[data-portal-theme=dark] :is(.pa-how,.pa-maxcard,.pa-empty,.pa-warn) :is(h3,h4,.pa-maxh,.pa-maxd){color:#e5edf9!important}
html[data-portal-theme=dark] .pa-t tbody td :is(small,.pa-note,.pa-estvs){color:#becfe2!important}
html[data-portal-theme=dark] .pa-t td input{background:#23374d!important;color:#f1f6ff!important}
html[data-portal-theme=dark] .pa-t .pa-wip-ok{color:#a1e3a9!important}
html[data-portal-theme=dark] .pa-t .pa-wip-bad{color:#ffb0bf!important}
}

/* Notifications and flag filters: readable state surfaces in dark mode. */
@media screen {
html[data-portal-theme=dark] [data-mention-seen]{background:#173c52!important;color:#e5edf9!important;opacity:1!important}
html[data-portal-theme=dark] [data-mention-seen][style*="#f3faef"]{background:#203e31!important}
html[data-portal-theme=dark] [data-mention-seen][style*="#f6f2fe"]{background:#32294d!important}
html[data-portal-theme=dark] [data-mention-seen] [style*="background:#fff6e0"]{background:#40351e!important;color:#ffe1a0!important}
html[data-portal-theme=dark] [data-mention-seen] [style*="color:#8a5a00"]{color:#ffe1a0!important}
html[data-portal-theme=dark] [data-mention-seen] [style*="color:#5b34c9"]{color:#dac6ff!important}
html[data-portal-theme=dark] [data-mention-seen] button[onclick^="mnSnoozeMenu"]{background:#32294d!important;color:#dac6ff!important;border-color:#b69ade!important}
html[data-portal-theme=dark] [data-mention-seen] button[onclick^="mnDone"]{background:#a1e3a9!important;color:#102c20!important;border-color:#a1e3a9!important}
html[data-portal-theme=dark] [data-mention-seen] button[onclick^="mnAck"]{background:#203e31!important;color:#a1e3a9!important;border-color:#a1e3a9!important}
html[data-portal-theme=dark] #rq-bulkbar{background:#1c2d44!important;color:#e5edf9!important;box-shadow:0 5px 18px #0004!important}
html[data-portal-theme=dark] #rq-bulkbar label{color:#e5edf9!important}
html[data-portal-theme=dark] #rq-selected-count{background:#273e59!important;color:#e5edf9!important}
html[data-portal-theme=dark] :is([data-rq-client],[data-rq-responsible]){color:#e5edf9!important;background:#1c2d44!important}
html[data-portal-theme=dark] :is([data-rq-client],[data-rq-responsible])[aria-pressed=true]{background:#24465b!important;color:#d9f3ff!important;box-shadow:inset 0 0 0 2px #a2e4ff!important}
html[data-portal-theme=dark] [data-rq-responsible] span{background:#273e59!important;color:#f1f6ff!important}
html[data-portal-theme=dark] :is([data-rq-client],[data-rq-responsible]):hover{background:#273e59!important}
html[data-portal-theme=dark] :is([data-rq-client],[data-rq-responsible]):focus-visible{outline:3px solid #a2e4ff;outline-offset:3px}
}

/* Meeting notes: preserve readable status and team discussions in dark mode. */
@media screen {
html[data-portal-theme=dark] .mtn-done{opacity:1}
html[data-portal-theme=dark] .mtn-row .mtn-t{color:#e5edf9}
html[data-portal-theme=dark] .mtn-row .mtn-d{color:#d5e1f0}
html[data-portal-theme=dark] .mtn-m{color:#bbcce0}
html[data-portal-theme=dark] .mtn-m>span[style*="color:#1a6f8f"]{color:#83d9f2!important}
html[data-portal-theme=dark] .mtn-m>span[style*="color:#2f6b2a"]{color:#a1e3a9!important}
html[data-portal-theme=dark] .mtn-m>span[style*="color:#a12c2c"]{color:#ffb6b0!important}
html[data-portal-theme=dark] .mtn-rp{background:#24364f!important;color:#e5edf9!important;border-left:3px solid #a9b9cf}
html[data-portal-theme=dark] .mtn-rp.vis{background:#173c52!important;border-color:#83d9f2}
html[data-portal-theme=dark] .mtn-rp.cl{background:#203e31!important;border-color:#a1e3a9}
html[data-portal-theme=dark] .mtn-rp.cl.fix{background:#40351e!important;border-color:#ffd276}
html[data-portal-theme=dark] .mtn-chip{background:#2b405c!important;color:#e5edf9!important}
html[data-portal-theme=dark] .mtn-note{color:#ffd276}
}

/* Vault filenames remain readable on dark surfaces. */
@media screen{html[data-portal-theme=dark] .doc-name{color:var(--text);font-weight:600}}

/* FYI reading surfaces only. Saved notes and outgoing documents retain their formatting. */
@media screen {
html[data-portal-theme=dark] .fyi-note-content{color:var(--text-mid)}
html[data-portal-theme=dark] .fyi-note-content [style*="color:#1a2f5e" i],
html[data-portal-theme=dark] .fyi-note-content :is(h1,h2,h3,h4,h5,h6,strong){color:var(--text)!important}
html[data-portal-theme=dark] .fyi-note-content :is(p,li,em){color:inherit}
html[data-portal-theme=dark] .fyi-note-content code{background:var(--surface2);color:var(--text);border-color:var(--border)}
html[data-portal-theme=dark] .fyi-note-content hr{border-top-color:var(--border)!important}
html[data-portal-theme=dark] #fyi-body .action-card [style*="color:#5b34c9" i]{color:var(--fs-purple)!important}
html[data-portal-theme=dark] #fyi-body .ac-actions button[onclick^="fyiEmailOne"]{color:var(--amber)!important;border-color:var(--amber)!important}
}

/* Shared screen components. Document/export markup has no ar-aging-screen class. */
@media screen{
html[data-portal-theme=dark] .ar-aging-screen{color:var(--text)!important}
html[data-portal-theme=dark] .ar-aging-screen thead th{background:#233750!important;color:#edf4ff!important;border-color:var(--border)!important}
html[data-portal-theme=dark] .ar-aging-screen tbody tr{background:color-mix(in srgb,var(--ar-row-color,#1c2d44) 16%,#18263b)!important}
html[data-portal-theme=dark] .ar-aging-screen td{color:var(--text)!important;border-color:var(--border)!important}
html[data-portal-theme=dark] .ar-aging-screen tbody td:nth-child(3){color:var(--red)!important}
html[data-portal-theme=dark] .ar-aging-screen tfoot tr{background:#234358!important;color:#edf4ff!important}
html[data-portal-theme=dark] :is(#rb-preview,#arb-preview,#bk-preview,#ar-client-preview){color-scheme:light;background:#fff!important;color:#1a2f5e!important;--text:#1a2f5e;--text-mid:#3d5472;--text-light:#6b7f9e;--surface:#fff;--surface2:#f8f9fb;--border:#d4dce6}
}