/* Moduł: Pulpit nawigacyjny */

/* Napraw wzrost wykresu miesięcznego — specyficzne ID zamiast globalnego canvas */
#monthly-chart {
    max-width: 100%;
    height: 600px !important;
}

/* Wykres donut — NIE override height */
#donutCard {
    display: block;
    height: auto !important;
    width: 100% !important;
}

.dashboard-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 30px;
    text-align: center;
    color: var(--primary-color);
    letter-spacing: -0.5px;
}

.chart-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 15px;
    text-align: center;
}

.chart-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 15px;
    font-size: 14px;
}

/* Kontenery statystyk */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    width: 100%;
}

.stat-box {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
    border: 1px solid var(--card-border);
    color: var(--text-color);
}

@media (hover: hover) and (pointer: fine) {
    .stat-box:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-lg);
    }
}

.stat-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 8px;
    text-align: center;
    line-height: 1.3;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.kafelek-uptime,
.kafelek-m3,
.kafelek-clickable {
    cursor: pointer;
    background-color: var(--accent-light);
    border: 1px solid var(--accent-border);
}

@media (hover: hover) and (pointer: fine) {
    .kafelek-uptime:hover,
    .kafelek-m3:hover,
    .kafelek-clickable:hover {
        background-color: var(--accent-light);
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }
}

/* Mapy */
.map-container {
    /* F4.15: token zamiast jasnoszarego gradientu — dark mode podąża automatycznie
       (dawniej gradient nadpisywany osobno w dark-mode-overrides) */
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
}

#map {
    width: 100%;
    height: 600px;
    border-radius: var(--radius-sm);
}

/* Lekko stonuj jasne tile'y mapy */
#map .leaflet-tile-pane {
    filter: brightness(0.96) saturate(1.05);
}

/* Konterner wykresu */
.chart-container {
    /* F4.15: token zamiast jasnoszarego gradientu — spójne z systemem kart */
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--card-border);
}

/* Wykres Produktionssteder — stała wysokość na desktop (bez niej canvas rośnie w nieskończoność) */
.production-chart-container {
    height: 936px;
}

.production-chart-container canvas {
    height: 100% !important;
}

/* Siatki */
.grid-2col,
.grid-2col-production {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-top: 20px;
}

/* =============================================
   RESPONSIVE - WIDOK MOBILNY
   ============================================= */
@media (max-width: 1024px) {

    .grid-2col,
    .grid-2col-production {
        grid-template-columns: 1fr 1fr;
    }

    #map {
        height: 400px;
    }
}

@media (max-width: 768px) {

    .grid-2col,
    .grid-2col-production {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-box {
        padding: 12px;
        min-height: 80px;
    }

    .stat-value {
        font-size: 20px;
    }

    .stat-title {
        font-size: 11px;
    }

    #map {
        height: 300px;
    }

    /* Klamra wysokości tylko dla wykresów Chart.js, które bez tego rosłyby w nieskończoność.
       Wcześniej była tu reguła `canvas { height: 300px !important }` — globalna i destrukcyjna:
       zniekształcała donut (#donutCard) oraz #top10-chart, który ma własną dynamiczną wysokość. */
    #monthly-chart {
        height: 400px !important;
    }

    #installation-breakdown-chart,
    #kw-history-chart,
    #daily-history-chart {
        max-height: 300px !important;
    }

    .chart-title {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .stats-container {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-box {
        padding: 10px;
        min-height: 70px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-title {
        font-size: 11px; /* F4.7: minimum czytelności (było 10px) */
    }

    #map {
        height: 250px;
    }

    /* Mniej miejsca w pionie na małym telefonie — niższe wykresy */
    #monthly-chart {
        height: 300px !important;
    }

    #installation-breakdown-chart,
    #kw-history-chart,
    #daily-history-chart {
        max-height: 240px !important;
    }
}

/* Przewijanie miesięczne (Dół pulpitu) */
/* Scrollbar pod wykresem miesięcznym */
.chart-scrollbar {
    margin-top: 10px;
    padding: 0 4px;
}

.chart-scrollbar-track {
    position: relative;
    width: 100%;
    height: 10px;
    background: var(--card-border, #e8e8e8); /* F4.14: --bg-muted nie istniało; card-border = widoczny tor w obu motywach */
    border-radius: 5px;
    cursor: pointer;
}

.chart-scrollbar-thumb {
    position: absolute;
    top: 0;
    height: 100%;
    min-width: 30px;
    background: var(--primary-color, #006400);
    border-radius: 5px;
    cursor: grab;
    opacity: 0.55;
    transition: opacity 0.15s;
}

.chart-scrollbar-thumb:hover,
.chart-scrollbar-thumb:active {
    opacity: 0.85;
    cursor: grabbing;
}

/* =============================================
   STATS-GRID: Donut (lewo) + stats-right (prawo)
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: minmax(300px, 38%) 1fr;
    gap: 20px;
    margin-bottom: 24px;
    align-items: stretch;
}

.stats-right {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10px;
    min-width: 0;
}

.stats-title-row {
    padding: 0 2px 4px;
}

.stats-title-row .page-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

.stats-title-row .page-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =============================================
   DONUT CARD
   ============================================= */
/* Donut card — szmaragdowy tint */
.donut-card {
    background: linear-gradient(135deg, rgba(0,100,0,0.03), rgba(34,139,34,0.05));
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 100, 0, 0.1), var(--shadow-sm);
}

/* Live power card — turkusowo-cyjanowy tint */
.live-power-card {
    background: linear-gradient(135deg, rgba(6,182,212,0.04), rgba(34,211,238,0.06)) !important;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.1), var(--shadow-sm) !important;
}

.donut-card::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #006400, #228B22, #4ade80);
}

/* Header: tytuł (lewo) + trend (prawo) */
.donut-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px 0;
}

.donut-card-header .donut-trend {
    margin: 0;
    padding: 2px 8px;
    font-size: 12px;
}

.donut-card-inner {
    display: flex;
    align-items: center;
    padding: 4px 12px 0;
    gap: 12px;
    flex: 1;
}

.donut-canvas-wrap {
    position: relative;
    width: 50%;
    max-width: 324px;
    min-height: 234px;
    flex-shrink: 0;
    margin: 0;
}

.donut-canvas-wrap canvas {
    filter: drop-shadow(0 8px 6px rgba(0,0,0,0.15));
}

.donut-center {
    display: none;
}

.donut-center[onclick] {
    pointer-events: auto;
}

.donut-center-val {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -2px;
    text-align: center;
    color: var(--text-color);
    width: 100%;
}

.donut-center-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
    margin-top: 2px;
}

.donut-info {
    flex: 1;
    /* Fix 2026-07-24 (zoom przeglądarki tnie treść): min-width:0 pozwala kolumnie
       tekstowej KURCZYĆ SIĘ zamiast wypychać poza kartę (overflow:hidden ucinał
       „7.170 MWh el total" i legendę przy zoomie 110–150% / wąskich oknach).
       Pionowe wyśrodkowanie przez justify-content zamiast sztywnych marginesów. */
    min-width: 0;
    align-self: stretch;
    padding-top: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.donut-info-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 0;
}

.donut-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
    text-align: left;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    /* Fix 2026-07-24: sztywne margin-left:110px / margin-top:80px pozycjonowały
       legendę „na oko" przy pełnej szerokości — przy zoomie/węższej kolumnie
       wypychały ją poza kartę (overflow:hidden ucinał wartości MWh).
       Naturalny flow: legenda zaraz za donutem, wyśrodkowanie robi .donut-info. */
    margin-left: 0;
    margin-top: 14px;
    min-width: 0;
}

.donut-total {
    margin-top: 0;
    margin-bottom: 6px;
    /* Fix 2026-07-24: bez sztywnego padding-left:70px (jak wyżej — ucinało liczbę) */
    padding-left: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    min-width: 0;
}

.donut-total-val {
    /* Fix 2026-07-24: clamp zamiast stałych 42px — liczba skaluje się z oknem
       (42px przy pełnej szerokości, mniej przy zoomie 110–150%) */
    font-size: clamp(28px, 2.6vw, 42px);
    font-weight: 800;
    color: var(--text-color);
    letter-spacing: -1.5px;
}

.donut-total-unit {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
}

.donut-trend {
    margin-top: 0;
    margin-bottom: 10px;
    padding: 4px 0;
    text-align: left;
    cursor: help;
    font-size: 12px;
}

.pie3d-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    z-index: var(--z-raised); /* F4.22 (=10) */
    transition: opacity 0.15s;
}

.legend-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    font-size: 14px;
    gap: 10px;
}

.legend-left {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap;
}

.legend-dot {
    width: 13px;
    height: 13px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-val {
    font-weight: 800;
    font-size: 19px;
    white-space: nowrap;
    color: var(--text-color);
}

.legend-pct {
    font-size: 14px;
    color: var(--text-muted);
    margin-left: 4px;
    font-weight: 700;
}

/* =============================================
   STAT-CARDS-ROW (3 karty: cieplo, metan, co2)
   ============================================= */
.stat-cards-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

/* Varme (ciepło) — ciepły czerwono-pomarańczowy */
.stat-card:nth-child(1) {
    background: linear-gradient(135deg, rgba(239,68,68,0.05), rgba(251,146,60,0.07));
}
/* Metan (biogaz) — fioletowo-indygo */
.stat-card:nth-child(2) {
    background: linear-gradient(135deg, rgba(139,92,246,0.05), rgba(99,102,241,0.06));
}
/* CO2e — zielony */
.stat-card:nth-child(3) {
    background: linear-gradient(135deg, rgba(0,100,0,0.04), rgba(74,222,128,0.06));
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 16px 14px 12px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 100, 0, 0.1), var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 110px;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #006400, #228B22);
}

.stat-card:nth-child(2)::before {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.stat-card:nth-child(3)::before {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-border);
}

.stat-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.stat-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: var(--accent-light);
}

.stat-trend-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 20px;
    background: var(--accent-light);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 2px;
}

.stat-card .stat-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    white-space: nowrap;
    line-height: 1;
    margin-bottom: 2px;
    color: var(--text-color);
}

.stat-kwh {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 1px;
}

.stat-sub {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 3px;
}

/* =============================================
   INLINE TICKERS
   ============================================= */
.inline-tickers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inline-ticker {
    /* F4.15: token (biały w light bez zmian; dark nadpisywany osobno) */
    background: var(--surface-color);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    height: 44px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.inline-ticker-title {
    color: white;
    font-weight: 800;
    font-size: 18px;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.2);
    z-index: 2;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    min-width: 90px;
}

.inline-ticker.el-ticker .inline-ticker-title {
    background: linear-gradient(135deg, #006400 0%, #228B22 100%);
}

.inline-ticker.news-ticker .inline-ticker-title {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
}

.inline-ticker-content {
    flex: 1;
    overflow: hidden;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
}

.inline-ticker-scroll {
    display: inline-flex;
    white-space: nowrap;
    animation: scrollTicker 120s linear infinite;
    align-items: center;
    padding-left: 100%;
}

.inline-ticker.news-ticker .inline-ticker-scroll {
    animation-duration: 60s;
    font-size: 21px;
}

.inline-ticker-scroll:hover {
    animation-play-state: paused;
}

@keyframes scrollTicker {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.ticker-node {
    display: inline-flex;
    align-items: center;
    margin-right: 36px;
    font-size: 20px;
}

.ticker-node .node-name {
    color: var(--text-muted);
    margin-right: 6px;
    font-weight: 700;
    font-size: 18px;
}

.ticker-node .node-val {
    font-weight: 800;
    color: var(--text-color);
    font-size: 21px;
}

.inline-ticker-controls {
    padding: 0 10px;
    height: 100%;
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.03);
    border-left: 1px solid var(--card-border);
    z-index: 2;
}

.toggle-switch {
    width: 30px;
    height: 16px;
    background: var(--card-border);
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch.on {
    /* F4.15: token — w dark #4ade80 (widoczny), było zamrożone #006400 */
    background: var(--primary-color);
}

.toggle-switch.on::after {
    left: 16px;
}

/* =============================================
   RESPONSIVE
   F4.9 (2026-07-23): breakpointy ujednolicone do 768/1024 (były 600/900 —
   w oknie 769-900px sidebar statyczny + zawinięte kolumny dawały najciaśniejszy
   wariant; teraz zawijanie obejmuje całą strefę statycznego sidebara ≤1024).
   ============================================= */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-cards-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .donut-canvas-wrap {
        max-width: 180px;
    }
}

/* ── Donut card — kompaktowy układ dla tabletów (TB336FU i podobnych) ──
   Wcześniej kompaktowy układ (donut nad info zamiast obok siebie) włączał się
   dopiero przy ≤600px. Na tabletach dashboard-3col trzymał donut w wąskiej
   kolumnie ~340–450px, a w `.donut-legend` był hardkodowany `margin-left: 110px`,
   `margin-top: 80px` + `.donut-total { padding-left: 70px }` i `.legend-left
   { white-space: nowrap }` — w efekcie legenda była ucinana, a pierwsza cyfra
   totalu wycinana poza kartę.
   POPRAWKA 2026-05-28: pierwotna reguła `(max-width: 1024px)` nie łapała tabletu
   z viewportem 1280–1920px (TB336FU landscape DPR=1.0–1.5). Druga gałąź
   `(hover: none) and (pointer: coarse)` łapie każdy tablet niezależnie od DPR. */
@media (max-width: 1024px),
       (max-width: 1920px) and (hover: none) and (pointer: coarse) {
    /* Układ POZIOMY (row): donut po lewej, info po prawej.
       Wcześniej był column (donut nad info) — wygenerował dużo pustego pionu
       i poziomego białego miejsca dookoła donuta wycentrowanego w 448px kolumnie.
       Row wykorzystuje całą szerokość karty, wysokość = max(donut, info) ≈ 180–200px
       zamiast 350+px. */
    .donut-card-inner {
        flex-direction: row;
        align-items: center;
        padding: 6px 14px 12px;
        gap: 12px;
    }

    .donut-canvas-wrap {
        width: 42%;
        max-width: 160px;
        min-width: 110px;
        min-height: 0;
        margin: 0;
        align-self: center;
        flex-shrink: 0;
    }

    .donut-info {
        flex: 1;
        align-self: center;
        align-items: flex-start;
        text-align: left;
        min-width: 0;
    }

    .donut-title {
        text-align: left;
        margin-bottom: 4px;
    }

    /* Wyzeruj hardkodowane offsety projektowane pod szeroką kartę desktopową */
    .donut-legend {
        margin-left: 0;
        margin-top: 0;
        align-items: stretch;
        width: 100%;
        gap: 4px;
    }

    .donut-total {
        padding-left: 0;
        margin-top: 0;
        margin-bottom: 6px;
        justify-content: flex-start;
    }

    /* Cyfra totalu — mniejsza na tablecie (była 42px desktop, 28px telefon) */
    .donut-total-val {
        font-size: 28px;
        letter-spacing: -0.5px;
    }

    .donut-total-unit {
        font-size: 12px;
    }

    /* Pozycje w legendzie — mniejsze fonty bez ucinania */
    .legend-item {
        font-size: 12px;
    }

    .legend-left {
        white-space: normal;
        font-size: 12px;
    }

    .legend-val {
        font-size: 14px;
    }

    .legend-pct {
        font-size: 11px;
    }

    .donut-card-header {
        padding: 6px 14px 0;
    }

    .donut-info-title {
        font-size: 12px;
        letter-spacing: 0.8px;
    }
}

/* F4.9: 600→768 (spójnie z breakpointem drawera) */
@media (max-width: 768px) {
    .stat-cards-row {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        gap: 12px;
    }

    /* ── Donut card kompakt na mobile ──
       Wcześniej: donut 50% szerokości karty + info 50%, w info hardkodowane
       margin-left: 110px / padding-left: 70px / white-space: nowrap → labele jak
       "Vedvarende energi" się ucinały, total cyfra 42px wycinała pierwszą cyfrę.
       Teraz: donut nad info (column), info zajmuje pełną szerokość. */
    .donut-card-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 4px 12px 12px;
        gap: 8px;
    }

    .donut-canvas-wrap {
        width: 100%;
        max-width: 220px;
        min-height: 0;
        margin: 0 auto;
        align-self: center;
    }

    .donut-info {
        align-self: stretch;
        align-items: center;
        text-align: center;
    }

    .donut-title {
        margin-bottom: 8px;
        font-size: 12px;
        letter-spacing: 0.5px;
        text-align: center;
    }

    /* Wyzeruj hardkodowane offsety, wyśrodkuj */
    .donut-legend {
        margin-left: 0;
        margin-top: 8px;
        align-items: stretch;
        width: 100%;
    }

    .donut-total {
        padding-left: 0;
        margin-top: 12px;
        justify-content: center;
    }

    .donut-total-val {
        font-size: 28px;
        letter-spacing: -0.5px;
    }

    .donut-total-unit {
        font-size: 13px;
    }

    /* Pozwól labelom łamać się — koniec ucinania tekstu */
    .legend-left {
        white-space: normal;
        font-size: 13px;
    }

    .legend-item {
        font-size: 13px;
        justify-content: space-between;
    }

    .legend-val {
        font-size: 16px;
    }

    .legend-pct {
        font-size: 12px;
    }

    /* Header (tytuł + trend) — mniejszy padding, krótszy tytuł */
    .donut-card-header {
        padding: 8px 12px 0;
    }

    .donut-info-title {
        font-size: 13px;
        letter-spacing: 0.6px;
    }
}

/* =============================================
   DASHBOARD 3-KOLUMNOWY LAYOUT
   ============================================= */
.dashboard-3col {
    display: flex;
    gap: 16px;
    min-height: 0;
}

.dash-left {
    flex: 0 0 36%;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dash-right {
    flex: 1;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* =============================================
   LIVE POWER CARD — osobna kolumna środkowa
   ============================================= */
.live-power-card {
    flex: 0 0 150px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    gap: 6px;
    position: relative;
    overflow: hidden;
}

.live-power-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #006400, #22c55e);
}

.lpc-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    justify-content: center;
    padding-top: 2px;
}

.lpc-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.lpc-kw {
    text-align: center;
}

.lpc-kw-val {
    font-size: 32px;
    font-weight: 900;
    color: var(--primary-color, #006400);
    line-height: 1;
    letter-spacing: -1px;
}

.lpc-kw-unit {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.lpc-engines {
    text-align: center;
    padding: 4px 0;
    border-top: 1px solid var(--card-border, rgba(0,0,0,0.06));
    width: 100%;
}

.lpc-eng-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-color);
    line-height: 1.2;
}

.lpc-eng-label {
    font-size: 11px; /* F4.7: było 9px — nieczytelne, zwłaszcza uppercase */
    color: var(--text-muted);
    text-transform: uppercase;
}

.lpc-bar-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    min-height: 80px;
}

.lpc-bar-wrap {
    flex: 1;
    width: 50px;
    min-height: 60px;
    background: rgba(0,0,0,0.06);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
}

.lpc-bar-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #006400, #22c55e);
    border-radius: 8px;
    transition: height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.lpc-pct {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-color);
    margin-top: 4px;
}

.lpc-daily-section {
    text-align: center;
    cursor: pointer;
    padding: 6px 4px;
    border-top: 1px solid var(--card-border, rgba(0,0,0,0.06));
    width: 100%;
    border-radius: 6px;
    transition: background 0.2s;
}

.lpc-daily-section:hover {
    background: var(--accent-light, rgba(0,100,0,0.06));
}

.lpc-daily-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-color, #006400);
    line-height: 1.2;
}

.lpc-daily-label {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.lpc-max {
    font-size: 11px; /* F4.7 */
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.lpc-ts {
    font-size: 11px; /* F4.7: było 9px */
    color: var(--text-muted);
    opacity: 0.7;
}

/* Status dot (shared) */
.lp-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    display: inline-block;
    flex-shrink: 0;
}

.lp-dot-active {
    animation: lp-pulse 2s ease-in-out infinite;
}

@keyframes lp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Dark mode */
[data-theme="dark"] .live-power-card {
    border-color: rgba(74,222,128,0.15);
}

[data-theme="dark"] .lpc-bar-wrap {
    background: rgba(255,255,255,0.08);
}

[data-theme="dark"] .lpc-daily-section:hover {
    background: rgba(74,222,128,0.08);
}

/* Responsive: live-power-card jako pasek (nie ukrywany na mobile)
   F4.9: 900→1024 (spójnie z resztą projektu) */
@media (max-width: 1024px) {
    .dashboard-3col {
        flex-wrap: wrap;
    }

    .dash-left {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .live-power-card {
        flex: 0 0 100%;
        flex-direction: row;
        gap: 16px;
        padding: 12px 16px;
    }

    .lpc-bar-section {
        flex-direction: row;
        min-height: auto;
        gap: 8px;
    }

    .lpc-bar-wrap {
        width: 100%;
        min-height: 20px;
        height: 20px;
        flex-direction: row;
        align-items: stretch;
    }

    .lpc-bar-fill {
        height: 100% !important;
        width: 0%;
        transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .dash-right {
        flex: 1 1 100%;
    }
}

/* Na bardzo małych ekranach Live Power zostaje widoczny — kompaktowy pasek
   (wcześniej `display: none` ukrywał kluczową informację o aktualnej mocy).
   F4.9: 600→768 (spójnie z breakpointem drawera) */
@media (max-width: 768px) {
    .live-power-card {
        padding: 8px 12px;
        gap: 8px;
    }

    .lpc-header {
        font-size: 11px;
        gap: 4px;
        padding-top: 0;
    }

    .lpc-bar-wrap {
        min-height: 16px;
        height: 16px;
    }

    /* Sekcja dzienna — mniejsze etykiety, jeden rząd */
    .lpc-daily-section {
        padding: 4px 6px;
        font-size: 11px;
    }
}
/* ============================================================
   TV MODE — kafelek "TV wersja" w naglowku instalacji
   #TAG: TV_MODE STYLE PRODUKCJA
   ============================================================ */
.tv-mode-controls .tv-mode-btn,
.tv-mode-controls .tv-mode-copy {
    background: var(--primary-color, #006400);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tv-mode-controls .tv-mode-copy {
    padding: 8px 10px;
    font-size: 14px;
}
.tv-mode-controls .tv-mode-btn:hover,
.tv-mode-controls .tv-mode-copy:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}
.tv-mode-controls .tv-mode-btn:active,
.tv-mode-controls .tv-mode-copy:active {
    transform: translateY(0);
}
[data-theme="dark"] .tv-mode-controls .tv-mode-btn,
[data-theme="dark"] .tv-mode-controls .tv-mode-copy {
    background: var(--primary-color, #4ade80);
    color: #0a1a14;
}
[data-theme="dark"] .tv-mode-controls .tv-mode-btn:hover,
[data-theme="dark"] .tv-mode-controls .tv-mode-copy:hover {
    background: var(--primary-hover);
}
