/* Shared SEMS theme geometry and typography; palette overrides select dark/light colors. */
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) {
    --bg-app: #081923;
    --bg-sidebar: #09202b;
    --bg-header: #0a1d28;
    --surface-1: #0d202b;
    --surface-2: #152c39;
    --surface-3: #1b3443;
    --border-default: #284250;
    --border-subtle: rgba(115,155,181,.22);
    --text-primary: #f4f8fb;
    --text-secondary: #bdd0de;
    --text-muted: #9cb5c7;
    --accent-primary: #00d9a0;
    --accent-green: #24e47b;
    --accent-blue: #32a8ff;
    --accent-cyan: #19c6df;
    --accent-purple: #8469ff;
    --accent-orange: #ff961a;
    --accent-red: #ff5574;
    --chart-grid: rgba(130, 160, 175, .12);
    --chart-label: #9cb0bd;
    --chart-area-top: rgba(255, 150, 26, .38);
    --chart-area-bottom: rgba(255, 150, 26, .03);
    --card-fill: linear-gradient(145deg, var(--surface-2), var(--surface-1) 70%);
    --card-shadow: inset 0 1px 0 rgba(255,255,255,.025), 0 4px 14px rgba(0,0,0,.14);
    --active-fill: rgba(0,217,160,.08);
    --ct-body-color: var(--text-secondary);
    --ct-heading-color: var(--text-primary);
    --ct-secondary-color: var(--text-muted);
    --ct-body-bg: var(--bg-app);
    --ct-secondary-bg: var(--surface-1);
    --ct-tertiary-bg: var(--surface-2);
    --ct-border-color: var(--border-default);
    --ct-primary: var(--accent-primary);
    --ct-success: var(--accent-green);
    --ct-danger: var(--accent-red);
    --ct-warning: var(--accent-orange);
    --ct-info: var(--accent-cyan);
    --ct-success-rgb: 36,228,123;
    --ct-danger-rgb: 255,85,116;
    --ct-info-rgb: 25,198,223;
    --ct-primary-rgb: 0,217,160;
    --ct-warning-rgb: 255,150,26;
    --ct-menu-bg: var(--bg-sidebar);
    --ct-menu-item-color: var(--text-secondary);
    --ct-menu-item-hover-color: var(--text-primary);
    --ct-menu-item-active-color: var(--accent-primary);
    --ct-topbar-bg: var(--bg-header);
    --ct-topbar-item-color: var(--text-primary);
    --ct-topbar-search-bg: var(--surface-3);
    --sems-soft-bg: var(--bg-app);
    --sems-soft-surface: var(--surface-1);
    --sems-soft-border: var(--border-subtle);
    --sems-soft-hover: var(--active-fill);
    --sems-soft-shadow: rgba(0,0,0,.14);
    --sems-soft-highlight: rgba(255,255,255,.025);
    --sems-page-bg: var(--bg-app);
    --sems-surface-bg: var(--surface-1);
    --sems-surface-soft-bg: var(--surface-2);
    --sems-surface-border: var(--border-subtle);
    --sems-input-bg: var(--surface-3);
    --sems-input-border: var(--border-default);
    --sems-table-bg: var(--surface-1);
    --sems-table-striped-bg: var(--surface-2);
    --sems-table-hover-bg: var(--surface-3);
    --sems-shadow: var(--card-shadow);
    --dashboard-ui-font: 'SEMS Roboto', Arial, sans-serif;
    --ct-font-sans-serif: var(--dashboard-ui-font);
    --ct-body-font-family: var(--dashboard-ui-font);
    --metric-icon-size: 22px;
}

html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) body { background: var(--bg-app); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .leftside-menu {
    background: var(--bg-sidebar) !important;
    box-shadow: inset -1px 0 var(--border-subtle) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom {
    background: linear-gradient(110deg, var(--bg-header), #10232d 55%, #0a1c26) !important;
    box-shadow: inset 0 -1px var(--border-subtle) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav-title { color: var(--text-muted) !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link { color: var(--text-secondary); border-radius: 7px; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav a:hover { background: var(--surface-2) !important; color: var(--text-primary) !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .menuitem-active > .side-nav-link,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav a.active {
    color: var(--accent-primary) !important;
    background: var(--active-fill) !important;
    outline: 1px solid rgba(0,217,160,.65) !important;
    outline-offset: -1px;
    box-shadow: inset 0 0 12px rgba(0,217,160,.06), 0 0 10px rgba(0,217,160,.08) !important;
}
/* Reference topbar: retain all existing controls and responsive visibility. */
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .topbar > .d-flex:first-child {
    flex: 1 1 auto;
    min-width: 0;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .app-search {
    width: min(52vw, 772px);
    max-width: calc(100% - 68px);
    margin-left: 8px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .app-search form { max-width: none; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .app-search .form-control {
    background: linear-gradient(110deg, #243642, #20313c) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-default) !important;
    border-radius: 9px !important;
    height: 42px;
    padding-left: 52px;
    font-size: 14px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.025) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .app-search .form-control::placeholder {
    color: var(--text-secondary) !important;
    opacity: 1;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .app-search .search-icon {
    left: 15px;
    line-height: 42px;
    font-size: 22px;
    color: var(--text-secondary);
    pointer-events: none;
}
/* The existing submit action remains available as the magnifier button. */
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .app-search button[type="submit"] {
    position: absolute;
    inset: 0 auto 0 0;
    width: 44px;
    font-size: 0;
    border: 0 !important;
    border-radius: 9px 0 0 9px;
    background: transparent !important;
    box-shadow: none !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .topbar-menu {
    flex-shrink: 0;
    gap: 26px !important;
    padding-left: 24px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .button-toggle-menu {
    color: var(--text-secondary);
    position: relative;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .button-toggle-menu::after {
    content: "";
    position: absolute;
    right: -2px;
    top: 50%;
    transform: translateY(-50%);
    height: 22px;
    border-right: 1px solid var(--border-subtle);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .topbar-menu .nav-link {
    color: var(--text-secondary);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .topbar-menu .nav-link:hover { color: var(--text-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .nav-user {
    background: transparent !important;
    border: 0;
    padding-left: 18px !important;
    gap: 12px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .nav-user::before {
    content: "";
    position: absolute;
    left: 0;
    height: 24px;
    border-left: 1px solid var(--border-subtle);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .nav-user::after {
    content: "";
    display: block !important;
    width: 7px;
    height: 7px;
    margin: -4px 6px 0 16px;
    border: solid var(--text-secondary);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .account-user-avatar {
    flex: 0 0 36px;
    width: 36px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .account-user-avatar img {
    display: block;
    width: 36px;
    height: 36px;
    object-fit: cover;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .nav-user h5 { font-size: 13px; font-weight: 500; color: var(--text-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .nav-user h6 { font-size: 12px; color: var(--text-secondary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .noti-icon-badge { background: var(--accent-red); box-shadow: none; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom :is(button,a,input):focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
@media (max-width: 991.98px) {
    html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .topbar-menu { gap: 16px !important; padding-left: 12px; }
    html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .navbar-custom .nav-user::after { margin-left: 2px; }
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(input,textarea)::placeholder { color: var(--text-muted) !important; }

html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.dropdown-menu,.modal-content,.offcanvas,.form-control,.form-select) {
    background-color: var(--surface-2) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
    box-shadow: var(--card-shadow);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .dropdown-item { color: var(--text-secondary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .dropdown-item:hover { background: var(--surface-3); color: var(--text-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page :is(.btn-light,.btn-outline-secondary,.plant-generation-tab) {
    background: var(--surface-2) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-default) !important;
    box-shadow: none !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page :is(.btn.active,.plant-generation-tab.active) {
    background: var(--active-fill) !important;
    color: var(--text-primary) !important;
    border-color: var(--accent-primary) !important;
    box-shadow: inset 0 0 0 1px var(--accent-primary) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page :is(.btn-light,.btn-outline-secondary,.plant-generation-tab):hover {
    background: var(--surface-3) !important;
    border-color: var(--accent-primary) !important;
    color: var(--text-primary) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(a,button,input,select,textarea):focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .footer { background: var(--bg-header) !important; color: var(--text-muted); border-color: var(--border-subtle); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) * { scrollbar-color: var(--border-default) var(--surface-1); }


@font-face { font-family: 'SEMS Roboto'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/Roboto-400.ttf') format('truetype'); }
@font-face { font-family: 'SEMS Roboto'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/Roboto-500.ttf') format('truetype'); }
@font-face { font-family: 'SEMS Roboto'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/Roboto-600.ttf') format('truetype'); }
@font-face { font-family: 'SEMS Roboto'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/Roboto-700.ttf') format('truetype'); }


html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) body,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(input,button,select,textarea,.dashboard-live-value) { font-family: var(--dashboard-ui-font); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page :is(h1,h2,h3,h4,h5,h6) { font-weight: 600; }

/* Common surfaces; geometry and responsive rules remain owned by each page. */
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page {
    background: linear-gradient(135deg, var(--bg-app), #091d27 45%, #071720) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.content-page,.modal,.offcanvas) .card:not([class*="bg-"]) {
    background: var(--card-fill) !important;
    border-color: var(--border-subtle) !important;
    border-radius: 10px;
    box-shadow: var(--card-shadow) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .card-body { background: transparent !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page :is(.card-header,.card-footer):not([class*="bg-"]) {
    background: transparent !important;
    border-color: var(--border-subtle) !important;
    box-shadow: none !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(h1,h2,h3,h4,h5,h6,.header-title,.form-label) { color: var(--text-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .text-muted { color: var(--text-muted) !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.table,table.dataTable) {
    --ct-table-bg: var(--surface-1);
    --ct-table-color: var(--text-secondary);
    --ct-table-border-color: var(--border-subtle);
    --ct-table-striped-bg: var(--surface-2);
    --ct-table-striped-color: var(--text-secondary);
    --ct-table-hover-bg: var(--surface-3);
    --ct-table-hover-color: var(--text-primary);
    color: var(--text-secondary);
    background: var(--surface-1);
    border-color: var(--border-subtle);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.table,table.dataTable) thead th {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.dataTables_wrapper,.dt-container) :is(label,.dataTables_info,.dt-info) { color: var(--text-secondary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.dataTables_wrapper,.dt-container) :is(input,select),
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.select2-dropdown,.select2-selection,.selectize-input,.selectize-dropdown,.daterangepicker,.flatpickr-calendar,.input-group-text) {
    background: var(--surface-2) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-default) !important;
    box-shadow: none;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.select2-selection__rendered,.select2-results__option,.daterangepicker .calendar-table,.daterangepicker td.available,.flatpickr-day) { color: var(--text-secondary) !important; background: var(--surface-2); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.form-control,.form-select):focus { border-color: var(--accent-primary) !important; box-shadow: 0 0 0 2px rgba(0,217,160,.12) !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.nav-tabs,.nav-pills) .nav-link { color: var(--text-secondary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.nav-tabs,.nav-pills) .nav-link.active,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .page-item.active .page-link { background: var(--active-fill) !important; border-color: var(--accent-primary) !important; color: var(--accent-primary) !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.page-link,.accordion-item,.accordion-button,.list-group-item) { background: var(--surface-1); color: var(--text-secondary); border-color: var(--border-subtle); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.btn-primary,.btn-success) { --ct-btn-bg: #008f70; --ct-btn-border-color: #00b98c; --ct-btn-hover-bg: #00a27d; --ct-btn-hover-border-color: var(--accent-primary); --ct-btn-color: #f4fffc; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .apexcharts-tooltip { background: var(--surface-2) !important; border-color: var(--border-default) !important; color: var(--text-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .apexcharts-tooltip-title { background: var(--surface-1) !important; border-color: var(--border-subtle) !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.apexcharts-xaxis-label,.apexcharts-yaxis-label) { fill: var(--chart-label); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .apexcharts-gridline { stroke: var(--chart-grid); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-login-form-panel { background: var(--card-fill); color: var(--text-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .bg-light { background: var(--surface-2) !important; color: var(--text-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) :is(.form-control,.form-select) { box-shadow: inset 0 1px 0 rgba(255,255,255,.025) !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .form-check-input:checked { background-color: #008f70; border-color: var(--accent-primary); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-login-brand { background: linear-gradient(145deg, var(--surface-2), var(--bg-sidebar)); }
/* Generated decoration is shared by both themes; controls keep their owners. */
.sems-generated-card-header, .sems-card-heading-icon { display: none; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-generated-card-header { display: block !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .sems-uniform-card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle) !important;
    background: transparent !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
    font-size: 14px;
    line-height: 1.35;
    color: var(--text-primary);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-card-heading-icon {
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 7px;
    background: var(--active-fill);
    color: var(--accent-primary);
    font-size: 20px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-card-body-title { padding-bottom: 12px; margin-bottom: 16px !important; border-bottom: 1px solid var(--border-subtle); }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .card .dataTables_wrapper,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .card :is(.dataTables_wrapper > .row,.dataTables_scroll,.dataTables_scrollHead,.dataTables_scrollHeadInner,.dataTables_scrollBody,.table-responsive) {
    background: transparent !important;
    box-shadow: none !important;
    max-width: 100%;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .card .card-body { min-width: 0; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .card .dataTables_wrapper { width: 100%; overflow-x: auto; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .card .dataTables_wrapper > .row { margin-left: 0; margin-right: 0; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .content-page .card .dataTables_wrapper > .row > [class*="col-"] { padding-left: 0; padding-right: 0; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-table-card .card-body { padding: 16px 20px 20px; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-table-card :is(.dataTables_length,.dataTables_filter) { margin-bottom: 12px; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .sems-table-card :is(.dataTables_info,.dataTables_paginate) { padding-top: 12px !important; }

@media (min-width: 768px) {
    html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .card .dataTables_wrapper > .dataTables_length { float: left; }
    html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .card .dataTables_wrapper > .dataTables_filter { float: right; }
    html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .card .dataTables_wrapper > .dataTables_paginate { float: right; }
    html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .card .dataTables_wrapper > .dataTables_info { float: left; }
    html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .card .dataTables_wrapper > table { clear: both; }
}

/* Sidebar close-up reference: lighter type, tighter rhythm, restrained teal glow. */
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .leftside-menu {
    background: linear-gradient(110deg, #0b202b 0%, #10252f 60%, #0b1d27 100%) !important;
    --ct-menu-item-font-size: 14px;
    --ct-menu-item-icon-size: 22px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav :is(.side-nav-second-level,.side-nav-third-level) a {
    font-family: var(--dashboard-ui-font);
    font-size: 14px !important;
    font-weight: 400 !important;
    letter-spacing: 0;
    color: #bed0dd;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link > span:not(.badge) { font-weight: 400 !important; }
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link > i {
    font-size: 22px;
    line-height: 22px;
    color: #b6cbd9;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-title {
    font-size: 11px;
    font-weight: 400 !important;
    letter-spacing: .35px;
    opacity: 1;
    color: #9eb4c2 !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link {
    border-radius: 7px;
    box-shadow: none;
    transition: background-color .18s ease, color .18s ease, box-shadow .18s ease;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link:hover,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link:focus-visible {
    background: rgba(29,70,79,.3) !important;
    box-shadow: inset 0 0 0 1px rgba(93,156,163,.15) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav :is(.menuitem-active,.side-nav-item.active) > .side-nav-link,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link.active {
    background: linear-gradient(110deg, rgba(0,125,112,.23), rgba(0,73,69,.17)) !important;
    color: #aefff0 !important;
    outline: 1px solid rgba(0,217,176,.58) !important;
    outline-offset: -1px;
    box-shadow: inset 0 0 15px rgba(0,217,160,.06), 0 0 13px rgba(0,217,160,.14) !important;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav :is(.menuitem-active,.side-nav-item.active) > .side-nav-link > i,
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .side-nav-link.active > i {
    color: #ddfff8;
    filter: drop-shadow(0 0 3px rgba(0,217,160,.3));
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .side-nav .badge {
    font-size: 11px;
    font-weight: 500;
    border-radius: 7px;
    padding: 3px 7px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]):not([data-sidenav-size="condensed"]):not([data-sidenav-size="sm-hover"]) .side-nav > .side-nav-item > .side-nav-link {
    margin: 2px 12px;
    padding: 7px 16px;
    line-height: 22px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]):not([data-sidenav-size="condensed"]):not([data-sidenav-size="sm-hover"]) .side-nav > .side-nav-item > .side-nav-link > i {
    width: 24px;
    min-width: 24px;
    margin-right: 12px;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]):not([data-sidenav-size="condensed"]):not([data-sidenav-size="sm-hover"]) .side-nav > .side-nav-title {
    margin: 14px 20px 4px;
    padding: 12px 0 2px;
    border-top: 1px solid rgba(116,151,170,.15);
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]):not([data-sidenav-size="condensed"]):not([data-sidenav-size="sm-hover"]) .side-nav > .side-nav-title:first-child {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 0;
}
html:root:is([data-bs-theme="dark"],[data-bs-theme="light"]) .leftside-menu .logo-lg img {
    width: 190px !important;
    height: 64px !important;
    object-fit: contain;
}

/* Light reference palette. Geometry above is shared with dark mode. */
html:root[data-bs-theme="light"] {
    --bg-app: #f0f7fb;
    --bg-sidebar: #f5f9fc;
    --bg-header: #edf5fa;
    --surface-1: #ffffff;
    --surface-2: #f3f8fd;
    --surface-3: #e4eef6;
    --border-default: #d5e6f1;
    --border-subtle: rgba(129,175,207,.24);
    --text-primary: #0b193c;
    --text-secondary: #41618a;
    --text-muted: #7188a5;
    --accent-primary: #00b894;
    --accent-green: #00a348;
    --accent-blue: #009dff;
    --accent-cyan: #00afd0;
    --accent-purple: #7651ef;
    --accent-orange: #ff8a00;
    --accent-red: #ff315c;
    --chart-grid: rgba(110,158,192,.16);
    --chart-label: #486389;
    --chart-area-top: rgba(255,138,0,.26);
    --chart-area-bottom: rgba(255,138,0,.04);
    --card-fill: linear-gradient(145deg, #fff, #fbfdff);
    --card-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 3px 12px rgba(76,133,170,.09);
    --active-fill: rgba(0,184,148,.08);
    --sems-soft-shadow: rgba(76,133,170,.09);
    --sems-soft-highlight: rgba(255,255,255,.85);
    --ct-primary-rgb: 0,184,148;
    --ct-success-rgb: 0,163,72;
    --ct-danger-rgb: 255,49,92;
    --ct-info-rgb: 0,175,208;
    --ct-warning-rgb: 255,138,0;
}
html:root[data-bs-theme="light"] .content-page { background: linear-gradient(135deg, #f0f7fb, #eaf3f9 45%, #f6faff) !important; }
html:root[data-bs-theme="light"] .leftside-menu { background: linear-gradient(110deg, #f7fbfd, #edf5fa 60%, #f5f9fc) !important; }
html:root[data-bs-theme="light"] .navbar-custom { background: linear-gradient(110deg, #edf5fa, #f6fafd) !important; }
html:root[data-bs-theme="light"] .navbar-custom .app-search .form-control { background: #fff !important; }
html:root[data-bs-theme="light"] .side-nav .side-nav-link,
html:root[data-bs-theme="light"] .side-nav :is(.side-nav-second-level,.side-nav-third-level) a,
html:root[data-bs-theme="light"] .side-nav .side-nav-link > i { color: var(--text-secondary); }
html:root[data-bs-theme="light"] .side-nav .side-nav-title { color: var(--text-secondary) !important; }
html:root[data-bs-theme="light"] .side-nav .side-nav-link:hover,
html:root[data-bs-theme="light"] .side-nav .side-nav-link:focus-visible { background: #e4f4f2 !important; }
html:root[data-bs-theme="light"] .side-nav :is(.menuitem-active,.side-nav-item.active) > .side-nav-link,
html:root[data-bs-theme="light"] .side-nav .side-nav-link.active {
    background: linear-gradient(110deg, #007e83, #00616c) !important;
    color: #fff !important;
    outline-color: #008f91 !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 2px 8px rgba(0,114,120,.12) !important;
}
html:root[data-bs-theme="light"] .side-nav :is(.menuitem-active,.side-nav-item.active) > .side-nav-link > i,
html:root[data-bs-theme="light"] .side-nav .side-nav-link.active > i { color: #fff; filter: none; }
html:root[data-bs-theme="light"] .content-page :is(.btn.active,.plant-generation-tab.active) { color: #006c68 !important; }
