/* SCA Contractor Intelligence — appearance layer.
   Loaded AFTER the existing dashboard styles, without altering the header design.
   SCA greens and pale neutral surfaces reference the Authority's brand palette. */

/* The original executive green header and subnavigation are deliberately invariant.
   Light theme tokens are scoped below, but header descendants retain dark values. */
#app > .topbar, #app > .subnav{
 --bg:#071f1b;--bg2:#0a2621;--surface:#0e3027;--surface2:#123b30;--surface3:#153c32;
 --border:#2c5143;--border2:#326753;--text:#eff8f0;--muted:#a1bdaf;--hint:#90ad9d;
 --green:#62c455;--green2:#45b553;--gold:#d9b978;--blue:#86bfa9;--red:#e38f86;
 color-scheme:dark;
}
#app > .topbar{background:#052d25;border-bottom-color:#2c5143}
#app > .subnav{background:#082c24;border-bottom-color:#2c5143}

/* Appearance control visually pairs with the existing EN / ع pill. */
#app > .topbar .theme-control,
.auth-theme-switch{
 display:flex;flex:0 0 94px;width:94px;height:40px;min-height:40px;
 align-items:stretch;justify-content:center;gap:0;direction:ltr;
 padding:2px;box-sizing:border-box;overflow:hidden;text-align:center;
 border:2px solid #73bc8d;border-radius:999px;background:#ecf7ef;
}
#app > .topbar .theme-control{margin-left:0;flex-shrink:0}
#app > .topbar .theme-control .theme-option,
.auth-theme-switch button{
 display:flex;align-items:center;justify-content:center;flex:1 1 50%;width:50%;min-width:0;
 height:100%;min-height:0;margin:0;padding:0;border:0;box-shadow:none;
 background:transparent;color:#154c32;border-radius:999px;
 font-family:var(--font-latin,Arial,sans-serif)!important;font-size:19px;font-weight:700;
 line-height:1;cursor:pointer;transition:background-color .15s ease,color .15s ease;
}
#app > .topbar .theme-control .theme-option[aria-pressed="true"],
.auth-theme-switch button[aria-pressed="true"]{background:#216945;color:white}
#app > .topbar .theme-control .theme-option:not([aria-pressed="true"]):hover,
.auth-theme-switch button:not([aria-pressed="true"]):hover{background:#cfead7}
#app > .topbar .theme-control .theme-option:focus-visible,
.auth-theme-switch button:focus-visible{outline:2px solid #93e5aa;outline-offset:-3px}
#app > .topbar .theme-control .theme-option span,
.auth-theme-switch button span{display:block;pointer-events:none}
@media(max-width:770px){
 #app > .topbar .theme-control{flex:0 0 84px;width:84px;height:36px;min-height:36px}
 #app > .topbar #header-account-actions{margin-left:0}
}
@media(max-width:620px){
 #app > .topbar .theme-control{flex:0 0 72px;width:72px;height:35px;min-height:35px}
 #app > .topbar .theme-control .theme-option{font-size:17px}
 #app > .topbar #header-account-actions{margin-left:0}
}
@media(max-width:440px){
 #app > .topbar .theme-control{flex:0 0 62px;width:62px;height:34px;min-height:34px}
 #app > .topbar .theme-control .theme-option{font-size:16px}
 #app > .topbar .head-context.language-control{flex:0 0 72px;width:72px}
 #app > .topbar{gap:5px}
 #app > .topbar #header-account-actions{margin-left:0}
}
@media(max-width:390px){
 #app > .topbar{padding-inline:7px;gap:3px}
 #app > .topbar .head-context.language-control{flex:0 0 65px;width:65px}
 #app > .topbar .theme-control{flex:0 0 54px;width:54px}
 #app > .topbar #header-account-actions{gap:3px;margin-left:0}
}
@media(prefers-reduced-motion:reduce){
 #app > .topbar .theme-option,.auth-theme-switch button{transition:none}
}

/* Light is the default: selected explicitly on initial page load. */
:root[data-theme="light"]{
 color-scheme:light;
 --bg:#f4f8f5;--bg2:#eaf2ed;--surface:#fff;--surface2:#f1f7f3;
 --surface3:#eaf4ed;--border:#c7d9cd;--border2:#a9c8b1;
 --text:#173c2c;--muted:#4c6b5a;--hint:#607d6b;--green:#236c42;
 --green2:#1b7547;--gold:#926815;--blue:#296c67;--violet:#66702e;--red:#a23e3e;
}
html[data-theme="light"] body{
 color-scheme:light;color:var(--text);
 background:radial-gradient(ellipse at top right,#e8f3e9 0%,#f5f8f5 52%,#f8faf8 100%);
}
html[data-theme="light"] ::selection{background:#b8dfc7;color:#173c2c}

/* Semantic containers and primary KPI surfaces across all four data tabs. */
html[data-theme="light"] :is(.product-card,.metric,.summary-panel,.gallery-wrap,.chart-card,
 .section-table,.section-config,.section-admin,.global-filters-section,.portfolio-summary,
 .contract-group-head,.contract-insight-group,.dataset-loading-card){
 background:#fff;border-color:#c7d9cd;color:#173c2c;
 box-shadow:0 2px 10px rgba(29,72,45,.045);
}
html[data-theme="light"] :is(.product-card,.metric){background:linear-gradient(135deg,#fff,#f0f7f1)}
html[data-theme="light"] .analysis-workspace .gallery-wrap{background:transparent;box-shadow:none}
html[data-theme="light"] :is(.section-top h2,.panel-heading,.metric-value,.product-heading,
 .summary-row strong,.chart-title,.chart-lightbox-title,.contract-group-heading h3){color:#183d2c}
html[data-theme="light"] :is(.breadcrumb,.right-crumb,.section-side,.metric-foot,.metric-label,
 .card-overline,.summary-note,.summary-row span,.product-desc,.chart-subtitle,.chart-footer,
 .small-caption,.search-hint,.config-status,.table-footer,.gallery-bottom,.field>span){color:#526f5e}
html[data-theme="light"] :is(.eyebrow,.breadcrumb strong,.live-icon){color:#1e7042}
html[data-theme="light"] .db-label{background:#e7f4eb;color:#236747;border-color:#b7d5c0}
html[data-theme="light"] .product-icon{background:#e0f0e7;color:#26784e}
html[data-theme="light"] :is(.summary-row,.summary-divider,.config-footer,.chart-footer,
 .section-table .table-footer,.market-model-note){border-color:#d8e5dc}
html[data-theme="light"] :is(.mini-pill,.chart-chip,.tag){background:#e6f4ec;color:#1a6742;border-color:#badbc7}
html[data-theme="light"] .visual-panel .chart-card,
html[data-theme="light"] .analysis-workspace .chart-card{background:linear-gradient(135deg,#fff,#f7faf7)}
html[data-theme="light"] .chart-card .chart-container{color:#234a36}
html[data-theme="light"] :is(.arrow-btn,.ghost-btn,.market-nav button,
 .chart-action-btn,.ctr-carousel-controls button,.chart-lightbox-close){
 background:#e9f4ec;color:#245c3d;border-color:#bad3c2;
}
html[data-theme="light"] :is(.arrow-btn,.ghost-btn,.market-nav button,
 .chart-action-btn,.ctr-carousel-controls button):hover:not(:disabled){
 background:#d8ecdf;color:#174a31;border-color:#81ba91;
}
html[data-theme="light"] :is(.primary-btn,.config-buttons .primary-btn){
 background:#216b43;color:#fff;border-color:#216b43;
}
html[data-theme="light"] :is(.primary-btn,.config-buttons .primary-btn):hover{background:#185a37}
html[data-theme="light"] :is(.checkmark,.chart-chip){background:#e4f3e9;color:#267649}
html[data-theme="light"] :is(.chart-explanation,.chart-lightbox-explanation){
 background:#eef6f0;border:1px solid #d4e5d8;color:#254b35;
}
html[data-theme="light"] .chart-explanation :is(p,strong),
html[data-theme="light"] .chart-lightbox-explanation :is(p,strong){color:#254b35}
html[data-theme="light"] .dataset-loading{background:rgba(28,62,45,.35)}
html[data-theme="light"] .dataset-loading-card :is(h2,.dataset-loading-eyebrow){color:#194b30}
html[data-theme="light"] .dataset-loading-card :is(.dataset-loading-message,.dataset-loading-hint){color:#52705d}
html[data-theme="light"] .dataset-continue-btn{color:#245b3e;border-color:#c4dccc}

/* Tables, search, dropdowns, data record drawers. */
html[data-theme="light"] :is(.table-toolbar input,.global-search-input,
 .field select,.pf-option-search,.pf-portfolio-search input,.pf-date-mode,
 .pf-date-range input,.pf-trigger,.pf-select-panel,.pf-date,.pf-advanced,
 .pf-option-list,.pf-chip,.pf-results,.pf-date-range,.record-details,
 .record-detail-panel,.dataset-picker,select,input:not([type=checkbox])){
 background:#fff;color:#214832;border-color:#b8d1bf;
}
html[data-theme="light"] :is(.table-toolbar input,.global-search-input,
 .pf-option-search,.pf-portfolio-search input,.field select)::placeholder{color:#748e7d}
html[data-theme="light"] :is(.field select option,.pf-date-mode option){background:#fff;color:#193f2b}
html[data-theme="light"] .pf-select-panel{box-shadow:0 12px 34px rgba(22,69,40,.18)}
html[data-theme="light"] :is(.pf-option,.pf-trigger,.pf-label,.pf-advanced>summary,
 .pf-date legend,.pf-option small,.pf-subhead,.pf-section-caption,.pf-search-label,
 .pf-date-mode-label,.pf-date-range label,.pf-heading h2,.pf-advanced .pf-label,
 .pf-advanced .pf-option,.pf-advanced .pf-subhead){color:#214a33}
html[data-theme="light"] :is(.pf-heading p,.pf-advanced>summary small,.pf-availability,
 .pf-unavailable,.pf-date legend small,.pf-option small,.pf-trigger small){color:#5e7765}
html[data-theme="light"] .pf-option:hover:not(:disabled),
html[data-theme="light"] .pf-option:focus-visible,
html[data-theme="light"] .pf-option[aria-checked=true]{background:#e2f0e7}
html[data-theme="light"] .pf-chip{background:#e5f2e9;color:#255b3d}
html[data-theme="light"] .pf-summary-actions b{background:#d4ebda;color:#1c5937}
html[data-theme="light"] .pf-advanced-body{border-color:#d4e3d7}
html[data-theme="light"] body:is(.projects-view,.other-tab-view) #global-filters{
 background:#fff;border-color:#bcd3c3;
}
html[data-theme="light"] body:is(.projects-view,.other-tab-view) #global-filters :is(.pf-advanced,.pf-date,.pf-select-panel,.pf-trigger){
 background:#fff;border-color:#bcd3c3;color:#214832;
}
html[data-theme="light"] body:is(.projects-view,.other-tab-view) #global-filters .pf-advanced :is(.pf-label,.pf-option,.pf-subhead,.pf-availability,.pf-unavailable,.pf-date legend,.pf-date-range label){color:#28513a}
html[data-theme="light"] :is(.table-viewport,.data-table td,.data-table th){border-color:#d8e5dc}
html[data-theme="light"] :is(.data-table thead,.market-table thead){background:#e0efe5}
html[data-theme="light"] .data-table th{color:#315a42}
html[data-theme="light"] .data-table td{color:#284a37;border-color:#dce8df}
html[data-theme="light"] .data-table .name-cell{color:#194730}
html[data-theme="light"] .data-table tr:hover td{background:#eaf5ed}
html[data-theme="light"] .table-toolbar input{background:#fff}
html[data-theme="light"] :is(.tag.future,.tag.ongoing,.tag.completed){color:#34583b}
html[data-theme="light"] .data-table .tag.risk{color:#8e3636;background:#fce5e5}

/* Market section: white visual cards with green signposting. */
html[data-theme="light"] :is(.market-summary,.market-group,.market-method,
 .market-card,.market-focus-section,.market-insights,.market-insight-grid){
 background:#fff;color:#214533;border-color:#ccdecf;
}
html[data-theme="light"] .market-summary li.market-key-insight{
 background:#f1f7f2;border-left-color:#39905c;color:#244a34;
}
html[data-theme="light"] .market-summary :is(p,.market-model-note){color:#526c5c}
html[data-theme="light"] :is(.market-key-insight-detail summary,.market-key-insight-body strong){color:#1d4931}
html[data-theme="light"] .market-key-insight-detail[open]{background:#e9f3ec}
html[data-theme="light"] .market-key-insight-detail summary:hover{background:#e3efe7}
html[data-theme="light"] .market-key-insight-toggle{color:#277247}
html[data-theme="light"] .market-key-insight-body{border-color:#d0e0d4}
html[data-theme="light"] .market-key-insight-body p{color:#425e4b}
html[data-theme="light"] .market-group-head{background:#e9f4ed;border-color:#d0e0d4}
html[data-theme="light"] .market-group-title,
html[data-theme="light"] .market-focus-heading h3{color:#1f4d33}
html[data-theme="light"] :is(.market-slide h3,.market-footnote,.market-position,
 .market-focus-heading p,.market-group-head p,.market-share-note,.market-share-help){color:#4c6d55}
html[data-theme="light"] .market-focus-heading{border-color:#d4e2d7}
html[data-theme="light"] .market-focus-grid > .market-focus-card{
 background:#f9fbf9;border-color:#dae8de;color:#1f4932;
}
html[data-theme="light"] :is(.market-focus-card .market-chart-container,.market-line svg){
 background:#f1f7f3;
}
html[data-theme="light"] .market-table th{color:#254b34;border-color:#c5dcca}
html[data-theme="light"] .market-table td{color:#294e38;border-color:#dce8de}
html[data-theme="light"] .market-table tr:hover td{background:#e9f5eb}
html[data-theme="light"] :is(.market-bar-name,.market-bar-row strong){color:#244f35}
html[data-theme="light"] .market-bar-track{background:#e4f1e8}
html[data-theme="light"] .market-group .market-slide{color:#284c36}
html[data-theme="light"] :is(.market-reading-guide .market-guide-item h4,
 .market-reading-footnote,.market-reading-guide .market-guide-item p){color:#375943}
html[data-theme="light"] .market-reading-guide .market-guide-item{border-color:#d7e6db}
html[data-theme="light"] .market-share-ranked,
html[data-theme="light"] .market-share-selected{background:#f0f7f1;color:#294b35;border-color:#c3dac9}
html[data-theme="light"] .market-share-row strong,
html[data-theme="light"] .market-share-name{color:#264a34}
html[data-theme="light"] :is(.market-band.high,.market-direction.up){color:#17653c}
html[data-theme="light"] :is(.market-band.medium,.market-direction.steady){color:#75510d}
html[data-theme="light"] :is(.market-band.low,.market-direction.down){color:#a04032}
html[data-theme="light"] .market-band.high{background:#e1f2e6}
html[data-theme="light"] .market-band.medium{background:#fdf0d0}
html[data-theme="light"] .market-band.low{background:#fce7e1}
html[data-theme="light"] .market-band.missing{background:#e2e9e4;color:#607167}
html[data-theme="light"] .market-empty{background:#f6faf7;border-color:#b8d1c0;color:#476d53}
html[data-theme="light"] .market-donut:after{background:#f8fbf8}
html[data-theme="light"] .market-stack-track{background:#e6f2e8;border-color:#c5dccb}

/* Contractor-specific analytics: labels, bar tracks, map selections, and legends. */
html[data-theme="light"] :is(.ctr-page,.ctr-gallery-card,.contract-pie-panel,.ctr-map-top,
 .ctr-map-region,.ctr-map-stat,.ctr-more-note,.ctr-map-switch){
 background:#fff;color:#234e35;border-color:#c9decf;
}
html[data-theme="light"] :is(.ctr-legend,.ctr-row-name,.ctr-bar-value,.ctr-pair-label,
 .ctr-series-label,.ctr-radar-label,.ctr-map-stat strong,.ctr-map-region-name,
 .contract-pie-panel figcaption,.contract-pie-legend-row strong){color:#204b31}
html[data-theme="light"] :is(.ctr-map-footnote,.ctr-radar-hint,.ctr-more-note,
 .ctr-map-stat span,.contract-pie-legend-row,.ctr-map-key){color:#536f5a}
html[data-theme="light"] :is(.ctr-bar-track,.ctr-pair-track){background:#e5f0e7;border-color:#d3e6d8}
html[data-theme="light"] .ctr-map-metric{background:#e7f4ec;color:#28533a;border-color:#b5d1bd}
html[data-theme="light"] .ctr-map-metric[aria-pressed="true"]{background:#26734b;color:white}

/* Charts use the same measured values and series colors; only their labels
   and faint decoration are adjusted for contrast on pale backgrounds. */
html[data-theme="light"] :is(.chart-svg,.market-line svg,.market-radar svg,.ctr-radar-holder svg,
 .contract-pie-svg,.ctr-quadrant-svg) text{fill:#284b39}
html[data-theme="light"] svg :is([fill="#aebdb7"],[fill="#b8c9bd"],[fill="#d3e3d7"],
 [fill="#d6eee1"],[fill="#e5f6e9"],[fill="#b8d2c1"]){fill:#395b46}
html[data-theme="light"] :is(.market-line svg,.market-radar svg) :is(line,polygon)[stroke="#b8d2c1"]{
 stroke:#bacfc0;stroke-opacity:.75;
}
html[data-theme="light"] .chart-container svg .sca-riyal-svg-path{pointer-events:none}

/* Enlarged analytical visuals and dialogs retain readable white panels. */
html[data-theme="light"] :is(.chart-lightbox-dialog,.chart-lightbox-visual,
 .detail-panel,.record-detail-dialog,.modal-panel){
 background:#fff;color:#204630;border-color:#c6dccd;
}
html[data-theme="light"] :is(.chart-lightbox-header,.chart-lightbox-explanation,
 .chart-lightbox-visual){border-color:#d6e4d9}
html[data-theme="light"] :is(.chart-lightbox-dialog p,.detail-field dt,.detail-field dd){
 color:#385c44;
}
html[data-theme="light"] :is(.custom-tip,.toast){background:#f4faf5;color:#204a32;border-color:#bfd6c5}
html[data-theme="light"] :is(.back-to-top,.pager button){background:#277047;color:#fff;border-color:#277047}

/* Standalone /login and auth pages share preference but do not inherit the
   authenticated app header, which remains completely unchanged. */
html[data-theme="light"] body.login-page,
html[data-theme="light"] body:not(:has(#app)){
 background:radial-gradient(circle at 5% 5%,#e3f2e6 0%,#f5f8f5 58%);
 color:#193e2b;
}
html[data-theme="light"] body:not(:has(#app)) .panel{
 background:#fff;color:#214630;border-color:#c3d7c8;
 box-shadow:0 20px 50px rgba(32,63,39,.09);
}
html[data-theme="light"] body:not(:has(#app)) :is(.brand span,h1,h2){color:#173f2c}
html[data-theme="light"] body:not(:has(#app)) :is(label,p,.auth-support){color:#4a6855}
html[data-theme="light"] body:not(:has(#app)) input,
html[data-theme="light"] body:not(:has(#app)) select{
 background:#fff;color:#193e2b;border-color:#b8cfbe;
}
html[data-theme="light"] body:not(:has(#app)) .auth-support a{color:#226a43}
html[data-theme="light"] body:not(:has(#app)) .admin-back-link{
 background:#e5f2e8;color:#255a3d;border-color:#b8d7c0;
}
html[data-theme="dark"] body.login-page .panel{color-scheme:dark;background:#0c2a23;color:#e5f7ed;border-color:#315a48}
html[data-theme="dark"] body.login-page .panel :is(h1,h2){color:#e5f7ed}
html[data-theme="dark"] body.login-page .panel :is(p,label){color:#bfd7c8}
html[data-theme="dark"] body.login-page .panel :is(input,select){color:#eefbf4;background:#13392f;border-color:#3a6550}

/* Sign-in heading: do not displace the existing centered card at different zooms. */
body.login-page .auth-signin-head{gap:8px;flex-wrap:wrap;justify-content:flex-start}
body.login-page .auth-signin-head .brand{flex:1 1 178px}
body.login-page .auth-signin-head .auth-language-switch{flex:0 0 100px;width:100px;height:38px;min-height:38px}
body.login-page .auth-signin-head .auth-theme-switch{flex:0 0 82px;width:82px;height:38px;min-height:38px;margin:0}
body.login-page .auth-signin-head .auth-theme-switch button{min-width:0;width:50%;height:100%;min-height:0;padding:0}
body:not(.login-page) .auth-theme-switch{width:94px;margin:0 0 14px}
@media(max-width:520px){
 body.login-page .auth-signin-head .brand{flex:1 1 100%;white-space:normal}
 body.login-page .auth-signin-head .auth-language-switch{margin-left:auto}
 body.login-page .auth-signin-head .auth-theme-switch{flex-basis:72px;width:72px}
}


/* ================================================================
   Light-theme accessibility / visual audit, 27 Oct 2026
   Scoped to Light mode. Header colors and dark-mode analytics untouched.
   ================================================================ */

/* 1. Header branding: the top bar always uses the executive palette.
   An inherited --text token previously made "Contractor" dark in Light. */
html[data-theme="light"] #app > .topbar,
html[data-theme="dark"] #app > .topbar{
 color:#eff8f0;
}
html[data-theme="light"] #app > .topbar .brand-title,
html[data-theme="dark"] #app > .topbar .brand-title{
 color:#eff8f0;
}
html[data-theme="light"] #app > .topbar .brand-title em,
html[data-theme="dark"] #app > .topbar .brand-title em{
 color:#8ada61;
}
html[data-theme="light"] #app > .topbar .brand-overline,
html[data-theme="dark"] #app > .topbar .brand-overline{
 color:#c1e2cc;
}
html[data-theme="light"] #app > .topbar .header-rule,
html[data-theme="dark"] #app > .topbar .header-rule{
 border-color:#2c5143;
}
html[data-theme="light"] #app > .subnav,
html[data-theme="dark"] #app > .subnav{
 color:#eff8f0;
}
html[data-theme="light"] #app > .subnav .nav-link:not(.active){
 color:#a6c9b6;
}
html[data-theme="light"] #app > .subnav .nav-link.active{
 color:#83dc74;
}

/* 2. Align the sign-in form and language/theme/brand controls with
   the background SCA geometric mark rather than the page's top edge.
   Translate both locales together; do not transform/resize the card. */
body.login-page .wrap{
 margin-top:clamp(122px,17vh,186px);
 margin-bottom:4vh;
}
@media(max-height:690px) and (min-width:621px){
 body.login-page .wrap{margin-top:clamp(44px,10vh,90px)}
}
@media(max-width:620px){
 body.login-page .wrap{margin-top:clamp(46px,9vh,92px)}
}
@media(max-width:390px){
 body.login-page .wrap{margin-top:40px}
}

/* 3. Projects / Contracts / Contractors visual groups.
   Legacy rules had more specificity than the first light-theme layer,
   leaving dark outer group shells and card headers. */
html[data-theme="light"] body .analysis-workspace > .section-analytics,
html[data-theme="light"] body .analysis-workspace .section-analytics .visual-panel,
html[data-theme="light"] body .analysis-workspace .section-analytics .gallery-wrap,
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-gallery{
 background:transparent;
 color:#214934;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-gallery > .contract-insight-group,
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-gallery > .project-chart-carousel,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group,
html[data-theme="light"] body .analysis-workspace .section-analytics .project-chart-carousel{
 background:#fff;
 border-color:#c9ddce;
 color:#214b35;
 box-shadow:0 2px 12px rgba(27,73,45,.06);
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-gallery > .chart-card,
html[data-theme="light"] body .analysis-workspace .section-analytics .project-pair-track > .chart-card,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group > .project-pair-track > .chart-card,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .contract-group-grid > .chart-card{
 background:linear-gradient(135deg,#fff,#f7faf8);
 border-color:#ceded1;
 color:#214b35;
 box-shadow:none;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group > .contract-group-head{
 background:transparent;
 border-color:#d3e3d8;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-title,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .contract-group-heading h3,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .chart-title{
 color:#183f2c;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-subtitle,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .contract-group-heading p,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .chart-subtitle{
 color:#4c6f57;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-card .chart-chip,
html[data-theme="light"] body .market-insight-grid .chart-card .chart-chip,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .chart-chip{
 background:#e3f0e7;
 border:1px solid #a4c8b0;
 color:#1a603a;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-gallery > .chart-card > .chart-footer,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .chart-footer,
html[data-theme="light"] body .analysis-workspace .section-analytics .project-pair-track > .chart-card > .chart-footer{
 color:#496b55;
 border-color:#d4e4d9;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-card .chart-container,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .chart-container{
 background:#f2f7f3;
 color:#254a36;
 border-radius:9px;
}
/* Chart inner marks retain their established series colors. */
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-container :is(.chart-compact-bars,.compact-plot,.contract-dual-pie,.ctr-bars,.ctr-pair-track){
 color:#214a34;
}
html[data-theme="light"] body .analysis-workspace .section-analytics :is(.compact-plot-name,.compact-plot-value,.ctr-row-name,.ctr-bar-value,.contract-pie-legend-row,.contract-pie-legend-row strong,.contract-pie-panel figcaption){
 color:#264c36;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-pie-panel{
 background:#f8fbf8;
 border-color:#cce0d0;
}

/* 4. Action controls: visibly actionable dark green / white, matching the
   existing executive dark controls. Includes chart and carousel navigation. */
html[data-theme="light"] body :is(
 .chart-action-btn,
 .analysis-workspace .section-analytics .chart-card .chart-action-btn,
 .analysis-workspace .section-analytics .contract-insight-group .chart-action-btn,
 .market-insight-grid .chart-card .chart-action-btn,
 .market-focus-card .chart-action-btn,
 .project-pair-controls button,
 .contract-group-actions button,
 .ctr-carousel-controls button,
 .market-nav button,
 .market-card-footer .market-nav button
){
 background:#20583e;
 color:#fff;
 border:1px solid #20583e;
 box-shadow:0 1px 4px rgba(21,70,44,.16);
 opacity:1;
}
html[data-theme="light"] body :is(
 .chart-action-btn,
 .project-pair-controls button,
 .contract-group-actions button,
 .ctr-carousel-controls button,
 .market-nav button
):hover:not(:disabled){
 background:#2e7550;
 color:#fff;
 border-color:#246d45;
}
html[data-theme="light"] body :is(
 .chart-action-btn,
 .project-pair-controls button,
 .contract-group-actions button,
 .ctr-carousel-controls button,
 .market-nav button
):focus-visible{
 outline:3px solid #99d8ac;
 outline-offset:2px;
}
html[data-theme="light"] body :is(
 .chart-action-btn,
 .project-pair-controls button,
 .contract-group-actions button,
 .ctr-carousel-controls button,
 .market-nav button
):disabled{
 opacity:.55;
 background:#d6e5db;
 color:#40654b;
 border-color:#adccba;
 box-shadow:none;
}
html[data-theme="light"] body :is(.market-nav button,.contract-group-actions button,.project-pair-controls button,.ctr-carousel-controls button) svg,
html[data-theme="light"] body .chart-action-btn svg{
 stroke:currentColor;
}
html[data-theme="light"] body .market-card-footer .market-nav button:not(:disabled){
 background:#20583e;
 color:#fff;
 border-color:#20583e;
}

/* 5. Record details uses .detail-pane, not .detail-panel.
   This fixes the originally missed dark drawer, labels and close action. */
html[data-theme="light"] body .modal-overlay{
 background:rgba(14,37,25,.42);
}
html[data-theme="light"] body .detail-pane,
html[data-theme="light"] body .detail-pane.contractor-detail{
 color-scheme:light;
 background:#fff;
 color:#1d402d;
 border-color:#bbd1c3;
 box-shadow:-20px 0 55px rgba(27,60,41,.19);
}
html[data-theme="light"] body .detail-pane .detail-header{
 border-bottom:1px solid #cbded0;
}
html[data-theme="light"] body .detail-pane .detail-header h3{
 color:#183e2a;
}
html[data-theme="light"] body .detail-pane .eyebrow,
html[data-theme="light"] body .detail-pane .detail-subhead{
 color:#237244;
}
html[data-theme="light"] body .detail-pane .detail-header button{
 background:#225c40;
 color:#fff;
 border:1px solid #225c40;
}
html[data-theme="light"] body .detail-pane .detail-header button:hover{
 background:#307a52;
}
html[data-theme="light"] body .detail-pane .detail-header button:focus-visible{
 outline:3px solid #a4dcb5;
 outline-offset:2px;
}
html[data-theme="light"] body .detail-pane .detail-field{
 border-color:#dce9df;
}
html[data-theme="light"] body .detail-pane .detail-field dt{
 color:#526f5b;
}
html[data-theme="light"] body .detail-pane .detail-field dd{
 color:#1e4932;
 font-weight:650;
}
html[data-theme="light"] body .detail-pane :is(.contractor-radar-card,.detail-section,.detail-subhead){
 background:#f7faf8;
 border-color:#d8e6dc;
}
html[dir="rtl"][data-theme="light"] body .detail-pane{
 border-left:0;
 border-right:1px solid #bbd1c3;
 box-shadow:20px 0 55px rgba(27,60,41,.19);
}

/* 6. Market Composition: stronger labels and control contrast, with the
   original map greens and percentage data left intact. */
html[data-theme="light"] body .market-focus-grid > .market-focus-card,
html[data-theme="light"] body .market-insight-grid .market-group > .market-card{
 background:#fff;
 border-color:#cbdfd1;
}
html[data-theme="light"] body .market-focus-card .market-chart-container,
html[data-theme="light"] body .market-card .market-chart-container{
 background:#f1f7f3;
 color:#284c37;
}
html[data-theme="light"] body .market-sa-share .market-share-selected{
 background:#e7f4eb;
 border:1px solid #a9cbb5;
 color:#27503a;
}
html[data-theme="light"] body .market-sa-share .market-share-selected-heading,
html[data-theme="light"] body .market-sa-share .market-share-selected > span:last-child{
 color:#4b6d55;
}
html[data-theme="light"] body .market-sa-share .market-share-region-name{
 color:#1b5436;
 font-weight:780;
}
html[data-theme="light"] body .market-sa-share .market-share-region-percent{
 color:#17693f;
 font-weight:850;
}
html[data-theme="light"] body .market-sa-share .market-share-key,
html[data-theme="light"] body .market-sa-share .market-share-key-numbers,
html[data-theme="light"] body .market-sa-share .market-share-help,
html[data-theme="light"] body .market-sa-share .market-share-note{
 color:#41684c;
}
html[data-theme="light"] body .market-sa-share .market-share-row{
 background:#e8f1ea;
 color:#224632;
 border:1px solid transparent;
}
html[data-theme="light"] body .market-sa-share .market-share-row .market-share-name,
html[data-theme="light"] body .market-sa-share .market-share-row strong{
 color:#1d4932;
 font-weight:750;
}
html[data-theme="light"] body .market-sa-share .market-share-row .market-share-track{
 background:#cbded1;
}
html[data-theme="light"] body .market-sa-share .market-share-row[aria-pressed="true"]{
 background:#d2e9d9;
 border-color:#348252;
 outline:1px solid #348252;
}
html[data-theme="light"] body .market-sa-share .market-share-row:hover,
html[data-theme="light"] body .market-sa-share .market-share-row:focus-visible{
 background:#d9eddf;
 border-color:#348252;
 outline:2px solid #348252;
 outline-offset:1px;
}
html[data-theme="light"] body .market-sa-share .market-share-svg path:hover,
html[data-theme="light"] body .market-sa-share .market-share-svg path:focus-visible{
 stroke:#1c593b;
}

/* 7. The enlarged chart treatment is already good: retain white surfaces
   and make headings/interpretation text equally legible. */
html[data-theme="light"] body .chart-lightbox-dialog .chart-lightbox-heading h2{
 color:#1a4930;
}
html[data-theme="light"] body .chart-lightbox-dialog .chart-lightbox-heading p{
 color:#557461;
}
html[data-theme="light"] body .chart-lightbox-explanation,
html[data-theme="light"] body .chart-lightbox-explanation :is(strong,p){
 color:#254c36;
}
html[data-theme="light"] body .chart-lightbox-dialog .chart-lightbox-close{
 color:#fff;
 background:#235e41;
 border-color:#235e41;
}
html[data-theme="light"] body .chart-lightbox-dialog .chart-lightbox-close:hover{
 background:#327a52;
}

/* Visibility of explanatory copy and graph captions across the other tabs. */
html[data-theme="light"] body :is(
 .chart-compact-bars,.compact-plot-name,.compact-plot-value,.contract-pie-legend-row,
 .ctr-series-label,.ctr-map-stat span,.ctr-map-footnote,.ctr-more-note
){
 color:#355841;
}
html[data-theme="light"] body :is(.chart-compact-bars,.market-table-scroll,.table-viewport){
 scrollbar-color:#91b5a0 #edf5ee;
}


/* Sign-in composition: restrained top / bottom executive accents.
   Prevent the .wrap's top margin collapsing through the body: this was
   exposing a tall band of the dark root background before the login page.
   The background emblem, login contents and authenticated header stay intact. */
body.login-page{
 display:flow-root;
 min-height:100vh;
 min-height:100dvh;
}
/* Thin accents deliberately sit at opposite edges of the page rather than
   stacking near the top. The pale or dark theme remains visible between them. */
html[data-theme="light"] body.login-page:not(:has(#app)){
 background:
  linear-gradient(#052d25,#052d25) top center / 100% 14px no-repeat,
  linear-gradient(#26734e,#26734e) bottom center / 100% 12px no-repeat,
  radial-gradient(circle at 5% 5%,#e3f2e6 0%,#f5f8f5 58%);
}
html[data-theme="dark"] body.login-page{
 background:
  linear-gradient(#06392c,#06392c) top center / 100% 14px no-repeat,
  linear-gradient(#277047,#277047) bottom center / 100% 12px no-repeat,
  radial-gradient(circle at 5% 5%,#124b3a 0%,#061d19 52%);
}


/* Visualization parity + hierarchy + contrast audit · 27 October 2026
   Preserve SVG charts across compact and enlarged modes. The compact panel
   scrolls without substituting a different bar-chart type or shrinking text. */
.analysis-workspace .section-analytics .chart-container:has(> .chart-compact-bars + svg.chart-parity){
 display:block;
 overflow-x:auto;
 overflow-y:auto;
 min-width:0;
 max-height:350px;
 scrollbar-width:thin;
 overscroll-behavior:contain;
 scrollbar-color:#76a88d transparent;
}
.analysis-workspace .section-analytics .chart-container > .chart-compact-bars:has(+ svg.chart-parity){
 display:none!important;
}
.analysis-workspace .section-analytics .chart-container > .chart-compact-bars + svg.chart-parity{
 display:block!important;
 min-width:680px;
 width:100%!important;
 max-width:none!important;
 max-height:none!important;
 height:auto!important;
 overflow:visible;
}
.analysis-workspace .section-analytics .chart-container > svg.chart-parity[viewBox^="0 0 520"]{
 min-width:520px;
}
.analysis-workspace .section-analytics .chart-container > svg.chart-parity[viewBox^="0 0 760"]{
 min-width:760px;
}
.analysis-workspace .section-analytics .chart-container > svg.chart-parity[viewBox^="0 0 770"]{
 min-width:770px;
}
html[dir="rtl"] .analysis-workspace .section-analytics .chart-container:has(> .chart-compact-bars + svg.chart-parity){
 direction:ltr;
}

/* Projects uses clearly labeled groups like Contracts. The group heading is
   separate from the inner visualization title, including 1 / 1 groups. */
.analysis-workspace .section-analytics .chart-gallery > .project-single-group{
 display:flex;flex-direction:column;gap:10px;min-width:0;
 background:rgba(235,241,237,.065);
 border:1px solid rgba(222,237,226,.23);border-radius:12px;
 padding:12px;
}
.analysis-workspace .section-analytics .project-single-track{min-width:0}
.analysis-workspace .section-analytics .project-single-track > .chart-card{
 width:100%;min-width:0;min-height:360px;margin:0;
 padding:14px;box-sizing:border-box;
}
.project-single-heading{min-height:58px;margin:0;align-items:flex-start}
.project-single-heading h3{font-size:14px;line-height:1.35;margin:0;color:#ebfff0;font-weight:800}
.project-single-heading p{font-size:11px;line-height:1.5;margin:4px 0 0;color:#b9d9c6}
.project-single-count{color:#d3edd9;font-size:11px;font-weight:800;flex:none}
.project-pair-controls > span:has(> strong){display:flex;flex-direction:column;gap:4px;min-width:0}
.project-pair-controls > span > strong{font-size:14px;line-height:1.3;color:#ebfff0}
.project-pair-controls > span > small{font-size:11px;color:#b9d9c6;line-height:1.5}
@media(max-width:720px){
 .analysis-workspace .section-analytics .project-single-group{padding:10px}
 .analysis-workspace .section-analytics .project-single-track>.chart-card{padding:12px}
}

/* Compact Dark theme charts retain the existing colors, but their headings
   and group captions must not fade to almost white on white in Light theme. */
html[data-theme="light"] body .analysis-workspace .section-analytics .project-single-group{
 background:#fff;border-color:#c5dccb;color:#204630;
 box-shadow:0 2px 12px rgba(32,75,46,.05);
}
html[data-theme="light"] body .analysis-workspace .section-analytics .project-single-track>.chart-card{
 background:#f9fbf9;border-color:#d0e3d4;
}
html[data-theme="light"] body .project-single-heading :is(h3,p),
html[data-theme="light"] body .project-pair-controls > span > strong{
 color:#1c4b31;
}
html[data-theme="light"] body .project-single-heading p,
html[data-theme="light"] body .project-pair-controls > span > small{
 color:#436b4f;
}
html[data-theme="light"] body :is(.project-single-count,.contract-slide-count,.ctr-page){
 color:#29583c;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .project-pair-controls,
html[data-theme="light"] body .analysis-workspace .section-analytics .project-pair-hint{
 color:#376849;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .project-chart-carousel > .project-pair-controls,
html[data-theme="light"] body .analysis-workspace .section-analytics .contract-insight-group .contract-group-head{
 color:#1b4b30;
}
html[data-theme="light"] body .contract-insight-group .contract-group-heading :is(h3,p){
 color:#24583b;
}
html[data-theme="light"] body .contract-insight-group .contract-group-heading p{
 color:#4b7158;
}
/* SVG quantitative ticks and grid guides remain legible on pale plot backgrounds. */
html[data-theme="light"] body .analysis-workspace .chart-container .chart-svg.chart-parity text,
html[data-theme="light"] body .chart-lightbox-visual .chart-svg.chart-parity text{
 fill:#234e37;
}
html[data-theme="light"] body .analysis-workspace .chart-container .chart-svg.chart-parity rect[fill="#1a433a"],
html[data-theme="light"] body .chart-lightbox-visual .chart-svg.chart-parity rect[fill="#1a433a"]{
 fill:#e4f0e7;
}
html[data-theme="light"] body .analysis-workspace .chart-container .chart-svg.chart-parity line,
html[data-theme="light"] body .chart-lightbox-visual .chart-svg.chart-parity line{
 stroke:#93b09d;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-card .chart-title{
 color:#1b4630;
}
html[data-theme="light"] body .analysis-workspace .section-analytics .chart-card .chart-subtitle{
 color:#4b6d57;
}

/* Light-mode contractor chart enlarged panels: no faint text on white.
   Emphasize selected profile name, selectable input, footprint totals and map. */
html[data-theme="light"] body .chart-lightbox-visual :is(.ctr-slide h3,.ctr-chart-title,
 .ctr-radar-label,.ctr-radar-hint,.ctr-legend,.ctr-legend-primary,.ctr-legend-benchmark,
 .ctr-map-top-head,.ctr-map-top-row,.ctr-map-top-row b,.ctr-map-top-row b:last-child,
 .ctr-map-stat,.ctr-map-stat strong,.ctr-map-key,.ctr-map-footnote,
 .ctr-map-region-name,.ctr-map-region-count,.ctr-map-region-value){
 color:#28563d;
}
html[data-theme="light"] body .chart-lightbox-visual .ctr-legend-primary{color:#a23636}
html[data-theme="light"] body .chart-lightbox-visual .ctr-legend-benchmark{color:#a45c1d}
html[data-theme="light"] body .chart-lightbox-visual :is(.ctr-map-top-head,.ctr-map-top-row){
 border-color:#c0d7c7;
}
html[data-theme="light"] body .chart-lightbox-visual .ctr-map-top-head{
 color:#446c51;
}
html[data-theme="light"] body .chart-lightbox-visual .ctr-map-top-row b:last-child{
 color:#206e75;
}
html[data-theme="light"] body .chart-lightbox-visual :is(.ctr-map-stat,.ctr-map-region,.ctr-map-top){
 background:#f3f8f4;border-color:#c3dccb;
}
html[data-theme="light"] body .chart-lightbox-visual :is(.ctr-map-metric:not([aria-pressed="true"]),.ctr-radar-input){
 background:#fff;color:#214b33;border-color:#86af94;
}
html[data-theme="light"] body .chart-lightbox-visual .ctr-radar-input:focus-visible{
 outline:3px solid #64b484;
 outline-offset:2px;
}
/* Explicitly fix hard-coded pale text on enlarged maps and ranking tables. */
html[data-theme="light"] body .chart-lightbox-visual .ctr-saudi-footprint :is(
 .ctr-map-top-head span,.ctr-map-top-row span,.ctr-map-top-row strong,
 .ctr-map-region-name,.ctr-map-info,.ctr-map-help,.ctr-more-note){
 color:#28553c;
}
html[data-theme="light"] body .chart-lightbox-visual .ctr-saudi-footprint .ctr-map-top-row b{
 color:#286a43;
}

/* Market captions: navigation/footer titles, interpretation paragraphs,
   model disclosure, highlights and explanatory small text. */
html[data-theme="light"] body :is(
 .market-focus-card .chart-footer,.market-focus-card .chart-subtitle,
 .market-insight-grid .market-group .chart-footer,.market-group-head p,
 .market-focus-heading p,.market-model-note,.market-method p,
 .market-share-note,.market-share-help,.market-chart-container figcaption,
 .market-current-view,.market-card .chart-footer,.market-nav-status,
 .market-group .market-chart-container p){
 color:#345c42;
}
html[data-theme="light"] body :is(
 .market-method summary,.market-focus-card .chart-title,.market-insight-grid .market-card .chart-title,
 .market-card-footer .market-current-view,.market-summary h3,.market-group-title){
 color:#1d5035;
}
html[data-theme="light"] body .market-method{
 background:#fff;border-color:#c5ddcd;
}
html[data-theme="light"] body .market-model-note{
 color:#345e44;font-weight:500;line-height:1.7;
}
html[data-theme="light"] body .market-card-footer,
html[data-theme="light"] body .market-focus-card .chart-footer{
 border-color:#d5e7d9;
}

/* Final small-text contrast: Contracts/Contractors gallery navigation and
   Market slide captions have sufficient visual prominence in Light mode. */
html[data-theme="light"] body .ctr-gallery-card .ctr-chart-footer :is(.ctr-current-view,.ctr-page),
html[data-theme="light"] body .ctr-gallery-card .chart-subtitle,
html[data-theme="light"] body .ctr-gallery-card .ctr-slide > h3,
html[data-theme="light"] body .chart-lightbox-visual .ctr-slide > h3{
 color:#24573c;
}
html[data-theme="light"] body .ctr-gallery-card .ctr-chart-footer .ctr-current-view{
 font-weight:750;
}
html[data-theme="light"] body :is(.market-card .market-current-view,.market-card .market-position,
 .market-focus-card .chart-footer,.market-card-footer .market-current-view,
 .market-focus-heading .section-side,.market-model-note,.market-group .chart-subtitle){
 color:#2b6042;
 font-weight:650;
}
html[data-theme="light"] body .chart-lightbox-visual .ctr-saudi-footprint :is(
 .ctr-map-top-head,.ctr-map-top-head span,.ctr-map-top-row b,.ctr-map-top-row strong){
 color:#205238;
}

/* 2026-10-28: Scroll-free parity for the 8 identified Projects/Contracts bar charts.
   Preserve existing source SVGs for exports/regression, but display the same
   data-driven HTML bar rows in normal cards and the enlarged view.
   Only the outer carousel/document may scroll; no chart canvas scrollbars. */
html body .analysis-workspace .section-analytics .chart-card.chart-fit .chart-container{
 display:block!important;
 height:auto!important;max-height:none!important;min-height:0!important;
 min-width:0;width:100%;overflow:visible!important;
 padding:10px 12px!important;
}
html body .analysis-workspace .section-analytics .chart-card.chart-fit .chart-container>.chart-compact-bars.fit-bars{
 display:grid!important;
 grid-auto-rows:auto;max-height:none!important;
 min-height:0!important;height:auto!important;width:100%!important;
 min-width:0;overflow:visible!important;overscroll-behavior:auto;
 margin:0;padding:0;gap:0;
}
html body .analysis-workspace .section-analytics .chart-card.chart-fit .chart-container>svg.chart-svg{
 display:none!important;visibility:hidden!important;
}
html body .chart-card.chart-fit .fit-bars .compact-plot-row{
 display:grid;grid-template-columns:minmax(0,42%) minmax(0,1fr);
 align-items:center;gap:10px;min-width:0;min-height:34px;
 padding:6px 0;border-bottom:1px solid rgba(119,163,134,.22);
}
html body .chart-card.chart-fit .fit-bars .compact-plot-name{
 width:100%;max-width:100%;min-width:0;padding:0;
 overflow:visible;white-space:normal;overflow-wrap:anywhere;
 text-align:start;font-size:11px;line-height:1.3;
}
html body .chart-card.chart-fit .fit-bars .compact-plot-line{
 min-width:0;max-width:100%;gap:8px;
 grid-template-columns:minmax(0,1fr) max-content;
}
html body .chart-card.chart-fit .fit-bars .compact-plot-track{min-width:0;height:14px}
html body .chart-card.chart-fit .fit-bars .compact-plot-value{
 color:inherit;font-size:11px;min-width:32px;white-space:nowrap;
 font-variant-numeric:tabular-nums;
}
html[dir="rtl"] body .chart-card.chart-fit .fit-bars .compact-plot-row{
 direction:rtl;
}
html[dir="rtl"] body .chart-card.chart-fit .fit-bars .compact-plot-line{
 direction:ltr;grid-template-columns:minmax(0,1fr) max-content;
}
@media(max-width:470px){
 html body .chart-card.chart-fit .fit-bars .compact-plot-row{
  grid-template-columns:minmax(0,1fr);gap:5px;padding:7px 0;
 }
 html body .chart-card.chart-fit .fit-bars .compact-plot-name{font-size:12px}
}
/* Enlarge is a single flexible plot viewport: rows scale to fill available
   height, retaining labels and values without nested X/Y scrolling. */
body .chart-lightbox-dialog:has(.chart-lightbox-visual>.fit-bars){
 height:min(95dvh,920px);max-height:calc(100dvh - 16px);min-height:0;
 overflow:hidden!important;
}
body .chart-lightbox-visual:has(>.fit-bars){
 flex:1 1 auto;min-height:0;height:auto;
 display:flex;align-items:stretch;justify-content:stretch;
 padding:2px 8px;overflow:hidden!important;
}
body .chart-lightbox-visual>.chart-compact-bars.fit-bars{
 display:grid!important;
 grid-template-rows:repeat(var(--fit-rows),minmax(0,1fr));
 width:100%;height:100%;max-height:100%!important;min-height:0;
 margin:0;padding:0;gap:0;overflow:hidden!important;
}
body .chart-lightbox-visual>.fit-bars .compact-plot-row{
 display:grid;grid-template-columns:minmax(0,35%) minmax(0,1fr);
 align-items:center;gap:14px;min-height:0;min-width:0;
 padding:2px 0;overflow:hidden;border-bottom:1px solid rgba(119,163,134,.18);
}
body .chart-lightbox-visual>.fit-bars .compact-plot-name{
 min-width:0;max-width:100%;padding:0;
 overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;
 -webkit-line-clamp:2;line-clamp:2;
 white-space:normal;overflow-wrap:anywhere;
 font-size:clamp(10px,1.05vw,13px);line-height:1.25;
}
body .chart-lightbox-visual>.fit-bars .compact-plot-line{
 display:grid;align-items:center;
 grid-template-columns:minmax(0,1fr) max-content;
 min-width:0;gap:12px;direction:ltr;
}
body .chart-lightbox-visual>.fit-bars .compact-plot-track{
 height:clamp(9px,1.4vh,16px);min-width:0;
}
body .chart-lightbox-visual>.fit-bars .compact-plot-value{
 min-width:46px;white-space:nowrap;
 font-size:clamp(10px,1.04vw,13px);
 font-variant-numeric:tabular-nums;color:inherit;
}
body .chart-lightbox-dialog:has(.chart-lightbox-visual>.fit-bars) .chart-lightbox-heading,
body .chart-lightbox-dialog:has(.chart-lightbox-visual>.fit-bars) .chart-lightbox-explanation{
 flex:0 0 auto;
}
html[data-theme="light"] body .chart-card.chart-fit .fit-bars .compact-plot-track,
html[data-theme="light"] body .chart-lightbox-visual>.fit-bars .compact-plot-track{
 background:#e1eee5;
}
html[data-theme="light"] body :is(.chart-card.chart-fit,.chart-lightbox-visual) .fit-bars .compact-plot-name,
html[data-theme="light"] body :is(.chart-card.chart-fit,.chart-lightbox-visual) .fit-bars .compact-plot-value{
 color:#234b35;
}
html[dir="rtl"] body .chart-lightbox-visual>.fit-bars .compact-plot-row{
 direction:rtl;
}
html[dir="rtl"] body .chart-lightbox-visual>.fit-bars .compact-plot-line{
 direction:ltr;grid-template-columns:minmax(0,1fr) max-content;
}
@media(max-height:650px){
 body .chart-lightbox-dialog:has(.chart-lightbox-visual>.fit-bars){
  gap:6px;padding:9px;
 }
 body .chart-lightbox-dialog:has(.chart-lightbox-visual>.fit-bars) .chart-lightbox-heading{
  padding-bottom:6px;
 }
 body .chart-lightbox-dialog:has(.chart-lightbox-visual>.fit-bars) .chart-lightbox-explanation{
  padding-top:5px;font-size:10px;line-height:1.2;
 }
 body .chart-lightbox-visual>.fit-bars .compact-plot-name{
  -webkit-line-clamp:1;line-clamp:1;font-size:10px;
 }
 body .chart-lightbox-visual>.fit-bars .compact-plot-row{padding:0}
 body .chart-lightbox-visual>.fit-bars .compact-plot-track{height:9px}
}
@media(max-width:540px){
 body .chart-lightbox-visual>.fit-bars .compact-plot-row{
  grid-template-columns:minmax(0,43%) minmax(0,1fr);gap:6px;
 }
 body .chart-lightbox-visual>.fit-bars .compact-plot-line{gap:4px}
 body .chart-lightbox-visual>.fit-bars .compact-plot-value{min-width:28px;font-size:9px}
 body .chart-lightbox-visual>.fit-bars .compact-plot-name{font-size:10px}
}

/* Canonical hierarchy: Platform > Modules > Dashboards.
   Present the same ordered sections on every BI dashboard. */
.dashboard-labels{
 display:flex;align-items:center;flex-wrap:wrap;gap:10px 14px;
 min-height:38px;margin:0 0 18px;
}
.dashboard-label-group{display:inline-flex;align-items:baseline;gap:7px;min-width:0}
.dashboard-label-caption{font-size:10px;font-weight:750;color:var(--muted)}
.dashboard-label-group strong{font-size:12px;font-weight:800;color:var(--text)}
.dashboard-label-divider{color:var(--muted);font-size:13px}
.dashboard-labels .module-portfolio-status{margin:0 0 0 auto;min-height:22px}
.dashboard-section{
 width:100%;min-width:0;margin:25px 0 0;padding:20px 22px;
 border:1px solid var(--border);border-radius:13px;
 background:var(--surface);color:var(--text);
}
.dashboard-section>.section-top{margin:0 0 16px}
.dashboard-section>.section-top h2{font-size:19px;margin:4px 0 0}
.dashboard-section-content{min-width:0;min-height:28px}
.dashboard-key-insights .dashboard-section-content:empty,
.dashboard-notes .dashboard-section-content:empty{min-height:28px}
.dashboard-notes{margin-top:25px}
.dashboard-reporting-utility{
 display:block;position:relative;clear:both;
 margin:30px 0 0!important;padding:23px;
 border:1px solid var(--border);border-radius:13px;isolation:isolate;
}
#market-visuals .market-insights{
 padding:0;margin:0;border:0;background:transparent;
}
#market-visuals .market-insights>.section-top{display:none}
html[data-theme="light"] body .dashboard-section{
 background:#fff;border-color:#c7d9cd;color:#193f2b;
 box-shadow:0 2px 10px rgba(29,72,45,.045);
}
html[data-theme="light"] body .dashboard-label-group strong{color:#1d5034}
html[data-theme="light"] body .dashboard-label-caption,
html[data-theme="light"] body .dashboard-label-divider{color:#54725e}
html[data-theme="light"] body .dashboard-reporting-utility{
 background:#fff!important;border-color:#c7d9cd!important;
 color:#204a35!important;box-shadow:0 2px 10px rgba(29,72,45,.045);
}
html[data-theme="light"] body .dashboard-reporting-utility :is(.section-top h2,.dropbox strong,.admin-explainer strong){
 color:#1b4c31!important;
}
html[data-theme="light"] body .dashboard-reporting-utility :is(.section-side,.admin-explainer,.admin-explainer p,.dropbox>span,.dropbox span){
 color:#466f55!important;
}
html[data-theme="light"] body .dashboard-reporting-utility .dropbox{
 background:#f0f8f2!important;
 border:1px dashed #8bb99b!important;color:#1b4c31!important;
}
html[data-theme="light"] body .dashboard-reporting-utility .drop-icon{color:#217344!important}
html[data-theme="light"] body .dashboard-reporting-utility .ghost-btn,
html[data-theme="light"] body .dashboard-reporting-utility .template-btn{
 background:#e6f3e9!important;color:#1a603a!important;
 border:1px solid #9dc9ad!important;
}
html[data-theme="light"] body .dashboard-reporting-utility :is(.ghost-btn,.template-btn):hover{
 background:#d7ecdd!important;color:#11492e!important;
}
html[data-theme="light"] body .dashboard-reporting-utility .upload-message{
 color:#306a47!important;
}
html[data-theme="light"] body .dashboard-reporting-utility .admin-notice{
 background:#fff3db!important;border-left:3px solid #b57b22!important;
 color:#62441c!important;
}
html[data-theme="light"] body .dashboard-reporting-utility .prototype-flag{
 color:#7c5419!important;border-color:#cfb97e!important;background:#fff8e9;
}
html[data-theme="light"] body .dashboard-notes .market-method p{
 color:#355a41!important;
}
@media(max-width:720px){
 .dashboard-labels{gap:6px 9px}
 .dashboard-labels .module-portfolio-status{flex-basis:100%;margin:4px 0 0}
 .dashboard-section{padding:16px;margin-top:18px}
 .dashboard-reporting-utility{margin-top:24px!important;padding:17px}
}

/* Canonical section headings: one label per section, with keyboard-accessible
   Key insights disclosure closed by default for every dashboard. */
html body .dashboard-key-insights{
 padding:0;
 overflow:hidden;
}
html body .dashboard-key-insights > .dashboard-section-toggle{
 display:flex;align-items:center;justify-content:space-between;gap:16px;
 min-height:58px;margin:0;padding:16px 22px;
 list-style:none;cursor:pointer;
 color:var(--text);border-radius:13px;
}
html body .dashboard-key-insights > .dashboard-section-toggle::-webkit-details-marker{display:none}
html body .dashboard-key-insights > .dashboard-section-toggle::marker{content:""}
html body .dashboard-key-insights > .dashboard-section-toggle h2{
 margin:0;font-size:19px;font-weight:800;line-height:1.35;
 color:var(--text);
}
html body .dashboard-key-insights > .dashboard-section-toggle:hover{
 background:rgba(110,183,134,.1);
}
html body .dashboard-key-insights > .dashboard-section-toggle:focus-visible{
 outline:2px solid #79ca90;outline-offset:-4px;
}
html body .dashboard-key-insights > .dashboard-section-toggle .dashboard-section-toggle-icon{
 flex:0 0 10px;width:10px;height:10px;
 display:block;transform:rotate(45deg);
 border-right:2px solid currentColor;border-bottom:2px solid currentColor;
 transition:transform .18s ease;
}
html body .dashboard-key-insights[open] > .dashboard-section-toggle{
 border-bottom:1px solid var(--border);border-radius:13px 13px 0 0;
}
html body .dashboard-key-insights[open] > .dashboard-section-toggle .dashboard-section-toggle-icon{
 transform:rotate(225deg);
}
html body .dashboard-key-insights > .dashboard-section-content{
 padding:0 22px 22px;
}
html body .dashboard-key-insights:not([open]) > .dashboard-section-content{
 display:none!important;
}
html[data-theme="light"] body .dashboard-key-insights > .dashboard-section-toggle{
 color:#19482f;
}
html[data-theme="light"] body .dashboard-key-insights > .dashboard-section-toggle h2{
 color:#19482f;
}
html[data-theme="light"] body .dashboard-key-insights > .dashboard-section-toggle:hover{
 background:#edf7ef;
}
html[data-theme="light"] body .dashboard-key-insights[open] > .dashboard-section-toggle{
 border-bottom-color:#d3e5d8;
}
@media(max-width:720px){
 html body .dashboard-key-insights > .dashboard-section-toggle{padding:14px 16px}
 html body .dashboard-key-insights > .dashboard-section-content{padding:0 16px 16px}
}
@media(prefers-reduced-motion:reduce){
 html body .dashboard-key-insights > .dashboard-section-toggle .dashboard-section-toggle-icon{
  transition:none;
 }
}
/* Records' heading belongs to the full section, not a second nested card. */
html body .analysis-workspace > .section-config > .section-top{
 margin-bottom:16px;
}
html body .analysis-workspace > .section-config > .section-table{
 margin-top:0;
}

/* Identical, mirrored module/dashboard labels in English (LTR) and Arabic (RTL).
   Keep identity and record-status groups anchored to opposite row edges. */
.dashboard-labels{direction:ltr;justify-content:flex-start;gap:10px 14px}
.dashboard-labels .dashboard-label-group{direction:inherit;white-space:nowrap}
.dashboard-labels .dashboard-label-divider{flex:0 0 auto}
.dashboard-labels .module-portfolio-status{
 display:inline-flex;align-items:center;flex:0 0 auto;
 margin:0;margin-inline-start:auto;gap:9px;
 white-space:nowrap;direction:ltr;text-align:start;
}
.dashboard-labels .module-portfolio-status #header-count{
 direction:ltr;unicode-bidi:isolate;display:inline-block;
 font-variant-numeric:tabular-nums;
}
html[dir="rtl"] .dashboard-labels{direction:rtl}
html[dir="rtl"] .dashboard-labels .dashboard-label-group{direction:rtl}
html[dir="rtl"] .dashboard-labels .module-portfolio-status{direction:rtl}
html[dir="rtl"] .dashboard-labels .module-portfolio-status #header-count{
 direction:ltr;unicode-bidi:isolate;
}
@media(max-width:720px){
 .dashboard-labels .module-portfolio-status{
  flex:0 0 100%;margin-inline-start:0;
 }
}

/* Data explorer uses the same collapsed-by-default native disclosure
   pattern as Key insights. Only the content panel is hidden, never the
   summary, live record count, dataset selection or event registrations. */
html body .analysis-workspace > details.records-disclosure{
 display:block;min-height:0;
}
html body .records-disclosure > .records-disclosure-toggle{
 display:flex;align-items:center;justify-content:space-between;
 width:100%;gap:16px;min-height:38px;
 margin:0;padding:0;list-style:none;cursor:pointer;
 color:var(--text);
}
html body .records-disclosure > .records-disclosure-toggle::-webkit-details-marker{display:none}
html body .records-disclosure > .records-disclosure-toggle::marker{content:""}
html body .records-disclosure > .records-disclosure-toggle .records-disclosure-heading{
 display:flex;align-items:center;justify-content:space-between;
 flex:1 1 auto;gap:12px;min-width:0;margin:0;
}
html body .records-disclosure > .records-disclosure-toggle .section-side{
 display:flex;align-items:center;gap:6px;flex:0 0 auto;
 color:var(--muted);white-space:nowrap;
}
html body .records-disclosure > .records-disclosure-toggle .records-disclosure-icon{
 flex:0 0 10px;display:block;width:10px;height:10px;
 margin-inline:5px 2px;transform:rotate(45deg);
 border-right:2px solid currentColor;border-bottom:2px solid currentColor;
 transition:transform .18s ease;color:var(--text);
}
html body .records-disclosure[open] > .records-disclosure-toggle .records-disclosure-icon{
 transform:rotate(225deg);
}
html body .records-disclosure:not([open]) > #records-panel{
 display:none!important;
}
html body .records-disclosure[open] > #records-panel{
 margin-top:17px;
}
html body .records-disclosure > .records-disclosure-toggle:hover .section-label h2{
 color:var(--accent);
}
html body .records-disclosure > .records-disclosure-toggle:focus-visible{
 outline:2px solid #79ca90;outline-offset:4px;border-radius:6px;
}
html[data-theme="light"] body .records-disclosure > .records-disclosure-toggle{
 color:#19482f;
}
html[data-theme="light"] body .records-disclosure > .records-disclosure-toggle .records-disclosure-icon{
 color:#19482f;
}
@media(max-width:650px){
 html body .records-disclosure > .records-disclosure-toggle{gap:9px}
 html body .records-disclosure > .records-disclosure-toggle .records-disclosure-heading{
  align-items:flex-start;flex-direction:column;gap:7px;
 }
 html body .records-disclosure > .records-disclosure-toggle .section-side{
  white-space:normal;
 }
}
@media(prefers-reduced-motion:reduce){
 html body .records-disclosure > .records-disclosure-toggle .records-disclosure-icon{transition:none}
}

/* Public investment-by-type: labels and bars must occupy the entire card.
   This specific override follows all legacy fitted-chart rules in theme.css. */
html body .analysis-workspace .section-analytics .chart-card[data-investment-type="true"] .chart-container{
 display:block!important;width:100%!important;min-width:0!important;
 padding:12px!important;overflow:visible!important;
}
html body .analysis-workspace .section-analytics .chart-card[data-investment-type="true"] .chart-container>.chart-compact-bars.fit-bars{
 display:block!important;width:100%!important;min-width:0!important;
 max-width:none!important;overflow:visible!important;
}
html body .analysis-workspace .section-analytics .chart-card[data-investment-type="true"] .compact-plot-row{
 display:grid!important;grid-template-columns:minmax(0,39%) minmax(0,1fr)!important;
 gap:12px!important;align-items:center;
}
html body .analysis-workspace .section-analytics .chart-card[data-investment-type="true"] .compact-plot-name{
 overflow-wrap:normal!important;word-break:normal!important;hyphens:auto;
 font-size:11px;line-height:1.35;
}
html body .analysis-workspace .section-analytics .chart-card[data-investment-type="true"] .compact-plot-line{
 display:grid;grid-template-columns:minmax(0,1fr) max-content!important;min-width:0;
}
@media(max-width:620px){
 html body .analysis-workspace .section-analytics .chart-card[data-investment-type="true"] .compact-plot-row{
  grid-template-columns:minmax(0,1fr)!important;gap:4px!important;
 }
}

/* Public Projects > Project Type: the source labels must remain readable in
 * the three-column chart matrix. The previous 39%-label subgrid still left
 * the longest names cramped. Give every category its own complete line, then
 * show its proportional bar and source value directly beneath. This changes
 * presentation only, preserving the exact chart rows and CSV aggregates. */
html body .analysis-workspace .section-analytics
 .chart-card.chart-fit[data-investment-type="true"] .fit-bars .compact-plot-row{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  grid-auto-rows:auto!important;
  min-width:0;
  width:100%;
  gap:5px!important;
  align-items:stretch;
  padding:7px 0!important;
}
html body .analysis-workspace .section-analytics
 .chart-card.chart-fit[data-investment-type="true"] .fit-bars .compact-plot-name{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:normal!important;
  hyphens:none!important;
  line-height:1.35;
}
html body .analysis-workspace .section-analytics
 .chart-card.chart-fit[data-investment-type="true"] .fit-bars .compact-plot-line{
  display:grid;
  grid-template-columns:minmax(0,1fr) max-content!important;
  width:100%!important;
  min-width:0;
  gap:8px!important;
}
html[dir="rtl"] body .analysis-workspace .section-analytics
 .chart-card.chart-fit[data-investment-type="true"] .fit-bars .compact-plot-name[lang="en"]{
  direction:ltr;
  text-align:start;
}
