/* Dashboard metric cards */
.metric-cards {
    margin-left: -10px;
    margin-right: -10px;
}

.metric-cards > [class*="col-"] {
    padding-left: 10px;
    padding-right: 10px;
}

.metric-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 112px;
    margin-bottom: 24px;
    padding: 20px 22px;
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, transparent 48%),
        #2a3038;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.metric-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--metric-accent, #5867dd);
    border-radius: 14px 0 0 14px;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
    border-color: rgba(255, 255, 255, 0.12);
}

.metric-card__icon {
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 24px;
    color: var(--metric-accent, #5867dd);
    background: color-mix(in srgb, var(--metric-accent, #5867dd) 16%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--metric-accent, #5867dd) 28%, transparent);
}

.metric-card__body {
    min-width: 0;
    flex: 1;
}

.metric-card__label {
    margin: 0 0 6px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-card__value {
    margin: 0;
    font-size: 1.65rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.metric-card--demand { --metric-accent: #6b7cff; }
.metric-card--generation { --metric-accent: #22c55e; }
.metric-card--consumption { --metric-accent: #22d3ee; }
.metric-card--water { --metric-accent: #fb923c; }

/* Data panels (utility + circuit tables) */
.data-panel {
    padding: 0 !important;
    overflow: hidden;
    border-radius: 14px !important;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 120px),
        #2a3038 !important;
}

.data-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.data-panel__header h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
}

.data-panel__header span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.45);
}

.data-table-wrap {
    padding: 0 8px 8px;
}

.data-table {
    margin: 0;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
}

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 14px 12px;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    background: transparent;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.48);
    vertical-align: bottom;
    line-height: 1.35;
}

.data-table tbody td {
    padding: 14px 12px;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: rgba(255, 255, 255, 0.88);
    background: transparent;
    transition: background 0.15s ease;
}

.data-table tbody tr:last-child td {
    border-bottom: none !important;
}

.data-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.035);
}

.data-table .data-table__label {
    text-align: left !important;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.data-table thead th:first-child {
    text-align: left;
}

/* DataTables sorting headers in modern table */
.data-table.dataTable thead th {
    background: transparent !important;
    cursor: pointer;
}

.data-table.dataTable thead .sorting:after,
.data-table.dataTable thead .sorting_asc:after,
.data-table.dataTable thead .sorting_desc:after {
    opacity: 0.45;
}

table.dataTable.no-footer.data-table {
    border-bottom: none !important;
}

/* Header removed — pull sidebar flush to top */
.main-sidebar {
    padding-top: 0 !important;
    top: 0;
    bottom: 0;
    min-height: 100%;
}

/* Full-window dark fill + sticky footer (no white gaps) */
html {
    height: 100%;
    background-color: #383f48;
}

html,
body.skin-blue {
    min-height: 100%;
    min-height: 100vh;
    margin: 0;
    background-color: #383f48;
}

.wrapper.boxed-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #383f48;
}

.wrapper.boxed-wrapper > .content-wrapper {
    flex: 1 0 auto;
    min-height: 0 !important;
    background-color: #383f48;
}

.wrapper.boxed-wrapper > .main-footer {
    flex-shrink: 0;
    margin-top: auto;
}

@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .metric-card__icon {
        background: rgba(88, 103, 221, 0.16);
        box-shadow: inset 0 0 0 1px rgba(88, 103, 221, 0.28);
    }

    .metric-card--generation .metric-card__icon {
        background: rgba(34, 197, 94, 0.16);
        box-shadow: inset 0 0 0 1px rgba(34, 197, 94, 0.28);
    }

    .metric-card--consumption .metric-card__icon {
        background: rgba(34, 211, 238, 0.16);
        box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.28);
    }

    .metric-card--water .metric-card__icon {
        background: rgba(251, 146, 60, 0.16);
        box-shadow: inset 0 0 0 1px rgba(251, 146, 60, 0.28);
    }
}

@media (max-width: 767px) {
    .metric-card {
        min-height: 96px;
        padding: 16px 18px;
    }

    .metric-card__value {
        font-size: 1.4rem;
    }

    .data-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 4px 8px;
    }

    .utility-comparison-table {
        min-width: 760px;
    }

    .circuit-consumption-table {
        min-width: 680px;
    }

    .data-table td {
        white-space: nowrap;
    }
}
