/* DataHubX / PortfolioAI-inspired UNIFIED presentation layer.
   Replaces datahubx-portfolio-operations.css and datahubx-portfolio-theme.css.
   Load once, LAST, after home-light-theme-overrides.css.
   Works with .datahubx-theme-light / dark on html, body or layout wrapper.
   No changes to workflow, app behaviour, or semantic status classes. */
:root, .datahubx-theme-dark {
  --p-bg:#1e1e2e; --p-nav:#15252f; --p-side:#191a2b;
  --p-surface:#292b40;--p-surface-soft:#25283b;--p-table-head:#303247;
  --p-line:#3c4058;--p-text:#ecedf5;--p-title:#f2f4fb;
  --p-muted:#b6bfd2;--p-subtle:#9ca9c1;--p-link:#93bafa;
  --p-hover:#33364b;--p-selection:#30344c;--p-field:#25283b;
  --p-primary:#6255d9;--p-primary-text:#fff;--p-success:#34d399;
  --p-error:#fb7185;--p-warning:#fbbf24;--p-info:#60a5fa;
  --p-shadow:none;--p-radius:10px;
  --p-nav-text:#e6eaf5;--p-side-text:#d5dded;
  --dhx-bg:var(--p-bg);--dhx-card:var(--p-surface);--dhx-text:var(--p-text);
  --dhx-muted:var(--p-muted);--dhx-border:var(--p-line);
  --dp-bg-page:var(--p-bg);--dp-bg-card:var(--p-surface);
  --dp-bg-muted:var(--p-surface-soft);--dp-bg-hover:var(--p-hover);
  --dp-text:var(--p-text);--dp-muted:var(--p-muted);--dp-border:var(--p-line);
  --dx-bg:var(--p-bg);--dx-surface:var(--p-surface);
  --dx-text:var(--p-text);--dx-muted:var(--p-muted);
  color-scheme:dark;
}
html.datahubx-theme-light,body.datahubx-theme-light,.datahubx-theme-light {
  --p-bg:#f5f7fb;--p-nav:#15252f;--p-side:#191a2b;
  --p-surface:#fff;--p-surface-soft:#f8fafc;--p-table-head:#eff3f9;
  --p-line:#dbe3ec;--p-text:#172033;--p-title:#101827;
  --p-muted:#566579;--p-subtle:#64748b;--p-link:#2563eb;
  --p-hover:#eef5ff;--p-selection:#30344c;--p-field:#fff;
  --p-primary:#4f46e5;--p-primary-text:#fff;--p-success:#047857;
  --p-error:#b91c1c;--p-warning:#a16207;--p-info:#1d4ed8;
  --p-shadow:0 1px 3px rgba(15,23,42,.055);
  --p-nav-text:#e6eaf5;--p-side-text:#d5dded;
  color-scheme:light;
}
/* Put palette on Blazor root as well: theme class may be on html/body or a layout div. */
html:has(.datahubx-theme-light),body:has(.datahubx-theme-light) {
  --p-bg:#f5f7fb;--p-text:#172033;--p-title:#101827;
  --p-surface:#fff;--p-surface-soft:#f8fafc;--p-table-head:#eff3f9;
  --p-line:#dbe3ec;--p-muted:#566579;--p-subtle:#64748b;
  --p-link:#2563eb;--p-hover:#eef5ff;--p-field:#fff;
  --p-primary:#4f46e5;--p-success:#047857;--p-info:#1d4ed8;
  --p-error:#b91c1c;--p-warning:#a16207;
  color-scheme:light;
}
/* Existing project variables in a light layout must also follow light palette. */
.datahubx-theme-light {
  --dhx-bg:var(--p-bg);--dhx-card:var(--p-surface);--dhx-text:var(--p-text);
  --dhx-muted:var(--p-muted);--dhx-border:var(--p-line);
  --dp-bg-page:var(--p-bg);--dp-bg-card:var(--p-surface);
  --dp-bg-muted:var(--p-surface-soft);--dp-bg-hover:var(--p-hover);
  --dp-text:var(--p-text);--dp-muted:var(--p-muted);--dp-border:var(--p-line);
  --dx-bg:var(--p-bg);--dx-surface:var(--p-surface);
  --dx-text:var(--p-text);--dx-muted:var(--p-muted);
}
/* Main content and scoped page marker. Avoid forcing navbar/sidebar to light. */
.datahubx-theme-dark .mud-main-content,.datahubx-theme-light .mud-main-content,
.datahubx-theme-dark .dhx-portfolio-page,.datahubx-theme-light .dhx-portfolio-page,
body:has(.datahubx-theme-light) .mud-main-content,
body:has(.datahubx-theme-dark) .mud-main-content {
  background:var(--p-bg) !important;color:var(--p-text) !important;
}
.dhx-portfolio-page {min-width:0;color:var(--p-text)}
/* Custom topbar/sidebar remain dark in BOTH modes, with explicit readable foreground. */
.datahubx-theme-light .mud-appbar,.datahubx-theme-dark .mud-appbar,
body:has(.datahubx-theme-light) .mud-appbar,body:has(.datahubx-theme-dark) .mud-appbar,
.datahubx-theme-light .dp-appbar,.datahubx-theme-dark .dp-appbar {
  background:var(--p-nav,#15252f) !important;color:var(--p-nav-text,#e6eaf5) !important;
  border-bottom:1px solid #334452;box-shadow:none !important;
}
.datahubx-theme-light .mud-appbar :is(.mud-typography,.mud-icon-root,.mud-button-root,.mud-input-root,.mud-input-slot,.mud-select-input),
.datahubx-theme-dark .mud-appbar :is(.mud-typography,.mud-icon-root,.mud-button-root,.mud-input-root,.mud-input-slot,.mud-select-input),
.datahubx-theme-light .dp-appbar :is(a,button,span,.mud-typography,.mud-icon-root),
.datahubx-theme-dark .dp-appbar :is(a,button,span,.mud-typography,.mud-icon-root) {
  color:var(--p-nav-text,#e6eaf5) !important;
}
.datahubx-theme-light .mud-drawer,.datahubx-theme-dark .mud-drawer,
body:has(.datahubx-theme-light) .mud-drawer,body:has(.datahubx-theme-dark) .mud-drawer,
.datahubx-theme-light .dp-sidebar,.datahubx-theme-dark .dp-sidebar {
  background:var(--p-side,#191a2b) !important;color:var(--p-side-text,#d5dded) !important;
  border-color:#32364f !important;
}
.datahubx-theme-light .mud-drawer :is(.mud-nav-link,.mud-nav-group-header,.mud-typography,.mud-icon-root),
.datahubx-theme-dark .mud-drawer :is(.mud-nav-link,.mud-nav-group-header,.mud-typography,.mud-icon-root),
.datahubx-theme-light .dp-sidebar :is(.dp-nav-link,a,.mud-icon-root),
.datahubx-theme-dark .dp-sidebar :is(.dp-nav-link,a,.mud-icon-root) {
  color:var(--p-side-text,#d5dded) !important;
}
.datahubx-theme-light .mud-drawer .mud-nav-link.active,.datahubx-theme-dark .mud-drawer .mud-nav-link.active,
.datahubx-theme-light .dp-sidebar .active,.datahubx-theme-dark .dp-sidebar .active {
  color:#fff !important;background:var(--p-selection,#30344c) !important;
  border-left:2px solid #43b1d7;
}
/* Typography: target visual components, not indiscriminate every descendant. */
.datahubx-theme-light :is(.dhx-page-title,.dhx-section-title,.dhx-portfolio-page .mud-typography-h4,.dhx-portfolio-page .mud-typography-h5,.dhx-portfolio-page .mud-typography-h6),
.datahubx-theme-dark :is(.dhx-page-title,.dhx-section-title,.dhx-portfolio-page .mud-typography-h4,.dhx-portfolio-page .mud-typography-h5,.dhx-portfolio-page .mud-typography-h6) {
  color:var(--p-title) !important;
}
.dhx-page-header{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px}
.dhx-page-title{font-size:1.5rem;font-weight:800;letter-spacing:-.025em}
.dhx-page-subtitle,.dhx-portfolio-page .datahubx-muted{color:var(--p-muted) !important;font-size:.82rem}
.dhx-section-title{font-size:.9rem;font-weight:800}
.dhx-page-info{display:flex;align-items:center;min-height:42px;padding:10px 14px;
  border-left:2px solid #55a4d5;background:var(--p-surface-soft);color:var(--p-text);
  border-radius:0 8px 8px 0;margin:4px 0 12px;box-sizing:border-box}
.dhx-page-info__text{font-size:12px;line-height:1.55}
/* All table/card/panel surfaces (MudBlazor components and page marker). */
.datahubx-theme-light :is(.mud-card,.mud-paper:not(.mud-appbar):not(.mud-drawer),.mud-table-container,.mud-simple-table,.mud-tabs-panels),
.datahubx-theme-dark :is(.mud-card,.mud-paper:not(.mud-appbar):not(.mud-drawer),.mud-table-container,.mud-simple-table,.mud-tabs-panels) {
  color:var(--p-text) !important;background-color:var(--p-surface) !important;
  border-color:var(--p-line) !important;
}
.datahubx-theme-light .mud-dialog,.datahubx-theme-dark .mud-dialog,
.datahubx-theme-light .mud-popover,.datahubx-theme-dark .mud-popover {
  background:var(--p-surface) !important;color:var(--p-text) !important;border-color:var(--p-line) !important;
}
.datahubx-theme-light :is(.mud-table,.mud-table-root,.mud-table-body),
.datahubx-theme-dark :is(.mud-table,.mud-table-root,.mud-table-body){background:var(--p-surface) !important;color:var(--p-text) !important}
.datahubx-theme-light .mud-table-head .mud-table-cell,.datahubx-theme-dark .mud-table-head .mud-table-cell {
  background:var(--p-table-head) !important;color:var(--p-text) !important;font-weight:750 !important;
  border-bottom:1px solid var(--p-line) !important;
}
.datahubx-theme-light .mud-table-cell,.datahubx-theme-dark .mud-table-cell {
 color:var(--p-text) !important;border-bottom-color:var(--p-line) !important;
}
.datahubx-theme-light .mud-table-body .mud-table-row:hover,.datahubx-theme-dark .mud-table-body .mud-table-row:hover {
 background:var(--p-hover) !important;
}
.datahubx-theme-light .mud-table-body .mud-table-row:nth-child(even),
.datahubx-theme-dark .mud-table-body .mud-table-row:nth-child(even){background:var(--p-surface-soft) !important}
/* Inputs and labels: this covers text typed into inputs and select elements. */
.datahubx-theme-light :is(.mud-input-root,.mud-input-slot,.mud-input,.mud-select-input,.mud-input-label,.mud-input-helper-text),
.datahubx-theme-dark :is(.mud-input-root,.mud-input-slot,.mud-input,.mud-select-input,.mud-input-label,.mud-input-helper-text){color:var(--p-text) !important}
.datahubx-theme-light :is(input,textarea,select),.datahubx-theme-dark :is(input,textarea,select){color:var(--p-text);color-scheme:light}
.datahubx-theme-dark :is(input,textarea,select){color-scheme:dark}
.datahubx-theme-light :is(input::placeholder,textarea::placeholder),.datahubx-theme-dark :is(input::placeholder,textarea::placeholder){color:var(--p-subtle) !important;opacity:1}
.datahubx-theme-light .mud-input-outlined-border,.datahubx-theme-dark .mud-input-outlined-border{border-color:var(--p-line) !important}
.datahubx-theme-light .mud-input-control:focus-within .mud-input-outlined-border,
.datahubx-theme-dark .mud-input-control:focus-within .mud-input-outlined-border{border-color:var(--p-link) !important}
/* Inputs in AppBar are dark regardless of page mode. */
.datahubx-theme-light .mud-appbar :is(input,select),.datahubx-theme-dark .mud-appbar :is(input,select){color-scheme:dark;color:var(--p-nav-text) !important}
/* Tabs, pagination, menus, popovers, tree, list, expansion. */
.datahubx-theme-light :is(.mud-tab,.mud-list-item,.mud-menu-item,.mud-treeview-item,.mud-table-pagination,.mud-expand-panel-header),
.datahubx-theme-dark :is(.mud-tab,.mud-list-item,.mud-menu-item,.mud-treeview-item,.mud-table-pagination,.mud-expand-panel-header){color:var(--p-text) !important}
.datahubx-theme-light .mud-tab.mud-tab-active,.datahubx-theme-dark .mud-tab.mud-tab-active{color:var(--p-title) !important;background:var(--p-hover) !important}
.datahubx-theme-light .mud-tabs-tabbar,.datahubx-theme-dark .mud-tabs-tabbar{border:1px solid var(--p-line);background:var(--p-surface-soft) !important}
.datahubx-theme-light :is(.mud-table-pagination,.mud-select,.mud-dialog-title,.mud-dialog-content,.mud-expansion-panel,.mud-list,.mud-menu),
.datahubx-theme-dark :is(.mud-table-pagination,.mud-select,.mud-dialog-title,.mud-dialog-content,.mud-expansion-panel,.mud-list,.mud-menu){color:var(--p-text) !important}
/* Visible icons and outline buttons without overriding semantic colors. */
.datahubx-theme-light .mud-icon-root:not(.mud-primary-text):not(.mud-success-text):not(.mud-error-text):not(.mud-warning-text),
.datahubx-theme-dark .mud-icon-root:not(.mud-primary-text):not(.mud-success-text):not(.mud-error-text):not(.mud-warning-text){color:inherit}
.datahubx-theme-light .mud-button-outlined:not(.mud-button-outlined-primary):not(.mud-button-outlined-error),
.datahubx-theme-dark .mud-button-outlined:not(.mud-button-outlined-primary):not(.mud-button-outlined-error){color:var(--p-text) !important;border-color:var(--p-line) !important}
.datahubx-theme-light .mud-button-filled-primary,.datahubx-theme-dark .mud-button-filled-primary{color:#fff !important;background:var(--p-primary) !important}
.datahubx-theme-light .mud-button-filled-primary .mud-icon-root,.datahubx-theme-dark .mud-button-filled-primary .mud-icon-root{color:#fff !important}
/* Default chips; semantic chips must retain their explicit Mud color. */
.datahubx-theme-light .mud-chip.mud-chip-color-default,.datahubx-theme-dark .mud-chip.mud-chip-color-default {
 color:var(--p-text) !important;border-color:var(--p-line) !important;background:var(--p-surface-soft) !important;
}
.datahubx-theme-light .mud-chip-color-success,.datahubx-theme-dark .mud-chip-color-success {color:var(--p-success) !important}
.datahubx-theme-light .mud-chip-color-error,.datahubx-theme-dark .mud-chip-color-error {color:var(--p-error) !important}
.datahubx-theme-light .mud-chip-color-warning,.datahubx-theme-dark .mud-chip-color-warning {color:var(--p-warning) !important}
.datahubx-theme-light .mud-chip-color-info,.datahubx-theme-dark .mud-chip-color-info {color:var(--p-info) !important}
/* Tables and notification blocks must remain legible in both modes. */
.datahubx-theme-light .mud-alert,.datahubx-theme-dark .mud-alert {color:var(--p-text) !important;background:var(--p-surface-soft) !important;border-color:var(--p-line) !important}
.datahubx-theme-light .mud-alert-message,.datahubx-theme-dark .mud-alert-message{color:inherit !important}
.dhx-kpi-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.dhx-kpi{min-height:96px;padding:14px;border:1px solid var(--p-line);border-radius:12px;background:var(--p-surface-soft);color:var(--p-text)}
/* Native progress/spinner/status semantics are not transformed. */
@media (max-width:1200px){.dhx-kpi-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:720px){.dhx-kpi-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.dhx-page-header{align-items:flex-start;flex-direction:column}}
