/* ============================================================================
   BMS Monitoring — page stylesheet
   ----------------------------------------------------------------------------
   Global stylesheet (not CSS-isolated). Every rule is namespaced under
   .bms-page / .bms-* so it can never leak into another page, while still
   being able to style MudBlazor components (MudCard, MudTabs, MudChip, ...)
   and the child components in Components/BmsDashboard.

   Why global instead of Bms.razor.css:
   Blazor CSS isolation only stamps the b-{hash} attribute on literal HTML
   elements of the owning component. Any element rendered by MudBlazor or by
   a child component (which is where 90% of this page's markup lives) never
   receives that attribute, so every `.bms-*[b-...]` selector silently
   failed. A namespaced global sheet is the reliable model for a MudBlazor
   heavy page and lets the dashboard sub-components share one design system.

   Load order: MudBlazor.min.css -> app.css -> bms.css
   ========================================================================== */

/* ----------------------------------------------------------------------------
   1. Design tokens + page shell
   -------------------------------------------------------------------------- */

.bms-page {
    --bms-bg: #F4F7FC;
    --bms-card: #FFFFFF;
    --bms-primary: #0755C7;
    --bms-primary-hover: #0648A8;
    --bms-primary-soft: #EAF2FF;
    --bms-primary-border: #C7DAF6;
    --bms-accent: #06B6D4;
    --bms-heading: #0F1F38;
    --bms-text: #334155;
    --bms-muted: #64748B;
    --bms-faint: #8595A9;
    --bms-border: #E2E8F0;
    --bms-line-soft: #EDF2F8;
    --bms-success: #15803D;
    --bms-success-bg: #ECFDF3;
    --bms-success-border: #BBF7D0;
    --bms-warning: #B45309;
    --bms-warning-bg: #FFFBEB;
    --bms-warning-border: #FDE68A;
    --bms-danger: #B91C1C;
    --bms-danger-bg: #FEF2F2;
    --bms-danger-border: #FECACA;
    --bms-radius: 14px;
    --bms-radius-sm: 10px;
    --bms-gap: 16px;
    --bms-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --bms-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
    --bms-shadow-hover: 0 10px 28px rgba(7, 85, 199, 0.10);

    display: flex;
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: none;
    min-height: 100%;
    margin: 0;
    padding: 20px 24px 40px;
    box-sizing: border-box;
    color: var(--bms-text);
    font-family: 'Inter', 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background:
        radial-gradient(1100px 380px at 0% -20%, rgba(7, 85, 199, 0.07), transparent 60%),
        radial-gradient(900px 360px at 100% 0%, rgba(6, 182, 212, 0.05), transparent 55%),
        var(--bms-bg);
}

.bms-page *,
.bms-page *::before,
.bms-page *::after {
    box-sizing: border-box;
}

.bms-page .mud-typography,
.bms-page .mud-button-root,
.bms-page .mud-input,
.bms-page .mud-chip,
.bms-page .mud-table {
    font-family: inherit;
}

.bms-page .mud-button-root {
    letter-spacing: 0;
    text-transform: none;
}

/* ----------------------------------------------------------------------------
   2. Page header
   -------------------------------------------------------------------------- */

.bms-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    width: 100%;
}

.bms-page-heading {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.bms-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    flex: 0 0 auto;
    border-radius: 16px;
    color: #FFFFFF;
    background: linear-gradient(135deg, #0A63E0 0%, #054CAF 100%);
    box-shadow: 0 8px 20px rgba(7, 85, 199, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.bms-title-icon .mud-icon-root {
    font-size: 27px;
}

.bms-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.bms-eyebrow {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bms-primary);
}

.bms-page .bms-title {
    margin: 0;
    font-size: 26px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--bms-heading);
}

.bms-subtitle {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--bms-muted);
}

.bms-page-actions {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
    min-width: 0;
    margin-left: auto;
}

/* ----------------------------------------------------------------------------
   3. Command bar
   -------------------------------------------------------------------------- */

.bms-command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: auto;
    max-width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid var(--bms-border);
    border-radius: var(--bms-radius);
    box-shadow: var(--bms-shadow);
    backdrop-filter: blur(8px);
}

.bms-search-cluster {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

.bms-search-wrap {
    flex: 0 1 300px;
    min-width: 170px;
    max-width: 320px;
}

.bms-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    margin-left: auto;
}

/* The toolbar lives beside the page title, so its controls are slightly more
   compact than the standalone buttons used inside the cards. */
.bms-page .bms-page-actions .bms-btn.mud-button-root {
    height: 38px;
    min-height: 38px;
    padding: 0 13px;
    font-size: 13px;
}

.bms-page .bms-page-actions .bms-btn .mud-button-label {
    font-size: 13px;
}

.bms-page .bms-page-actions .bms-search-wrap .mud-input.mud-input-outlined {
    height: 38px;
}

/* MudBlazor sets `.mud-input-control { width: auto !important }`, so a plain
   `width: 100%` never wins. !important is required here. */
.bms-page .bms-search-wrap .bms-search.mud-input-control,
.bms-page .bms-search-wrap .mud-input-control {
    width: 100% !important;
    margin: 0;
}

.bms-page .bms-search-wrap .mud-input.mud-input-outlined {
    height: 42px;
    border-radius: 10px;
    background: #F8FAFD;
}

.bms-page .bms-search-wrap .mud-input-outlined-border {
    border-color: var(--bms-border);
    border-radius: 10px;
}

.bms-page .bms-search-wrap .mud-input.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: var(--bms-primary-border);
}

.bms-page .bms-search-wrap .mud-input.mud-input-outlined.mud-input-focused .mud-input-outlined-border {
    border-color: var(--bms-primary);
    border-width: 2px;
}

.bms-page .bms-search-wrap .mud-input-root {
    font-size: 13.5px;
    color: var(--bms-text);
}

.bms-page .bms-search-wrap .mud-input-adornment {
    color: var(--bms-faint);
}

/* ----------------------------------------------------------------------------
   4. Buttons
   -------------------------------------------------------------------------- */

.bms-page .bms-btn.mud-button-root {
    height: 42px;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: none;
}

.bms-page .bms-btn .mud-button-label {
    font-size: 13.5px;
    font-weight: 600;
}

.bms-page .bms-small-btn.mud-button-root {
    height: 36px;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 9px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: none;
}

.bms-page .bms-small-btn .mud-button-label {
    font-size: 12.5px;
    font-weight: 600;
}

.bms-page .bms-btn.mud-button-filled-primary,
.bms-page .bms-small-btn.mud-button-filled-primary {
    box-shadow: 0 1px 2px rgba(7, 85, 199, 0.25);
}

.bms-page .bms-btn.mud-button-filled-primary:hover,
.bms-page .bms-small-btn.mud-button-filled-primary:hover {
    background: var(--bms-primary-hover);
}

.bms-page .bms-btn.mud-button-outlined-primary,
.bms-page .bms-small-btn.mud-button-outlined-primary {
    border-color: var(--bms-primary-border);
    background: #FFFFFF;
}

.bms-page .bms-btn.mud-button-outlined-primary:hover,
.bms-page .bms-small-btn.mud-button-outlined-primary:hover {
    border-color: var(--bms-primary);
    background: var(--bms-primary-soft);
}

.bms-page .bms-link-btn.mud-button-root {
    height: auto;
    min-height: 0;
    min-width: 0;
    margin-top: 8px;
    padding: 0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.4;
}

.bms-page .bms-link-btn .mud-button-label {
    font-size: 12.5px;
    font-weight: 600;
}

.bms-page .bms-icon-btn.mud-icon-button {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid var(--bms-border);
    border-radius: 11px;
    background: #FFFFFF;
    color: var(--bms-primary);
    box-shadow: none;
}

.bms-page .bms-icon-btn.mud-icon-button:hover {
    background: var(--bms-primary-soft);
    border-color: var(--bms-primary-border);
    color: var(--bms-primary);
}

/* ----------------------------------------------------------------------------
   5. Search results
   -------------------------------------------------------------------------- */

.bms-page .bms-results.mud-paper {
    padding: 8px;
    background: var(--bms-card);
    border: 1px solid var(--bms-border);
    border-radius: var(--bms-radius);
    box-shadow: var(--bms-shadow);
    max-height: 360px;
    overflow-y: auto;
}

.bms-results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 8px 10px;
    border-bottom: 1px solid var(--bms-line-soft);
    margin-bottom: 6px;
}

.bms-results-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--bms-heading);
}

.bms-results-title .mud-icon-root {
    font-size: 16px;
    color: var(--bms-primary);
}

.bms-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--bms-primary-soft);
    color: var(--bms-primary);
    font-size: 10.5px;
    font-weight: 700;
}

.bms-page .bms-result-list.mud-list {
    padding: 0;
}

.bms-page .bms-result-item.mud-list-item {
    padding: 0;
    margin: 0;
    border-radius: 10px;
}

.bms-page .bms-result-item.mud-list-item:hover {
    background: #F4F8FE;
}

.bms-page .bms-result-item .mud-list-item-text {
    width: 100%;
    margin: 0;
    padding: 0;
}

.bms-result {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    text-align: left;
}

.bms-result-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
    border-radius: 10px;
    background: var(--bms-primary-soft);
    color: var(--bms-primary);
}

.bms-result-avatar .mud-icon-root {
    font-size: 19px;
}

.bms-result-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.bms-result-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--bms-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bms-result-meta {
    font-size: 11.5px;
    color: var(--bms-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bms-sep {
    margin: 0 4px;
    color: #C7D2E0;
}

.bms-result-arrow {
    font-size: 18px !important;
    color: #C3CEDD;
    flex: 0 0 auto;
}

/* ----------------------------------------------------------------------------
   6. Selected asset bar
   -------------------------------------------------------------------------- */

.bms-page .bms-asset-bar.mud-paper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    padding: 14px 16px;
    background: var(--bms-card);
    border: 1px solid var(--bms-border);
    border-radius: var(--bms-radius);
    box-shadow: var(--bms-shadow);
}

.bms-asset-main {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 auto;
    min-width: 0;
}

.bms-asset-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 13px;
    background: linear-gradient(135deg, #E8F1FF 0%, #DCEAFE 100%);
    color: var(--bms-primary);
    box-shadow: inset 0 0 0 1px rgba(7, 85, 199, 0.08);
}

.bms-asset-icon .mud-icon-root {
    font-size: 24px;
}

.bms-asset-copy {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.bms-asset-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.bms-page .bms-asset-name {
    font-size: 16px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--bms-heading);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bms-asset-state {
    font-size: 12px;
    font-weight: 600;
    color: var(--bms-muted);
    white-space: nowrap;
}

.bms-status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #94A3B8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.16);
}

.bms-status-dot.online {
    background: #16A34A;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.16);
}

.bms-status-dot.offline {
    background: #94A3B8;
    box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2);
}

.bms-asset-meta {
    display: flex;
    align-items: center;
    gap: 4px 16px;
    flex-wrap: wrap;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--bms-muted);
}

.bms-asset-meta > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.bms-asset-meta .mud-icon-root {
    font-size: 14px;
    color: #9AA9BD;
}

.bms-asset-side {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
}

.bms-asset-sync {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.bms-kicker {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bms-faint);
}

.bms-asset-sync-value {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--bms-heading);
    white-space: nowrap;
}

.bms-asset-sync-hint {
    font-size: 10.5px;
    color: var(--bms-faint);
    white-space: nowrap;
}

/* ----------------------------------------------------------------------------
   7. Tabs
   ----------------------------------------------------------------------------
   MudTabPanel renders with `display: contents` when active, so the panels
   container must be the flex/grid container — never the panel itself.
   -------------------------------------------------------------------------- */

.bms-page .bms-tabs.mud-tabs {
    width: 100%;
    max-width: none;
    min-width: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.bms-page .bms-tabs > .mud-tabs-tabbar {
    min-height: 54px;
    background: var(--bms-card);
    border: 1px solid var(--bms-border);
    border-radius: var(--bms-radius);
    box-shadow: var(--bms-shadow);
    overflow: hidden;
}

.bms-page .bms-tabs .mud-tab {
    min-width: 0;
    min-height: 52px;
    padding: 0 18px;
    color: #52627A;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    transition: color 0.15s ease, background 0.15s ease;
}

.bms-page .bms-tabs .mud-tab:hover {
    color: var(--bms-primary);
    background: #F4F8FE;
}

.bms-page .bms-tabs .mud-tab.mud-tab-active {
    color: var(--bms-primary);
    background: transparent;
}

.bms-page .bms-tabs .mud-tab-icon-text {
    font-size: 15px !important;
    margin-right: 8px;
}

.bms-page .bms-tabs .mud-tab-slider {
    height: 3px;
    background: var(--bms-primary);
    border-radius: 3px 3px 0 0;
}

.bms-page .bms-tabs > .mud-tabs-panels {
    display: flex;
    flex-direction: column;
    gap: var(--bms-gap);
    width: 100%;
    min-width: 0;
    padding: 16px 0 0;
    background: transparent;
}

/* ----------------------------------------------------------------------------
   8. Cards + shared typography
   -------------------------------------------------------------------------- */

.bms-page .bms-card.mud-paper {
    padding: 20px;
    background: var(--bms-card);
    border: 1px solid var(--bms-border);
    border-radius: var(--bms-radius);
    box-shadow: var(--bms-shadow);
    color: var(--bms-text);
    min-width: 0;
}

.bms-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.bms-card-heading {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.bms-card-heading-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.bms-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 11px;
    background: var(--bms-primary-soft);
    color: var(--bms-primary);
}

.bms-card-icon .mud-icon-root {
    font-size: 20px;
}

.bms-card-icon.tone-blue {
    background: #EAF2FF;
    color: #0755C7;
}

.bms-card-icon.tone-green {
    background: #ECFDF3;
    color: #15803D;
}

.bms-card-icon.tone-cyan {
    background: #ECFEFF;
    color: #0E7490;
}

.bms-card-icon.tone-red {
    background: #FEF2F2;
    color: #B91C1C;
}

.bms-card-icon.tone-amber {
    background: #FFFBEB;
    color: #B45309;
}

.bms-card-icon.tone-slate {
    background: #F1F5F9;
    color: #475569;
}

.bms-page .bms-card-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--bms-heading);
}

.bms-muted {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--bms-muted);
}

.bms-muted code,
.bms-hint code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #F3F6FA;
    color: #40506A;
    font-size: 11.5px;
}

.bms-hint {
    margin: 10px 0 0;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--bms-faint);
}

.bms-head-tags {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------------------
   9. Chips / status pills
   -------------------------------------------------------------------------- */

.bms-page .bms-state-chip.mud-chip,
.bms-page .bms-status-chip.mud-chip {
    height: 24px;
    min-height: 24px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: #F1F5F9;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: none;
    white-space: nowrap;
}

.bms-page .bms-state-chip .mud-chip-content,
.bms-page .bms-status-chip .mud-chip-content {
    display: inline-flex;
    align-items: center;
    padding: 0;
    line-height: 1;
}

.bms-page .bms-state-chip.success.mud-chip,
.bms-page .bms-status-chip.success.mud-chip {
    background: var(--bms-success-bg);
    border-color: var(--bms-success-border);
    color: var(--bms-success);
}

.bms-page .bms-state-chip.danger.mud-chip,
.bms-page .bms-status-chip.danger.mud-chip {
    background: var(--bms-danger-bg);
    border-color: var(--bms-danger-border);
    color: var(--bms-danger);
}

.bms-page .bms-state-chip.warning.mud-chip,
.bms-page .bms-status-chip.warning.mud-chip {
    background: var(--bms-warning-bg);
    border-color: var(--bms-warning-border);
    color: var(--bms-warning);
}

.bms-page .bms-state-chip.muted.mud-chip,
.bms-page .bms-status-chip.muted.mud-chip {
    background: #F1F5F9;
    border-color: var(--bms-border);
    color: #64748B;
}

.bms-page .bms-state-chip.info.mud-chip,
.bms-page .bms-status-chip.info.mud-chip {
    background: var(--bms-primary-soft);
    border-color: var(--bms-primary-border);
    color: var(--bms-primary);
}

/* ----------------------------------------------------------------------------
   9b. Dashboard column layout
   The monitor grid is a MudGrid of two 6/12 columns on large screens. Each
   column is a flex stack so its cards keep the shared page gap instead of
   collapsing into each other (MudCard has no margin of its own).
   -------------------------------------------------------------------------- */

.bms-page .bms-monitor-grid.mud-grid {
    align-items: flex-start;
}

.bms-col-left,
.bms-col-right {
    display: flex;
    flex-direction: column;
    gap: var(--bms-gap);
    min-width: 0;
}

.bms-page .bms-status-card.mud-paper,
.bms-page .bms-curve-card.mud-paper,
.bms-page .bms-cells.mud-paper {
    min-width: 0;
}

/* ----------------------------------------------------------------------------
   10. Battery overview + SOC gauge (Components/BmsDashboard/SocGauge)
   -------------------------------------------------------------------------- */

.bms-page .bms-overview.mud-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #F5F9FF 100%);
}

.bms-overview-body {
    display: block;
}

/* SocGauge already renders inside the overview card — it must not look like
   a second nested card. */
.bms-page .bms-overview .bms-soc-panel.mud-paper {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.bms-soc-layout {
    display: flex;
    align-items: center;
    gap: 28px;
}

.bms-soc-gauge-wrap {
    position: relative;
    display: grid;
    place-items: center;
    width: 150px;
    height: 150px;
    flex: 0 0 auto;
}

.bms-page .bms-soc-ring.mud-progress-circular {
    width: 150px !important;
    height: 150px !important;
}

.bms-page .bms-soc-ring .mud-progress-circular-svg {
    width: 100%;
    height: 100%;
}

.bms-page .bms-soc-ring .mud-progress-circular-circle {
    stroke-width: 7;
}

.bms-soc-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    pointer-events: none;
}

.bms-soc-value {
    font-size: 40px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--bms-heading);
    font-variant-numeric: tabular-nums;
}

.bms-soc-unit {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bms-faint);
}

.bms-soc-side {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 14px;
    min-width: 0;
}

.bms-soc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.bms-soc-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--bms-muted);
}

.bms-soc-remaining {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12.5px;
    color: var(--bms-muted);
}

.bms-soc-remaining strong {
    font-size: 15px;
    font-weight: 700;
    color: var(--bms-heading);
    font-variant-numeric: tabular-nums;
}

.bms-page .bms-compact-progress.mud-progress-linear {
    height: 8px;
    border-radius: 999px;
}

/* ----------------------------------------------------------------------------
   11. KPI stat cards (Components/BmsDashboard/StatCard)
   -------------------------------------------------------------------------- */

.bms-page .bms-metrics.mud-grid {
    margin-top: 0;
}

.bms-page .bms-stat-card.mud-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 122px;
    padding: 16px;
    border-radius: var(--bms-radius);
    background: linear-gradient(180deg, #FFFFFF 0%, #F9FBFF 100%);
    border: 1px solid var(--bms-border);
    box-shadow: var(--bms-shadow-sm);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.bms-page .bms-stat-card.mud-card:hover {
    transform: translateY(-2px);
    border-color: var(--bms-primary-border);
    box-shadow: var(--bms-shadow-hover);
}

.bms-stat-head {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.bms-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: var(--bms-primary-soft);
    color: var(--bms-primary);
}

.bms-stat-icon .mud-icon-root {
    font-size: 17px;
}

.bms-stat-icon.primary {
    background: #EAF2FF;
    color: #0755C7;
}

.bms-stat-icon.cyan {
    background: #ECFEFF;
    color: #0E7490;
}

.bms-stat-icon.slate {
    background: #F1F5F9;
    color: #475569;
}

.bms-stat-label {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bms-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bms-stat-value-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 10px;
    min-width: 0;
}

.bms-stat-value {
    font-size: 30px;
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--bms-heading);
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.bms-stat-unit {
    font-size: 12px;
    font-weight: 700;
    color: var(--bms-muted);
}

.bms-stat-caption {
    margin-top: 8px;
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--bms-faint);
}

/* ----------------------------------------------------------------------------
   12. BMS status grid (Components/BmsDashboard/StatusGrid) + status message
   -------------------------------------------------------------------------- */

.bms-page .bms-status-grid.mud-grid {
    margin-top: 2px;
}

.bms-status-item-wrap {
    min-width: 0;
}

.bms-status-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    min-height: 72px;
    padding: 12px;
    background: #F8FAFC;
    border: 1px solid var(--bms-line-soft);
    border-radius: var(--bms-radius-sm);
    transition: background 0.18s ease, border-color 0.18s ease;
}

.bms-status-item:hover {
    background: #FFFFFF;
    border-color: var(--bms-primary-border);
}

.bms-status-label {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--bms-faint);
}

.bms-status-value {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
    color: #1E293B;
    overflow-wrap: anywhere;
}

.bms-status-value.success,
.bms-status-value.bms-tone-ok {
    color: var(--bms-success);
}

.bms-status-value.warning {
    color: var(--bms-warning);
}

.bms-status-value.danger,
.bms-status-value.bms-tone-bad {
    color: var(--bms-danger);
}

.bms-status-value.muted,
.bms-status-value.bms-tone-muted {
    color: var(--bms-muted);
}

.bms-tone-ok {
    color: var(--bms-success) !important;
}

.bms-tone-bad {
    color: var(--bms-danger) !important;
}

.bms-tone-muted {
    color: var(--bms-muted) !important;
}

.bms-status-message {
    margin-top: 16px;
    padding: 14px;
    background: #F8FAFC;
    border: 1px solid var(--bms-line-soft);
    border-radius: var(--bms-radius-sm);
}

.bms-status-message-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bms-faint);
}

.bms-status-message-head .mud-icon-root {
    font-size: 15px;
    color: var(--bms-primary);
}

.bms-msg {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--bms-text);
    overflow-wrap: anywhere;
}

.bms-msg.clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bms-msg-raw {
    margin: 8px 0 0;
    padding: 8px 10px;
    background: #FFFFFF;
    border: 1px dashed var(--bms-border);
    border-radius: 8px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--bms-faint);
    overflow-wrap: anywhere;
}

.bms-msg-raw .bms-status-label {
    display: inline;
    margin-right: 6px;
}

/* ----------------------------------------------------------------------------
   13. Cell telemetry
   -------------------------------------------------------------------------- */

.bms-cell-status-chips {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px 12px;
    flex-wrap: wrap;
}

.bms-status-count {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--bms-muted);
    white-space: nowrap;
}

.bms-status-count i {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: #CBD5E1;
}

.bms-status-count.normal i {
    background: #16A34A;
}

.bms-status-count.balancing i {
    background: var(--bms-accent);
}

.bms-status-count.warning i {
    background: #F59E0B;
}

.bms-status-count.critical i {
    background: #DC2626;
}

.bms-status-count.invalid i {
    background: #CBD5E1;
}

.bms-cell-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.bms-cell-stat {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    background: #F8FAFC;
    border: 1px solid var(--bms-line-soft);
    border-radius: var(--bms-radius-sm);
    min-width: 0;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.bms-cell-stat:hover {
    background: #FFFFFF;
    border-color: var(--bms-primary-border);
}

.bms-cell-stat-top {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.bms-cell-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 7px;
    background: #EFF6FF;
    color: var(--bms-primary);
}

.bms-cell-stat-icon .mud-icon-root {
    font-size: 14px;
}

.bms-cell-stat-icon.tone-slate {
    background: #F1F5F9;
    color: #475569;
}

.bms-cell-stat-icon.tone-cyan {
    background: #ECFEFF;
    color: #0E7490;
}

.bms-cell-stat-label {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--bms-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bms-cell-stat-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--bms-heading);
    font-variant-numeric: tabular-nums;
}

.bms-cell-stat-value.normal {
    color: var(--bms-success);
}

.bms-cell-stat-value.warning {
    color: var(--bms-warning);
}

.bms-cell-stat-value.critical {
    color: var(--bms-danger);
}

.bms-cell-stat-value.invalid {
    color: var(--bms-muted);
}

/* MudGrid is replaced with an auto-fill CSS grid so the tiles stay square
   and wrap cleanly at every breakpoint. */
.bms-page .bms-cell-grid.mud-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 8px;
    width: 100%;
    margin: 0;
}

.bms-page .bms-cell-grid > .bms-cell-grid-item {
    flex: none;
    width: auto;
    max-width: none;
    padding: 0;
    min-width: 0;
}

.bms-page .bms-cell-tile.mud-paper,
.bms-page .bms-cell.mud-paper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    min-height: 66px;
    padding: 8px 6px;
    border: 1px solid transparent;
    border-radius: var(--bms-radius-sm);
    background: #F2FCF6;
    color: #15803D;
    box-shadow: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.bms-page .bms-cell-tile.mud-paper:hover,
.bms-page .bms-cell.mud-paper:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.bms-cell-no {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7C8CA1;
    opacity: 0.8;
}

.bms-cell-value {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: inherit;
    font-variant-numeric: tabular-nums;
}

.bms-cell-unit {
    margin-left: 2px;
    font-size: 10px;
    font-weight: 700;
    color: inherit;
    opacity: 0.75;
}

.bms-cell-tile.normal,
.bms-cell.normal {
    background: #F2FCF6;
    border-color: #BBF7D0;
    color: #15803D;
}

.bms-cell-tile.balancing,
.bms-cell.balancing {
    background: #ECFEFF;
    border-color: #A5E4EF;
    color: #0E7490;
}

.bms-cell-tile.warning,
.bms-cell.warning {
    background: #FFFBEB;
    border-color: #FDE68A;
    color: #B45309;
}

.bms-cell-tile.critical,
.bms-cell.critical {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #B91C1C;
}

.bms-cell-tile.invalid,
.bms-cell.invalid {
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    color: #64748B;
}

.bms-cell-legend {
    display: flex;
    align-items: center;
    gap: 7px 16px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--bms-line-soft);
    font-size: 12px;
    color: var(--bms-muted);
}

.bms-cell-legend > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.bms-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
}

.bms-legend-dot.normal {
    background: #16A34A;
}

.bms-legend-dot.balancing {
    background: var(--bms-accent);
}

.bms-legend-dot.warning {
    background: #F59E0B;
}

.bms-legend-dot.critical {
    background: #DC2626;
}

.bms-legend-dot.invalid {
    background: #CBD5E1;
}

/* ----------------------------------------------------------------------------
   14. Charts
   -------------------------------------------------------------------------- */

.bms-curve-head {
    margin-bottom: 12px;
}

.bms-segment {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: #F1F5F9;
    border: 1px solid var(--bms-line-soft);
    border-radius: 10px;
}

.bms-page .bms-segment .bms-segment-btn.mud-button-root {
    min-width: 0;
    height: 30px;
    padding: 0 14px;
    border-radius: 7px;
    background: transparent;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    text-transform: none;
    white-space: nowrap;
    box-shadow: none;
}

.bms-page .bms-segment .bms-segment-btn .mud-button-label {
    font-size: 12px;
    font-weight: 600;
}

.bms-page .bms-segment .bms-segment-btn:hover {
    color: var(--bms-primary);
    background: transparent;
}

.bms-page .bms-segment .bms-segment-btn.active {
    background: #FFFFFF;
    color: var(--bms-primary);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.bms-inline-tools {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.bms-page .bms-inline-progress.mud-progress-linear {
    flex: 1 1 120px;
    max-width: 180px;
    height: 4px;
    border-radius: 999px;
}

.bms-chart-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    width: 100%;
    min-width: 0;
}

.bms-chart-panel {
    width: 100%;
    min-width: 0;
    padding: 14px;
    background: #FBFCFE;
    border: 1px solid var(--bms-line-soft);
    border-radius: 12px;
}

.bms-chart-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.bms-chart-panel-head > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bms-chart-title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--bms-heading);
}

.bms-chart-subtitle {
    display: block;
    font-size: 12px;
    line-height: 1.4;
    color: var(--bms-faint);
}

.bms-chart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    padding: 0 9px;
    flex: 0 0 auto;
    border: 1px solid var(--bms-border);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--bms-muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.bms-chart {
    position: relative;
    width: 100%;
    height: 280px;
    min-height: 260px;
}

.bms-chart .apexcharts-canvas {
    max-width: 100%;
    border-radius: 10px;
}

.bms-chart .apexcharts-legend {
    display: flex !important;
    flex-wrap: wrap;
    gap: 2px 8px;
    margin-top: 4px;
    padding: 0 !important;
}

.bms-chart .apexcharts-legend-text {
    padding-left: 14px !important;
    font-family: 'Inter', 'Roboto', sans-serif !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #475569 !important;
}

.bms-chart .apexcharts-toolbar {
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.bms-chart .apexcharts-xaxistooltip {
    display: none !important;
}

.bms-chart .apexcharts-tooltip {
    border: 1px solid var(--bms-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14) !important;
    font-family: 'Inter', 'Roboto', sans-serif !important;
}

.bms-chart .apexcharts-tooltip-title {
    border-bottom: 1px solid var(--bms-border) !important;
    background: #F4F7FB !important;
    font-size: 12px !important;
    font-weight: 600 !important;
}

.bms-chart-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: var(--bms-gap);
    align-items: start;
}

/* ----------------------------------------------------------------------------
   15. Faults & alarms
   -------------------------------------------------------------------------- */

.bms-page .bms-fault-card.mud-card {
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.bms-fault-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.bms-fault-stat {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    background: #F8FAFC;
    border: 1px solid var(--bms-line-soft);
    border-radius: var(--bms-radius-sm);
    min-width: 0;
}

.bms-fault-stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: #F1F5F9;
    color: #475569;
}

.bms-fault-stat-icon .mud-icon-root {
    font-size: 17px;
}

.bms-fault-stat-icon.tone-red {
    background: var(--bms-danger-bg);
    color: var(--bms-danger);
}

.bms-fault-stat-icon.tone-amber {
    background: var(--bms-warning-bg);
    color: var(--bms-warning);
}

.bms-fault-stat-icon.tone-slate {
    background: #F1F5F9;
    color: #475569;
}

.bms-fault-stat > div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bms-fault-stat strong {
    font-size: 19px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--bms-heading);
    font-variant-numeric: tabular-nums;
}

.bms-fault-stat span:last-child {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--bms-muted);
}

.bms-page .bms-fault-tabs-inner.mud-tabs {
    min-width: 0;
}

.bms-page .bms-fault-tabs-inner > .mud-tabs-tabbar {
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    padding: 3px;
    background: #F1F5F9;
    border: 1px solid var(--bms-line-soft);
    border-radius: 10px;
    box-shadow: none;
    overflow: hidden;
}

.bms-page .bms-fault-tabs-inner .mud-tab {
    min-height: 34px;
    padding: 0 13px;
    border-radius: 7px;
    color: #52627A;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 34px;
    text-transform: none;
}

.bms-page .bms-fault-tabs-inner .mud-tab:hover {
    color: var(--bms-primary);
    background: #E9F1FD;
}

.bms-page .bms-fault-tabs-inner .mud-tab.mud-tab-active {
    color: var(--bms-primary);
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.bms-page .bms-fault-tabs-inner .mud-tab-slider {
    display: none;
}

.bms-page .bms-fault-tabs-inner > .mud-tabs-panels {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
}

.bms-alarm-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bms-alarm-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #F8FAFC;
    border: 1px solid var(--bms-line-soft);
    border-radius: var(--bms-radius-sm);
    min-width: 0;
}

.bms-alarm-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: #94A3B8;
}

.bms-alarm-dot.success {
    background: #16A34A;
}

.bms-alarm-dot.warning {
    background: #F59E0B;
}

.bms-alarm-dot.danger {
    background: #DC2626;
}

.bms-alarm-dot.muted {
    background: #94A3B8;
}

.bms-alarm-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--bms-heading);
    overflow-wrap: anywhere;
}

.bms-fault-empty {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    border: 1px dashed var(--bms-success-border);
    border-radius: var(--bms-radius-sm);
    background: #F7FEF9;
    font-size: 12px;
    line-height: 1.45;
    color: var(--bms-success);
}

.bms-fault-empty .mud-icon-root {
    font-size: 18px;
    flex: 0 0 auto;
    color: #16A34A;
}

/* ----------------------------------------------------------------------------
   16. Device location / map (Components/BmsDashboard/MapCard)
   -------------------------------------------------------------------------- */

.bms-map-card {
    min-height: 0;
}

.bms-page .bms-map-card .bms-card-head {
    margin-bottom: 8px;
}

.bms-map-meta {
    margin-bottom: 10px;
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--bms-muted);
}

.bms-map-surface {
    margin-top: 4px;
    border-radius: 12px;
}

.bms-map-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.bms-page .bms-map-select.mud-input-control {
    width: 150px !important;
    margin: 0;
}

.bms-page .bms-map-select .mud-input.mud-input-outlined {
    height: 36px;
    background: #FFFFFF;
}

.bms-page .bms-map-select .mud-input-root {
    font-size: 12px;
}

.bms-map-zoombar {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: #FFFFFF;
    border: 1px solid var(--bms-border);
    border-radius: 9px;
}

.bms-page .bms-map-zoom.mud-icon-button {
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    border-radius: 7px;
    color: #475569;
}

.bms-page .bms-map-zoom.mud-icon-button:hover {
    background: #EFF6FF;
    color: var(--bms-primary);
}

.bms-map-frame {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--bms-border);
    border-radius: 12px;
    background: #F1F5FA;
}

.bms-map-container {
    position: relative;
    z-index: 0;
    width: 100%;
    height: 340px;
    min-height: 300px;
    overflow: hidden;
    border-radius: 12px;
    background: #F1F5FA;
}

.bms-map-container .leaflet-container {
    width: 100%;
    height: 100%;
    font-family: 'Inter', 'Roboto', sans-serif;
}

.bms-map-loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #F7F9FC;
    font-size: 12px;
    color: var(--bms-muted);
    pointer-events: none;
}

.bms-map-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 30px 16px;
    border: 1px dashed #CBD5E1;
    border-radius: var(--bms-radius-sm);
    background: #F8FAFC;
    text-align: center;
    color: var(--bms-muted);
}

.bms-map-empty p {
    margin: 0;
    max-width: 420px;
    font-size: 12px;
    line-height: 1.5;
}

.bms-map-error {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 9px 12px;
    border: 1px solid var(--bms-danger-border);
    border-radius: var(--bms-radius-sm);
    background: var(--bms-danger-bg);
    font-size: 12px;
    color: var(--bms-danger);
}

/* ----------------------------------------------------------------------------
   17. Tables / toolbars / pager
   -------------------------------------------------------------------------- */

.bms-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.bms-page .bms-field.mud-input-control {
    width: 170px !important;
    margin: 0;
}

.bms-page .bms-field .mud-input.mud-input-outlined {
    height: 36px;
    background: #FFFFFF;
}

.bms-page .bms-field .mud-input-root {
    font-size: 12.5px;
}

.bms-page .bms-filter-field.mud-input-control {
    width: 320px !important;
    max-width: 100%;
}

.bms-table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid var(--bms-border);
    border-radius: var(--bms-radius-sm);
    background: #FFFFFF;
}

.bms-page .bms-table.mud-simple-table {
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.bms-page .bms-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    white-space: nowrap;
}

.bms-page .bms-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 11px 14px;
    background: #F6F9FC;
    border-bottom: 1px solid var(--bms-border);
    color: #64748B;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
}

.bms-page .bms-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #EDF2F8;
    color: var(--bms-text);
    vertical-align: middle;
}

.bms-page .bms-table tbody tr:last-child td {
    border-bottom: none;
}

.bms-page .bms-table tbody tr:nth-child(even) {
    background: #FAFCFE;
}

.bms-page .bms-table tbody tr:hover {
    background: #F0F6FF;
}

.bms-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--bms-muted);
}

.bms-pager-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ----------------------------------------------------------------------------
   18. Key/value lists + control grid
   -------------------------------------------------------------------------- */

.bms-kv {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px dashed var(--bms-border);
    font-size: 12.5px;
    color: var(--bms-muted);
}

.bms-kv:last-child {
    border-bottom: none;
}

.bms-kv strong {
    font-size: 12.5px;
    font-weight: 600;
    text-align: right;
    color: var(--bms-heading);
    overflow-wrap: anywhere;
}

.bms-kv strong.bms-tone-ok {
    color: var(--bms-success) !important;
}

.bms-kv strong.bms-tone-bad {
    color: var(--bms-danger) !important;
}

.bms-kv strong.bms-tone-muted {
    color: var(--bms-muted) !important;
}

.bms-control-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--bms-gap);
}

/* ----------------------------------------------------------------------------
   19. Empty states + notices
   -------------------------------------------------------------------------- */

.bms-page .bms-empty.mud-paper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 280px;
    padding: 44px 24px;
    text-align: center;
}

.bms-empty h2 {
    margin: 4px 0 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--bms-heading);
}

.bms-empty p {
    margin: 0;
    max-width: 460px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--bms-muted);
}

.bms-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 66px;
    height: 66px;
    margin-bottom: 4px;
    border-radius: 19px;
    background: linear-gradient(135deg, #E8F1FF 0%, #DCEAFE 100%);
    color: var(--bms-primary);
}

.bms-empty-icon .mud-icon-root {
    font-size: 32px;
}

.bms-empty-icon-sm {
    width: 48px;
    height: 48px;
    border-radius: 14px;
}

.bms-empty-icon-sm .mud-icon-root {
    font-size: 24px;
}

.bms-inline-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 0 0;
    padding: 24px 12px;
    border: 1px dashed var(--bms-border);
    border-radius: var(--bms-radius-sm);
    background: #F8FAFD;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--bms-muted);
}

.bms-inline-empty .mud-icon-root {
    font-size: 18px;
    flex: 0 0 auto;
    color: #9AA9BD;
}

/* MudAlert used as a notice — kept light instead of the heavy filled default. */
.bms-page .bms-note.mud-alert {
    margin: 0 0 12px;
    padding: 10px 14px;
    border: 1px solid var(--bms-warning-border);
    border-radius: var(--bms-radius-sm);
    background: var(--bms-warning-bg);
    color: #92400E;
    font-size: 12.5px;
    line-height: 1.5;
}

.bms-page .bms-note.mud-alert .mud-alert-message {
    padding: 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: inherit;
}

.bms-page .bms-note.mud-alert .mud-alert-icon {
    color: #B9800F;
}

.bms-page .bms-note.mud-alert .mud-icon-root {
    font-size: 18px;
}

/* ----------------------------------------------------------------------------
   20. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1440px) {
    /* Keep the title and toolbar on one line on laptop-width screens by
       dropping the button icons and tightening the search field. */
    .bms-page .bms-page-actions .bms-btn .mud-button-icon-start {
        display: none;
    }

    .bms-page .bms-page-actions .bms-btn.mud-button-root {
        padding: 0 12px;
    }

    .bms-page .bms-page-actions .bms-search-wrap {
        flex-basis: 260px;
        max-width: 280px;
    }
}

@media (max-width: 1280px) {
    .bms-page {
        padding: 18px 20px 34px;
    }

    .bms-chart-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .bms-page .bms-page-actions .bms-search-wrap {
        flex-basis: 230px;
        max-width: 250px;
    }
}

@media (max-width: 1100px) {
    .bms-page-actions {
        flex: 1 1 100%;
        width: 100%;
        max-width: none;
        margin-left: 0;
    }

    .bms-page .bms-page-actions .bms-command-bar {
        width: 100%;
    }

    .bms-page-actions .bms-header-actions {
        width: auto;
        flex: 0 0 auto;
        justify-content: flex-end;
        margin-left: auto;
    }

    .bms-command-bar {
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .bms-page {
        padding: 16px 16px 30px;
        gap: 14px;
    }

    .bms-page-head {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .bms-page .bms-page-actions .bms-search-cluster,
    .bms-page .bms-page-actions .bms-search-wrap {
        flex: 1 1 100%;
        max-width: none;
    }

    .bms-page-actions .bms-header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-left: 0;
    }

    .bms-page .bms-title {
        font-size: 23px;
    }

    .bms-asset-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .bms-asset-side {
        justify-content: space-between;
        width: 100%;
        padding-top: 12px;
        border-top: 1px solid var(--bms-line-soft);
    }

    .bms-asset-sync {
        align-items: flex-start;
        text-align: left;
    }

    .bms-soc-layout {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .bms-soc-gauge-wrap,
    .bms-page .bms-soc-ring.mud-progress-circular {
        width: 128px !important;
        height: 128px !important;
    }

    .bms-soc-value {
        font-size: 34px;
    }

    .bms-status-grid .bms-status-item {
        min-height: 0;
    }

    .bms-cell-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bms-map-container {
        height: 280px;
        min-height: 240px;
    }

    .bms-control-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .bms-fault-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .bms-page .bms-field.mud-input-control,
    .bms-page .bms-map-select.mud-input-control,
    .bms-page .bms-filter-field.mud-input-control {
        width: 100% !important;
    }
}

@media (max-width: 640px) {
    .bms-page {
        padding: 14px 12px 26px;
    }

    .bms-title-icon {
        width: 44px;
        height: 44px;
        border-radius: 13px;
    }

    .bms-title-icon .mud-icon-root {
        font-size: 23px;
    }

    .bms-page .bms-title {
        font-size: 21px;
    }

    .bms-command-bar {
        padding: 8px;
    }

    .bms-page .bms-card.mud-paper {
        padding: 14px;
    }

    .bms-stat-card {
        min-height: 108px;
    }

    .bms-stat-value {
        font-size: 26px;
    }

    .bms-cell-summary,
    .bms-fault-summary {
        grid-template-columns: minmax(0, 1fr);
    }

    .bms-page .bms-cell-grid.mud-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }

    .bms-chart {
        height: 230px;
        min-height: 230px;
    }

    .bms-chart-panel {
        padding: 10px;
    }

    .bms-map-container {
        height: 240px;
    }

    .bms-page .bms-tabs .mud-tab {
        padding: 0 12px;
        font-size: 12.5px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bms-page .bms-tabs .mud-tab,
    .bms-page .bms-stat-card.mud-card,
    .bms-page .bms-cell-tile.mud-paper,
    .bms-page .bms-cell.mud-paper,
    .bms-page .bms-segment .bms-segment-btn.mud-button-root {
        transition: none;
    }

    .bms-page .bms-stat-card.mud-card:hover,
    .bms-page .bms-cell-tile.mud-paper:hover,
    .bms-page .bms-cell.mud-paper:hover {
        transform: none;
    }
}
