/* ==========================================================================
   Responsive Layout System - Desktop/Mobile Separation
   Breakpoints: 768px (md) | 1024px (lg) | 1280px (xl) | 1536px (2xl)
   ========================================================================== */

/* ---- Global resets & max-width containment ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Prevent content from stretching on ultra-wide monitors */
.dashboard-main,
.energy-main-wrapper {
    max-width: 1800px;
    margin-left: auto;
    margin-right: auto;
}

/* ---- Mobile-first base (< 768px) ---- */

.desktop-only { display: none !important; }
.mobile-only { display: block !important; }
.mobile-card { display: block !important; }

/* ---- Desktop overrides (>= 768px) ---- */
@media (min-width: 768px) {
    .desktop-only { display: block !important; }
    .desktop-only-flex { display: flex !important; }
    .desktop-only-grid { display: grid !important; }
    .desktop-only-table { display: table !important; }
    .desktop-only-inline { display: inline-block !important; }
    .mobile-only { display: none !important; }
    .mobile-card { display: none !important; }
}

/* ==========================================================================
   Dashboard Page - Responsive Overrides
   ========================================================================== */

/* --- Page padding --- */
.dashboard-main {
    padding: 1rem;
}
@media (min-width: 768px)  { .dashboard-main { padding: 1.5rem; } }
@media (min-width: 1024px) { .dashboard-main { padding: 1.75rem 2rem; } }
@media (min-width: 1280px) { .dashboard-main { padding: 2rem 2.5rem; } }
@media (min-width: 1536px) { .dashboard-main { padding: 2.5rem 3.5rem; } }

/* --- Energy Section Header --- */
.dashboard-energy-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}
@media (min-width: 768px) {
    .dashboard-energy-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

/* Energy title */
.dashboard-energy-title {
    font-size: 1.125rem;
    line-height: 1.4;
}
@media (min-width: 768px)  { .dashboard-energy-title { font-size: 1.375rem; } }
@media (min-width: 1280px) { .dashboard-energy-title { font-size: 1.5rem; } }
@media (min-width: 1536px) { .dashboard-energy-title { font-size: 1.625rem; } }

/* --- Pie chart grid --- */
.energy-pie-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px) {
    .energy-pie-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}
@media (min-width: 1280px) { .energy-pie-grid { gap: 1.75rem; } }
@media (min-width: 1536px) { .energy-pie-grid { gap: 2rem; } }

/* Pie chart height on dashboard */
.dashboard-pie-container {
    height: 180px;
}
@media (min-width: 1024px) { .dashboard-pie-container { height: 220px; } }
@media (min-width: 1280px) { .dashboard-pie-container { height: 260px; } }
@media (min-width: 1536px) { .dashboard-pie-container { height: 300px; } }

/* --- Main meter section --- */
.main-meter-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}
@media (min-width: 768px) {
    .main-meter-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.main-meter-badge {
    font-size: 8px;
    align-self: flex-start;
}
@media (min-width: 768px)  { .main-meter-badge { font-size: 10px; align-self: auto; } }
@media (min-width: 1280px) { .main-meter-badge { font-size: 11px; padding: 0.375rem 0.75rem; } }

/* Meter cards */
.meter-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px)  { .meter-cards-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }
@media (min-width: 1280px) { .meter-cards-grid { gap: 1.75rem; } }
@media (min-width: 1536px) { .meter-cards-grid { gap: 2rem; } }

/* --- Stats cards --- */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (min-width: 640px)  { .stats-cards-grid { gap: 1rem; } }
@media (min-width: 1024px) { .stats-cards-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; } }
@media (min-width: 1280px) { .stats-cards-grid { gap: 1.75rem; } }
@media (min-width: 1536px) { .stats-cards-grid { gap: 2rem; } }

/* Stats card value */
.stats-card-value {
    font-size: 1.5rem;
    line-height: 1.2;
}
@media (min-width: 768px)  { .stats-card-value { font-size: 1.75rem; } }
@media (min-width: 1280px) { .stats-card-value { font-size: 2.25rem; } }
@media (min-width: 1536px) { .stats-card-value { font-size: 2.5rem; } }

/* Stats card label */
.stats-card-label {
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
}
@media (min-width: 1280px) { .stats-card-label { font-size: 11px; letter-spacing: 0.1em; } }
@media (min-width: 1536px) { .stats-card-label { font-size: 12px; } }

/* Stats card sub-text */
.stats-card-sub {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
}
@media (min-width: 1280px) { .stats-card-sub { font-size: 10px; } }
@media (min-width: 1536px) { .stats-card-sub { font-size: 11px; } }

/* --- Material consumption section --- */
.consumption-section-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
@media (min-width: 768px)  { .consumption-section-card { border-radius: 1.25rem; } }
@media (min-width: 1536px) { .consumption-section-card { border-radius: 1.5rem; } }
.consumption-section-card:hover {
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.06);
}

.consumption-section-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}
@media (min-width: 640px) {
    .consumption-section-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1rem 1.5rem;
    }
}
@media (min-width: 1280px) { .consumption-section-header { padding: 1.25rem 2rem; } }
@media (min-width: 1536px) { .consumption-section-header { padding: 1.5rem 2.5rem; } }

.consumption-section-body {
    padding: 1rem;
}
@media (min-width: 768px)  { .consumption-section-body { padding: 1.5rem; } }
@media (min-width: 1280px) { .consumption-section-body { padding: 2rem; } }
@media (min-width: 1536px) { .consumption-section-body { padding: 2.5rem; } }

.consumption-chart-wrapper {
    height: 280px;
}
@media (min-width: 768px)  { .consumption-chart-wrapper { height: 400px; } }
@media (min-width: 1280px) { .consumption-chart-wrapper { height: 500px; } }
@media (min-width: 1536px) { .consumption-chart-wrapper { height: 580px; } }

/* Legend */
.consumption-legend {
    max-height: 120px;
    overflow-y: auto;
}
@media (min-width: 768px) {
    .consumption-legend { max-height: none; overflow-y: visible; }
}

/* --- Plants status grid --- */
.plants-status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 1024px) { .plants-status-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1280px) { .plants-status-grid { gap: 2rem; } }
@media (min-width: 1536px) { .plants-status-grid { gap: 2.25rem; } }

/* Plant status card refinement */
.plant-status-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.plant-status-card:hover {
    box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.07);
    border-color: #cbd5e1;
}
@media (min-width: 1536px) {
    .plant-status-card { border-radius: 1.25rem; }
}

/* --- Energy table --- */
.energy-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.energy-table-container table { min-width: 600px; }
@media (min-width: 768px) { .energy-table-container table { min-width: 100%; } }

/* Desktop table hover effect */
.desktop-table-row {
    transition: background-color 0.15s ease;
}
.desktop-table-row:hover {
    background-color: #f8fafc;
}

/* Alternating row stripes on desktop */
@media (min-width: 768px) {
    .desktop-table tbody .desktop-table-row:nth-child(even) {
        background-color: #fafbfc;
    }
    .desktop-table tbody .desktop-table-row:nth-child(even):hover {
        background-color: #f1f5f9;
    }
    .desktop-table tbody .desktop-table-row:hover {
        background-color: #f1f5f9;
    }
}

/* --- Modal --- */
.dashboard-modal-card {
    width: 95vw;
    max-width: 95vw;
    margin: 0.5rem;
}
@media (min-width: 768px) { .dashboard-modal-card { width: auto; max-width: 32rem; margin: 2rem auto; } }

/* ==========================================================================
   Energy Dashboard Page - Responsive Overrides
   ========================================================================== */

/* Energy page wrapper */
.energy-main-wrapper {
    padding: 0.75rem;
    background-color: #f8fafc;
}
@media (min-width: 640px)  { .energy-main-wrapper { padding: 1.25rem; } }
@media (min-width: 1024px) { .energy-main-wrapper { padding: 1.75rem 2rem; } }
@media (min-width: 1280px) { .energy-main-wrapper { padding: 2rem 2.5rem; } }
@media (min-width: 1536px) { .energy-main-wrapper { padding: 2.5rem 3.5rem; } }

/* Page header */
.energy-page-header {
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}
@media (min-width: 768px) {
    .energy-page-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.energy-page-title {
    font-size: 1.125rem;
}
@media (min-width: 768px)  { .energy-page-title { font-size: 1.375rem; } }
@media (min-width: 1280px) { .energy-page-title { font-size: 1.625rem; } }
@media (min-width: 1536px) { .energy-page-title { font-size: 1.75rem; } }

/* --- Summary dashboard grid --- */
.energy-summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 1024px) { .energy-summary-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; } }
@media (min-width: 1280px) { .energy-summary-grid { gap: 2rem; } }
@media (min-width: 1536px) { .energy-summary-grid { gap: 2.5rem; } }

/* --- Manual units grid --- */
.manual-units-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 1024px) { .manual-units-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; } }
@media (min-width: 1280px) { .manual-units-grid { gap: 2rem; } }
@media (min-width: 1536px) { .manual-units-grid { gap: 2.5rem; } }

/* --- Key metrics grid --- */
.energy-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    text-align: center;
}
@media (min-width: 768px)  { .energy-metrics-grid { gap: 1rem; text-align: left; } }
@media (min-width: 1024px) { .energy-metrics-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; } }
@media (min-width: 1280px) { .energy-metrics-grid { gap: 1.75rem; } }
@media (min-width: 1536px) { .energy-metrics-grid { gap: 2rem; } }

/* Metric value text */
.metric-value-text {
    font-size: 1rem;
    line-height: 1.3;
}
@media (min-width: 768px)  { .metric-value-text { font-size: 1.125rem; } }
@media (min-width: 1024px) { .metric-value-text { font-size: 1.25rem; } }
@media (min-width: 1280px) { .metric-value-text { font-size: 1.5rem; } }
@media (min-width: 1536px) { .metric-value-text { font-size: 1.75rem; } }

/* Metric label */
.metric-label-text {
    font-size: 8px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
@media (min-width: 768px)  { .metric-label-text { font-size: 10px; } }
@media (min-width: 1280px) { .metric-label-text { font-size: 11px; letter-spacing: 0.06em; } }
@media (min-width: 1536px) { .metric-label-text { font-size: 12px; } }

/* --- Technical details grid --- */
.tech-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
@media (min-width: 768px)  { .tech-details-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; } }
@media (min-width: 1024px) { .tech-details-grid { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; } }
@media (min-width: 1280px) { .tech-details-grid { gap: 1.5rem; } }

/* --- Charts row --- */
.energy-charts-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 2rem;
}
@media (min-width: 1024px) {
    .energy-charts-row {
        grid-template-columns: 5fr 3fr;
        gap: 2rem;
        margin-top: 2.5rem;
    }
}
@media (min-width: 1280px) {
    .energy-charts-row { gap: 2.5rem; margin-top: 3rem; }
}
@media (min-width: 1536px) {
    .energy-charts-row { gap: 3rem; }
}

/* --- Chart box --- */
.energy-chart-box {
    position: relative;
    height: 260px;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 0.75rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.energy-chart-box:hover {
    box-shadow: 0 6px 20px 0 rgba(0, 0, 0, 0.06);
    border-color: #cbd5e1;
}
@media (min-width: 768px) {
    .energy-chart-box {
        height: 340px;
        border-radius: 1rem;
        padding: 1rem;
    }
}
@media (min-width: 1024px) {
    .energy-chart-box { height: 380px; padding: 1.25rem; }
}
@media (min-width: 1280px) {
    .energy-chart-box { height: 420px; padding: 1.5rem; }
}
@media (min-width: 1536px) {
    .energy-chart-box { height: 460px; border-radius: 1.25rem; }
}

.energy-chart-box canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}

/* --- Chart tabs --- */
.chart-tab-group {
    display: flex;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: 0.5rem;
    box-shadow: inset 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.chart-tab-btn {
    padding: 0.375rem 0.75rem;
    font-size: 9px;
    font-weight: 900;
    border-radius: 0.375rem;
    transition: all 0.2s;
    white-space: nowrap;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
@media (min-width: 768px)  { .chart-tab-btn { padding: 0.5rem 1rem; font-size: 10px; } }
@media (min-width: 1280px) { .chart-tab-btn { padding: 0.5rem 1.25rem; font-size: 11px; } }
@media (min-width: 1536px) { .chart-tab-btn { padding: 0.625rem 1.5rem; font-size: 12px; border-radius: 0.5rem; } }

/* Chart section header */
.chart-section-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    min-height: auto;
}
@media (min-width: 768px) {
    .chart-section-header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        margin-bottom: 1.25rem;
        min-height: 48px;
    }
}
@media (min-width: 1280px) {
    .chart-section-header { margin-bottom: 1.5rem; }
}

/* --- Meter entry cards --- */
.meter-entry-header {
    padding: 0.75rem 1rem;
}
@media (min-width: 768px)  { .meter-entry-header { padding: 1.25rem 1.75rem; } }
@media (min-width: 1280px) { .meter-entry-header { padding: 1.5rem 2.5rem; } }
@media (min-width: 1536px) { .meter-entry-header { padding: 1.75rem 3rem; } }

.meter-entry-body {
    padding: 1rem;
}
@media (min-width: 768px)  { .meter-entry-body { padding: 1.75rem; } }
@media (min-width: 1280px) { .meter-entry-body { padding: 2rem 2.5rem; } }
@media (min-width: 1536px) { .meter-entry-body { padding: 2.5rem 3rem; } }

/* --- History modal --- */
.history-modal-card {
    width: 95vw;
    max-width: 95vw;
    max-height: 90vh;
}
@media (min-width: 768px)  { .history-modal-card { width: auto; max-width: 48rem; max-height: 80vh; } }
@media (min-width: 1280px) { .history-modal-card { max-width: 56rem; } }
@media (min-width: 1536px) { .history-modal-card { max-width: 64rem; } }

/* --- Consumption summary --- */
.consumption-summary-value {
    font-size: 1.875rem;
    line-height: 1.1;
}
@media (min-width: 640px)  { .consumption-summary-value { font-size: 2.25rem; } }
@media (min-width: 1280px) { .consumption-summary-value { font-size: 2.75rem; } }
@media (min-width: 1536px) { .consumption-summary-value { font-size: 3rem; } }

/* Pie chart in summary */
.energy-pie-container {
    height: 160px;
}
@media (min-width: 768px)  { .energy-pie-container { height: 200px; } }
@media (min-width: 1280px) { .energy-pie-container { height: 260px; } }
@media (min-width: 1536px) { .energy-pie-container { height: 300px; } }

/* Scroll hint (mobile only) */
.scroll-hint {
    display: block;
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0;
}
@media (min-width: 768px) { .scroll-hint { display: none; } }

/* --- Spacing utilities --- */
.section-spacing {
    margin-bottom: 1.25rem;
}
@media (min-width: 768px)  { .section-spacing { margin-bottom: 1.75rem; } }
@media (min-width: 1280px) { .section-spacing { margin-bottom: 2.25rem; } }
@media (min-width: 1536px) { .section-spacing { margin-bottom: 2.75rem; } }

/* Card padding */
.card-padding {
    padding: 1rem;
}
@media (min-width: 768px)  { .card-padding { padding: 1.5rem; } }
@media (min-width: 1280px) { .card-padding { padding: 2rem; } }
@media (min-width: 1536px) { .card-padding { padding: 2.5rem; } }

/* ==========================================================================
   Desktop Polish - Shared Refinements (>= 768px)
   ========================================================================== */

/* Subtle card transitions */
@media (min-width: 768px) {
    .stats-card-hover {
        transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
        cursor: default;
    }
    .stats-card-hover:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 30px -6px rgba(0, 0, 0, 0.1);
        border-color: #c7d2fe;
    }
}

/* Better table styling on desktop */
@media (min-width: 768px) {
    .desktop-table th {
        font-size: 10px;
        letter-spacing: 0.08em;
        padding: 0.875rem 1.25rem;
        background-color: #f8fafc;
        border-bottom: 2px solid #e2e8f0;
    }
    .desktop-table td {
        padding: 0.75rem 1.25rem;
        font-size: 0.8125rem;
    }
}
@media (min-width: 1280px) {
    .desktop-table th {
        padding: 1rem 1.5rem;
        font-size: 10.5px;
    }
    .desktop-table td {
        padding: 0.875rem 1.5rem;
        font-size: 0.875rem;
    }
}
@media (min-width: 1536px) {
    .desktop-table th {
        padding: 1.125rem 1.75rem;
        font-size: 11px;
    }
    .desktop-table td {
        padding: 1rem 1.75rem;
    }
}

/* Energy section card (dashboard) */
.energy-section-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    padding: 1rem;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.2s ease;
}
.energy-section-card:hover {
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.06);
}
@media (min-width: 768px) {
    .energy-section-card {
        border-radius: 1.25rem;
        padding: 1.75rem;
        margin-bottom: 2rem;
    }
}
@media (min-width: 1280px) {
    .energy-section-card {
        padding: 2rem 2.5rem;
        margin-bottom: 2.25rem;
    }
}
@media (min-width: 1536px) {
    .energy-section-card {
        padding: 2.5rem 3rem;
        margin-bottom: 2.5rem;
        border-radius: 1.5rem;
    }
}

/* Meter card on dashboard */
.meter-summary-card {
    background: white;
    border-radius: 0.875rem;
    border: 1px solid #e2e8f0;
    padding: 1.25rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.meter-summary-card:hover {
    border-color: #c7d2fe;
    box-shadow: 0 6px 20px -4px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}
@media (min-width: 1280px) {
    .meter-summary-card {
        padding: 1.5rem;
        border-radius: 1rem;
    }
}
@media (min-width: 1536px) {
    .meter-summary-card { padding: 1.75rem; }
}

/* Main meter wrapper */
.main-meter-wrapper {
    border: 2px solid #e0e7ff;
    border-radius: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #eef2ff 0%, #ffffff 50%, #f8fafc 100%);
    margin-bottom: 1.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.main-meter-wrapper:hover {
    border-color: #c7d2fe;
    box-shadow: 0 4px 16px -4px rgba(79, 70, 229, 0.08);
}
@media (min-width: 768px) {
    .main-meter-wrapper {
        border-radius: 1.25rem;
        padding: 1.75rem;
        margin-bottom: 2rem;
    }
}
@media (min-width: 1280px) {
    .main-meter-wrapper {
        padding: 2rem 2.5rem;
        margin-bottom: 2.25rem;
    }
}
@media (min-width: 1536px) {
    .main-meter-wrapper {
        padding: 2.5rem 3rem;
        margin-bottom: 2.5rem;
        border-radius: 1.5rem;
    }
}

/* Consistent section titles */
.section-title {
    font-size: 0.8125rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #334155;
}
@media (min-width: 1280px) { .section-title { font-size: 0.9375rem; letter-spacing: 0.06em; } }
@media (min-width: 1536px) { .section-title { font-size: 1rem; } }

/* ==========================================================================
   Plant Detail Page — Component System  (v4.0)
   ========================================================================== */

/* ── Hero Header ─────────────────────────────────────────────────────────── */
.plant-hero-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 60%, #ffffff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 1.25rem;
    box-shadow: 0 1px 4px rgba(79,70,229,0.06);
}
@media (min-width: 768px) {
    .plant-hero-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 1.5rem 2rem;
        border-radius: 1.5rem;
        gap: 1.5rem;
    }
}
@media (min-width: 1280px) {
    .plant-hero-header { padding: 1.75rem 2.5rem; }
}
@media (min-width: 1536px) {
    .plant-hero-header { padding: 2rem 3rem; border-radius: 1.75rem; }
}

.plant-hero-icon {
    width: 2.75rem; height: 2.75rem;
    display: flex; align-items: center; justify-content: center;
    background: #4f46e5;
    color: white;
    border-radius: 0.875rem;
    box-shadow: 0 4px 12px rgba(79,70,229,0.3);
    flex-shrink: 0;
}
@media (min-width: 768px)  { .plant-hero-icon { width: 3rem; height: 3rem; border-radius: 1rem; } }
@media (min-width: 1280px) { .plant-hero-icon { width: 3.5rem; height: 3.5rem; } }

.plant-hero-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
@media (min-width: 768px)  { .plant-hero-title { font-size: 1.5rem; } }
@media (min-width: 1280px) { .plant-hero-title { font-size: 1.875rem; } }
@media (min-width: 1536px) { .plant-hero-title { font-size: 2rem; } }

.plant-type-badge {
    display: inline-flex; align-items: center;
    font-size: 9px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.1em;
    background: #e0e7ff; color: #4338ca;
    padding: 0.2rem 0.625rem;
    border-radius: 100px;
    border: 1px solid #c7d2fe;
    white-space: nowrap;
}
@media (min-width: 1280px) { .plant-type-badge { font-size: 10px; padding: 0.25rem 0.75rem; } }

.plant-status-online,
.plant-status-offline {
    display: inline-flex; align-items: center; gap: 0.375rem;
    font-size: 9px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em;
    padding: 0.2rem 0.625rem;
    border-radius: 100px;
}
.plant-status-online  { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.plant-status-offline { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

.status-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.status-dot.online  { background: #22c55e; animation: pulse 2s infinite; }
.status-dot.offline { background: #ef4444; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.plant-hero-actions {
    display: flex; gap: 0.625rem;
    width: 100%;
}
@media (min-width: 768px) { .plant-hero-actions { width: auto; flex-shrink: 0; } }

/* ── Button system ───────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.375rem; flex: 1;
    background: #4f46e5; color: white;
    padding: 0.625rem 1.125rem;
    border-radius: 0.75rem;
    font-size: 11px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.07em;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(79,70,229,0.25);
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    cursor: pointer; text-decoration: none;
}
.btn-primary:hover  { background: #4338ca; box-shadow: 0 4px 16px rgba(79,70,229,0.35); }
.btn-primary:active { transform: scale(0.97); }
@media (min-width: 768px) {
    .btn-primary { flex: none; padding: 0.625rem 1.375rem; font-size: 11px; }
}
@media (min-width: 1280px) {
    .btn-primary { padding: 0.75rem 1.75rem; font-size: 12px; }
}

.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.375rem; flex: 1;
    background: white; color: #4f46e5;
    padding: 0.625rem 1.125rem;
    border-radius: 0.75rem;
    font-size: 11px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.07em;
    white-space: nowrap;
    border: 1.5px solid #c7d2fe;
    box-shadow: 0 1px 3px rgba(79,70,229,0.08);
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    cursor: pointer; text-decoration: none;
}
.btn-secondary:hover  { background: #eef2ff; border-color: #a5b4fc; box-shadow: 0 4px 12px rgba(79,70,229,0.12); }
.btn-secondary:active { transform: scale(0.97); }
@media (min-width: 768px) {
    .btn-secondary { flex: none; padding: 0.625rem 1.375rem; }
}
@media (min-width: 1280px) {
    .btn-secondary { padding: 0.75rem 1.75rem; font-size: 12px; }
}

.btn-ghost-sm {
    display: inline-flex; align-items: center;
    color: #6366f1;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 10px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.06em;
    white-space: nowrap;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    transition: background 0.15s, color 0.15s;
    cursor: pointer; text-decoration: none;
}
.btn-ghost-sm:hover { background: #e0e7ff; color: #4338ca; }
@media (min-width: 1280px) { .btn-ghost-sm { font-size: 10.5px; padding: 0.4rem 0.875rem; } }

.btn-ghost-active {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

/* ── KPI cards ───────────────────────────────────────────────────────────── */
.kpi-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    border-left-width: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.1);
}
@media (min-width: 768px)  { .kpi-card { border-radius: 1.125rem; } }
@media (min-width: 1536px) { .kpi-card { border-radius: 1.25rem; } }

.kpi-card.accent-indigo { border-left-color: #6366f1; }
.kpi-card.accent-emerald{ border-left-color: #10b981; }
.kpi-card.accent-amber  { border-left-color: #f59e0b; }
.kpi-card.accent-violet { border-left-color: #8b5cf6; }

.kpi-card-inner {
    display: flex; align-items: flex-start;
    gap: 1rem;
    padding: 1.125rem;
}
@media (min-width: 768px)  { .kpi-card-inner { padding: 1.375rem; gap: 1rem; } }
@media (min-width: 1280px) { .kpi-card-inner { padding: 1.75rem; gap: 1.25rem; } }
@media (min-width: 1536px) { .kpi-card-inner { padding: 2rem 2.25rem; } }

.kpi-icon-ring {
    width: 2.5rem; height: 2.5rem;
    border-radius: 0.75rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-icon-ring.indigo { background: #eef2ff; color: #6366f1; }
.kpi-icon-ring.emerald{ background: #ecfdf5; color: #10b981; }
.kpi-icon-ring.amber  { background: #fffbeb; color: #f59e0b; }
.kpi-icon-ring.violet { background: #f5f3ff; color: #8b5cf6; }
@media (min-width: 1280px) { .kpi-icon-ring { width: 3rem; height: 3rem; border-radius: 1rem; } }

.kpi-content { min-width: 0; flex: 1; }

.kpi-label {
    font-size: 9px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: #94a3b8;
    margin-bottom: 0.375rem;
}
@media (min-width: 768px)  { .kpi-label { font-size: 10px; margin-bottom: 0.5rem; } }
@media (min-width: 1280px) { .kpi-label { font-size: 10.5px; } }

.kpi-value {
    font-size: 1.625rem; font-weight: 900;
    color: #1e293b;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
@media (min-width: 768px)  { .kpi-value { font-size: 2rem; } }
@media (min-width: 1280px) { .kpi-value { font-size: 2.5rem; } }
@media (min-width: 1536px) { .kpi-value { font-size: 2.75rem; } }

.kpi-value--sm {
    font-size: 1.125rem !important;
}
@media (min-width: 768px)  { .kpi-value--sm { font-size: 1.375rem !important; } }
@media (min-width: 1280px) { .kpi-value--sm { font-size: 1.625rem !important; } }

.kpi-unit {
    font-size: 11px; font-weight: 700;
    color: #94a3b8;
    margin-left: 0.25rem;
    letter-spacing: 0;
}
@media (min-width: 1280px) { .kpi-unit { font-size: 13px; } }

.kpi-sub {
    font-size: 9px; font-weight: 700;
    color: #94a3b8; text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 0.375rem;
}
@media (min-width: 1280px) { .kpi-sub { font-size: 10px; margin-top: 0.5rem; } }

/* ── Section card ────────────────────────────────────────────────────────── */
.plant-section-card {
    background: white;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.plant-section-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
@media (min-width: 768px)  { .plant-section-card { border-radius: 1.25rem; } }
@media (min-width: 1536px) { .plant-section-card { border-radius: 1.5rem; } }

.plant-section-header {
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem;
    /* make button reset work */
    width: 100%; text-align: left; cursor: default;
    border-radius: inherit;
    border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
button.plant-section-header { cursor: pointer; }
button.plant-section-header:hover { background: #f5f3ff; }
@media (min-width: 768px)  { .plant-section-header { padding: 1rem 1.5rem; } }
@media (min-width: 1280px) { .plant-section-header { padding: 1.125rem 1.75rem; } }
@media (min-width: 1536px) { .plant-section-header { padding: 1.25rem 2rem; } }

.plant-section-body {
    padding: 1rem 1.125rem;
}
@media (min-width: 768px)  { .plant-section-body { padding: 1.5rem; } }
@media (min-width: 1280px) { .plant-section-body { padding: 2rem 1.75rem; } }
@media (min-width: 1536px) { .plant-section-body { padding: 2.25rem 2rem; } }

/* Section decorators */
.section-icon-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.section-icon-dot.indigo { background: #6366f1; }
.section-icon-dot.emerald{ background: #10b981; }
.section-icon-dot.amber  { background: #f59e0b; }
.section-icon-dot.violet { background: #8b5cf6; }

.section-badge {
    display: inline-flex; align-items: center;
    font-size: 9px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.08em;
    background: #f1f5f9; color: #64748b;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
}
.section-badge.pro {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #4f46e5;
    border: 1px solid #c7d2fe;
}

/* Accordion chevron */
.accordion-chevron {
    width: 2rem; height: 2rem;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: white;
    border: 1px solid #e2e8f0;
    color: #94a3b8;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
button.plant-section-header:hover .accordion-chevron {
    background: #ede9fe; color: #4f46e5; border-color: #c4b5fd;
}

/* ── Material stocks grid ────────────────────────────────────────────────── */
.plant-stocks-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
}
@media (min-width: 640px)  { .plant-stocks-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; } }
@media (min-width: 1024px) { .plant-stocks-grid { grid-template-columns: repeat(4, 1fr); gap: 1rem; } }
@media (min-width: 1280px) { .plant-stocks-grid { grid-template-columns: repeat(6, 1fr); gap: 1.25rem; } }
@media (min-width: 1536px) { .plant-stocks-grid { gap: 1.5rem; } }

.stock-card {
    padding: 0.875rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.stock-card:hover { border-color: #a5b4fc; box-shadow: 0 2px 8px rgba(79,70,229,0.07); }
.stock-card.critical { background: #fff1f2; border-color: #fecdd3; }
.stock-card.critical:hover { border-color: #fda4af; }
@media (min-width: 1280px) { .stock-card { padding: 1rem 1.125rem; border-radius: 1rem; } }

.stock-card-label {
    font-size: 8.5px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.08em;
    color: #94a3b8;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-bottom: 0.375rem;
}
@media (min-width: 1280px) { .stock-card-label { font-size: 9.5px; } }

.stock-card-value {
    font-size: 1.5rem; font-weight: 900;
    color: #4f46e5;
    line-height: 1.1;
}
.stock-card-value.critical { color: #e11d48; }
@media (min-width: 768px)  { .stock-card-value { font-size: 1.75rem; } }
@media (min-width: 1280px) { .stock-card-value { font-size: 2rem; } }

.stock-card-unit {
    font-size: 8.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: #94a3b8;
}

/* ── Charts grid ─────────────────────────────────────────────────────────── */
.plant-charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 1024px) { .plant-charts-grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; } }
@media (min-width: 1280px) { .plant-charts-grid { gap: 2rem; } }
@media (min-width: 1536px) { .plant-charts-grid { gap: 2.5rem; } }

/* Chart canvas wrappers */
.plant-chart-container-md {
    position: relative; width: 100%; height: 260px;
}
@media (min-width: 768px)  { .plant-chart-container-md { height: 310px; } }
@media (min-width: 1280px) { .plant-chart-container-md { height: 360px; } }
@media (min-width: 1536px) { .plant-chart-container-md { height: 400px; } }

.plant-chart-container-lg {
    position: relative; width: 100%; height: 300px;
}
@media (min-width: 768px)  { .plant-chart-container-lg { height: 380px; } }
@media (min-width: 1280px) { .plant-chart-container-lg { height: 460px; } }
@media (min-width: 1536px) { .plant-chart-container-lg { height: 520px; } }

/* Chart inline legend pills (in section header) */
.chart-legend-pill {
    display: inline-flex; align-items: center; gap: 0.375rem;
    font-size: 9px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: #64748b;
}
.chart-legend-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.chart-legend-pill.emerald  { color: #059669; }
.chart-legend-pill.indigo   { color: #4f46e5; }
.chart-legend-dot.emerald   { background: rgba(16,185,129,0.85); }
.chart-legend-dot.indigo    { background: rgba(99,102,241,0.8); }

/* Custom doughnut legend */
.legend-wrap {
    display: flex; flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.legend-pill {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 100px;
    font-size: 9.5px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.legend-pill:hover { background: #eef2ff; border-color: #a5b4fc; color: #4f46e5; }
.legend-pill--off  { opacity: 0.35; text-decoration: line-through; }
@media (min-width: 1280px) { .legend-pill { font-size: 10px; padding: 0.35rem 0.875rem; } }

.legend-pill-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.legend-pill-text {}

/* ── Day stats row (below daily chart) ──────────────────────────────────── */
.plant-daystats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid #f1f5f9;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    gap: 0.5rem;
}
@media (min-width: 768px) {
    .plant-daystats-row { margin-top: 1.75rem; padding-top: 1.75rem; }
}
@media (min-width: 1280px) {
    .plant-daystats-row { margin-top: 2rem; padding-top: 2rem; gap: 1rem; }
}

.plant-daystat {
    display: flex; flex-direction: column;
    align-items: center; text-align: center;
    padding: 0 0.5rem;
}
.plant-daystat.divider {
    border-left: 1px solid #f1f5f9;
}

.plant-daystat-value {
    font-size: 2rem; font-weight: 900;
    color: #4f46e5;
    line-height: 1; letter-spacing: -0.03em;
    margin-bottom: 0.375rem;
}
@media (min-width: 768px)  { .plant-daystat-value { font-size: 2.75rem; } }
@media (min-width: 1280px) { .plant-daystat-value { font-size: 3.25rem; } }
@media (min-width: 1536px) { .plant-daystat-value { font-size: 3.5rem; } }

.plant-daystat-label {
    font-size: 8.5px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.09em;
    color: #94a3b8; line-height: 1.4;
}
@media (min-width: 768px)  { .plant-daystat-label { font-size: 9.5px; } }
@media (min-width: 1280px) { .plant-daystat-label { font-size: 10.5px; letter-spacing: 0.11em; } }

/* ── Dosing precision layout ─────────────────────────────────────────────── */
.precision-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
}
@media (min-width: 640px) {
    .precision-header {
        flex-direction: row;
        align-items: center;
        gap: 1.75rem;
        text-align: left;
    }
}
@media (min-width: 1280px) { .precision-header { gap: 2.25rem; } }

.precision-ring-center { flex-shrink: 0; display: flex; justify-content: center; }

.precision-ring-bg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 1.25rem;
    border: 1px solid #e2e8f0;
    box-shadow: inset 0 2px 8px rgba(0,0,0,0.04);
}
@media (min-width: 640px) { .precision-ring-bg { padding: 1.5rem; } }

.precision-meta { min-width: 0; }

.precision-health-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}
@media (min-width: 640px)  { .precision-health-grid { grid-template-columns: repeat(2, 1fr); gap: 0.625rem; } }
@media (min-width: 1280px) { .precision-health-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; } }
@media (min-width: 1536px) { .precision-health-grid { grid-template-columns: repeat(4, 1fr); } }

/* legacy aliases kept for safety */
.precision-layout     { display: contents; }
.precision-ring-wrap  { display: contents; }
.precision-health-wrap { min-width: 0; }

/* ── Dosing analysis grid ────────────────────────────────────────────────── */
.dosing-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
@media (min-width: 1280px) { .dosing-stack { gap: 1.75rem; } }
@media (min-width: 1536px) { .dosing-stack { gap: 2rem; } }

.plant-dosing-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 1024px) { .plant-dosing-grid { grid-template-columns: repeat(2, 1fr); gap: 1.75rem; } }
@media (min-width: 1280px) { .plant-dosing-grid { gap: 2rem; } }
@media (min-width: 1536px) { .plant-dosing-grid { gap: 2.5rem; } }

/* ── Stats grid ──────────────────────────────────────────────────────────── */
.plant-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}
@media (min-width: 768px)  { .plant-stats-grid { gap: 1rem; } }
@media (min-width: 1024px) { .plant-stats-grid { grid-template-columns: repeat(4, 1fr); gap: 1.25rem; } }
@media (min-width: 1280px) { .plant-stats-grid { gap: 1.75rem; } }
@media (min-width: 1536px) { .plant-stats-grid { gap: 2rem; } }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f8fafc; border-radius: 100px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 100px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Desktop type refinements for plant page ─────────────────────────────── */
@media (min-width: 1280px) {
    .plant-section-body .text-xs { font-size: 0.8125rem; }
    .plant-section-card .section-title { font-size: 0.875rem; }
}
@media (min-width: 1536px) {
    .plant-section-card .desktop-table td { font-size: 0.875rem; }
}

/* ==========================================================================
   Focus States & Accessibility
   ========================================================================== */

/* Better focus rings for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

/* ==========================================================================
   Desktop Typography Refinements (2xl+)
   ========================================================================== */

/* Scale up small utility text on large screens */
@media (min-width: 1536px) {
    .desktop-table .text-xs { font-size: 0.8125rem; }
    .energy-section-card .text-xs { font-size: 0.8125rem; }
    .main-meter-wrapper .text-xs { font-size: 0.8125rem; }
}