:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --panel-soft: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #1597f2;
    --primary-dark: #061f54;
    --primary-soft: #e0f2fe;
    --border: #e2e8f0;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --success: #166534;
    --success-soft: #dcfce7;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.billing-annual-card,
.billing-payment-card {
    margin-top: 1rem;
}

.billing-annual-chart {
    height: 260px;
    display: grid;
    grid-template-columns: repeat(12, minmax(34px, 1fr));
    align-items: end;
    gap: .65rem;
    padding: 1.25rem .5rem .25rem;
    overflow-x: auto;
}

.billing-annual-column {
    min-width: 34px;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: .45rem;
    text-align: center;
    color: var(--muted);
    font-size: .75rem;
}

.billing-annual-bars {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 3px;
    min-height: 0;
}

.billing-annual-bar {
    width: min(16px, 42%);
    min-height: 2px;
    border-radius: 5px 5px 2px 2px;
}

.billing-annual-edc { background: #22c55e; }
.billing-annual-supplier { background: #64748b; }

.billing-payment-status {
    padding: .45rem .8rem;
    border-radius: 999px;
    font-size: .82rem;
}

.billing-payment-status.paid {
    color: #166534;
    background: #dcfce7;
}

.billing-payment-status.unpaid {
    color: #9a3412;
    background: #ffedd5;
}

.billing-payment-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 1.5rem;
    align-items: center;
}

.billing-payment-details {
    display: grid;
    gap: .75rem;
}

.billing-payment-details > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--border);
}

.billing-payment-details span { color: var(--muted); }
.billing-payment-qr { display: grid; justify-items: center; gap: .4rem; }
.billing-payment-qr img { width: 210px; max-width: 100%; background: white; padding: .5rem; border-radius: 14px; }
.billing-payment-qr small { color: var(--muted); }
.billing-payment-missing { padding: 1rem; border-radius: 12px; background: #fff7ed; color: #9a3412; }
.billing-paid-toggle { display: flex; align-items: center; gap: .65rem; margin-top: 1.25rem; font-weight: 600; }

.billing-share-chart {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex: 0 0 auto;
}

.billing-share-pie {
    width: 82px;
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    position: relative;
    border-radius: 50%;
    background: conic-gradient(#22c55e 0 var(--edc-share), #64748b var(--edc-share) 100%);
}

.billing-share-pie::after {
    content: "";
    position: absolute;
    inset: 13px;
    border-radius: 50%;
    background: var(--panel);
}

.billing-share-pie strong {
    position: relative;
    z-index: 1;
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
}

.billing-share-legend {
    display: grid;
    gap: .3rem;
    color: var(--muted);
    font-size: .75rem;
}

.billing-share-legend span { display: flex; align-items: center; gap: .35rem; }
.billing-share-legend i { width: 9px; height: 9px; border-radius: 50%; }
.billing-share-legend .share-edc { background: #22c55e; }
.billing-share-legend .share-supplier { background: #64748b; }
.billing-document-share-chart { position: relative; z-index: 1; margin-left: auto; }
.billing-selected-section .billing-kpi-grid-wide { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ================================
   Public marketing demo
================================ */
.demo-shell { min-height: 100vh; background: var(--bg); color: var(--text); }
.demo-page { max-width: 1440px; margin: 0 auto; padding: 0 2.25rem 2rem; }
.demo-header { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--border); }
.demo-brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--primary-dark); font-size: 1.18rem; font-weight: 800; text-decoration: none; }
.demo-brand img { width: 42px; height: 42px; object-fit: contain; }
.demo-header-meta, .demo-live { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .78rem; }
.demo-pill { padding: .4rem .7rem; border-radius: 999px; color: #075985; background: #e0f2fe; font-size: .7rem; font-weight: 800; letter-spacing: .08em; }
.demo-live i { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px #dcfce7; }
.demo-intro { display: flex; justify-content: space-between; align-items: end; gap: 2rem; padding: 2.3rem 0 1.45rem; }
.demo-eyebrow { display: block; margin-bottom: .35rem; color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.demo-intro h1 { max-width: 790px; margin: 0; font-size: clamp(1.8rem, 3.2vw, 3rem); line-height: 1.1; letter-spacing: -.04em; }
.demo-intro p, .demo-section-heading p { max-width: 700px; margin: .8rem 0 0; color: var(--muted); }
.demo-site-selector { min-width: 220px; padding: .95rem 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.demo-site-selector span, .demo-site-selector small { display: block; color: var(--muted); font-size: .72rem; }
.demo-site-selector strong { display: block; margin: .25rem 0; font-size: .95rem; }
.demo-site-selector b { color: var(--success); }
.demo-tabs { display: flex; gap: .35rem; margin-bottom: 1.25rem; padding: .3rem; border-radius: 12px; background: var(--panel-soft); width: fit-content; }
.demo-tabs button { border: 0; border-radius: 9px; padding: .6rem 1rem; color: var(--muted); background: transparent; font: inherit; font-size: .85rem; font-weight: 700; cursor: pointer; }
.demo-tabs button.active { color: var(--primary-dark); background: var(--panel); box-shadow: 0 3px 10px rgba(15,23,42,.08); }
.demo-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.demo-metric, .demo-card { border: 1px solid var(--border); border-radius: 16px; background: var(--panel); box-shadow: var(--shadow); }
.demo-metric { position: relative; overflow: hidden; padding: 1.15rem 1.25rem; }
.demo-metric::after { content: ""; position: absolute; right: -28px; bottom: -44px; width: 130px; height: 100px; border-radius: 50%; opacity: .14; background: currentColor; }
.demo-blue { color: #0284c7; } .demo-green { color: #16a34a; } .demo-purple { color: #7c3aed; } .demo-orange { color: #ea580c; }
.demo-metric-top { display: flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .78rem; font-weight: 700; }
.demo-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: currentColor; background: color-mix(in srgb, currentColor 13%, transparent); font-size: 1.1rem; }
.demo-metric strong { display: block; margin-top: .7rem; color: var(--text); font-size: 1.85rem; letter-spacing: -.04em; }
.demo-metric strong small { color: var(--muted); font-size: .8rem; font-weight: 600; }
.demo-metric em { display: block; margin-top: .18rem; color: var(--muted); font-size: .72rem; font-style: normal; }
.demo-main-grid { display: grid; grid-template-columns: minmax(0, 1.42fr) minmax(330px, .8fr); gap: 1rem; margin-top: 1rem; }
.demo-card { padding: 1.35rem; color: var(--text); }
.demo-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 1rem; }
.demo-card-heading h2 { margin: 0; font-size: 1.08rem; letter-spacing: -.02em; }
.demo-status, .demo-muted { color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .08em; }
.demo-status { color: #16a34a; }
.demo-flow { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto minmax(60px, 1fr) auto; align-items: center; gap: .7rem; min-height: 184px; }
.demo-flow-node { display: grid; justify-items: center; gap: .25rem; min-width: 86px; padding: .9rem .5rem; border: 1px solid var(--border); border-radius: 14px; background: var(--panel-soft); }
.demo-flow-node span { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 50%; color: #0284c7; background: #e0f2fe; font-size: 1.35rem; }
.demo-flow-node b { font-size: .78rem; } .demo-flow-node strong { color: var(--muted); font-size: .68rem; white-space: nowrap; }
.demo-flow-solar span { color: #f59e0b; background: #fef3c7; } .demo-flow-grid span { color: #16a34a; background: #dcfce7; }
.demo-flow-line { position: relative; height: 4px; border-radius: 99px; background: var(--border); }
.demo-flow-line i { display: block; height: 100%; border-radius: inherit; background: #0ea5e9; }
.demo-flow-line small { display: block; margin-top: .45rem; color: var(--muted); font-size: .62rem; text-align: center; white-space: nowrap; }
.demo-flow-sharing i { background: #22c55e; }
.demo-flow-summary { display: flex; flex-wrap: wrap; gap: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .72rem; }
.demo-flow-summary span { display: flex; align-items: center; gap: .35rem; } .demo-flow-summary b { color: var(--text); }
.dot, .demo-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; } .dot.blue, .demo-legend .blue { background: #0ea5e9; } .dot.green, .demo-legend .green { background: #22c55e; } .dot.purple { background: #8b5cf6; }
.demo-consumer { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; margin-top: 1rem; }
.demo-consumer div { display: grid; gap: .15rem; } .demo-consumer b { font-size: .78rem; } .demo-consumer small { color: var(--muted); font-size: .67rem; }
.demo-consumer > strong { font-size: .8rem; } .demo-progress { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; } .demo-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #22c55e, #86efac); }
.demo-total-row { display: flex; justify-content: space-between; margin-top: 1.1rem; padding-top: .8rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .74rem; } .demo-total-row b { color: #16a34a; }
.demo-chart-card { margin-top: 1rem; } .demo-legend { display: flex; flex-wrap: wrap; gap: .8rem; color: var(--muted); font-size: .7rem; } .demo-legend span { display: inline-flex; align-items: center; gap: .3rem; } .demo-legend .gray { background: #94a3b8; }
.demo-chart { display: grid; grid-template-columns: 45px 1fr; height: 220px; margin-top: 1.2rem; border-bottom: 1px solid var(--border); background: repeating-linear-gradient(to bottom, transparent 0, transparent 54px, var(--border) 55px); }
.demo-y-axis { display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 .45rem; color: var(--muted); font-size: .62rem; } .demo-bars { display: flex; justify-content: space-around; align-items: end; gap: .35rem; padding: 0 .4rem 0; }
.demo-bar-group { display: flex; align-items: end; justify-content: center; gap: 3px; height: 100%; position: relative; flex: 1; } .demo-bar { width: min(18px, 27%); min-height: 3px; border-radius: 5px 5px 1px 1px; } .demo-bar.blue { background: #0ea5e9; } .demo-bar.green { background: #22c55e; } .demo-bar.gray { background: #94a3b8; } .demo-bar-group small { position: absolute; bottom: -.95rem; color: var(--muted); font-size: .62rem; }
.demo-section-heading { padding: 1.6rem 0 1rem; } .demo-section-heading h2 { margin: 0; font-size: 1.65rem; letter-spacing: -.03em; }
.demo-recommendation-grid, .demo-economy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } .demo-recommendation-card { position: relative; } .demo-recommendation-badge { display: inline-block; margin-bottom: 1.1rem; padding: .35rem .55rem; border-radius: 999px; font-size: .64rem; font-weight: 800; letter-spacing: .07em; } .demo-recommendation-badge.good { color: #166534; background: #dcfce7; } .demo-recommendation-badge.neutral { color: #075985; background: #e0f2fe; } .demo-recommendation-badge.wait { color: #9a3412; background: #ffedd5; }
.demo-recommendation-card h3 { margin: 0; font-size: 1rem; } .demo-recommendation-card > strong { display: block; margin: .4rem 0 1rem; font-size: 1.4rem; } .demo-recommendation-card p { min-height: 2.5rem; margin: 0; color: var(--muted); font-size: .75rem; } .demo-recommendation-card p b { color: var(--text); }
.demo-score { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .55rem; margin-top: 1.3rem; color: var(--muted); font-size: .68rem; } .demo-score > i { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; } .demo-score > i b { display: block; height: 100%; border-radius: inherit; background: #22c55e; } .demo-score strong { color: var(--text); }
.demo-economy-grid { grid-template-columns: .8fr 1.2fr; } .demo-economy-highlight { display: grid; align-content: start; background: linear-gradient(145deg, #062b67, #0b5aa7); color: white; } .demo-economy-highlight .demo-eyebrow, .demo-economy-highlight p, .demo-economy-highlight small { color: #bfdbfe; } .demo-economy-highlight > strong { margin-top: .35rem; font-size: 2.2rem; } .demo-economy-highlight p { margin: .2rem 0 1rem; } .demo-pie { display: grid; place-items: center; width: 108px; height: 108px; margin: .5rem 0 1rem; border-radius: 50%; background: conic-gradient(#4ade80 0 66%, rgba(255,255,255,.2) 66% 100%); } .demo-pie::after { content: ""; position: absolute; width: 76px; height: 76px; border-radius: 50%; background: #0b4f91; } .demo-pie b { position: relative; z-index: 1; }
.demo-table-card { display: grid; align-content: start; gap: 0; } .demo-economy-row { display: flex; justify-content: space-between; padding: .9rem 0; border-bottom: 1px solid var(--border); color: var(--muted); font-size: .8rem; } .demo-economy-row b { color: var(--text); } .demo-economy-row .green-text { color: #16a34a; } .demo-economy-row.total { border-bottom: 0; font-size: .95rem; font-weight: 800; }
.demo-footer { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .68rem; }
@media (max-width: 900px) { .demo-page { padding: 0 1rem 1.5rem; } .demo-intro { align-items: stretch; flex-direction: column; } .demo-site-selector { min-width: 0; } .demo-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .demo-main-grid, .demo-recommendation-grid, .demo-economy-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .demo-header { align-items: flex-start; flex-direction: column; padding: 1rem 0; } .demo-header-meta { width: 100%; justify-content: space-between; } .demo-metric-grid { grid-template-columns: 1fr 1fr; gap: .6rem; } .demo-metric { padding: .85rem; } .demo-metric strong { font-size: 1.45rem; } .demo-flow { grid-template-columns: 1fr; gap: .35rem; padding: .8rem 0; } .demo-flow-line { width: 4px; height: 22px; margin: 0 auto; } .demo-flow-line i { width: 100% !important; height: 70%; } .demo-flow-line small { position: absolute; left: 12px; top: 3px; margin: 0; } .demo-flow-summary { display: grid; gap: .5rem; } .demo-footer { flex-direction: column; } }

.edc-billing-closure-card {
    margin: 1rem 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    border-left: 4px solid #f59e0b;
}

.edc-billing-closure-card.is-closed { border-left-color: #22c55e; }
.edc-billing-closure-card h3 { margin: .2rem 0; }
.edc-billing-closure-card p { margin: 0; color: var(--muted); }
.edc-billing-closure-card small { display: block; margin-top: .45rem; color: var(--muted); }

@media (max-width: 760px) {
    .billing-payment-layout { grid-template-columns: 1fr; }
    .billing-annual-chart { min-width: 620px; }
    .billing-annual-card { overflow-x: auto; }
    .billing-share-chart { width: 100%; justify-content: flex-start; }
    .billing-document-share-chart { margin-left: 0; }
    .billing-selected-section .billing-kpi-grid-wide { grid-template-columns: 1fr; }
    .edc-billing-closure-card { align-items: stretch; flex-direction: column; }
}

:root[data-theme="dark"] {
    --bg: #0b1220;
    --panel: #111827;
    --panel-soft: #162033;
    --text: #e5edf7;
    --muted: #94a3b8;
    --primary: #38bdf8;
    --primary-dark: #dbeafe;
    --primary-soft: rgba(56, 189, 248, 0.16);
    --border: rgba(148, 163, 184, 0.26);
    --danger: #fca5a5;
    --danger-soft: rgba(127, 29, 29, 0.42);
    --success: #86efac;
    --success-soft: rgba(20, 83, 45, 0.36);
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

h1,
h2,
h3 {
    border: none;
    outline: none;
    box-shadow: none;
}

/* ================================
   Layout
================================ */

.app-shell {
    min-height: 100vh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
}

.app-header-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 10px 20px;
}

.app-main {
    min-width: 0;
}

.app-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 22px 20px;
}

/* ================================
   Navigation
================================ */

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    min-width: max-content;
}

.brand-logo {
    height: 44px;
    width: auto;
    display: block;
}

.brand-logo-dark {
    display: none;
}

:root[data-theme="dark"] .brand-logo-light {
    display: none;
}

:root[data-theme="dark"] .brand-logo-dark {
    display: block;
}

.nav-toggle {
    display: none;
}

.nav-toggle-button {
    display: none;
    border: 1px solid var(--border);
    background: var(--panel);
    border-radius: 12px;
    padding: 7px 11px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: var(--muted);
    padding: 9px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
    transition: 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.nav-link-logout,
.nav-link-user {
    background: var(--panel-soft);
    border: 1px solid var(--border);
    color: var(--primary-dark);
}

/* ================================
   Page header
================================ */

.page-header {
    margin-bottom: 24px;
}

.page-header-with-refresh {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.page-title {
    font-size: 32px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.03em;
    color: var(--text);
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.page-description {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 15px;
}

/* ================================
   Cards, panels
================================ */

.card,
.panel {
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 24px;
    box-shadow: var(--shadow);
    transition: .18s ease;
}

.card:hover,
.panel:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

.card {
    padding: 18px;
}

.panel {
    margin-top: 14px;
    padding: 18px;
}

.panel-header,
.overview-card-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.panel-header h2,
.overview-card-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 850;
    color: var(--text);
    letter-spacing: -0.02em;
}

.panel-header p,
.overview-card-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* ================================
   Grids
================================ */

.dashboard-grid,
.overview-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.dashboard-two-column {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 14px;
    margin-top: 14px;
}

.overview-layout {
    display: block;
    margin-bottom: 24px;
}

/* ================================
   Metric cards
================================ */

.metric-card {
    position: relative;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 22px;
    padding: 20px;
    min-height: 112px;
    box-shadow: var(--shadow);
}

.metric-card::after {
    content: "";
    position: absolute;
    right: -38px;
    top: -38px;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: rgba(224, 242, 254, 0.75);
    opacity: 0.55;
    pointer-events: none;
}

.metric-card-blue::after,
.metric-card-green::after,
.metric-card-yellow::after,
.metric-card-purple::after,
.metric-card-orange::after {
    background: rgba(224, 242, 254, 0.75);
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.metric-header .metric-icon {
    margin-bottom: 0;
    flex-shrink: 0;
}

.metric-header .metric-label {
    margin: 0;
    line-height: 1.3;
}

.metric-icon {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    font-size: 18px;
    line-height: 1;
}

.metric-label {
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.metric-value {
    position: relative;
    z-index: 1;
    margin-top: 4px;
    font-size: 30px;
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: -0.04em;
    color: var(--text);
}

.metric-unit {
    font-size: 12px;
    color: var(--muted);
    font-weight: 800;
}

.metric-subvalue {
    position: relative;
    z-index: 1;
    margin-top: 6px;
    color: var(--text);
    font-size: 13px;
    line-height: 1.35;
}

.metric-card-wide {
    grid-column: span 2;
}

.metric-split {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: end;
    margin-top: 6px;
}

.metric-split > div + div {
    border-left: 1px solid var(--border);
    padding-left: 14px;
}

.metric-split-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
}

/* staré accent classy sjednocené na modrou */
.overview-accent-yellow,
.overview-accent-green,
.overview-accent-blue,
.overview-accent-purple,
.overview-accent-orange,
.overview-accent-sky,
.overview-accent-indigo,
.overview-accent-cyan,
.overview-accent-slate {
    --metric-accent-bg: rgba(239, 246, 255, 0.95);
    --metric-accent-border: rgba(191, 219, 254, 0.95);
    --metric-accent-color: #1d4ed8;
    --metric-glow: rgba(59, 130, 246, 0.08);
}

/* ================================
   Status, messages
================================ */

.text-success {
    color: #16a34a;
}

.text-danger {
    color: #dc2626;
}

.text-muted {
    color: var(--muted);
}

.status-good,
.status-neutral {
    border-radius: 999px;
    padding: 6px 10px;
    display: inline-block;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.status-good {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.status-neutral {
    background: #e2e8f0;
    color: #334155;
}

.error-panel,
.success-panel,
.warning-panel {
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 18px;
    font-weight: 750;
    font-size: 13px;
}

.error-panel {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.success-panel {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid #bbf7d0;
}

.empty-state {
    background: var(--panel-soft);
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

/* ================================
   Forms, buttons, toolbar
================================ */

.toolbar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
}


/* ================================
   Single day date selector
================================ */

.single-date-filter-panel {
    margin-bottom: 18px;
}

.single-date-filter-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.day-date-selector {
    display: inline-grid;
    grid-template-columns: 44px minmax(220px, 280px) 44px;
    align-items: end;
    gap: 10px;
}

.day-date-field {
    min-width: 0;
}

.day-date-field input[type="date"] {
    width: 100%;
}

.day-date-arrow {
    width: 44px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #ffffff;
    color: var(--text);
    font-size: 26px;
    line-height: 1;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: 0.18s ease;
}

.day-date-arrow:hover:not(:disabled) {
    transform: translateY(-1px);
    border-color: rgba(29, 140, 248, 0.45);
    color: #1d8cf8;
    box-shadow: 0 12px 26px rgba(21, 151, 242, 0.16);
}

.day-date-arrow:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    box-shadow: none;
}
.date-refresh-button {
    height: 40px;
}

@media (max-width: 640px) {
    .single-date-filter-row {
        align-items: stretch;
    }

    .day-date-selector {
        width: 100%;
        grid-template-columns: 42px minmax(0, 1fr) 42px;
    }

    .date-refresh-button {
        width: 100%;
    }
}

.search-box {
    flex: 1;
    max-width: 520px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
}

.search-box input {
    border: none;
    outline: none;
    width: 100%;
    background: transparent;
    font-weight: 650;
    font-size: 13px;
}

.primary-button,
.secondary-button {
    border: none;
    border-radius: 12px;
    padding: 11px 18px;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.2s;
    white-space: nowrap;
}

.primary-button {
    background: #1d8cf8;
    color: white;
    box-shadow: 0 10px 22px rgba(21, 151, 242, 0.22);
}

.primary-button:hover {
    background: #0f7ae5;
}

.secondary-button {
    background: #eef2f7;
    color: #334155;
    border: 1px solid var(--border);
    margin-top: 5px;
}

.secondary-button:hover {
    background: #dfe7ef;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    padding: 0.6rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.admin-table th {
    text-align: left;
    color: var(--muted);
    font-weight: 750;
}

.table-input {
    width: 10rem;
    min-height: 2.25rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card);
    color: var(--text);
}

.table-input-wide {
    width: 18rem;
}

.mqtt-settings-layout {
    display: grid;
    gap: 24px;
}

.mqtt-settings-card {
    display: grid;
    gap: 18px;
}

.mqtt-mappings-section {
    margin-top: 4px;
}

.mqtt-mapping-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.mqtt-mapping-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
}

.mqtt-mapping-main {
    display: grid;
    grid-template-columns: 88px minmax(260px, 1.6fr) minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: start;
}

.mqtt-mapping-details {
    display: grid;
    grid-template-columns: minmax(140px, 0.8fr) minmax(140px, 0.8fr) minmax(180px, 1fr) minmax(78px, 0.45fr) minmax(120px, 0.7fr) minmax(86px, 0.45fr);
    gap: 10px;
    align-items: start;
}

.mqtt-field {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.mqtt-field span,
.mqtt-active-toggle span,
.mqtt-cell-hint {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
}

.mqtt-cell-hint {
    display: block;
    line-height: 1.25;
}

.mqtt-field .table-input {
    width: 100%;
    min-width: 0;
}

.mqtt-active-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 2.25rem;
    margin-top: 20px;
    font-weight: 750;
}

.mqtt-row-action {
    margin-top: 20px;
    min-height: 2.25rem;
    white-space: nowrap;
}

.mqtt-section-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 12px;
    font-weight: 750;
    color: var(--muted);
}

.form-field input,
.form-field select,
.form-field textarea,
.assign-box select {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13px;
    background: white;
    outline: none;
}

.form-field-wide {
    grid-column: 1 / -1;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 6px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

/* ================================
   Refresh ring
================================ */

.refresh-ring-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px;
    box-shadow: var(--shadow);
    min-width: max-content;
}

.dashboard-header-actions {
    align-items: center;
    gap: 10px;
}

.dashboard-performance-toggle {
    min-height: 46px;
    margin-top: 0;
    border-radius: 999px;
    padding: 10px 14px;
}

.dashboard-performance-toggle.active {
    background: var(--primary-soft);
    border-color: rgba(21, 151, 242, 0.35);
    color: var(--primary-dark);
}

.refresh-ring {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: conic-gradient(var(--primary) var(--progress), #e2e8f0 0);
    display: grid;
    place-items: center;
    position: relative;
}

.refresh-ring::after {
    content: "";
    position: absolute;
    inset: 4px;
    background: white;
    border-radius: 999px;
}

.refresh-ring span {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 850;
    color: var(--primary-dark);
}

/* ================================
   Dashboard blocks
================================ */

.recommendation-box,
.export-control-box {
    border-radius: 14px;
    padding: 14px;
    border: 1px solid var(--border);
}

.recommendation-box {
    background: linear-gradient(135deg, var(--primary-soft), #ffffff);
}

.recommendation-title {
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 850;
    margin-bottom: 6px;
}

.recommendation-text {
    font-size: 15px;
    font-weight: 700;
}

.battery-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin-top: 14px;
}

.battery-fill {
    height: 100%;
    background: linear-gradient(90deg, #1597f2, #0b72e7);
    border-radius: 999px;
}

.export-control-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: var(--panel-soft);
}

.export-limit {
    margin-top: 6px;
    font-size: 28px;
    font-weight: 900;
    color: var(--primary-dark);
    letter-spacing: -0.04em;
}

.export-limit span {
    font-size: 13px;
    color: var(--muted);
}

.export-mode {
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 750;
    color: var(--primary-dark);
}

/* ================================
   Consumption points
================================ */

.consumption-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.consumption-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.consumption-card-header,
.admin-user-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.consumption-card-header h2,
.admin-user-header h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 850;
}

.consumption-card-header p,
.admin-user-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.consumption-meta {
    display: grid;
    gap: 9px;
}

.consumption-meta div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.consumption-meta span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.consumption-meta strong {
    text-align: right;
    font-size: 13px;
}

.consumption-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
}

/* ================================
   Reservations
================================ */

.reservation-list,
.assigned-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reservation-item,
.assigned-item {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}

.reservation-item strong,
.assigned-item strong {
    display: block;
    font-size: 13px;
    font-weight: 850;
}

.reservation-item span,
.assigned-item span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}

.reservation-time {
    font-weight: 850;
    color: var(--primary-dark);
    white-space: nowrap;
    font-size: 13px;
}

.reservation-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ================================
   Admin
================================ */

.admin-users-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.admin-user-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.admin-section-title {
    font-size: 11px;
    font-weight: 850;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.assign-box {
    display: flex;
    gap: 10px;
    align-items: center;
}

.assign-box select {
    flex: 1;
    border-radius: 999px;
}

/* ================================
   Point summaries
================================ */

.point-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.point-summary-card {
    text-align: left;
    background: var(--panel-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    color: var(--text);
    transition: 0.15s ease;
}

.point-summary-card:hover,
.point-summary-card.active {
    background: var(--primary-soft);
    border-color: rgba(21, 151, 242, 0.45);
}

.point-summary-card strong {
    display: block;
    font-size: 14px;
    font-weight: 850;
    color: var(--primary-dark);
    margin-bottom: 7px;
}

.point-summary-card span {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.point-summary-card em {
    display: inline-block;
    margin-top: 10px;
    font-style: normal;
    font-size: 12px;
    font-weight: 800;
    color: var(--primary-dark);
}

.report-filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.report-filter-tabs button {
    appearance: none;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    color: var(--primary-dark);
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.report-filter-tabs button.active,
.report-filter-tabs button:hover {
    background: var(--primary-soft);
    border-color: rgba(21, 151, 242, 0.45);
}

/* ================================
   Reports chart
================================ */

.simple-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chart-row {
    display: grid;
    grid-template-columns: 78px 1fr 78px;
    gap: 10px;
    align-items: center;
}

.chart-label,
.chart-value {
    font-size: 11px;
    color: var(--muted);
    font-weight: 750;
}

.chart-value {
    text-align: right;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chart-bar {
    height: 7px;
    border-radius: 999px;
    min-width: 2px;
}

.chart-bar-consumption,
.legend-consumption {
    background: #1e40af;
}

.chart-bar-shared,
.legend-shared {
    background: #0ea5e9;
}

.chart-bar-supplier,
.legend-supplier {
    background: #94a3b8;
}

.daily-chart.grouped {
    height: 260px;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 22px 10px 10px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.95));
    border: 1px solid rgba(226, 232, 240, 0.9);
}

.daily-chart-group {
    flex: 1;
    min-width: 7px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.daily-chart-bar {
    flex: 1;
    min-width: 2px;
    min-height: 2px;
    border-radius: 999px 999px 4px 4px;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.daily-chart-consumption {
    background: rgba(30, 64, 175, 0.75);
}

.daily-chart-shared {
    background: rgba(14, 165, 233, 0.75);
}

.daily-chart-supplier {
    background: rgba(148, 163, 184, 0.75);
}

.daily-chart-group:hover .daily-chart-bar {
    opacity: 0.9;
    transform: translateY(-2px);
}

.chart-legend,
.overview-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    align-items: center;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.chart-legend i,
.overview-legend i {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    flex-shrink: 0;
}

.chart-legend span,
.overview-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.chart-legend.interactive button,
.overview-legend.interactive button {
    appearance: none;
    border: 1px solid rgba(203, 213, 225, 0.85);
    background: rgba(255, 255, 255, 0.86);
    color: #475569;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 0.84rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    line-height: 1;
    box-shadow: none;
    transition: all 0.15s ease;
}

.chart-legend.interactive button:hover,
.chart-legend.interactive button.active,
.overview-legend.interactive button:hover,
.overview-legend.interactive button.active {
    background: rgba(239, 246, 255, 0.95);
    border-color: rgba(125, 211, 252, 0.9);
    color: #0f3768;
}

/* ================================
   Dashboard overview
================================ */

.overview-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto auto;
    gap: 16px;
    align-items: end;
    padding: 22px;
    margin-bottom: 24px;
}

.overview-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.overview-filter label {
    font-size: 12px;
    color: var(--muted);
    font-weight: 750;
}

.overview-filter input,
.overview-filter select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: white;
    font-size: 13px;
    outline: none;
}

.overview-toolbar .primary-button,
.overview-toolbar .secondary-button {
    height: 42px;
}

.overview-chart-card,
.overview-table-card {
    padding: 24px;
    margin-bottom: 24px;
}

.overview-chart-card {
    overflow: hidden;
}

.overview-chart {
    height: 300px;
    max-height: 300px;
    min-height: 300px;
    box-sizing: border-box;
    display: flex;
    align-items: stretch;
    gap: 3px;
    padding: 18px 10px 8px;
    border-radius: 22px;
    background:
        linear-gradient(to top, rgba(226, 232, 240, 0.58) 1px, transparent 1px),
        linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.96));
    background-size: 100% 58px, 100% 100%;
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow-x: auto;
    overflow-y: hidden;
}

.overview-chart-column {
    flex: 1 0 13px;
    min-width: 13px;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) 20px;
    gap: 6px;
}

.overview-bars {
    min-height: 0;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.32);
}

.overview-bar {
    flex: 1;
    min-width: 2px;
    max-width: 7px;
    min-height: 2px;
    border-radius: 999px 999px 4px 4px;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.overview-chart-column:hover .overview-bar {
    opacity: 0.9;
    transform: translateY(-2px);
}

.overview-production,
.legend-production {
    background: rgba(30, 64, 175, 0.70);
}

.overview-own,
.legend-own {
    background: rgba(14, 165, 233, 0.68);
}

.overview-consumers,
.legend-consumers {
    background: rgba(148, 163, 184, 0.74);
}

.overview-export,
.legend-export {
    background: rgba(71, 85, 105, 0.56);
}

.overview-chart-label {
    height: 20px;
    max-height: 20px;
    font-size: 0.64rem;
    color: #94a3b8;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    line-height: 1;
}

.overview-balance-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0 24px;
}

.overview-balance-mini {
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    padding: 16px;
}

.overview-balance-mini span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.overview-balance-mini strong {
    display: block;
    margin-top: 8px;
    font-size: 26px;
    font-weight: 850;
    color: var(--text);
}

.overview-balance-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
}

.overview-balance-split > div {
    min-width: 0;
}

.overview-balance-split > div + div {
    border-left: 1px solid var(--border);
    padding-left: 16px;
}

.overview-balance-split span {
    font-size: 11px;
}

.overview-balance-split strong {
    margin-top: 6px;
    font-size: 22px;
}

.overview-balance-card,
.overview-donut,
.overview-balance-list {
    display: none;
}

/* ================================
   Tables
================================ */

.report-table-wrapper {
    overflow-x: auto;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
}

.report-table thead {
    background: #f8fafc;
}

.report-table th,
.report-table td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
    font-size: 13px;
}

.report-table th {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 800;
}

.report-table tbody tr:hover {
    background: rgba(21, 151, 242, 0.035);
    transition: background .15s ease;
}

.sortable-table th button {
    appearance: none;
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
}

.sortable-table th button:hover {
    color: #0f3768;
}

/* ================================
   Allocation
================================ */

.allocation-diff-positive {
    color: #166534;
    font-weight: 850;
}

.allocation-diff-negative {
    color: #b91c1c;
    font-weight: 850;
}

.allocation-diff-neutral {
    color: var(--muted);
    font-weight: 750;
}

/* ================================
   Modal
================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 24px;
    backdrop-filter: blur(6px);
}

.modal-window {
    width: 100%;
    max-width: 760px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 800;
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted);
    padding: 0;
}

.modal-body {
    padding: 28px;
}

/* ================================
   Admin healthcheck
================================ */

.admin-health-panel {
    margin-top: 24px;
    padding: 22px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

.admin-health-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.admin-health-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 800;
}

.admin-health-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.admin-health-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-health-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.admin-health-refresh {
    min-height: 36px;
    padding: 8px 13px;
}

.admin-health-meta {
    margin-bottom: 12px;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 700;
}

.admin-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
    gap: 14px;
}

.admin-health-card {
    position: relative;
    min-height: 150px;
    padding: 16px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(226, 232, 240, 0.92);
    overflow: hidden;
}

.admin-health-card::after {
    content: "";
    position: absolute;
    top: -42px;
    right: -32px;
    width: 104px;
    height: 104px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.06);
    pointer-events: none;
}

.admin-health-card-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.admin-health-icon {
    width: 34px;
    height: 34px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 246, 255, 0.95);
    border: 1px solid rgba(191, 219, 254, 0.9);
    flex-shrink: 0;
}

.admin-health-card strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 850;
    line-height: 1.25;
}

.admin-health-card span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.admin-health-badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 850;
    border: 1px solid transparent;
}

.admin-health-detail {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    color: #475569;
    font-size: 0.82rem;
    line-height: 1.45;
}

.admin-health-lastseen {
    position: relative;
    z-index: 1;
    margin-top: 9px;
    color: #94a3b8;
    font-size: 0.76rem;
    font-weight: 700;
}

.admin-health-ok.admin-health-card::after,
.admin-health-card.admin-health-ok::after {
    background: rgba(37, 99, 235, 0.07);
}

.admin-health-warning.admin-health-card::after,
.admin-health-card.admin-health-warning::after {
    background: rgba(14, 165, 233, 0.08);
}

.admin-health-error-state.admin-health-card::after,
.admin-health-card.admin-health-error-state::after {
    background: rgba(239, 68, 68, 0.08);
}

.admin-health-ok.admin-health-summary,
.admin-health-ok.admin-health-badge {
    color: #1d4ed8;
    background: rgba(239, 246, 255, 0.95);
    border-color: rgba(191, 219, 254, 0.95);
}

.admin-health-warning.admin-health-summary,
.admin-health-warning.admin-health-badge {
    color: #0369a1;
    background: rgba(240, 249, 255, 0.95);
    border-color: rgba(186, 230, 253, 0.95);
}

.admin-health-error-state.admin-health-summary,
.admin-health-error-state.admin-health-badge {
    color: #b91c1c;
    background: rgba(254, 242, 242, 0.95);
    border-color: rgba(254, 202, 202, 0.95);
}

.admin-health-error {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(254, 242, 242, 0.92);
    border: 1px solid rgba(254, 202, 202, 0.95);
    color: #991b1b;
    font-size: 0.9rem;
    line-height: 1.45;
}

/* ================================
   Loading
================================ */

.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.skeleton-card {
    height: 120px;
    border-radius: 20px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

/* ================================
   Blazor error
================================ */

#blazor-error-ui {
    background: #fff7ed;
    border-top: 1px solid #fed7aa;
    bottom: 0;
    color: #9a3412;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
}

/* ================================
   Responsive
================================ */

@media (max-width: 1100px) {
    .overview-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .overview-balance-summary {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1000px) {
    .consumption-grid,
    .point-summary-grid {
        grid-template-columns: 1fr;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-box {
        max-width: none;
    }

    .report-filter-tabs {
        justify-content: flex-start;
    }
}

@media (max-width: 900px) {
    .app-header-inner {
        padding: 8px 14px;
    }

    .app-content {
        padding: 18px 14px;
    }

    .top-nav {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .nav-toggle-button {
        display: block;
        margin-left: auto;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 10px;
    }

    .nav-toggle:checked ~ .top-nav .nav-links {
        display: flex;
    }

    .nav-link {
        border-radius: 14px;
        padding: 11px 12px;
        background: var(--panel-soft);
    }

    .page-header-with-refresh,
    .panel-header,
    .overview-card-header,
    .export-control-box,
    .admin-user-header,
    .assigned-item,
    .assign-box,
    .reservation-item,
    .reservation-actions,
    .admin-health-header {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-header-actions {
        justify-content: flex-start;
    }

    .admin-health-actions {
        justify-content: flex-start;
    }

    .page-title {
        font-size: 26px;
    }

    .dashboard-grid,
    .skeleton-grid,
    .overview-kpi-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-two-column {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .metric-card-wide {
        grid-column: auto;
    }

    .metric-split {
        grid-template-columns: 1fr;
    }

    .metric-split > div + div {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 12px;
    }

    .chart-row {
        grid-template-columns: 72px 1fr;
    }

    .chart-value {
        grid-column: 2;
        text-align: left;
    }

    .modal-window {
        max-width: 100%;
        border-radius: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .admin-health-panel {
        padding: 18px;
    }
}

@media (max-width: 700px) {
    .overview-toolbar {
        grid-template-columns: 1fr;
    }
}

@media print {
    .app-header,
    .overview-toolbar,
    .overview-filter-card,
    .report-filter-tabs,
    .secondary-button,
    .primary-button {
        display: none !important;
    }

    .app-content {
        max-width: none;
        padding: 0;
    }

    .card {
        box-shadow: none;
        break-inside: avoid;
    }
}

/* =========================================================
   Compact top navigation
   ========================================================= */

.app-header-inner {
    max-width: 1540px;
    padding: 8px 18px;
}

.top-nav {
    gap: 14px;
}

.brand-logo {
    height: 38px;
}

.nav-links {
    flex: 1;
    min-width: 0;
    gap: 6px;
}

.nav-link {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 750;
}

.nav-user-area {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-link-user {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-group {
    position: relative;
    flex-shrink: 0;
}

.nav-group summary {
    list-style: none;
}

.nav-group summary::marker {
    display: none;
}

.nav-link-dropdown {
    cursor: pointer;
}

.nav-link-dropdown::after {
    content: "▾";
    font-size: 10px;
    opacity: 0.72;
    margin-left: 2px;
}

.nav-group[open] .nav-link-dropdown {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 80;
    min-width: 230px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(16px);
}

.nav-dropdown-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 750;
    white-space: nowrap;
    transition: 0.15s ease;
}

.nav-dropdown-link:hover,
.nav-dropdown-link.active {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.nav-user-menu .nav-dropdown-menu {
    min-width: 280px;
}

.nav-user-dropdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}

.nav-user-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-soft);
    color: var(--text);
}

.nav-user-card strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
}

.nav-user-card span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
}

.nav-theme-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
}

.nav-theme-section > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.nav-theme-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel-soft);
}

.nav-theme-toggle button {
    min-height: 34px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 850;
}

.nav-theme-toggle button:hover:not(:disabled),
.nav-theme-toggle button.active {
    background: var(--primary);
    color: #ffffff;
}

.nav-theme-toggle button:disabled {
    cursor: wait;
    opacity: .72;
}

.nav-dropdown-logout {
    margin-top: 4px;
    border-top: 1px solid var(--border);
    border-radius: 0 0 12px 12px;
    color: var(--danger);
}

@media (max-width: 1280px) {
    .app-header-inner {
        padding-left: 12px;
        padding-right: 12px;
    }

    .brand-logo {
        height: 34px;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-link {
        padding: 7px 8px;
        font-size: 11.5px;
    }

    .nav-link-user {
        max-width: 150px;
    }
}

@media (max-width: 1080px) {
    .nav-toggle-button {
        display: block;
        margin-left: auto;
    }

    .top-nav {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        padding-top: 10px;
    }

    .nav-toggle:checked ~ .top-nav .nav-links {
        display: flex;
    }

    .nav-link,
    .nav-link-user,
    .nav-link-logout {
        max-width: none;
        border-radius: 14px;
        padding: 11px 12px;
        background: var(--panel-soft);
        justify-content: flex-start;
    }

    .nav-user-area {
        width: 100%;
        margin-left: 0;
        flex-direction: column;
        align-items: stretch;
    }

    .nav-group {
        width: 100%;
    }

    .nav-dropdown-menu {
        position: static;
        min-width: 0;
        margin-top: 6px;
        box-shadow: none;
        background: rgba(248, 250, 252, 0.9);
    }
}


/* =========================================================
   Phase 5 polish: consumer selector + consumption chart axis
   ========================================================= */

.metric-header-with-actions {
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.metric-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.consumer-carousel-card .metric-split {
    align-items: start;
}

.consumer-carousel-card .metric-value {
    font-size: 24px;
}

.metric-card-actions {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: none;
    flex-shrink: 0;
}

.metric-card-actions button {
    appearance: none;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #334155;
    font-size: 18px;
    font-weight: 850;
    line-height: 1;
    cursor: pointer;
    transition: 0.15s ease;
}

.metric-card-actions button:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.metric-card-actions span {
    min-width: 38px;
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
}

.consumer-carousel-detail {
    align-items: center;
}

.daily-chart.grouped.with-axis {
    height: 300px;
    min-height: 300px;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 18px 10px 10px;
}

.daily-chart-group-wrapper {
    flex: 1 0 14px;
    min-width: 14px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
}

.daily-chart.grouped.with-axis .daily-chart-group {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    height: auto;
    min-height: 0;
}

.daily-chart-axis-label {
    height: 20px;
    max-height: 20px;
    color: #94a3b8;
    font-size: 0.64rem;
    font-weight: 750;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.daily-chart-group-wrapper:hover .daily-chart-bar {
    opacity: 0.9;
    transform: translateY(-2px);
}

@media (max-width: 900px) {
    .metric-header-with-actions {
        flex-direction: row;
        align-items: center;
    }

    .metric-card-actions span {
        min-width: 32px;
    }

    .daily-chart-group-wrapper {
        flex-basis: 18px;
        min-width: 18px;
    }
}

/* Billing chart */
.billing-chart-card {
    overflow: hidden;
}

.billing-chart {
    height: 260px;
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 22px 8px 8px;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow-x: auto;
    overflow-y: hidden;
}

.billing-chart-column {
    flex: 1 0 34px;
    min-width: 34px;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr 36px;
    gap: 8px;
    align-items: end;
}

.billing-chart-value-label {
    min-height: 16px;
    margin-bottom: 0;
    color: #334155;
    font-size: 0.68rem;
    font-weight: 850;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.billing-chart-bars {
    height: 100%;
    min-height: 180px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.billing-chart-bar {
    width: 12px;
    min-height: 2px;
    border-radius: 999px 999px 4px 4px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.billing-chart-column:hover .billing-chart-bar {
    transform: translateY(-2px);
    opacity: 0.9;
}

.billing-chart-edc {
    background: #0ea5e9;
}

.billing-chart-supplier {
    background: #94a3b8;
}

.billing-chart-label {
    min-height: 28px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    overflow: hidden;
}

/* Billing cleanup: jednotky menší než hodnota + schování starých cen z hlavního filtru. */
.billing-toolbar {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto auto;
    align-items: end;
}

.billing-price-note {
    margin-top: 18px;
    margin-bottom: 10px;
    padding: 16px 18px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}

.metric-value-with-unit {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.metric-unit-inline {
    font-size: 12px;
    line-height: 1;
    font-weight: 850;
    letter-spacing: -0.01em;
    color: var(--muted);
}

.billing-chart-card {
    overflow: hidden;
}

.billing-chart {
    min-height: 245px;
    padding: 22px 18px 12px;
}

.billing-chart-label {
    min-height: 32px;
    font-size: 11px;
    line-height: 1.2;
    color: var(--muted);
}

@media (max-width: 1100px) {
    .billing-toolbar {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}
.billing-toolbar {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr)) auto auto;
    gap: 14px;
    align-items: end;
}

.billing-print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin: 18px 0;
}

    .billing-print-header h2 {
        margin: 0 0 6px;
        font-size: 1.7rem;
        letter-spacing: -0.04em;
    }

    .billing-print-header p,
    .billing-print-header span {
        color: var(--muted);
    }

.billing-price-note {
    margin: 22px 0 12px;
    padding: 16px 18px;
    line-height: 1.45;
}

.billing-kpi-grid .metric-value {
    font-size: 2rem;
    line-height: 1.05;
}

.billing-kpi-grid .metric-unit-inline {
    font-size: .78rem;
    font-weight: 800;
    color: var(--muted);
}

.billing-chart-card {
    padding: 22px;
}

.billing-chart {
    height: 310px;
    padding: 24px 18px 14px;
    border-radius: 22px;
    overflow-x: auto;
}

.billing-chart-column {
    flex: 1 0 42px;
    min-width: 42px;
    grid-template-rows: 1fr 38px;
}

.billing-chart-bar {
    width: 10px;
}

.billing-table-card {
    margin-top: 18px;
}

@media (max-width: 1100px) {
    .billing-toolbar {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}
/* ================================
   User dashboard detail panels
================================ */

.user-dashboard-detail {
    align-items: stretch;
    margin-top: 26px;
}

.user-dashboard-detail .panel {
    padding: 24px;
    border-radius: 22px;
    min-height: 300px;
}

.user-panel-header {
    margin-bottom: 22px;
}

.user-panel-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 850;
    color: var(--text);
    letter-spacing: -0.03em;
}

.user-panel-header p {
    margin: 5px 0 0;
    max-width: 560px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.user-empty-state {
    min-height: 190px;
    display: grid;
    place-items: center;
    border: 1px dashed rgba(148, 163, 184, 0.45);
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.7);
    color: var(--muted);
    font-size: 14px;
}

.energy-mix-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 26px;
    align-items: center;
}

.energy-mix-donut {
    --edc: 0;
    --local-end: var(--edc);
    width: 190px;
    height: 190px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background:
        conic-gradient(#0ea5e9 0 calc(var(--edc) * 1%), #22c55e calc(var(--edc) * 1%) calc(var(--local-end) * 1%), #e2e8f0 0),
        #e2e8f0;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.9), 0 18px 36px rgba(15, 23, 42, 0.08);
}

.energy-mix-donut-inner {
    width: 126px;
    height: 126px;
    border-radius: 999px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.9);
}

.energy-mix-donut-inner strong {
    font-size: 34px;
    line-height: 1;
    font-weight: 900;
    color: var(--text);
    letter-spacing: -0.05em;
}

.energy-mix-donut-inner span {
    margin-top: 7px;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
}

.energy-mix-list {
    display: grid;
    gap: 10px;
}

.energy-mix-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.72);
}

.energy-mix-row span {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.energy-mix-row strong {
    color: var(--text);
    font-size: 16px;
    font-weight: 900;
    white-space: nowrap;
}

.energy-mix-row-highlight {
    background: rgba(239, 246, 255, 0.95);
    border-color: rgba(191, 219, 254, 0.95);
}

.legend-dot,
.recommendation-good-dot,
.recommendation-neutral-dot,
.recommendation-bad-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 auto;
}

.legend-shared,
.recommendation-good-dot {
    background: #0ea5e9;
}

.legend-local {
    background: #22c55e;
}

.legend-supplier,
.recommendation-neutral-dot {
    background: #cbd5e1;
}

.recommendation-bad-dot {
    background: #f97316;
}

.hourly-recommendation-chart {
    height: 190px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(24px, 1fr));
    gap: 8px;
    align-items: end;
    padding: 18px 16px 14px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 18px;
    background:
        linear-gradient(to top, rgba(226, 232, 240, 0.6) 1px, transparent 1px),
        linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.96));
    background-size: 100% 42px, 100% 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.hourly-recommendation-item {
    min-width: 24px;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 8px;
    align-items: end;
}

.hourly-recommendation-bar-wrap {
    height: 132px;
    display: flex;
    align-items: end;
    justify-content: center;
}

.hourly-recommendation-bar {
    width: 100%;
    min-height: 6px;
    border-radius: 999px 999px 6px 6px;
    background: #cbd5e1;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.hourly-recommendation-item.recommendation-good .hourly-recommendation-bar {
    background: #0ea5e9;
}

.hourly-recommendation-item.recommendation-neutral .hourly-recommendation-bar {
    background: #cbd5e1;
}

.hourly-recommendation-item.recommendation-bad .hourly-recommendation-bar {
    background: #f97316;
}

.hourly-recommendation-hour {
    display: block;
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
}

.recommendation-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 14px;
}

.recommendation-legend span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

@media (max-width: 900px) {
    .energy-mix-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .energy-mix-list {
        width: 100%;
    }
}

/* ================================
   Energy sale / FVE revenue page
================================ */

.revenue-page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.revenue-period-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    min-width: 120px;
    padding: 10px 16px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
}

    .revenue-period-badge span {
        color: var(--muted);
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .05em;
    }

    .revenue-period-badge strong {
        color: var(--text);
        font-size: 20px;
        font-weight: 850;
        letter-spacing: -0.03em;
    }

.revenue-control-card,
.revenue-scenario-card,
.revenue-energy-card,
.revenue-breakdown-card,
.revenue-table-card {
    border-radius: 24px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
}

.revenue-control-card {
    padding: 20px;
    margin-bottom: 18px;
}

.revenue-control-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

    .revenue-control-header h2,
    .revenue-scenario-card h2,
    .revenue-energy-card h2,
    .revenue-breakdown-card h2,
    .revenue-table-card h2 {
        margin: 0;
        font-size: 20px;
        line-height: 1.15;
        color: var(--text);
        letter-spacing: -0.03em;
    }

    .revenue-control-header p,
    .revenue-scenario-card p,
    .revenue-energy-card p,
    .revenue-breakdown-card p,
    .revenue-table-card p {
        margin: 6px 0 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.4;
    }

.revenue-recalculate-button {
    min-width: 160px;
    min-height: 42px;
    border-radius: 16px;
    font-weight: 850;
}

.revenue-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: end;
}

.input-with-unit {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
    overflow: hidden;
}

    .input-with-unit input {
        flex: 1;
        min-width: 0;
        border: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
    }

    .input-with-unit span {
        display: inline-flex;
        align-items: center;
        padding: 0 12px;
        color: var(--muted);
        background: var(--panel-soft);
        border-left: 1px solid var(--border);
        font-size: 12px;
        font-weight: 800;
        white-space: nowrap;
    }

.revenue-options-panel {
    grid-column: span 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.toggle-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    cursor: pointer;
}

    .toggle-row input {
        margin-top: 3px;
        width: 16px;
        height: 16px;
        accent-color: var(--primary);
        flex-shrink: 0;
    }

    .toggle-row span {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .toggle-row strong {
        color: var(--text);
        font-size: 13px;
        font-weight: 850;
    }

    .toggle-row small {
        color: var(--muted);
        font-size: 12px;
        line-height: 1.35;
    }

.revenue-kpi-grid {
    margin-top: 0;
}

.revenue-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.revenue-scenario-card,
.revenue-energy-card,
.revenue-breakdown-card,
.revenue-table-card {
    padding: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.scenario-comparison {
    display: grid;
    gap: 14px;
}

.scenario-row {
    display: grid;
    grid-template-columns: 190px 1fr;
    gap: 14px;
    align-items: center;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
}

.scenario-row-highlight {
    background: linear-gradient(135deg, rgba(224, 242, 254, 0.9), rgba(255, 255, 255, 0.9));
}

.scenario-row span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.scenario-row strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-size: 24px;
    font-weight: 850;
    letter-spacing: -0.04em;
}

.scenario-bar-track,
.energy-flow-track {
    position: relative;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.scenario-bar,
.energy-flow-fill {
    width: var(--bar-width);
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #38bdf8);
    transition: width .2s ease;
}

.revenue-note {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-radius: 18px;
    font-size: 13px;
}

    .revenue-note strong {
        color: var(--text);
        font-weight: 850;
    }

    .revenue-note span {
        color: var(--muted);
        font-weight: 750;
    }

.revenue-note-positive {
    background: var(--success-soft);
    border: 1px solid rgba(22, 101, 52, 0.16);
}

.revenue-note-negative {
    background: var(--danger-soft);
    border: 1px solid rgba(185, 28, 28, 0.16);
}

.energy-flow-stack {
    display: grid;
    gap: 13px;
}

.energy-flow-item {
    display: grid;
    gap: 8px;
}

.energy-flow-label {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

    .energy-flow-label strong {
        color: var(--text);
        font-weight: 850;
    }

.energy-flow-fill-muted {
    background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

.revenue-energy-total {
    margin-top: 18px;
    padding: 14px;
    border-radius: 18px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

    .revenue-energy-total span {
        color: var(--muted);
        font-size: 12px;
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .revenue-energy-total strong {
        color: var(--primary-dark);
        font-size: 22px;
        font-weight: 850;
        letter-spacing: -0.04em;
    }

.revenue-breakdown-card {
    margin-bottom: 14px;
}

.revenue-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.revenue-breakdown-grid-wide {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.breakdown-box {
    padding: 15px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
}

    .breakdown-box span,
    .breakdown-box small {
        display: block;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.35;
    }

    .breakdown-box span {
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .04em;
    }

    .breakdown-box strong {
        display: block;
        margin: 8px 0 6px;
        color: var(--text);
        font-size: 22px;
        font-weight: 850;
        letter-spacing: -0.04em;
    }

.breakdown-box-positive strong {
    color: var(--success);
}

.breakdown-box-negative strong {
    color: var(--danger);
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.table-scroll {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

    .data-table thead {
        background: #f8fafc;
    }

    .data-table th,
    .data-table td {
        padding: 13px 12px;
        border-bottom: 1px solid var(--border);
        text-align: left;
        white-space: nowrap;
        font-size: 13px;
    }

    .data-table th {
        color: var(--muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .05em;
        font-weight: 850;
    }

    .data-table tbody tr:hover {
        background: rgba(21, 151, 242, 0.035);
    }

    .data-table .number {
        text-align: right;
    }

.revenue-data-table td:first-child,
.revenue-data-table th:first-child {
    padding-left: 16px;
}

.empty-table-cell {
    text-align: center !important;
    color: var(--muted);
    padding: 26px !important;
}

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.metric-card-red::after {
    background: rgba(254, 226, 226, 0.8);
}

@media (max-width: 1100px) {
    .revenue-form-grid,
    .revenue-breakdown-grid,
    .revenue-breakdown-grid-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .revenue-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .revenue-page-header,
    .revenue-control-header,
    .revenue-note,
    .revenue-energy-total {
        align-items: stretch;
        flex-direction: column;
    }

    .revenue-period-badge {
        align-items: flex-start;
    }

    .revenue-form-grid,
    .revenue-options-panel,
    .revenue-breakdown-grid,
    .revenue-breakdown-grid-wide {
        grid-template-columns: 1fr;
    }

    .revenue-options-panel {
        grid-column: auto;
    }

    .scenario-row {
        grid-template-columns: 1fr;
    }

    .revenue-recalculate-button {
        width: 100%;
    }
}

/* ================================
   Performance-friendly dashboard refresh
   - the countdown ring runs in CSS, so Blazor does not re-render every second
================================ */

.refresh-ring-css {
    --progress: 0%;
    animation: dashboard-refresh-ring 10s linear infinite;
}

@keyframes dashboard-refresh-ring {
    0% {
        --progress: 0%;
    }

    10% {
        --progress: 10%;
    }

    20% {
        --progress: 20%;
    }

    30% {
        --progress: 30%;
    }

    40% {
        --progress: 40%;
    }

    50% {
        --progress: 50%;
    }

    60% {
        --progress: 60%;
    }

    70% {
        --progress: 70%;
    }

    80% {
        --progress: 80%;
    }

    90% {
        --progress: 90%;
    }

    100% {
        --progress: 100%;
    }
}

/* Dashboard forecast resilience */
.forecast-note {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(245, 158, 11, 0.10);
    color: #92400e;
    font-size: 0.9rem;
    line-height: 1.35;
}

.recommendation-waiting-price .hourly-recommendation-bar {
    opacity: 0.45;
}

/* Admin dashboard performance metrics */

.admin-performance-panel {
    margin-top: 24px;
    padding: 22px;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.06);
}

.admin-performance-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

    .admin-performance-header h2 {
        margin: 0;
        color: var(--text);
        font-size: 1.2rem;
        font-weight: 850;
        letter-spacing: -0.03em;
    }

    .admin-performance-header p {
        margin: 4px 0 0;
        color: var(--muted);
        font-size: 0.92rem;
        line-height: 1.4;
    }

.admin-performance-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: max-content;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 850;
    border: 1px solid transparent;
}

.admin-performance-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: 14px;
}

.admin-performance-card {
    position: relative;
    min-height: 138px;
    padding: 16px;
    border-radius: 22px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(226, 232, 240, 0.92);
}

    .admin-performance-card::after {
        content: "";
        position: absolute;
        top: -42px;
        right: -34px;
        width: 112px;
        height: 112px;
        border-radius: 999px;
        background: rgba(59, 130, 246, 0.07);
        pointer-events: none;
    }

.admin-performance-card-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.admin-performance-icon {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    background: rgba(239, 246, 255, 0.95);
    border: 1px solid rgba(191, 219, 254, 0.9);
    font-size: 18px;
}

.admin-performance-card strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 850;
    line-height: 1.25;
}

.admin-performance-card span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.25;
    word-break: break-word;
}

.admin-performance-main {
    position: relative;
    z-index: 1;
    margin-top: 16px;
    color: var(--text);
    font-size: 2rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.06em;
}

.admin-performance-detail {
    position: relative;
    z-index: 1;
    margin-top: 10px;
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.4;
}

.admin-performance-empty {
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.92);
    border: 1px dashed rgba(148, 163, 184, 0.45);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.admin-performance-ok.admin-performance-summary {
    color: #1d4ed8;
    background: rgba(239, 246, 255, 0.95);
    border-color: rgba(191, 219, 254, 0.95);
}

.admin-performance-warning.admin-performance-summary {
    color: #0369a1;
    background: rgba(240, 249, 255, 0.95);
    border-color: rgba(186, 230, 253, 0.95);
}

.admin-performance-error.admin-performance-summary {
    color: #b91c1c;
    background: rgba(254, 242, 242, 0.95);
    border-color: rgba(254, 202, 202, 0.95);
}

.admin-performance-ok.admin-performance-card::after {
    background: rgba(37, 99, 235, 0.07);
}

.admin-performance-warning.admin-performance-card::after {
    background: rgba(14, 165, 233, 0.10);
}

.admin-performance-error.admin-performance-card::after {
    background: rgba(239, 68, 68, 0.10);
}

@media (max-width: 900px) {
    .admin-performance-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-performance-card-grid {
        grid-template-columns: 1fr;
    }
}
/* ================================
   Admin healthcheck - compact worker actions
================================ */

.admin-health-worker-actions {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.admin-health-worker-button {
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.76rem;
    line-height: 1.1;
    white-space: nowrap;
}

/* ================================
   User dashboard forecast / consumption layout
   2026-05-19
   - Forecast is wider and rendered first on desktop.
   - Daily consumption is narrower and rendered second.
   - Original styles above are preserved; these rules only override the relevant layout.
================================ */

.user-dashboard-detail.dashboard-two-column {
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.85fr);
    align-items: stretch;
}

.user-dashboard-detail .user-forecast-panel {
    order: 1;
    min-width: 0;
}

.user-dashboard-detail .user-energy-mix-panel {
    order: 2;
    min-width: 0;
}

.user-dashboard-detail .user-forecast-panel .user-panel-header p {
    max-width: 760px;
}

.user-dashboard-detail .user-energy-mix-panel .energy-mix-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 22px;
}

.user-dashboard-detail .user-energy-mix-panel .energy-mix-list {
    width: 100%;
}

.user-dashboard-detail .user-energy-mix-panel .energy-mix-donut {
    width: 176px;
    height: 176px;
}

.user-dashboard-detail .user-energy-mix-panel .energy-mix-donut-inner {
    width: 116px;
    height: 116px;
}

.user-dashboard-detail .user-energy-mix-panel .energy-mix-donut-inner strong {
    font-size: 31px;
}

/* Forecast V2 summary chips. Kept here so the CSS works with both the current
   and the Forecast V2 UserDashboardContent markup. */
.forecast-summary-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.forecast-summary-chip {
    min-width: 132px;
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.95);
    border: 1px solid rgba(226, 232, 240, 0.92);
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.1;
}

.forecast-summary-chip strong {
    color: var(--text);
    font-size: 1rem;
    font-weight: 900;
}

.forecast-summary-chip-good {
    background: rgba(236, 253, 245, 0.92);
    border-color: rgba(167, 243, 208, 0.9);
    color: #047857;
}

.hourly-recommendation-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    scrollbar-width: thin;
}

.user-dashboard-detail .user-forecast-panel .hourly-recommendation-chart {
    min-width: max-content;
    display: flex;
    align-items: stretch;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 14px 14px 12px;
}

.user-dashboard-detail .user-forecast-panel .hourly-recommendation-item {
    width: 58px;
    min-width: 58px;
    display: grid;
    grid-template-rows: 18px 1fr auto auto;
    gap: 6px;
    align-items: end;
    padding: 0 2px;
}

.hourly-recommendation-score {
    align-self: start;
    justify-self: center;
    min-width: 30px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.85);
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 900;
    text-align: center;
}

.user-dashboard-detail .user-forecast-panel .hourly-recommendation-bar-wrap {
    height: 106px;
}

.hourly-recommendation-item.recommendation-excellent .hourly-recommendation-bar {
    background: linear-gradient(180deg, #34d399, #059669);
}

.hourly-recommendation-item.recommendation-good .hourly-recommendation-bar {
    background: linear-gradient(180deg, #38bdf8, #0284c7);
}

.hourly-recommendation-item.recommendation-bad .hourly-recommendation-bar {
    background: linear-gradient(180deg, #fb923c, #ea580c);
}

.hourly-recommendation-footer {
    display: grid;
    gap: 2px;
    text-align: center;
}

.hourly-recommendation-price {
    display: block;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
}

.hourly-recommendation-detail {
    display: flex;
    justify-content: center;
    gap: 5px;
    color: #64748b;
    font-size: 0.62rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.recommendation-excellent-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
    flex: 0 0 auto;
    background: #10b981;
}

@media (max-width: 1200px) {
    .user-dashboard-detail.dashboard-two-column {
        grid-template-columns: 1fr;
    }

    .user-dashboard-detail .user-forecast-panel,
    .user-dashboard-detail .user-energy-mix-panel {
        order: initial;
    }

    .user-dashboard-detail .user-energy-mix-panel .energy-mix-layout {
        grid-template-columns: 220px minmax(0, 1fr);
        justify-items: stretch;
    }
}

@media (max-width: 900px) {
    .user-dashboard-detail .user-energy-mix-panel .energy-mix-layout {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .user-dashboard-detail .user-forecast-panel .hourly-recommendation-item {
        width: 54px;
        min-width: 54px;
    }
}

/* =========================================================
   EDC DAY SIMULATION
   ========================================================= */

.edc-day-filter-panel {
    margin-bottom: 18px;
}

.compact-panel-header {
    margin-bottom: 16px;
}

.edc-day-filter-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.edc-date-field {
    min-width: 260px;
    max-width: 360px;
}

.edc-run-button {
    min-height: 52px;
}

.edc-day-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: 20px;
    align-items: stretch;
}

.edc-day-chart-panel {
    margin-bottom: 24px;
}

.edc-day-timeline-wrapper {
    overflow-x: auto;
    padding: 10px 4px 14px;
}

.edc-day-timeline {
    display: grid;
    grid-template-columns: repeat(96, 42px);
    gap: 6px;
    min-width: max-content;
    align-items: end;
}

.edc-day-slot {
    appearance: none;
    border: 1px solid #dbe6ef;
    border-radius: 14px;
    background: #ffffff;
    min-height: 170px;
    padding: 6px 4px;
    display: grid;
    grid-template-rows: 22px 1fr 20px;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.edc-day-slot:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.edc-day-slot.negative {
    border-color: #fecdd3;
    background: #fff7f8;
}

.edc-day-slot.limited {
    box-shadow: inset 0 0 0 2px rgba(244, 63, 94, 0.14);
}

.edc-day-slot.has-sharing:not(.negative) {
    background: #f8fbff;
}

.edc-day-slot-price {
    align-self: center;
    justify-self: center;
    min-width: 26px;
    padding: 2px 5px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.1;
}

.edc-day-slot.negative .edc-day-slot-price {
    background: #ffe4e6;
    color: #be123c;
}

.edc-day-slot-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 108px;
    padding-top: 8px;
}

.edc-day-slot-bar {
    display: inline-block;
    width: 13px;
    min-height: 4px;
    border-radius: 999px 999px 4px 4px;
}

.edc-day-slot-bar.shared {
    background: linear-gradient(180deg, #29b6ff 0%, #0284c7 100%);
}

.edc-day-slot-bar.surplus {
    background: linear-gradient(180deg, #fb923c 0%, #ea580c 100%);
}

.edc-day-slot-time {
    align-self: end;
    justify-self: center;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}

.edc-day-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 16px;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.edc-day-legend span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}

.legend-dot.shared {
    background: #0ea5e9;
}

.legend-dot.surplus {
    background: #f97316;
}

.legend-dot.negative {
    background: #e11d48;
}

.legend-dot.limited {
    background: #f59e0b;
}

.edc-interval-detail-grid {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 24px;
    margin-bottom: 24px;
}

.edc-detail-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.edc-detail-metrics > div {
    border: 1px solid #e5edf6;
    border-radius: 18px;
    padding: 16px 18px;
    background: #ffffff;
}

.edc-detail-metrics span {
    display: block;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}

.edc-detail-metrics strong {
    color: #0f172a;
    font-size: 22px;
    font-weight: 850;
}

.edc-mode-card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.edc-mode-card {
    border: 1px solid #dbe6ef;
    border-radius: 20px;
    padding: 18px;
    background: #f8fafc;
}

.edc-mode-card.safe {
    border-color: #b7ebc8;
    background: #f0fdf4;
}

.edc-mode-card h3 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 17px;
}

.edc-mode-card p {
    margin: 0 0 14px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.4;
}

.edc-mode-card strong {
    color: #0f172a;
    font-size: 22px;
    font-weight: 850;
}

.edc-day-table tbody tr {
    cursor: pointer;
}

.edc-day-table tbody tr:hover {
    background: #f8fafc;
}

.edc-row-negative {
    background: #fff7f8;
}

.edc-row-sharing {
    background: #f8fbff;
}

@media (max-width: 1300px) {
    .edc-day-summary-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .edc-interval-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .edc-day-summary-grid,
    .edc-detail-metrics,
    .edc-mode-card-grid {
        grid-template-columns: 1fr;
    }

    .edc-day-filter-row {
        align-items: stretch;
        flex-direction: column;
    }

    .edc-date-field {
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 1400px) {
    .edc-day-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .edc-day-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   EDC DAY SIMULATION - real grid export model
   ========================================================= */

.edc-day-summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: stretch;
}

.edc-day-summary-grid .metric-card-wide {
    grid-column: auto;
}

.edc-day-summary-grid .metric-card {
    min-width: 0;
    padding: 18px;
}

.edc-day-summary-grid .metric-header {
    margin-bottom: 12px;
}

.edc-day-summary-grid .metric-value {
    font-size: 27px;
}

.edc-day-summary-grid .metric-split {
    gap: 10px;
}

.edc-day-summary-grid .metric-split > div + div {
    padding-left: 10px;
}

.edc-day-summary-grid .metric-subvalue {
    font-size: 12px;
}

.edc-day-slot.has-supplier-export:not(.negative) {
    background: #fffaf5;
}

.edc-day-slot-bars.stacked {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
}

.edc-day-slot-bars.stacked .edc-day-slot-bar {
    width: 14px;
}

.edc-row-supplier-export {
    background: #fffaf5;
}

.edc-row-supplier-export:hover {
    background: #fff3e8 !important;
}

@media (max-width: 1100px) {
    .edc-day-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ================================
   EDC EXPORT CONTROL SIMULATION
================================ */

.page-header:has(.header-actions),
.page-header-with-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.metric-value-small {
    font-size: 26px;
    letter-spacing: -0.04em;
}

.strategy-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.strategy-preview-card {
    border: 1px solid #dbe6ef;
    border-radius: 22px;
    padding: 20px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.strategy-preview-card.recommended {
    border-color: rgba(34, 197, 94, 0.35);
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 72%);
}

.strategy-preview-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.strategy-preview-header h3 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 22px;
    font-weight: 850;
    letter-spacing: -0.03em;
}

.strategy-preview-header p {
    margin: 0;
    color: #64748b;
    line-height: 1.45;
}

.strategy-preview-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.strategy-preview-metrics > div {
    border: 1px solid #e5edf6;
    border-radius: 18px;
    padding: 14px 16px;
    background: rgba(248, 250, 252, 0.85);
}

.strategy-preview-metrics span {
    display: block;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 7px;
}

.strategy-preview-metrics strong {
    color: #0f172a;
    font-size: 18px;
    font-weight: 850;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}

.badge-success {
    color: #047857;
    background: #dcfce7;
    border: 1px solid #bbf7d0;
}

.sortable-table th button {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 850;
    text-transform: inherit;
    letter-spacing: inherit;
    padding: 0;
    cursor: pointer;
}

.sortable-table th button:hover {
    color: var(--primary-dark);
}

@media (max-width: 1100px) {
    .page-header:has(.header-actions),
    .page-header-with-actions {
        flex-direction: column;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .strategy-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .strategy-preview-metrics {
        grid-template-columns: 1fr;
    }
}

/* ================================
   EDC EXPORT CONTROL - polish
================================ */

.info-panel {
    border-radius: 16px;
    padding: 15px 16px;
    margin-bottom: 18px;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.45;
    background: #eff6ff;
    color: #1e3a8a;
    border: 1px solid #bfdbfe;
}

.export-control-warning-panel,
.export-control-info-panel {
    margin-top: -6px;
    margin-bottom: 18px;
}

.export-control-kpi-grid {
    align-items: stretch;
}

.export-control-kpi-grid .metric-card {
    min-height: 128px;
}

.export-control-kpi-grid .metric-value {
    font-size: clamp(26px, 2.4vw, 34px);
    line-height: 1.05;
}

.export-control-kpi-grid .metric-value-small {
    font-size: clamp(22px, 2.1vw, 30px);
}

.export-control-kpi-grid .metric-subvalue {
    line-height: 1.35;
}

.export-control-panel .panel-header {
    margin-bottom: 14px;
}

.export-control-panel .strategy-preview-grid {
    gap: 18px;
}

.export-control-panel .strategy-preview-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.export-control-panel .strategy-preview-header {
    gap: 16px;
}

.export-control-panel .strategy-preview-header h3 {
    font-size: clamp(20px, 2vw, 26px);
}

.export-control-panel .strategy-preview-header p {
    font-size: 14px;
    line-height: 1.5;
}

.export-control-panel .strategy-preview-metrics {
    margin-top: auto;
}

.export-control-panel .strategy-preview-metrics > div {
    min-width: 0;
}

.export-control-panel .strategy-preview-metrics strong {
    font-size: clamp(17px, 1.7vw, 22px);
    line-height: 1.2;
    word-break: break-word;
}

.export-control-allocation-panel .report-table th,
.export-control-allocation-panel .report-table td {
    white-space: nowrap;
}

@media (max-width: 1280px) {
    .export-control-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .page-header-with-refresh {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-with-refresh .header-actions {
        justify-content: stretch;
    }

    .page-header-with-refresh .header-actions .primary-button,
    .page-header-with-refresh .header-actions .secondary-button {
        flex: 1 1 180px;
    }

    .export-control-kpi-grid {
        grid-template-columns: 1fr;
    }

    .export-control-panel,
    .export-control-allocation-panel {
        padding: 16px;
    }

    .export-control-panel .strategy-preview-card {
        padding: 16px;
    }
}

@media (max-width: 620px) {
    .export-control-panel .strategy-preview-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .export-control-panel .strategy-preview-metrics {
        grid-template-columns: 1fr;
    }

    .export-control-kpi-grid .metric-value,
    .export-control-kpi-grid .metric-value-small {
        font-size: 24px;
    }
}

/* ================================
   Billing customer report polish
================================ */
.billing-page-header .page-description {
    max-width: 920px;
}

.billing-toolbar {
    grid-template-columns: 120px 180px minmax(260px, 1fr) 170px auto auto;
    align-items: end;
}

.billing-point-filter select {
    min-width: 260px;
}

.billing-print-area {
    margin-top: 22px;
}

.billing-print-header,
.billing-document-header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 26px;
    border: 1px solid rgba(203, 213, 225, 0.92);
    border-radius: 28px;
    box-shadow: 0 22px 52px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: hidden;
}

.billing-document-header::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: linear-gradient(180deg, #dc2626, #f97316);
}

.billing-document-header-main,
.billing-document-generated {
    position: relative;
    z-index: 1;
}

.billing-document-eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(220, 38, 38, 0.09);
    color: #991b1b;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.billing-document-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.55rem, 2.4vw, 2.15rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
}

.billing-document-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.billing-document-meta-row span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(226, 232, 240, 0.92);
    color: #475569;
    font-size: 0.9rem;
    font-weight: 750;
}

.billing-document-generated {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 190px;
    padding-left: 22px;
    border-left: 1px solid rgba(203, 213, 225, 0.72);
    text-align: right;
}

.billing-document-generated span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.billing-document-generated strong {
    margin-top: 6px;
    color: #0f172a;
    font-size: 1.02rem;
    font-weight: 900;
}

.billing-section-header,
.billing-card-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 24px 0 14px;
}

.billing-section-header h2,
.billing-card-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.billing-section-header p,
.billing-card-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.billing-price-pill {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.billing-price-pill span {
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.09);
    border: 1px solid rgba(14, 165, 233, 0.18);
    color: #075985;
    font-size: 0.82rem;
    font-weight: 850;
    white-space: nowrap;
}

.billing-kpi-grid-wide {
    grid-template-columns: repeat(4, minmax(210px, 1fr));
    gap: 18px;
}

.billing-comparison-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 16px 0 4px;
}

.billing-comparison-strip > div {
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel-soft);
}

.billing-comparison-strip span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 850;
}

.billing-comparison-strip strong {
    display: block;
    margin-top: 5px;
    color: var(--text);
    font-size: 1rem;
}

.billing-split-metric {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.billing-split-metric > div {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    background: var(--panel-soft);
}

.billing-split-metric span {
    display: block;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 850;
}

.billing-split-metric strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: clamp(1rem, 1.8vw, 1.28rem);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.billing-total-card {
    border-color: rgba(248, 113, 113, 0.22);
}

.billing-total-card .metric-icon {
    background: rgba(239, 68, 68, 0.10);
    color: #b91c1c;
}

.billing-total-card .metric-label {
    color: #7f1d1d;
}

.billing-chart-card,
.billing-table-card {
    margin-top: 22px;
    border: 1px solid rgba(226, 232, 240, 0.88);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.07);
}

.billing-chart {
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98)),
        repeating-linear-gradient(to top, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.16) 1px, transparent 1px, transparent 52px);
}

.billing-chart-edc {
    background: linear-gradient(180deg, #0284c7, #38bdf8);
}

.billing-chart-supplier {
    background: linear-gradient(180deg, #64748b, #cbd5e1);
}

.billing-legend {
    justify-content: flex-end;
    margin-top: 14px;
}

.billing-report-table {
    min-width: 1120px;
}

.billing-report-table th,
.billing-report-table td {
    vertical-align: middle;
}

.billing-report-table .number-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.billing-sort-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 850;
    text-align: inherit;
    cursor: pointer;
}

.billing-sort-button span {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 750;
}

.billing-sort-button:hover {
    color: #0369a1;
}

.billing-savings-cell {
    color: #047857;
    font-weight: 850;
}

.billing-overall-summary {
    margin-bottom: 22px;
}

.billing-overall-summary .billing-section-header {
    margin-top: 0;
}

.billing-kpi-grid .metric-card,
.billing-kpi-grid-wide .metric-card {
    display: grid;
    grid-template-rows: minmax(42px, auto) minmax(48px, auto) auto;
    align-content: start;
    height: 100%;
}

.billing-kpi-grid .metric-header,
.billing-kpi-grid-wide .metric-header {
    min-height: 42px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.billing-kpi-grid .metric-value,
.billing-kpi-grid-wide .metric-value,
.billing-kpi-grid .billing-split-metric,
.billing-kpi-grid-wide .billing-split-metric {
    align-self: center;
}

.billing-kpi-grid .metric-subvalue,
.billing-kpi-grid-wide .metric-subvalue {
    align-self: end;
}

.billing-tariff-values {
    display: grid;
    gap: 5px;
    min-width: 172px;
}

.billing-tariff-values > span {
    display: grid;
    grid-template-columns: 52px auto;
    gap: 10px;
    align-items: baseline;
    justify-content: end;
}

.billing-tariff-values small {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 750;
    text-align: left;
}

.billing-tariff-values strong {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.billing-detail-table-wrapper {
    max-height: min(68vh, 680px);
    overflow: auto;
    scrollbar-gutter: stable;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.billing-detail-table {
    min-width: 900px;
}

.billing-detail-table th {
    height: 58px;
    vertical-align: bottom;
}

.billing-detail-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--panel-soft);
    box-shadow: inset 0 -1px 0 var(--border);
}

.billing-detail-table tbody td,
.billing-detail-table tfoot td {
    vertical-align: middle;
}

.billing-detail-table .billing-sort-button {
    display: flex;
    min-height: 34px;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 4px;
    line-height: 1.2;
}

.billing-detail-table th:first-child .billing-sort-button {
    justify-content: flex-start;
}

.billing-column-title {
    display: grid;
    gap: 2px;
    text-align: right;
}

.billing-column-title small {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: none;
}

@media (max-width: 1200px) {
    .billing-toolbar {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .billing-kpi-grid-wide {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .billing-comparison-strip {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .billing-kpi-grid-wide {
        grid-template-columns: 1fr;
    }

    .billing-section-header,
    .billing-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .billing-price-pill {
        justify-content: flex-start;
    }

    .billing-document-header {
        flex-direction: column;
        gap: 18px;
    }

    .billing-document-generated {
        align-items: flex-start;
        min-width: 0;
        padding-left: 0;
        border-left: 0;
        text-align: left;
    }
}
@media print {

    html,
    body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 10px !important;
        color: #111827 !important;
    }

    .sidebar,
    .top-row,
    .page-header,
    .billing-toolbar,
    .billing-screen-only-total,
    .chart-legend,
    .billing-sort-button::after,
    .btn,
    button {
        display: none !important;
    }

    .content,
    main,
    article,
    .page,
    .container-fluid {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .billing-print-area {
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* ===== HLAVIČKA ===== */

    .billing-print-header,
    .billing-document-header {
        position: relative;
        background: #fff !important;
        border: 1px solid #d8dee9 !important;
        border-radius: 14px !important;
        padding: 18px 22px !important;
        margin-bottom: 14px !important;
        box-shadow: none !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

        .billing-document-header::before {
            content: "";
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 5px;
            border-radius: 14px 0 0 14px;
            background: #dc2626 !important;
        }

    /* ===== KPI ===== */

    .billing-selected-section,
    .billing-kpi-grid-wide {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .billing-kpi-grid-wide {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 14px !important;
    }

    .metric-card,
    .card {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 12px !important;
        padding: 10px 12px !important;
        min-height: auto !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    .metric-label {
        font-size: 9px !important;
        font-weight: 700 !important;
    }

    .metric-value {
        font-size: 24px !important;
        line-height: 1.1 !important;
    }

    .metric-subvalue {
        font-size: 9px !important;
    }

    /* ===== SEKCE ===== */

    .billing-section-header {
        margin-top: 10px !important;
        margin-bottom: 8px !important;
        break-after: avoid !important;
        page-break-after: avoid !important;
    }

    .billing-chart-card,
    .billing-table-card {
        margin-top: 0 !important;
        padding-top: 12px !important;
        break-before: auto !important;
        page-break-before: auto !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
        overflow: visible !important;
        display: block !important;
    }

    /* ===== GRAF ===== */

    .billing-chart {
        height: auto !important;
        min-height: 180px !important;
        max-height: none !important;
        overflow: visible !important;
        border: 1px solid #d8dee9 !important;
        border-radius: 12px !important;
        padding: 12px !important;
    }

    .billing-chart-value-label {
        display: block !important;
        color: #111827 !important;
        font-size: 7px !important;
        line-height: 1 !important;
    }

    /* ===== TABULKA ===== */

    .billing-report-table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: collapse !important;
        font-size: 8px !important;
        line-height: 1.15 !important;
    }

        .billing-report-table th {
            font-size: 7px !important;
            font-weight: 700 !important;
            background: #f8fafc !important;
            color: #475569 !important;
        }

        .billing-report-table td {
            font-size: 8px !important;
            color: #111827 !important;
        }

        .billing-report-table th,
        .billing-report-table td {
            padding: 3px 4px !important;
            border-bottom: 1px solid #e5e7eb !important;
            vertical-align: middle !important;
        }

    .billing-sort-button {
        cursor: default !important;
    }

    /* ===== ZAMEZENÍ ZBYTEČNÝM PAGE BREAKŮM ===== */

    h1,
    h2,
    h3,
    h4,
    .billing-section-header,
    .billing-chart-card,
    .billing-table-card,
    .metric-card {
        break-before: auto !important;
        page-break-before: auto !important;
        break-after: auto !important;
        page-break-after: auto !important;
    }

    /* ===== CHROME PRINT FIX ===== */

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* ================================
   Energy sale / FVE revenue refinement
================================ */

.revenue-form-grid-compact {
    grid-template-columns: 110px minmax(150px, 190px) 150px minmax(260px, 1.4fr) minmax(180px, 1fr);
    gap: 12px;
    align-items: end;
}

.revenue-field-small input,
.revenue-field-small select,
.revenue-field-month select {
    min-height: 40px;
}

.revenue-field-small input {
    max-width: 110px;
}

.revenue-options-panel {
    grid-column: 1 / -1;
}

.energy-flow-fill-accent {
    background: linear-gradient(90deg, #22c55e, #84cc16);
}

.revenue-table-header {
    align-items: center;
}

.segmented-control.revenue-detail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    flex-shrink: 0;
}

.segmented-control.revenue-detail-toggle button {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
}

.segmented-control.revenue-detail-toggle button.active {
    background: white;
    color: var(--primary-dark);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.segmented-control.revenue-detail-toggle button:disabled {
    cursor: wait;
    opacity: .65;
}

.revenue-data-table th.number,
.revenue-data-table td.number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 1280px) {
    .revenue-form-grid-compact {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .revenue-field-small input {
        max-width: none;
    }
}

@media (max-width: 760px) {
    .revenue-table-header {
        align-items: stretch;
    }

    .segmented-control.revenue-detail-toggle {
        justify-content: center;
    }

    .segmented-control.revenue-detail-toggle button {
        flex: 1;
    }
}

/* =========================================================
   FINAL CSS RESTORE - Billing + Overview
   2026-05-22
   This block intentionally stays at the very end of app.css.
   It restores the nicer billing/customer-document styling and fixes
   the overview date filter layout after later CSS overrides.
   ========================================================= */

/* ---------- Dashboard overview filter toolbar ---------- */

.overview-toolbar {
    display: grid;
    grid-template-columns: minmax(430px, 520px) minmax(150px, 220px) minmax(150px, 220px) minmax(160px, 250px) auto;
    gap: 14px;
    align-items: end;
    padding: 20px 22px;
    margin-bottom: 24px;
}

.overview-date-range-selector {
    display: grid;
    grid-template-columns: 44px minmax(150px, 1fr) minmax(150px, 1fr) 44px;
    gap: 10px;
    align-items: end;
    min-width: 0;
}

.overview-date-range-selector .overview-filter {
    min-width: 0;
}

.overview-date-range-selector .day-date-arrow {
    margin: 0;
    align-self: end;
}

.overview-toolbar .overview-filter input,
.overview-toolbar .overview-filter select {
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}

.overview-toolbar .primary-button,
.overview-toolbar .secondary-button {
    height: 42px;
    min-height: 42px;
    margin-top: 0;
    padding-inline: 22px;
}

.overview-toolbar .primary-button {
    min-width: 150px;
}

.overview-toolbar .secondary-button {
    min-width: 108px;
}

@media (max-width: 1180px) {
    .overview-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .overview-date-range-selector {
        grid-column: 1 / -1;
    }

    .overview-toolbar .primary-button,
    .overview-toolbar .secondary-button {
        width: 100%;
    }
}

@media (max-width: 700px) {
    .overview-toolbar {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .overview-date-range-selector {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        grid-template-areas:
            "prev from next"
            "prev to next";
        align-items: end;
    }

    .overview-date-range-selector .day-date-arrow:first-child {
        grid-area: prev;
    }

    .overview-date-range-selector .overview-filter:nth-of-type(1) {
        grid-area: from;
    }

    .overview-date-range-selector .overview-filter:nth-of-type(2) {
        grid-area: to;
    }

    .overview-date-range-selector .day-date-arrow:last-child {
        grid-area: next;
    }
}

/* ---------- Billing toolbar ---------- */

.billing-page-header .page-description {
    max-width: 920px;
}

.billing-toolbar {
    display: grid !important;
    grid-template-columns: 105px 170px minmax(260px, 1fr) 180px 118px 132px !important;
    gap: 14px !important;
    align-items: end !important;
    padding: 20px 22px !important;
    margin-bottom: 22px !important;
}

.billing-toolbar .overview-filter,
.billing-toolbar .form-field {
    min-width: 0;
}

.billing-toolbar .overview-filter label,
.billing-toolbar .form-field label {
    margin-bottom: 6px;
}

.billing-toolbar .overview-filter input,
.billing-toolbar .overview-filter select,
.billing-toolbar .form-field input,
.billing-toolbar .form-field select {
    width: 100%;
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
}

.billing-toolbar .primary-button,
.billing-toolbar .secondary-button {
    width: 100%;
    height: 42px;
    min-height: 42px;
    margin-top: 0;
    padding: 0 14px;
    border-radius: 13px;
}

.billing-point-filter select {
    min-width: 0 !important;
}

@media (max-width: 1200px) {
    .billing-toolbar {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .billing-toolbar .primary-button,
    .billing-toolbar .secondary-button {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .billing-toolbar {
        grid-template-columns: 1fr !important;
        padding: 18px !important;
    }
}

/* ---------- Billing customer document ---------- */

.billing-print-area {
    margin-top: 22px;
}

.billing-document-header,
.billing-print-header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    padding: 24px 26px;
    border: 1px solid rgba(203, 213, 225, 0.92);
    border-radius: 28px;
    position: relative;
    overflow: hidden;
    margin: 18px 0 22px;
}

.billing-document-header::before,
.billing-print-header::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: linear-gradient(180deg, #dc2626, #f97316);
}

.billing-document-header-main,
.billing-document-generated {
    position: relative;
    z-index: 1;
}

.billing-document-eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    margin-bottom: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(220, 38, 38, 0.09);
    color: #991b1b;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.billing-document-header h2,
.billing-print-header h2 {
    margin: 0;
    color: #0f172a;
    font-size: clamp(1.55rem, 2.4vw, 2.15rem);
    line-height: 1.05;
    letter-spacing: -0.045em;
}

.billing-document-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.billing-document-meta-row span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(226, 232, 240, 0.92);
    color: #475569;
    font-size: 0.9rem;
    font-weight: 750;
}

.billing-document-generated {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 190px;
    padding-left: 22px;
    border-left: 1px solid rgba(203, 213, 225, 0.72);
    text-align: right;
}

.billing-document-generated span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.billing-document-generated strong {
    margin-top: 6px;
    color: #0f172a;
    font-size: 1.02rem;
    font-weight: 900;
}

.billing-section-header,
.billing-card-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 24px 0 14px;
}

.billing-section-header h2,
.billing-card-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.billing-section-header p,
.billing-card-header p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.billing-price-pill {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.billing-price-pill span {
    display: inline-flex;
    align-items: center;
    padding: 8px 11px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.09);
    border: 1px solid rgba(14, 165, 233, 0.18);
    color: #075985;
    font-size: 0.82rem;
    font-weight: 850;
    white-space: nowrap;
}

.billing-kpi-grid-wide {
    grid-template-columns: repeat(4, minmax(210px, 1fr));
    gap: 18px;
}

.billing-kpi-grid-wide .metric-card,
.billing-kpi-grid .metric-card {
    min-height: 116px;
}

.billing-kpi-grid-wide .metric-value,
.billing-kpi-grid .metric-value {
    font-size: clamp(1.55rem, 2.4vw, 2rem);
    line-height: 1.05;
}

.billing-total-card {
    border-color: rgba(248, 113, 113, 0.22);
}

.billing-total-card::after,
.metric-card-red::after {
    background: rgba(254, 226, 226, 0.82);
}

.billing-total-card .metric-icon {
    background: rgba(239, 68, 68, 0.10);
    color: #b91c1c;
}

.billing-total-card .metric-label {
    color: #7f1d1d;
}

/* ---------- Billing chart, screen ---------- */

.billing-chart-card,
.billing-table-card {
    margin-top: 22px;
    border: 1px solid rgba(226, 232, 240, 0.88);
    border-radius: 24px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.07);
}

.billing-chart-card {
    padding: 22px;
    overflow: hidden;
}

.billing-chart {
    height: 315px !important;
    min-height: 315px !important;
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 22px 18px 14px;
    border-radius: 22px;
    background:
        linear-gradient(to top, rgba(226, 232, 240, 0.55) 1px, transparent 1px),
        linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
    background-size: 100% 54px, 100% 100%;
    border: 1px solid rgba(226, 232, 240, 0.9);
    overflow-x: auto;
    overflow-y: hidden;
}

.billing-chart-column {
    flex: 1 0 42px;
    min-width: 42px;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr 38px;
    gap: 8px;
    align-items: end;
}

.billing-chart-value-label {
    display: block;
    min-height: 16px;
    margin: 0;
    color: #334155;
    font-size: 0.68rem;
    font-weight: 850;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.billing-chart-bars {
    height: 100%;
    min-height: 180px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
}

.billing-chart-bar {
    width: 11px;
    min-height: 2px;
    border-radius: 999px 999px 4px 4px;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.billing-chart-column:hover .billing-chart-bar {
    transform: translateY(-2px);
    opacity: 0.9;
}

.billing-chart-edc {
    background: linear-gradient(180deg, #0284c7, #38bdf8);
}

.billing-chart-supplier {
    background: linear-gradient(180deg, #64748b, #cbd5e1);
}

.billing-chart-label {
    min-height: 32px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    overflow: hidden;
}

.billing-legend {
    justify-content: flex-end;
    margin-top: 14px;
}

.billing-report-table {
    min-width: 1120px;
}

.billing-report-table .number-cell,
.billing-report-table th.number,
.billing-report-table td.number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.billing-sort-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 850;
    text-align: inherit;
    cursor: pointer;
}

.billing-sort-button span {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 750;
}

.billing-sort-button:hover {
    color: #0369a1;
}

.billing-savings-cell {
    color: #047857;
    font-weight: 850;
}

@media (max-width: 1200px) {
    .billing-kpi-grid-wide {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .billing-comparison-strip {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .billing-kpi-grid-wide {
        grid-template-columns: 1fr;
    }

    .billing-section-header,
    .billing-card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .billing-price-pill {
        justify-content: flex-start;
    }

    .billing-document-header,
    .billing-print-header {
        flex-direction: column;
        gap: 18px;
    }

    .billing-document-generated {
        align-items: flex-start;
        min-width: 0;
        padding-left: 0;
        border-left: 0;
        text-align: left;
    }
}

/* ---------- Billing print / PDF ---------- */

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    html,
    body {
        width: auto !important;
        min-width: 0 !important;
        background: #ffffff !important;
        color: #111827 !important;
        font-size: 10px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .app-header,
    .top-row,
    .sidebar,
    .page-header,
    .billing-toolbar,
    .billing-screen-only-total,
    .report-filter-tabs,
    .primary-button,
    .secondary-button,
    .chart-legend:not(.billing-legend) {
        display: none !important;
    }

    .app-content,
    .content,
    main,
    article {
        max-width: none !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .card,
    .panel,
    .metric-card,
    .billing-document-header,
    .billing-print-header,
    .billing-chart-card,
    .billing-table-card {
        box-shadow: none !important;
        transform: none !important;
    }

    .billing-print-area {
        margin: 0 !important;
    }

    .billing-document-header,
    .billing-print-header {
        padding: 14px 16px !important;
        margin: 0 0 10px !important;
        border: 1px solid #d8dee9 !important;
        border-radius: 18px !important;
        background: #ffffff !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .billing-document-header::before,
    .billing-print-header::before {
        background: #dc2626 !important;
        width: 5px !important;
    }

    .billing-document-eyebrow {
        margin-bottom: 6px !important;
        padding: 4px 8px !important;
        font-size: 8px !important;
        background: #fee2e2 !important;
        color: #991b1b !important;
    }

    .billing-document-header h2,
    .billing-print-header h2 {
        font-size: 22px !important;
    }

    .billing-document-meta-row {
        margin-top: 8px !important;
        gap: 5px !important;
    }

    .billing-document-meta-row span {
        min-height: 0 !important;
        padding: 4px 7px !important;
        border-radius: 8px !important;
        font-size: 9px !important;
    }

    .billing-document-generated {
        min-width: 160px !important;
        padding-left: 14px !important;
    }

    .billing-document-generated span {
        font-size: 8px !important;
    }

    .billing-document-generated strong {
        font-size: 11px !important;
    }

    .billing-section-header,
    .billing-card-header {
        margin: 10px 0 7px !important;
        gap: 10px !important;
        break-after: avoid;
    }

    .billing-section-header h2,
    .billing-card-header h2 {
        font-size: 15px !important;
    }

    .billing-section-header p,
    .billing-card-header p {
        font-size: 9px !important;
    }

    .billing-price-pill span {
        padding: 4px 7px !important;
        font-size: 8px !important;
        border-radius: 999px !important;
    }

    .billing-kpi-grid-wide,
    .billing-kpi-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .billing-kpi-grid-wide .metric-card,
    .billing-kpi-grid .metric-card {
        min-height: 76px !important;
        padding: 10px !important;
        border-radius: 14px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .billing-kpi-grid-wide .metric-header,
    .billing-kpi-grid .metric-header {
        gap: 7px !important;
        margin-bottom: 8px !important;
    }

    .billing-kpi-grid-wide .metric-icon,
    .billing-kpi-grid .metric-icon {
        width: 24px !important;
        height: 24px !important;
        border-radius: 9px !important;
        font-size: 13px !important;
    }

    .billing-kpi-grid-wide .metric-label,
    .billing-kpi-grid .metric-label {
        font-size: 8px !important;
        letter-spacing: .03em !important;
    }

    .billing-kpi-grid-wide .metric-value,
    .billing-kpi-grid .metric-value {
        font-size: 20px !important;
        line-height: 1 !important;
    }

    .billing-kpi-grid-wide .metric-unit-inline,
    .billing-kpi-grid .metric-unit-inline,
    .billing-kpi-grid-wide .metric-unit,
    .billing-kpi-grid .metric-unit {
        font-size: 8px !important;
    }

    .billing-kpi-grid-wide .metric-subvalue,
    .billing-kpi-grid .metric-subvalue {
        font-size: 8px !important;
        margin-top: 4px !important;
    }

    .billing-chart-card {
        padding: 12px !important;
        margin-top: 10px !important;
        border-radius: 16px !important;
        border: 1px solid #d8dee9 !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .billing-chart {
        height: 250px !important;
        min-height: 250px !important;
        padding: 12px 8px 8px !important;
        gap: 5px !important;
        border-radius: 14px !important;
        border: 1px solid #d8dee9 !important;
        overflow: hidden !important;
        background:
            linear-gradient(to top, rgba(209, 213, 219, 0.75) 1px, transparent 1px),
            #ffffff !important;
        background-size: 100% 42px, 100% 100% !important;
    }

    .billing-chart-column {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        display: grid !important;
        grid-template-rows: 13px 1fr 31px !important;
        gap: 5px !important;
    }

    .billing-chart-value-label {
        display: block !important;
        min-height: 13px !important;
        color: #111827 !important;
        font-size: 7px !important;
        font-weight: 850 !important;
        white-space: nowrap !important;
        overflow: visible !important;
        text-align: center !important;
    }

    .billing-chart-bars {
        min-height: 0 !important;
        gap: 2px !important;
    }

    .billing-chart-bar {
        width: 8px !important;
        min-height: 2px !important;
    }

    .billing-chart-label {
        min-height: 31px !important;
        height: 31px !important;
        color: #374151 !important;
        font-size: 7px !important;
        line-height: 1.12 !important;
        overflow: hidden !important;
        word-break: normal !important;
    }

    .billing-legend {
        margin-top: 8px !important;
        justify-content: flex-end !important;
        font-size: 8px !important;
    }

    .billing-table-card {
        margin-top: 10px !important;
        padding: 12px !important;
        border-radius: 16px !important;
        border: 1px solid #d8dee9 !important;
        break-inside: auto;
        page-break-inside: auto;
    }

    .report-table-wrapper,
    .table-scroll {
        overflow: visible !important;
    }

    .billing-report-table,
    .report-table {
        min-width: 0 !important;
        width: 100% !important;
        font-size: 8px !important;
        table-layout: auto !important;
    }

    .billing-report-table th,
    .billing-report-table td,
    .report-table th,
    .report-table td {
        padding: 4px 5px !important;
        white-space: nowrap !important;
    }

    .billing-sort-button {
        cursor: default !important;
        pointer-events: none !important;
    }
}
/* ================================
   Billing filters - compact professional toolbar
================================ */
.billing-toolbar-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    padding: 20px 22px;
    margin-bottom: 24px;
}

.billing-toolbar-fields {
    display: grid;
    grid-template-columns: 120px 180px minmax(260px, 1fr) 170px;
    gap: 14px;
    align-items: end;
    min-width: 0;
}

.billing-toolbar-card .overview-filter {
    min-width: 0;
}

    .billing-toolbar-card .overview-filter label {
        margin-bottom: 6px;
    }

    .billing-toolbar-card .overview-filter input,
    .billing-toolbar-card .overview-filter select {
        height: 42px;
        min-height: 42px;
        padding: 9px 12px;
        border-radius: 13px;
    }

.billing-toolbar-actions {
    display: inline-flex;
    align-items: end;
    justify-content: flex-end;
    gap: 10px;
    min-width: max-content;
}

    .billing-toolbar-actions .primary-button,
    .billing-toolbar-actions .secondary-button {
        height: 42px;
        min-height: 42px;
        margin-top: 0;
        padding-left: 18px;
        padding-right: 18px;
        border-radius: 13px;
    }

    .billing-toolbar-actions .secondary-button {
        min-width: 122px;
    }

@media (max-width: 1180px) {
    .billing-toolbar-card {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .billing-toolbar-fields {
        grid-template-columns: 120px 180px minmax(260px, 1fr) 170px;
    }

    .billing-toolbar-actions {
        justify-content: flex-end;
    }
}

@media (max-width: 920px) {
    .billing-toolbar-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .billing-toolbar-card {
        padding: 16px;
    }

    .billing-toolbar-fields,
    .billing-toolbar-actions {
        grid-template-columns: 1fr;
    }

    .billing-toolbar-actions {
        display: grid;
        min-width: 0;
    }

        .billing-toolbar-actions .primary-button,
        .billing-toolbar-actions .secondary-button {
            width: 100%;
        }
}

@media print {
    .billing-toolbar-card {
        display: none !important;
    }
}

/* ================================
   Billing PDF/print chart fix
   - Screen chart keeps visual bars, but values are placed in a dedicated row.
   - Print/PDF uses a readable horizontal chart so values do not overlap or disappear.
================================ */
.billing-chart-column {
    grid-template-rows: 1fr 38px;
    gap: 6px;
}

.billing-chart-values {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    align-items: end;
    min-height: 22px;
}

.billing-chart-value-label {
    display: block;
    min-width: 0;
    color: #334155;
    font-size: 0.66rem;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
}

.billing-chart-value-edc {
    color: #0284c7;
}

.billing-chart-value-supplier {
    color: #64748b;
}

.billing-chart-bars {
    min-height: 170px;
}

.billing-print-chart {
    display: none;
}

@media screen and (max-width: 900px) {
    .billing-chart-column {
        flex-basis: 46px;
        min-width: 46px;
    }

    .billing-chart-value-label {
        font-size: 0.62rem;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    html,
    body {
        width: auto !important;
        min-width: 0 !important;
        background: #ffffff !important;
        color: #111827 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .app-content {
        max-width: none !important;
        width: 100% !important;
        padding: 0 !important;
    }

    .billing-print-area {
        width: 100% !important;
        margin: 0 !important;
    }

    .billing-document-header,
    .billing-print-header {
        padding: 16px 18px !important;
        border-radius: 18px !important;
        margin: 0 0 14px !important;
    }

    .billing-selected-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .billing-section-header {
        margin: 12px 0 10px !important;
    }

    .billing-price-pill span {
        padding: 5px 8px !important;
        font-size: 9px !important;
    }

    .billing-kpi-grid-wide {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

        .billing-kpi-grid-wide .metric-card {
            min-height: 82px !important;
            padding: 10px !important;
            border-radius: 14px !important;
            overflow: hidden !important;
        }

        .billing-kpi-grid-wide .metric-header {
            gap: 6px !important;
            margin-bottom: 8px !important;
        }

        .billing-kpi-grid-wide .metric-icon {
            width: 24px !important;
            height: 24px !important;
            border-radius: 8px !important;
            font-size: 12px !important;
        }

        .billing-kpi-grid-wide .metric-label {
            font-size: 8px !important;
            line-height: 1.1 !important;
        }

        .billing-kpi-grid-wide .metric-value {
            font-size: 18px !important;
            line-height: 1.05 !important;
            letter-spacing: -0.04em !important;
            white-space: nowrap !important;
        }

        .billing-kpi-grid-wide .metric-unit-inline,
        .billing-kpi-grid-wide .metric-subvalue {
            font-size: 8px !important;
        }

    .billing-chart-card,
    .billing-table-card {
        padding: 16px !important;
        border-radius: 18px !important;
        box-shadow: none !important;
        border: 1px solid #d8dee9 !important;
        margin-top: 14px !important;
    }

    .billing-card-header {
        margin: 0 0 12px !important;
    }

        .billing-card-header h2 {
            font-size: 16px !important;
        }

        .billing-card-header p {
            font-size: 10px !important;
        }

    .billing-chart,
    .billing-legend {
        display: none !important;
    }

    .billing-print-chart {
        display: grid !important;
        gap: 6px !important;
        width: 100% !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }

    .billing-print-chart-row {
        display: grid !important;
        grid-template-columns: 78px minmax(0, 1fr) !important;
        gap: 10px !important;
        align-items: center !important;
        padding: 6px 0 !important;
        border-bottom: 1px solid #e5e7eb !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .billing-print-chart-period {
        color: #334155 !important;
        font-size: 9px !important;
        font-weight: 850 !important;
        line-height: 1.15 !important;
    }

    .billing-print-chart-bars {
        display: grid !important;
        gap: 4px !important;
        min-width: 0 !important;
    }

    .billing-print-chart-line {
        display: grid !important;
        grid-template-columns: 54px minmax(0, 1fr) 64px !important;
        gap: 7px !important;
        align-items: center !important;
        min-width: 0 !important;
    }

        .billing-print-chart-line span {
            color: #64748b !important;
            font-size: 8px !important;
            font-weight: 800 !important;
            white-space: nowrap !important;
        }

        .billing-print-chart-line strong {
            color: #111827 !important;
            font-size: 8px !important;
            font-weight: 900 !important;
            text-align: right !important;
            white-space: nowrap !important;
            font-variant-numeric: tabular-nums !important;
        }

    .billing-print-chart-track {
        height: 7px !important;
        border-radius: 999px !important;
        background: #e5e7eb !important;
        overflow: hidden !important;
    }

    .billing-print-chart-fill {
        height: 100% !important;
        min-width: 1px !important;
        border-radius: inherit !important;
    }

    .billing-print-chart-fill-edc {
        background: #0284c7 !important;
    }

    .billing-print-chart-fill-supplier {
        background: #94a3b8 !important;
    }

    .billing-report-table {
        min-width: 0 !important;
        width: 100% !important;
        table-layout: fixed !important;
        font-size: 8px !important;
    }

        .billing-report-table th,
        .billing-report-table td {
            padding: 5px 4px !important;
            white-space: normal !important;
            line-height: 1.2 !important;
        }

        .billing-report-table th {
            font-size: 7px !important;
        }

        .billing-report-table .number-cell {
            text-align: right !important;
            font-variant-numeric: tabular-nums !important;
        }
}

.dashboard-registration-wait-card {
    max-width: 760px;
    margin-top: 24px;
    padding: 28px;
}

.dashboard-registration-wait-title {
    font-size: 1.45rem;
    line-height: 1.25;
    margin-top: 8px;
}

.dashboard-registration-wait-text {
    margin-top: 10px;
    font-size: 1rem;
}

/* Application settings */
.settings-page-header {
    margin-bottom: 20px;
}

.settings-header-save {
    min-height: 42px;
    margin-top: 4px;
}

.settings-control-card {
    padding: 24px;
    overflow: hidden;
}

.settings-control-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.settings-control-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 850;
    letter-spacing: -0.025em;
}

.settings-control-header p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .92rem;
}

.settings-mode-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 170px;
    padding: 11px 13px;
    border-radius: 16px;
    border: 1px solid rgba(14, 165, 233, .22);
    background: rgba(224, 242, 254, .62);
}

.settings-mode-badge span,
.settings-summary-item span {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.settings-mode-badge strong {
    color: var(--primary-dark);
    font-size: .96rem;
    font-weight: 900;
    text-align: right;
}

.settings-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.settings-summary-item {
    min-width: 0;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
}

.settings-summary-item strong {
    display: block;
    margin-top: 6px;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 900;
}

.settings-form-layout {
    display: grid;
    gap: 18px;
}

.settings-section {
    padding: 16px;
    border: 1px solid rgba(226, 232, 240, .9);
    border-radius: 18px;
    background: #ffffff;
}

.settings-section-title {
    margin-bottom: 12px;
}

.settings-section-title h3 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
    font-weight: 850;
}

.settings-mode-selector {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.settings-mode-option {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-height: 104px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel-soft);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: .16s ease;
}

.settings-mode-option strong {
    color: var(--text);
    font-size: .98rem;
    font-weight: 900;
}

.settings-mode-option span {
    color: var(--muted);
    font-size: .86rem;
    line-height: 1.42;
}

.settings-mode-option:hover,
.settings-mode-option.active {
    border-color: rgba(21, 151, 242, .48);
    background: rgba(224, 242, 254, .64);
    box-shadow: 0 12px 28px rgba(21, 151, 242, .10);
}

.settings-mode-option.active strong {
    color: var(--primary-dark);
}

.settings-field-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.settings-field-grid .form-field > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.settings-toggle-row {
    margin: 0;
}

@media (max-width: 980px) {
    .settings-summary-grid,
    .settings-field-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mqtt-settings-layout {
        gap: 18px;
    }

    .mqtt-mapping-main {
        grid-template-columns: 82px minmax(220px, 1fr);
    }

    .mqtt-topic-field {
        grid-column: 2;
    }

    .mqtt-row-action {
        grid-column: 2;
        justify-self: start;
    }

    .mqtt-mapping-details {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .settings-mode-selector {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .settings-control-card {
        padding: 18px;
    }

    .mqtt-mapping-main,
    .mqtt-mapping-details {
        grid-template-columns: 1fr;
    }

    .mqtt-topic-field,
    .mqtt-row-action {
        grid-column: auto;
    }

    .mqtt-active-toggle {
        margin-top: 0;
    }

    .mqtt-row-action {
        margin-top: 0;
    }

    .settings-control-header {
        flex-direction: column;
        align-items: stretch;
    }

    .settings-mode-badge {
        align-items: flex-start;
        min-width: 0;
    }

    .settings-summary-grid,
    .settings-field-grid {
        grid-template-columns: 1fr;
    }

    .settings-header-save {
        width: 100%;
    }
}

/* Energy sale sortable tables */
.table-sort-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    text-align: left;
}

.table-sort-button.number {
    justify-content: flex-end;
    text-align: right;
}

.table-sort-button:hover {
    color: var(--primary, #2563eb);
}

.revenue-data-table tfoot .revenue-total-row td,
.revenue-total-row td {
    font-weight: 800;
    background: #f8fafc;
    border-top: 2px solid #dbe3ef;
}

/* =========================================================
   Navigation dropdown behavior fix
   2026-05-28
   ---------------------------------------------------------
   Menu je založené na <details>/<summary>. Browser sám nezavírá
   ostatní otevřené <details>, proto mohou zůstat otevřené vizuálně.
   Tady necháváme native <details> logiku, ale vizuálně zobrazíme pouze
   menu, které je právě otevřené a zároveň je pod kurzorem nebo má focus.
   Výsledek: po otevření jiného menu se předchozí menu vizuálně zavře.
   ========================================================= */

.app-header,
.app-header-inner,
.top-nav,
.nav-links {
    overflow: visible;
}

.nav-group {
    position: relative;
}

.nav-group summary {
    list-style: none;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary::marker {
    display: none;
}

.nav-group[open] > .nav-dropdown-menu {
    display: none;
}

.nav-group[open]:hover > .nav-dropdown-menu,
.nav-group[open]:focus-within > .nav-dropdown-menu {
    display: block;
}

.nav-group[open]:not(:hover):not(:focus-within) > .nav-link-dropdown {
    color: var(--muted);
    background: transparent;
}

.nav-group[open]:not(:hover):not(:focus-within) > .nav-link-dropdown:hover {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.nav-dropdown-menu {
    pointer-events: auto;
}

@media (max-width: 1080px) {
    .nav-group[open] > .nav-dropdown-menu {
        display: none;
    }

    .nav-group[open]:hover > .nav-dropdown-menu,
    .nav-group[open]:focus-within > .nav-dropdown-menu {
        display: block;
    }
}

.revenue-current-tariff-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.9);
    color: #334155;
}

.revenue-current-tariff-info strong {
    font-size: 0.86rem;
    color: #0f172a;
}

.revenue-current-tariff-info span {
    font-size: 0.78rem;
    line-height: 1.35;
}

/* EDC control reports */
.edc-import-panel {
    margin-bottom: 18px;
}

.edc-import-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 18px;
    align-items: stretch;
}

.file-upload-box {
    border: 1px dashed rgba(148, 163, 184, .7);
    border-radius: 18px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    background: linear-gradient(180deg, #ffffff, rgba(248, 250, 252, .96));
    transition: .16s ease;
}

.file-upload-box:hover {
    border-color: rgba(21, 151, 242, .55);
    background: rgba(224, 242, 254, .45);
}

.file-upload-box input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: .8rem;
    font-weight: 900;
    letter-spacing: .06em;
}

.file-upload-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.file-upload-action {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    background: #1d8cf8;
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(21, 151, 242, 0.18);
    font-size: .84rem;
    font-weight: 850;
}

.file-upload-box small,
.edc-import-help span,
.compact-field small {
    color: var(--muted-text, #64748b);
}

.edc-import-help {
    border-radius: 18px;
    padding: 18px;
    background: rgba(14, 165, 233, .08);
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.filter-toolbar-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px;
    align-items: end;
    padding: 20px 22px;
    margin-bottom: 24px;
}

.filter-toolbar-fields {
    display: grid;
    gap: 14px;
    align-items: end;
    min-width: 0;
}

.filter-toolbar-actions {
    display: inline-flex;
    align-items: end;
    justify-content: flex-end;
    gap: 10px;
    min-width: max-content;
}

.filter-toolbar-actions .primary-button,
.filter-toolbar-actions .secondary-button {
    height: 42px;
    min-height: 42px;
    margin-top: 0;
    border-radius: 13px;
}

.edc-control-toolbar-fields {
    grid-template-columns: minmax(240px, 1.25fr) minmax(330px, 1.25fr) minmax(240px, 1fr) minmax(220px, auto);
}

.edc-control-toolbar-fields .day-date-selector {
    width: 100%;
    min-width: 0;
    grid-template-columns: 42px minmax(150px, 1fr) 42px;
}

.edc-control-toolbar-card .overview-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.edc-control-toolbar-card .overview-filter span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.edc-control-toolbar-card .overview-filter input,
.edc-control-toolbar-card .overview-filter select {
    width: 100%;
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 9px 12px;
    background: #ffffff;
}

.input-with-inline-unit {
    display: grid;
    grid-template-columns: minmax(76px, 1fr) auto;
    align-items: center;
    gap: 8px;
}

.input-with-inline-unit small {
    color: var(--muted);
    font-size: .76rem;
    font-weight: 800;
    white-space: nowrap;
}

.edc-month-summary-grid {
    margin-bottom: 28px;
}

@media (max-width: 1500px) {
    .edc-control-toolbar-fields {
        grid-template-columns: repeat(2, minmax(260px, 1fr));
    }
}

.filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--panel-soft);
    color: var(--text);
    font-size: .88rem;
    font-weight: 750;
}

.filter-toggle input {
    width: 16px;
    height: 16px;
    accent-color: #1d8cf8;
}

.responsive-table-wrapper {
    overflow-x: auto;
}

.edc-control-table th,
.edc-control-table td {
    white-space: nowrap;
}

.edc-control-table th.number-cell,
.edc-control-table td.number-cell {
    text-align: right;
}

.sortable-table th button,
.table-sort-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 850;
    padding: 0;
    cursor: pointer;
    text-align: inherit;
}

.sortable-table th button:hover,
.table-sort-button:hover {
    color: var(--primary);
}

.report-table tfoot td,
.data-table tfoot td,
.table-total-row td {
    background: #f8fafc;
    border-top: 2px solid #dbe3ef;
    font-weight: 850;
}

.edc-severity-warning {
    background: rgba(245, 158, 11, .08);
}

.edc-severity-critical {
    background: rgba(239, 68, 68, .10);
}

.edc-severity-unavailable {
    background: rgba(100, 116, 139, .10);
    color: var(--muted);
}

.small-metric-value {
    font-size: 1.35rem;
}

.metric-card .metric-label {
    font-size: 12px;
}

.metric-card .metric-value,
.metric-card .metric-value-small,
.metric-card .small-metric-value {
    font-size: 30px;
    line-height: 1.05;
    letter-spacing: 0;
}

.metric-card .metric-unit {
    font-size: 12px;
}

.metric-card .metric-subvalue {
    font-size: 13px;
}

.success-panel {
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 16px;
    background: rgba(22, 163, 74, .12);
    border: 1px solid rgba(22, 163, 74, .25);
    color: #166534;
}

:root[data-theme="dark"] .app-header {
    background: rgba(15, 23, 42, 0.92);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .panel {
    border-color: var(--border);
}

:root[data-theme="dark"] .card:hover,
:root[data-theme="dark"] .panel:hover {
    box-shadow: var(--shadow);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
    background: #0f172a;
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
    color: #64748b;
}

:root[data-theme="dark"] .nav-toggle-button,
:root[data-theme="dark"] .nav-dropdown-menu {
    background: rgba(17, 24, 39, 0.97);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

:root[data-theme="dark"] .nav-link-logout,
:root[data-theme="dark"] .nav-link-user,
:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .day-date-arrow,
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .refresh-ring-indicator,
:root[data-theme="dark"] .input-with-unit,
:root[data-theme="dark"] .settings-section,
:root[data-theme="dark"] .settings-mode-option,
:root[data-theme="dark"] .settings-summary-item,
:root[data-theme="dark"] .filter-toggle,
:root[data-theme="dark"] .edc-import-help,
:root[data-theme="dark"] .overview-chart-card,
:root[data-theme="dark"] .overview-table-card,
:root[data-theme="dark"] .billing-chart-card,
:root[data-theme="dark"] .billing-table-card,
:root[data-theme="dark"] .billing-document-header,
:root[data-theme="dark"] .billing-print-header,
:root[data-theme="dark"] .dashboard-section,
:root[data-theme="dark"] .dashboard-card,
:root[data-theme="dark"] .metric-card {
    background: var(--panel-soft);
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .file-upload-box {
    background: linear-gradient(180deg, #111827, #162033);
    border-color: var(--border);
}

:root[data-theme="dark"] .file-upload-box:hover {
    background: rgba(56, 189, 248, .12);
    border-color: rgba(56, 189, 248, .5);
}

:root[data-theme="dark"] .edc-control-toolbar-card .overview-filter input,
:root[data-theme="dark"] .edc-control-toolbar-card .overview-filter select {
    background: #0f172a;
}

:root[data-theme="dark"] .report-table,
:root[data-theme="dark"] .data-table,
:root[data-theme="dark"] .billing-report-table {
    color: var(--text);
}

:root[data-theme="dark"] .report-table thead,
:root[data-theme="dark"] .data-table thead,
:root[data-theme="dark"] .billing-report-table thead,
:root[data-theme="dark"] .report-table tfoot td,
:root[data-theme="dark"] .data-table tfoot td,
:root[data-theme="dark"] .billing-report-table tfoot td,
:root[data-theme="dark"] .table-total-row td,
:root[data-theme="dark"] .revenue-total-row td {
    background: rgba(30, 41, 59, .92);
    border-color: var(--border);
}

:root[data-theme="dark"] .report-table th,
:root[data-theme="dark"] .report-table td,
:root[data-theme="dark"] .data-table th,
:root[data-theme="dark"] .data-table td,
:root[data-theme="dark"] .billing-report-table th,
:root[data-theme="dark"] .billing-report-table td {
    border-color: var(--border);
}

:root[data-theme="dark"] .report-table tbody tr:hover,
:root[data-theme="dark"] .data-table tbody tr:hover {
    background: rgba(56, 189, 248, .08);
}

:root[data-theme="dark"] .edc-severity-warning {
    background: rgba(245, 158, 11, .14);
}

:root[data-theme="dark"] .edc-severity-critical {
    background: rgba(248, 113, 113, .16);
}

:root[data-theme="dark"] .edc-severity-unavailable {
    background: rgba(148, 163, 184, .12);
}

:root[data-theme="dark"] .success-panel {
    background: var(--success-soft);
    border-color: rgba(134, 239, 172, .3);
    color: var(--success);
}

@media (max-width: 760px) {
    .edc-import-grid {
        grid-template-columns: 1fr;
    }

    .filter-toolbar-card,
    .edc-control-toolbar-fields,
    .filter-toolbar-actions {
        grid-template-columns: 1fr;
    }

    .filter-toolbar-actions {
        display: grid;
        min-width: 0;
    }

    .filter-toolbar-actions .primary-button,
    .filter-toolbar-actions .secondary-button {
        width: 100%;
    }
}

/* ================================
   Dark theme final page coverage
================================ */

:root[data-theme="dark"] {
    color-scheme: dark;
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] .app-shell,
:root[data-theme="dark"] .app-main {
    background: var(--bg);
    color: var(--text);
}

:root[data-theme="dark"] .app-header,
:root[data-theme="dark"] .app-header-inner {
    background: rgba(15, 23, 42, 0.94);
    border-color: var(--border);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .modal-window,
:root[data-theme="dark"] .admin-health-panel,
:root[data-theme="dark"] .admin-performance-panel,
:root[data-theme="dark"] .revenue-control-card,
:root[data-theme="dark"] .revenue-scenario-card,
:root[data-theme="dark"] .revenue-energy-card,
:root[data-theme="dark"] .revenue-breakdown-card,
:root[data-theme="dark"] .revenue-table-card,
:root[data-theme="dark"] .billing-chart-card,
:root[data-theme="dark"] .billing-table-card,
:root[data-theme="dark"] .billing-document-header,
:root[data-theme="dark"] .billing-print-header,
:root[data-theme="dark"] .overview-chart-card,
:root[data-theme="dark"] .overview-table-card,
:root[data-theme="dark"] .settings-control-card,
:root[data-theme="dark"] .revenue-period-badge,
:root[data-theme="dark"] .revenue-current-tariff-info {
    background: var(--panel);
    color: var(--text);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

:root[data-theme="dark"] .revenue-period-badge span,
:root[data-theme="dark"] .revenue-current-tariff-info span {
    color: var(--muted);
}

:root[data-theme="dark"] .revenue-period-badge strong,
:root[data-theme="dark"] .revenue-current-tariff-info strong {
    color: var(--text);
}

:root[data-theme="dark"] .settings-mode-badge {
    background: rgba(56, 189, 248, .14);
    border-color: rgba(56, 189, 248, .34);
    box-shadow: none;
}

:root[data-theme="dark"] .settings-mode-badge span {
    color: var(--muted);
}

:root[data-theme="dark"] .settings-mode-badge strong {
    color: var(--primary-dark);
}

:root[data-theme="dark"] .settings-mode-option.active {
    background: rgba(56, 189, 248, .16);
    border-color: rgba(56, 189, 248, .54);
    box-shadow: 0 14px 30px rgba(8, 47, 73, .32), inset 0 0 0 1px rgba(125, 211, 252, .14);
}

:root[data-theme="dark"] .settings-mode-option.active strong {
    color: var(--primary-dark);
}

:root[data-theme="dark"] .settings-mode-option.active span {
    color: #bfdbfe;
}

:root[data-theme="dark"] .overview-balance-mini {
    background: var(--panel-soft);
    border-color: var(--border);
}

:root[data-theme="dark"] .overview-balance-mini span {
    color: var(--muted);
}

:root[data-theme="dark"] .overview-balance-mini strong {
    color: var(--text);
}

:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .metric-card-blue,
:root[data-theme="dark"] .metric-card-green,
:root[data-theme="dark"] .metric-card-yellow,
:root[data-theme="dark"] .metric-card-purple,
:root[data-theme="dark"] .metric-card-orange,
:root[data-theme="dark"] .metric-card-red {
    background: linear-gradient(180deg, rgba(17, 24, 39, .98), rgba(22, 32, 51, .98));
    border-color: var(--border);
}

:root[data-theme="dark"] .metric-card::after,
:root[data-theme="dark"] .metric-card-blue::after,
:root[data-theme="dark"] .metric-card-green::after,
:root[data-theme="dark"] .metric-card-yellow::after,
:root[data-theme="dark"] .metric-card-purple::after,
:root[data-theme="dark"] .metric-card-orange::after,
:root[data-theme="dark"] .metric-card-red::after,
:root[data-theme="dark"] .billing-total-card::after {
    background: rgba(56, 189, 248, .08);
}

:root[data-theme="dark"] .metric-icon,
:root[data-theme="dark"] .admin-health-icon,
:root[data-theme="dark"] .admin-performance-icon,
:root[data-theme="dark"] .file-upload-icon {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-color: rgba(56, 189, 248, .28);
}

:root[data-theme="dark"] .secondary-button,
:root[data-theme="dark"] .day-date-arrow,
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .refresh-ring-indicator,
:root[data-theme="dark"] .export-mode,
:root[data-theme="dark"] .status-neutral,
:root[data-theme="dark"] .nav-link-user,
:root[data-theme="dark"] .nav-link-logout,
:root[data-theme="dark"] .nav-toggle-button,
:root[data-theme="dark"] .segmented-control.revenue-detail-toggle,
:root[data-theme="dark"] .segmented-control.revenue-detail-toggle button.active,
:root[data-theme="dark"] .input-with-unit,
:root[data-theme="dark"] .toggle-row,
:root[data-theme="dark"] .filter-toggle,
:root[data-theme="dark"] .settings-section,
:root[data-theme="dark"] .settings-summary-item,
:root[data-theme="dark"] .settings-mode-option,
:root[data-theme="dark"] .forecast-summary-chip,
:root[data-theme="dark"] .energy-mix-row,
:root[data-theme="dark"] .edc-mode-card,
:root[data-theme="dark"] .edc-detail-metrics > div,
:root[data-theme="dark"] .strategy-preview-card,
:root[data-theme="dark"] .strategy-preview-metrics > div,
:root[data-theme="dark"] .breakdown-box,
:root[data-theme="dark"] .scenario-row,
:root[data-theme="dark"] .admin-performance-empty,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .user-empty-state,
:root[data-theme="dark"] .billing-document-meta-row span {
    background: var(--panel-soft);
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .nav-dropdown-menu {
    background: rgba(17, 24, 39, .98);
    border-color: var(--border);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea,
:root[data-theme="dark"] .form-field input,
:root[data-theme="dark"] .form-field select,
:root[data-theme="dark"] .assign-box select,
:root[data-theme="dark"] .overview-filter input,
:root[data-theme="dark"] .overview-filter select,
:root[data-theme="dark"] .edc-control-toolbar-card .overview-filter input {
    background: #0f172a;
    color: var(--text);
    border-color: var(--border);
}

:root[data-theme="dark"] .refresh-ring::after,
:root[data-theme="dark"] .energy-mix-donut-inner {
    background: var(--panel);
    box-shadow: inset 0 0 0 1px var(--border);
}

:root[data-theme="dark"] .battery-bar,
:root[data-theme="dark"] .scenario-bar-track,
:root[data-theme="dark"] .energy-flow-track,
:root[data-theme="dark"] .energy-mix-donut {
    background-color: #334155;
}

:root[data-theme="dark"] .recommendation-box,
:root[data-theme="dark"] .scenario-row-highlight,
:root[data-theme="dark"] .strategy-preview-card.recommended,
:root[data-theme="dark"] .energy-mix-row-highlight,
:root[data-theme="dark"] .forecast-summary-chip-good {
    background: rgba(56, 189, 248, .12);
    border-color: rgba(56, 189, 248, .28);
}

:root[data-theme="dark"] .admin-health-card,
:root[data-theme="dark"] .admin-performance-card,
:root[data-theme="dark"] .file-upload-box {
    background: linear-gradient(180deg, rgba(17, 24, 39, .98), rgba(22, 32, 51, .98));
    border-color: var(--border);
}

:root[data-theme="dark"] .admin-health-detail,
:root[data-theme="dark"] .admin-performance-detail,
:root[data-theme="dark"] .hourly-recommendation-detail,
:root[data-theme="dark"] .edc-day-legend,
:root[data-theme="dark"] .edc-day-slot-time,
:root[data-theme="dark"] .edc-day-slot-price,
:root[data-theme="dark"] .billing-chart-value-label,
:root[data-theme="dark"] .billing-document-meta-row span,
:root[data-theme="dark"] .billing-document-generated span,
:root[data-theme="dark"] .strategy-preview-header p,
:root[data-theme="dark"] .strategy-preview-metrics span,
:root[data-theme="dark"] .edc-mode-card p,
:root[data-theme="dark"] .edc-detail-metrics span,
:root[data-theme="dark"] .field-hint {
    color: var(--muted);
}

:root[data-theme="dark"] .strategy-preview-header h3,
:root[data-theme="dark"] .strategy-preview-metrics strong,
:root[data-theme="dark"] .edc-mode-card h3,
:root[data-theme="dark"] .edc-mode-card strong,
:root[data-theme="dark"] .edc-detail-metrics strong,
:root[data-theme="dark"] .billing-document-header h2,
:root[data-theme="dark"] .billing-print-header h2,
:root[data-theme="dark"] .billing-document-generated strong {
    color: var(--text);
}

:root[data-theme="dark"] .overview-chart,
:root[data-theme="dark"] .hourly-recommendation-chart,
:root[data-theme="dark"] .billing-chart {
    background:
        linear-gradient(to top, rgba(71, 85, 105, .52) 1px, transparent 1px),
        linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(17, 24, 39, .98));
    background-size: 100% 58px, 100% 100%;
    border-color: var(--border);
}

:root[data-theme="dark"] .billing-chart {
    background-size: 100% 54px, 100% 100%;
}

:root[data-theme="dark"] .report-table thead,
:root[data-theme="dark"] .data-table thead,
:root[data-theme="dark"] .billing-report-table thead,
:root[data-theme="dark"] .report-table tfoot td,
:root[data-theme="dark"] .data-table tfoot td,
:root[data-theme="dark"] .billing-report-table tfoot td,
:root[data-theme="dark"] .table-total-row td,
:root[data-theme="dark"] .revenue-total-row td {
    background: rgba(30, 41, 59, .96);
    border-color: var(--border);
}

:root[data-theme="dark"] .edc-day-slot {
    background: var(--panel);
    border-color: var(--border);
}

:root[data-theme="dark"] .edc-day-slot.negative,
:root[data-theme="dark"] .edc-row-negative {
    background: rgba(127, 29, 29, .28);
}

:root[data-theme="dark"] .edc-day-slot.has-sharing:not(.negative),
:root[data-theme="dark"] .edc-row-sharing {
    background: rgba(56, 189, 248, .09);
}

:root[data-theme="dark"] .edc-day-slot.has-supplier-export:not(.negative),
:root[data-theme="dark"] .edc-row-supplier-export {
    background: rgba(245, 158, 11, .12);
}

:root[data-theme="dark"] .info-panel {
    background: rgba(30, 64, 175, .22);
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, .32);
}

:root[data-theme="dark"] .success-panel,
:root[data-theme="dark"] .revenue-note-positive,
:root[data-theme="dark"] .edc-mode-card.safe {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(134, 239, 172, .3);
}

:root[data-theme="dark"] .error-panel,
:root[data-theme="dark"] .admin-health-error,
:root[data-theme="dark"] .revenue-note-negative {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(252, 165, 165, .32);
}

:root[data-theme="dark"] .warning-panel,
:root[data-theme="dark"] .forecast-note {
    background: rgba(245, 158, 11, .16);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, .3);
}

:root[data-theme="dark"] .admin-health-ok.admin-health-summary,
:root[data-theme="dark"] .admin-health-ok.admin-health-badge,
:root[data-theme="dark"] .admin-performance-ok.admin-performance-summary,
:root[data-theme="dark"] .badge-success {
    color: #bfdbfe;
    background: rgba(30, 64, 175, .24);
    border-color: rgba(96, 165, 250, .35);
}

:root[data-theme="dark"] .admin-health-warning.admin-health-summary,
:root[data-theme="dark"] .admin-health-warning.admin-health-badge,
:root[data-theme="dark"] .admin-performance-warning.admin-performance-summary {
    color: #bae6fd;
    background: rgba(3, 105, 161, .24);
    border-color: rgba(125, 211, 252, .35);
}

:root[data-theme="dark"] .admin-health-error-state.admin-health-summary,
:root[data-theme="dark"] .admin-health-error-state.admin-health-badge,
:root[data-theme="dark"] .admin-performance-error.admin-performance-summary {
    color: #fecaca;
    background: rgba(127, 29, 29, .32);
    border-color: rgba(252, 165, 165, .35);
}

:root[data-theme="dark"] .skeleton-card {
    background: linear-gradient(90deg, #111827 25%, #1f2937 37%, #111827 63%);
    background-size: 400% 100%;
}

:root[data-theme="dark"] #blazor-error-ui {
    background: #1f2937;
    color: #fed7aa;
    border-color: rgba(251, 146, 60, .35);
}

/* =========================================================
   Shared chart surfaces and tablet date controls
   ========================================================= */

.overview-chart,
.daily-chart.grouped,
.hourly-recommendation-chart,
.billing-chart,
.edc-day-timeline-wrapper {
    background:
        linear-gradient(to top, rgba(226, 232, 240, .58) 1px, transparent 1px),
        linear-gradient(180deg, rgba(248, 250, 252, .92), rgba(255, 255, 255, .96));
    background-size: 100% 58px, 100% 100%;
    border: 1px solid rgba(226, 232, 240, .9);
}

.edc-day-timeline-wrapper {
    border-radius: 16px;
    padding: 14px 10px 18px;
}

:root[data-theme="dark"] .overview-chart,
:root[data-theme="dark"] .daily-chart.grouped,
:root[data-theme="dark"] .hourly-recommendation-chart,
:root[data-theme="dark"] .billing-chart,
:root[data-theme="dark"] .edc-day-timeline-wrapper {
    background:
        linear-gradient(to top, rgba(71, 85, 105, .52) 1px, transparent 1px),
        linear-gradient(180deg, rgba(15, 23, 42, .96), rgba(17, 24, 39, .98));
    background-size: 100% 58px, 100% 100%;
    border-color: var(--border);
}

:root[data-theme="dark"] .billing-chart {
    background-size: 100% 54px, 100% 100%;
}

@media (max-width: 1180px) {
    .day-date-selector,
    .edc-control-toolbar-fields .day-date-selector {
        width: 100%;
        min-width: 0;
        grid-template-columns: 42px minmax(0, 1fr) 42px;
    }

    .day-date-selector .day-date-field,
    .day-date-selector .day-date-field input {
        min-width: 0;
        width: 100%;
    }

    .single-date-filter-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: end;
    }

    .filter-toolbar-card {
        grid-template-columns: minmax(0, 1fr);
    }

    .filter-toolbar-actions {
        min-width: 0;
        justify-content: flex-start;
    }

    .edc-control-toolbar-fields {
        grid-template-columns: minmax(0, 1fr);
    }

    .overview-date-range-selector {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        grid-template-areas:
            "prev from next"
            "prev to next";
        align-items: end;
    }

    .overview-date-range-selector .day-date-arrow:first-child {
        grid-area: prev;
    }

    .overview-date-range-selector .overview-filter:nth-of-type(1) {
        grid-area: from;
    }

    .overview-date-range-selector .overview-filter:nth-of-type(2) {
        grid-area: to;
    }

    .overview-date-range-selector .day-date-arrow:last-child {
        grid-area: next;
    }
}

@media (max-width: 700px) {
    .single-date-filter-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .date-refresh-button {
        width: 100%;
    }
}
.nav-site-selector {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--text-muted, #64748b);
    font-size: .78rem;
}

.nav-site-selector select {
    max-width: 13rem;
    border: 1px solid var(--border-color, #dbe3ee);
    border-radius: .5rem;
    background: var(--surface, #fff);
    color: var(--text-color, #172033);
    padding: .35rem .5rem;
}

.organization-grid {
    display: grid;
    gap: 1rem;
}

.organization-card-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.organization-card-heading h2 {
    margin: .15rem 0;
}

.form-grid-wide {
    grid-column: 1 / -1;
}

/* ================================
   Organization units and sites
================================ */

.organization-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.organization-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.organization-summary-card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 92px;
}

.organization-summary-card:hover {
    transform: none;
}

.organization-summary-card > div {
    min-width: 0;
}

.organization-summary-card span:not(.organization-summary-icon) {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.organization-summary-card strong {
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: 28px;
    line-height: 1;
    font-weight: 850;
}

.organization-summary-icon,
.organization-identity-icon,
.production-site-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    color: #1d4ed8;
    background: rgba(59, 130, 246, .12);
    font-size: 22px;
}

.organization-summary-icon-production,
.production-site-icon {
    color: #b45309;
    background: rgba(245, 158, 11, .14);
}

.organization-summary-icon-active {
    color: #047857;
    background: rgba(16, 185, 129, .13);
}

.organization-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
    color: var(--muted);
    font-weight: 700;
}

.organization-loading-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 6px var(--primary-soft);
    animation: organization-pulse 1.2s ease-in-out infinite;
}

@keyframes organization-pulse {
    50% {
        opacity: .45;
        transform: scale(.85);
    }
}

.organization-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
}

.organization-empty-state > span {
    font-size: 42px;
}

.organization-empty-state h2 {
    margin: 12px 0 6px;
}

.organization-empty-state p {
    max-width: 540px;
    margin: 0 0 18px;
    color: var(--muted);
}

.organization-grid {
    display: grid;
    gap: 18px;
}

.organization-card {
    padding: 22px;
}

.organization-card:hover {
    transform: none;
}

.organization-card-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin: 0;
}

.organization-identity {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.organization-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.organization-title-row h2 {
    margin: 0;
    color: var(--text);
    font-size: 21px;
    line-height: 1.2;
    font-weight: 850;
    letter-spacing: -.02em;
}

.organization-identity p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.organization-code {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px 7px;
    color: var(--primary-dark);
    background: var(--panel-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 750;
}

.organization-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 800;
}

.organization-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.organization-status.is-active {
    color: #047857;
    background: rgba(16, 185, 129, .12);
}

.organization-status.is-inactive {
    color: #64748b;
    background: rgba(100, 116, 139, .12);
}

.organization-actions,
.production-site-actions,
.organization-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.organization-action-button {
    min-height: 38px;
    margin-top: 0;
    padding: 8px 12px;
}

.organization-icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    cursor: pointer;
    transition: .18s ease;
}

.organization-delete-button {
    color: #b91c1c;
}

.organization-delete-button:hover {
    border-color: rgba(220, 38, 38, .35);
    background: rgba(254, 226, 226, .75);
}

.organization-card-divider {
    height: 1px;
    margin: 18px 0;
    background: var(--border);
}

.organization-sites-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.organization-sites-heading h3 {
    margin: 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .045em;
}

.organization-sites-heading p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.production-site-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.production-site-card {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
}

.production-site-card.is-inactive {
    opacity: .72;
}

.production-site-header {
    display: flex;
    align-items: center;
    gap: 11px;
}

.production-site-icon {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    font-size: 19px;
}

.production-site-title {
    min-width: 0;
    margin-right: auto;
}

.production-site-title h4 {
    overflow: hidden;
    margin: 0 0 3px;
    color: var(--text);
    font-size: 15px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.production-site-title code {
    color: var(--primary-dark);
    font-size: 11px;
}

.production-site-details {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 14px 0;
}

.production-site-details > div {
    min-width: 0;
    border-radius: 12px;
    padding: 10px;
    background: rgba(148, 163, 184, .08);
}

.production-site-details dt {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.production-site-details dd {
    overflow: hidden;
    margin: 0;
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-control-state {
    color: var(--muted);
}

.export-control-state.is-enabled {
    color: #047857;
}

.production-site-actions {
    justify-content: flex-start;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.organization-text-delete {
    border: 0;
    padding: 8px 6px;
    color: #b91c1c;
    background: transparent;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.organization-text-delete:hover {
    color: #991b1b;
    text-decoration: underline;
}

.protected-record-label {
    margin-left: auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
}

.organization-add-site-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width: 100%;
    min-height: 130px;
    border: 1px dashed rgba(29, 140, 248, .4);
    border-radius: 18px;
    color: var(--primary-dark);
    background: rgba(29, 140, 248, .035);
    cursor: pointer;
    transition: .18s ease;
}

.organization-add-site-empty:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.organization-add-site-empty > span {
    font-size: 25px;
}

.organization-add-site-empty strong {
    margin: 4px 0;
}

.organization-add-site-empty small {
    color: var(--muted);
}

.organization-modal {
    max-width: 760px;
}

.organization-delete-modal {
    max-width: 560px;
}

.organization-modal-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .09em;
}

.organization-modal-eyebrow-danger {
    color: #dc2626;
}

.organization-modal .form-field textarea {
    min-height: 86px;
    resize: vertical;
}

.organization-modal-actions {
    margin-top: 22px;
}

.organization-modal-actions .secondary-button {
    margin-top: 0;
}

.organization-form-warning,
.organization-tariff-current {
    margin-top: 16px;
    border: 1px solid rgba(245, 158, 11, .24);
    border-radius: 14px;
    padding: 11px 13px;
    color: #92400e;
    background: rgba(254, 243, 199, .55);
    font-size: 12px;
}

.organization-tariff-current {
    margin: 0 0 16px;
    border-color: var(--border);
    color: var(--muted);
    background: var(--panel-soft);
}

.organization-delete-summary {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border: 1px solid rgba(220, 38, 38, .18);
    border-radius: 16px;
    padding: 16px;
    background: rgba(254, 242, 242, .72);
}

.organization-delete-summary > span {
    font-size: 25px;
}

.organization-delete-summary strong {
    color: var(--text);
    font-size: 16px;
}

.organization-delete-summary p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid #dc2626;
    border-radius: 12px;
    padding: 9px 16px;
    color: white;
    background: #dc2626;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    transition: .18s ease;
}

.danger-button:hover:not(:disabled) {
    border-color: #b91c1c;
    background: #b91c1c;
}

.danger-button:disabled,
.organization-icon-button:disabled,
.organization-text-delete:disabled {
    cursor: not-allowed;
    opacity: .55;
}

:root[data-theme="dark"] .production-site-card {
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
}

:root[data-theme="dark"] .organization-delete-summary {
    border-color: rgba(248, 113, 113, .28);
    background: rgba(127, 29, 29, .18);
}

:root[data-theme="dark"] .organization-delete-button {
    background: var(--panel-soft);
}

:root[data-theme="dark"] .organization-delete-button:hover {
    background: rgba(127, 29, 29, .3);
}

:root[data-theme="dark"] .organization-form-warning {
    color: #fcd34d;
    background: rgba(120, 53, 15, .24);
}

@media (max-width: 1050px) {
    .organization-card-heading {
        flex-direction: column;
    }

    .organization-actions {
        justify-content: flex-start;
        width: 100%;
    }

    .production-site-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .organization-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .organization-summary-card {
        min-height: 76px;
    }

    .organization-card {
        padding: 16px;
    }

    .organization-identity-icon {
        display: none;
    }

    .organization-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .organization-action-button {
        width: 100%;
    }

    .organization-icon-button {
        width: 100%;
    }

    .production-site-details {
        grid-template-columns: minmax(0, 1fr);
    }

    .organization-modal .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .organization-modal-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ================================
   Billing information hierarchy
================================ */

.billing-toolbar-card {
    display: block;
    padding: 0;
    overflow: hidden;
    border-color: var(--border);
    box-shadow: 0 12px 32px rgba(15, 23, 42, .06);
}

.billing-toolbar-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--panel), var(--panel-soft));
}

.billing-toolbar-heading h2 {
    margin: 3px 0 0;
    color: var(--text);
    font-size: 1.15rem;
    letter-spacing: -.02em;
}

.billing-toolbar-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: .88rem;
}

.billing-section-kicker {
    display: block;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.billing-toolbar-fields {
    display: grid;
    grid-template-columns:
        minmax(170px, 1fr)
        minmax(170px, 1fr)
        minmax(230px, 1.35fr)
        100px
        minmax(135px, .75fr)
        minmax(125px, .7fr);
    gap: 14px;
    align-items: end;
    padding: 18px 22px;
}

.billing-toolbar-card .overview-filter label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .76rem;
    font-weight: 850;
}

.billing-toolbar-card .overview-filter input,
.billing-toolbar-card .overview-filter select {
    width: 100%;
    height: 42px;
    min-height: 42px;
    border-radius: 11px;
}

.billing-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    background: var(--panel-soft);
}

.billing-toolbar-actions .primary-button,
.billing-toolbar-actions .secondary-button {
    min-width: 0;
    height: 40px;
    min-height: 40px;
    margin: 0;
    border-radius: 11px;
}

.billing-toolbar-actions .primary-button {
    order: 1;
}

.billing-toolbar-actions .secondary-button {
    order: 2;
}

.billing-active-context {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -8px 0 22px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--panel-soft);
}

.billing-active-context > div {
    min-width: 0;
}

.billing-active-context span {
    display: block;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.billing-active-context strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: var(--text);
    font-size: .9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.billing-active-context .billing-context-separator {
    color: var(--muted);
    font-size: 1.25rem;
}

.billing-active-context .billing-context-period {
    margin-left: auto;
    padding-left: 16px;
    border-left: 1px solid var(--border);
}

.billing-overall-summary {
    padding: 22px;
    border-color: var(--border);
    box-shadow: 0 12px 30px rgba(15, 23, 42, .055);
}

.billing-overall-summary .billing-section-header {
    align-items: flex-start;
    margin: 0 0 17px;
}

.billing-site-summary {
    background: linear-gradient(180deg, var(--panel), var(--panel-soft));
}

.billing-organization-summary {
    margin-top: 22px;
}

.billing-organization-kpis {
    grid-template-columns: repeat(4, minmax(190px, 1fr));
}

.billing-organization-table {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.billing-organization-table .number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.billing-section-close {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.billing-section-close:hover {
    border-color: rgba(14, 165, 233, .4);
    color: var(--primary);
}

.billing-total-card {
    border-color: var(--border);
    border-top-width: 3px;
}

.billing-total-card.metric-card-blue {
    border-top-color: #38bdf8;
}

.billing-total-card.metric-card-yellow {
    border-top-color: #f59e0b;
}

.billing-total-card.metric-card-green {
    border-top-color: #10b981;
}

.billing-total-card .metric-icon {
    background: var(--panel-soft);
    color: var(--text);
}

.billing-total-card .metric-label {
    color: var(--muted);
}

.billing-positive-value,
.billing-savings-cell {
    color: #047857;
    font-weight: 850;
}

.billing-document-header {
    background: linear-gradient(135deg, var(--panel-soft), var(--panel));
}

.billing-comparison-strip {
    margin: 16px 0 22px;
}

.billing-comparison-strip > div {
    border-radius: 14px;
}

@media (max-width: 1280px) {
    .billing-toolbar-fields {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .billing-organization-kpis {
        grid-template-columns: repeat(2, minmax(190px, 1fr));
    }
}

@media (max-width: 820px) {
    .billing-toolbar-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .billing-point-filter {
        grid-column: 1 / -1;
    }

    .billing-active-context {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .billing-active-context .billing-context-separator {
        display: none;
    }

    .billing-active-context .billing-context-period {
        margin-left: 0;
        padding-left: 0;
        border-left: 0;
    }
}

@media (max-width: 600px) {
    .billing-toolbar-heading,
    .billing-toolbar-fields,
    .billing-toolbar-actions {
        padding-left: 16px;
        padding-right: 16px;
    }

    .billing-toolbar-fields,
    .billing-organization-kpis,
    .billing-active-context {
        grid-template-columns: minmax(0, 1fr);
    }

    .billing-point-filter {
        grid-column: auto;
    }

    .billing-toolbar-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .billing-toolbar-actions .primary-button,
    .billing-toolbar-actions .secondary-button {
        width: 100%;
    }

    .billing-overall-summary {
        padding: 16px;
    }
}

@media print {
    .billing-active-context {
        display: none !important;
    }
}

:root[data-theme="dark"] .billing-toolbar-heading,
:root[data-theme="dark"] .billing-site-summary,
:root[data-theme="dark"] .billing-document-header {
    background: linear-gradient(135deg, var(--panel), var(--panel-soft));
}

:root[data-theme="dark"] .billing-positive-value,
:root[data-theme="dark"] .billing-savings-cell {
    color: #6ee7b7;
}

/* ================================
   User dashboard monthly insights
================================ */

.user-monthly-energy-panel {
    margin-top: 22px;
    padding: 22px;
    border-color: var(--border);
    overflow: hidden;
}

.user-monthly-panel-header {
    align-items: flex-start;
    margin-bottom: 18px;
}

.user-insight-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--primary);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.user-monthly-period-badge {
    min-width: 138px;
    padding: 10px 14px;
    border: 1px solid rgba(16, 185, 129, .22);
    border-radius: 14px;
    background: rgba(16, 185, 129, .08);
    text-align: right;
}

.user-monthly-period-badge span {
    display: block;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
}

.user-monthly-period-badge strong {
    display: block;
    margin-top: 2px;
    color: #047857;
    font-size: 1.35rem;
    font-weight: 900;
}

.user-monthly-energy-grid {
    display: grid;
    grid-template-columns: minmax(250px, .9fr) minmax(250px, .85fr) minmax(330px, 1.35fr);
    gap: 16px;
}

.user-monthly-source-card,
.user-day-night-profile,
.user-consumption-tips {
    min-width: 0;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--panel-soft);
}

.user-insight-card-heading span {
    display: block;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.user-insight-card-heading strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 900;
}

.monthly-energy-mix-bar {
    display: flex;
    width: 100%;
    height: 15px;
    margin: 22px 0 18px;
    overflow: hidden;
    border-radius: 999px;
    background: #cbd5e1;
}

.monthly-energy-mix-edc {
    width: calc(var(--monthly-edc) * 1%);
    background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.monthly-energy-mix-local {
    width: calc(var(--monthly-local) * 1%);
    background: linear-gradient(90deg, #16a34a, #4ade80);
}

.monthly-energy-mix-supplier {
    flex: 1;
    background: linear-gradient(90deg, #94a3b8, #cbd5e1);
}

.monthly-energy-source-list {
    display: grid;
    gap: 12px;
}

.monthly-energy-source-list > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 3px 12px;
    align-items: baseline;
}

.monthly-energy-source-list span {
    color: var(--text);
    font-size: .86rem;
    font-weight: 800;
}

.monthly-energy-source-list strong {
    color: var(--text);
    font-size: .96rem;
    font-variant-numeric: tabular-nums;
}

.monthly-energy-source-list small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: .74rem;
}

.user-day-night-profile {
    display: grid;
    align-content: start;
    gap: 10px;
}

.user-profile-card {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
}

.user-profile-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 11px;
    background: var(--panel-soft);
    font-size: 1.15rem;
}

.user-profile-card span,
.user-profile-peak span {
    display: block;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 800;
}

.user-profile-card strong {
    display: block;
    margin-top: 2px;
    color: var(--text);
    font-size: 1.05rem;
}

.user-profile-card small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: .73rem;
}

.user-profile-day {
    border-left: 3px solid #f59e0b;
}

.user-profile-night {
    border-left: 3px solid #6366f1;
}

.user-profile-peak {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
}

.user-profile-peak strong {
    color: var(--text);
    font-size: .86rem;
}

.user-consumption-tip-list {
    display: grid;
    gap: 9px;
    margin-top: 13px;
}

.user-consumption-tip {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--panel);
}

.user-consumption-tip-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 9px;
    font-size: .9rem;
    font-weight: 900;
}

.user-consumption-tip h3 {
    margin: 0;
    color: var(--text);
    font-size: .86rem;
    line-height: 1.25;
}

.user-consumption-tip p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.4;
}

.user-consumption-tip-positive .user-consumption-tip-icon {
    background: rgba(16, 185, 129, .12);
    color: #047857;
}

.user-consumption-tip-opportunity .user-consumption-tip-icon {
    background: rgba(245, 158, 11, .14);
    color: #b45309;
}

.user-consumption-tip-info .user-consumption-tip-icon {
    background: rgba(14, 165, 233, .12);
    color: #0369a1;
}

@media (max-width: 1180px) {
    .user-monthly-energy-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .user-consumption-tips {
        grid-column: 1 / -1;
    }

    .user-consumption-tip-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .user-monthly-energy-panel {
        padding: 16px;
    }

    .user-monthly-panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .user-monthly-period-badge {
        min-width: 0;
        text-align: left;
    }

    .user-monthly-energy-grid,
    .user-consumption-tip-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .user-consumption-tips {
        grid-column: auto;
    }
}

:root[data-theme="dark"] .user-monthly-period-badge {
    background: rgba(6, 78, 59, .24);
}

:root[data-theme="dark"] .user-monthly-period-badge strong,
:root[data-theme="dark"] .user-consumption-tip-positive .user-consumption-tip-icon {
    color: #6ee7b7;
}

:root[data-theme="dark"] .user-consumption-tip-opportunity .user-consumption-tip-icon {
    color: #fcd34d;
}

:root[data-theme="dark"] .user-consumption-tip-info .user-consumption-tip-icon {
    color: #7dd3fc;
}
.landing-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: radial-gradient(circle at top, rgba(37, 99, 235, .12), transparent 45%);
}

.landing-card {
    width: min(560px, 100%);
    padding: 3rem;
    text-align: center;
}

.landing-logo {
    width: min(260px, 75%);
    margin-bottom: 1.5rem;
}

.landing-actions {
    display: flex;
    justify-content: center;
    gap: .75rem;
    margin: 1.75rem 0 1rem;
    flex-wrap: wrap;
}

.demo-mode-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    padding: .35rem 1rem;
    text-align: center;
    background: #f59e0b;
    color: #111827;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .04em;
}

body:has(.demo-mode-banner) .top-nav {
    margin-top: 29px;
}
