/* ========================================================================
   SDÍLENÉ STYLY ENERGETICKÉHO PORTÁLU SVJ
   ======================================================================== */

.fve-section-box {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #ffffff;
    padding: 20px;
    border: 1px solid #e0e0e0;
    max-width: 900px;
    margin: 20px auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    box-sizing: border-box;
}

.fve-card-box {
    background: #fafafa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    box-sizing: border-box;
}
.fve-card-box:last-child {
    margin-bottom: 0;
}

.fve-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}
.fve-card-header h4 {
    margin: 0;
    font-size: 15px;
    color: #333333;
}

.fve-nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.fve-nav-label {
    font-weight: bold;
    font-size: 14px;
    min-width: 80px;
    text-align: center;
}
.fve-nav-label--day { min-width: 100px; }
.fve-nav-label--year { min-width: 60px; }

.fve-nav-btn {
    background: #ffffff;
    border: 1px solid #cccccc;
    color: #333333;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.fve-nav-btn:hover { background: #f0f0f0; border-color: #999999; }

/* KPI ŘÁDKY */
.fve-kpi-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.fve-kpi-box {
    flex: 1;
    min-width: 150px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 12px;
    text-align: center;
    box-sizing: border-box;
}
.fve-kpi-badge {
    flex: 1;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 13px;
    box-sizing: border-box;
}
.fve-kpi-label {
    display: block;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}
.fve-kpi-label-inline {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
}
.fve-kpi-val { font-size: 16px; font-weight: 800; }

/* KONTEJNERY GRAFŮ A DVOU-SLOUPCOVÝ LAYOUT PRO FVE VÝROBU */
.fve-chart-wrap { position: relative; height: 260px; }
.fve-chart-wrap--sm { position: relative; height: 240px; }

.fve-two-col {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.fve-two-col-item {
    flex: 1;
    min-width: 260px;
    background: #fafafa;
    padding: 18px;
    border-radius: 8px;
    box-sizing: border-box;
}

/* STAV BEZ DAT / BLOKOVÁNO */
.fve-empty-state {
    box-sizing: border-box;
    display: none;
    height: 100%;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 24px;
    color: #475569;
    font-size: 14px;
    line-height: 1.5;
}
.fve-empty-state.is-visible { display: flex; }
.fve-empty-state.is-blocked {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}
.fve-empty-icon { font-size: 28px; margin-bottom: 8px; }

/* DISCLAIMER: DESKTOP VS MOBIL */
.fve-disclaimer-desk { font-size: 11px; color: #e65100; margin-top: 8px; line-height: 1.4; }
.fve-disclaimer-mob-btn {
    display: none;
    background: none;
    border: 0;
    color: #e65100;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

/* VLASTNÍ CSS MODAL */
.fve-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.fve-modal-overlay.active { opacity: 1; pointer-events: auto; }
.fve-modal-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transform: translateY(10px);
    transition: transform 0.2s ease;
    position: relative;
}
.fve-modal-overlay.active .fve-modal-box { transform: translateY(0); }
.fve-modal-close {
    position: absolute;
    top: 10px;
    right: 14px;
    font-size: 22px;
    font-weight: bold;
    color: #999999;
    cursor: pointer;
    line-height: 1;
}
.fve-modal-close:hover { color: #333333; }

/* TABULKA MĚŘIDEL A ODBĚRNÉHO MÍSTA */
.irtn-meters-table {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    font-size: 13px;
}
.irtn-meters-table th {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.irtn-meters-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}
.irtn-meters-table tr:last-child td { border-bottom: none; }
.irtn-type-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.irtn-pill-sv  { background: #e0f2fe; color: #0369a1; }
.irtn-pill-tv  { background: #ffe4e6; color: #be123c; }
.irtn-pill-bmt { background: #ede9fe; color: #6d28d9; }
.irtn-pill-el  { background: #ffedd5; color: #c2410c; }

/* ========================================================================
   EKONOMICKÁ BILANCE ([svj_bilance])
   ======================================================================== */
.fve-ekonomika-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    max-width: 1100px;
    margin: 20px auto;
    color: #0f172a;
}
.fve-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.fve-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px 22px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.fve-card-roi {
    grid-column: span 2;
    justify-content: space-between;
}
.fve-card-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.fve-card-val {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}
.fve-card-sub {
    font-size: 0.88rem;
    color: #64748b;
    line-height: 1.4;
}
.fve-roi-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}
.fve-roi-costs { font-size: 0.95rem; color: #334155; margin-top: 2px; }
.fve-roi-pct { font-size: 1.9rem; font-weight: 800; color: #15803d; line-height: 1; }
.fve-roi-subpct { font-size: 0.8rem; color: #64748b; font-weight: 600; }
.fve-progress-track {
    background: #e2e8f0;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 14px;
}
.fve-progress-bar {
    background: linear-gradient(90deg, #0284c7, #16a34a);
    height: 100%;
    border-radius: 7px;
}
.fve-roi-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    color: #1e293b;
    flex-wrap: wrap;
    gap: 8px;
}
.fve-time-badge {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #0369a1;
}
.fve-table-container {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    overflow-x: auto;
    box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.05);
}
.fve-econ-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}
.fve-econ-table th {
    background: #f1f5f9;
    color: #1e293b;
    font-size: 0.82rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 14px 16px;
    border-bottom: 2px solid #cbd5e1;
    white-space: nowrap;
}
.fve-econ-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}
.fve-row-year {
    background: #f8fafc;
    border-top: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
}
.fve-row-year td {
    padding: 16px;
    border-bottom: 2px solid #94a3b8;
    font-size: 1.05rem;
}
.fve-num-main { font-size: 1.02rem; font-weight: 700; color: #0f172a; }
.fve-num-bold { font-size: 1.12rem; font-weight: 800; }
.fve-num-sub  { font-size: 0.85rem; color: #64748b; margin-top: 2px; }

.fve-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}
.fve-badge-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.fve-badge-warning { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.fve-badge-info    { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.fve-badge-muted   { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }


/* ========================================================================
   RESPONZIVNÍ ÚPRAVY (TABLET A MOBIL)
   ======================================================================== */
@media (max-width: 850px) {
    .fve-cards-grid { grid-template-columns: 1fr; }
    .fve-card-roi   { grid-column: span 1; }
}

@media (max-width: 600px) {
    .fve-disclaimer-desk { display: none !important; }
    .fve-disclaimer-mob-btn { display: inline-flex !important; }

    /* Odtučnění okrajů pro maximální šířku grafu */
    .fve-section-box {
        padding: 0;
        border: none;
        box-shadow: none;
        margin: 10px 0;
        background: transparent;
    }
    .fve-card-box {
        padding: 12px 8px;
        margin-bottom: 16px;
        border: 1px solid #ececec;
    }
    .fve-two-col { gap: 12px; }
    .fve-two-col-item { min-width: 100%; padding: 12px 10px; }

    /* Hlavička karty a kompaktní navigační šipky */
    .fve-card-header {
        margin-bottom: 10px;
        gap: 6px;
    }
    .fve-card-header h4 { font-size: 14px; }
    .fve-nav-controls {
        width: 100%;
        justify-content: space-between;
        gap: 6px;
    }
    .fve-btn-text { display: none; }
    .fve-nav-btn {
        padding: 4px 14px;
        font-size: 18px;
        line-height: 1.2;
    }
    .fve-nav-label,
    .fve-nav-label--day,
    .fve-nav-label--year {
        min-width: auto;
        font-size: 13px;
    }

    /* KPI do kompaktního 3-sloupcového proužku */
    .fve-kpi-row {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        margin-bottom: 12px;
    }
    .fve-kpi-row--single {
        display: flex;
    }
    .fve-kpi-box,
    .fve-kpi-badge {
        min-width: 0;
        padding: 6px 4px;
        flex-direction: column;
        gap: 2px;
        text-align: center;
    }
    .fve-kpi-label,
    .fve-kpi-label-inline {
        font-size: 9px;
        line-height: 1.15;
        margin-bottom: 2px;
    }
    .fve-kpi-val,
    .fve-kpi-badge b {
        font-size: 12px;
        line-height: 1.2;
        word-break: break-word;
    }

    .fve-chart-wrap    { height: 230px; }
    .fve-chart-wrap--sm { height: 215px; }

    /* Tabulky měřidel a EANu jako mobilní kartičky */
    .irtn-meters-table {
        border: none;
        background: transparent;
        font-size: 13px;
    }
    .irtn-meters-table thead {
        display: none;
    }
    .irtn-meters-table tbody,
    .irtn-meters-table tr {
        display: block;
    }
    .irtn-meters-table tr {
        background: #ffffff;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 6px 12px;
        margin-bottom: 10px;
    }
    .irtn-meters-table tr:last-child {
        margin-bottom: 0;
    }
    .irtn-meters-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 6px 0;
        border-bottom: 1px solid #f1f5f9;
        text-align: right;
    }
    .irtn-meters-table td:last-child {
        border-bottom: none;
    }
    .irtn-meters-table td::before {
        content: attr(data-label);
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        color: #64748b;
        text-align: left;
        flex-shrink: 0;
    }
}

/* ========================================================================
   SLOUČENÝ WIDGET ENERGIÍ ([svj_widget_energie])
   ======================================================================== */
.svj-ew-wrap {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.svj-ew-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-left: 6px solid #ea580c;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}
.svj-ew-box.has-fve {
    border-left-color: #16a34a;
}
.svj-ew-box.is-collapsed {
    border-left-color: #94a3b8;
    background: #f8fafc;
}

.svj-ew-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    background: #ffffff;
}
.svj-ew-box.is-collapsed .svj-ew-header {
    border-bottom: none;
    background: transparent;
    padding: 6px 10px;
}

.svj-ew-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: 0.2px;
}
.svj-ew-box.is-collapsed .svj-ew-title {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
}
.svj-ew-title-link {
    color: inherit;
    text-decoration: none;
}
.svj-ew-title-link:hover {
    text-decoration: underline;
}

.svj-ew-gear-btn {
    background: none;
    border: none;
    padding: 1px 3px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    opacity: 0.65;
    transition: opacity 0.15s ease, transform 0.2s ease;
}
.svj-ew-gear-btn:hover {
    opacity: 1;
    transform: rotate(30deg);
}

/* PANEL NASTAVENÍ */
.svj-ew-settings {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px 10px;
    font-size: 12px;
    color: #334155;
}
.svj-ew-settings-title {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    margin-bottom: 5px;
}
.svj-ew-chk {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    cursor: pointer;
}
.svj-ew-chk input {
    margin: 0;
    cursor: pointer;
}
.svj-ew-settings-actions {
    display: flex;
    gap: 8px;
    margin-top: 7px;
}
.svj-ew-save-btn {
    background: #16a34a;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    padding: 4px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.svj-ew-save-btn:hover { background: #15803d; }
.svj-ew-cancel-btn {
    background: #ffffff;
    color: #475569;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 4px 9px;
    font-size: 12px;
    cursor: pointer;
}
.svj-ew-cancel-btn:hover { background: #f1f5f9; }

/* VÝRAZNĚJŠÍ SEKCE FVE ŽIVĚ */
.svj-ew-fve {
    background: #f4fbf5;
    padding: 7px 10px 6px;
    border-bottom: 1px solid #dcfce7;
}
.svj-ew-fve-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.svj-ew-fve-metric {
    display: flex;
    flex-direction: column;
}
.svj-ew-fve-metric:last-child {
    text-align: right;
}
.svj-ew-fve-lbl {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 1px;
}
.svj-ew-fve-val {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.1;
}
.svj-ew-fve-val.is-green { color: #15803d; }
.svj-ew-fve-val.is-blue  { color: #1565c0; }
.svj-ew-fve-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 10px;
    color: #6b7280;
    margin-top: 3px;
}
.svj-ew-fve-note {
    font-weight: 600;
    color: #15803d;
}

/* KOMPAKTNÍ ROČNÍ SPOTŘEBY */
.svj-ew-cons {
    padding: 6px 10px 6px;
    background: #ffffff;
}
.svj-ew-cons-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #64748b;
    margin-bottom: 3px;
}
.svj-ew-detail-link {
    color: #ea580c;
    text-decoration: none;
    font-weight: 700;
}
.svj-ew-detail-link:hover { text-decoration: underline; }

.svj-ew-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
    line-height: 1.25;
    color: #334155;
}
.svj-ew-row-lbl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.svj-ew-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.svj-ew-dot.is-el    { background: #ea580c; }
.svj-ew-dot.is-sv    { background: #0284c7; }
.svj-ew-dot.is-tv    { background: #e11d48; }
.svj-ew-dot.is-teplo { background: #7c3aed; }

.svj-ew-row-val {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #0f172a;
    white-space: nowrap;
}
.svj-ew-sub-pill {
    background: #dcfce7;
    color: #15803d;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
}
.svj-ew-muted { color: #94a3b8; }
