/*
    The reporting pages - day, month and year (issue #692, proposal B of the mockup in
    A_Documents/plans/mockups/reporting-redesign-mockup.html).

    Every period opens the same way: a period bar, one sentence, six figures against the
    period compared with, and the month as a heatmap calendar with the chosen day beside it.
    Below that the same sections in the same order on all three pages: energy, money, cars
    and charging, heating, household, rooms and air.

    The colours are the energy roles of the PV Home dashboard (--flow-* in animation.css):
    amber the roof, violet the grid, green what is sold, blue the house, orange the cars,
    red the heat pump. Loaded from common/commonHead.xhtml; only reporting_*.xhtml use it.
*/

.rpt {
    display: grid;
    gap: 16px;
    margin-bottom: 1.5rem;
    color: var(--flow-ink);
}

.rpt .card {
    margin-bottom: 0;
}

.rpt-split {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: 16px;
    align-items: start;
}

@media (max-width: 991.98px) {
    .rpt-split {
        grid-template-columns: minmax(0, 1fr);
    }
}

.rpt-pair {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 16px;
}

.rpt-muted {
    color: var(--flow-ink-soft);
}

.rpt-faint {
    color: var(--flow-ink-faint);
}

.rpt-num {
    font-variant-numeric: tabular-nums;
}

/* ── the period bar ─────────────────────────────────────────────────── */

.rpt-periodbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    background: var(--flow-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    padding: 8px 10px;
}

.rpt-seg {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border-radius: 9px;
    background: var(--flow-rule);
}

.rpt-seg a,
.rpt-seg button {
    font: inherit;
    font-size: 13.5px;
    border: 0;
    background: transparent;
    color: var(--flow-ink-soft);
    padding: 5px 12px;
    border-radius: 7px;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.4;
}

.rpt-seg a:hover,
.rpt-seg button:hover {
    color: var(--flow-ink);
}

.rpt-seg .on,
.rpt-seg button[aria-pressed="true"] {
    background: var(--flow-ink);
    color: var(--flow-card);
}

.rpt-when {
    display: flex;
    align-items: center;
    gap: 6px;
}

.rpt-when b {
    font-size: 16px;
    min-width: 10ch;
    text-align: center;
}

.rpt-when .ui-button.rpt-step {
    width: 34px;
    height: 34px;
    border-radius: 9px;
}

.rpt-spacer {
    flex: 1;
}

.rpt-compare {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12.5px;
    color: var(--flow-ink-faint);
}

.rpt-compare .ui-button.rpt-pill {
    border-radius: 999px;
    font-size: 12.5px;
}

.rpt-compare .ui-button.rpt-pill.on {
    background: var(--flow-house);
    border-color: var(--flow-house);
    color: #fff;
}

/* ── the summary ────────────────────────────────────────────────────── */

.rpt-headline {
    font-size: 21px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0;
    max-width: 48ch;
}

.rpt-headline em {
    font-style: normal;
    color: var(--flow-good);
}

.rpt-headline .change {
    display: block;
    font-size: 15px;
    font-weight: 400;
    color: var(--flow-ink-soft);
    margin-top: 4px;
}

.rpt-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    background: var(--flow-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 10px;
    overflow: hidden;
}

.rpt-kpi {
    display: grid;
    gap: 2px;
    align-content: start;
    padding: 14px 16px;
    box-shadow: inset -1px -1px 0 var(--flow-rule);
}

.rpt-kpi .l {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--flow-ink-soft);
}

.rpt-kpi .l i {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex: none;
}

.rpt-kpi .v {
    font-size: 21px;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.rpt-kpi .v small {
    font-size: 13px;
    font-weight: 500;
    color: var(--flow-ink-soft);
    margin-left: 3px;
}

.rpt-kpi .d {
    font-size: 12px;
    color: var(--flow-ink-faint);
}

.rpt-delta.up {
    color: var(--flow-good);
}

.rpt-delta.down {
    color: var(--flow-heat);
}

.rpt-highlights {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.rpt-highlights li {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr);
    gap: 8px;
    font-size: 14px;
    line-height: 1.45;
}

.rpt-highlights .m {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    background: var(--flow-ink-faint);
}

.tone-sun { background: var(--flow-sun) !important; }
.tone-grid { background: var(--flow-grid) !important; }
.tone-export { background: var(--flow-export) !important; }
.tone-house { background: var(--flow-house) !important; }
.tone-car { background: var(--flow-car) !important; }
.tone-heat { background: var(--flow-heat) !important; }
.tone-batt { background: var(--flow-batt) !important; }
.tone-warn { background: var(--flow-warn) !important; }
.tone-good { background: var(--flow-good) !important; }

/* ── the heatmap calendar ───────────────────────────────────────────── */

.rpt-cal-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
}

.rpt-cal-head h5 {
    margin: 0;
    font-weight: 600;
}

.rpt-cal {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.rpt-cal.year {
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 6px;
}

.rpt-cal .dow {
    font-size: 11px;
    color: var(--flow-ink-faint);
    text-align: center;
}

.rpt-cell {
    font: inherit;
    aspect-ratio: 1 / 0.82;
    min-width: 0;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--flow-track);
    color: var(--flow-ink);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    padding: 5px 6px;
    text-align: left;
}

.rpt-cal.year .rpt-cell {
    aspect-ratio: auto;
    min-height: 64px;
}

button.rpt-cell {
    cursor: pointer;
}

.rpt-cell .d {
    font-size: 11px;
    opacity: 0.85;
}

.rpt-cell .v {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rpt-cell .marks {
    display: flex;
    gap: 3px;
    min-height: 6px;
}

.rpt-cell .marks i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.rpt-cell.blank {
    background: transparent;
}

.rpt-cell.nodata,
.rpt-cell.future {
    background: transparent;
    border: 1px dashed #d9dcea;
    color: var(--flow-ink-faint);
}

.rpt-cell.picked {
    border-color: var(--flow-ink);
    box-shadow: inset 0 0 0 2px var(--flow-ink);
}

.rpt-cell:focus-visible {
    outline: 2px solid var(--flow-house);
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .rpt-cell {
        padding: 3px 4px;
    }

    .rpt-cell .v {
        font-size: 10px;
    }
}

.rpt-cal-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--flow-ink-faint);
}

.rpt-scale {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rpt-scale .g {
    width: 110px;
    height: 8px;
    border-radius: 4px;
    background: var(--flow-track);
}

/* the chosen day beside the calendar */
.rpt-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 12px;
    margin-bottom: 12px;
}

.rpt-panel-head h5 {
    margin: 0;
    font-weight: 600;
}

.rpt-open {
    font-size: 13px;
    font-weight: 600;
}

/* ── sections ───────────────────────────────────────────────────────── */

.rpt-section-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    margin: 10px 0 -4px 2px;
}

.rpt-section-head .n {
    font-size: 12px;
    color: var(--flow-ink-faint);
    font-variant-numeric: tabular-nums;
}

.rpt-section-head h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
}

.rpt-section-head span.note {
    font-size: 12.5px;
    color: var(--flow-ink-soft);
}

.rpt-splitbar {
    display: grid;
    gap: 6px;
}

.rpt-splitbar .cap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    color: var(--flow-ink-soft);
}

.rpt-splitbar .cap b {
    color: var(--flow-ink);
    font-variant-numeric: tabular-nums;
}

.rpt-splitbar .bar {
    display: flex;
    gap: 2px;
    height: 14px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--flow-track);
}

.rpt-splitbar .bar span {
    display: block;
    height: 100%;
}

.rpt-note {
    font-size: 12.5px;
    color: var(--flow-ink-soft);
    margin: 0;
}

/* the statement of the money section */
.rpt-stmt {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.rpt-stmt td {
    padding: 7px 0;
    border-bottom: 1px solid var(--flow-rule);
    vertical-align: baseline;
}

.rpt-stmt td.amt {
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
    padding-left: 12px;
    font-variant-numeric: tabular-nums;
}

.rpt-stmt td .sub {
    display: block;
    font-size: 12px;
    color: var(--flow-ink-faint);
}

.rpt-stmt tr.grp td {
    padding-top: 14px;
    font-size: 11.5px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--flow-ink-faint);
    font-weight: 600;
}

.rpt-stmt tr.total td {
    border-bottom: 0;
    border-top: 2px solid var(--flow-ink);
    font-weight: 700;
}

.rpt-stmt .plus {
    color: var(--flow-good);
}

.rpt-stmt .minus {
    color: var(--flow-heat);
}

/* the cars, one row each */
.rpt-table-wrap {
    overflow-x: auto;
}

.rpt-cars {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
    font-size: 13.5px;
}

.rpt-cars th,
.rpt-cars td {
    text-align: right;
    padding: 9px 10px;
    border-bottom: 1px solid var(--flow-rule);
    vertical-align: middle;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rpt-cars th:first-child,
.rpt-cars td:first-child {
    text-align: left;
    white-space: normal;
}

.rpt-cars th {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--flow-ink-faint);
    font-weight: 600;
}

.rpt-cars td:first-child {
    font-weight: 600;
}

.rpt-cars tfoot td {
    font-weight: 700;
    border-bottom: 0;
    border-top: 2px solid var(--flow-rule);
}

.rpt-cars .sub {
    display: block;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--flow-ink-faint);
}

.rpt-car {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rpt-car img {
    width: 56px;
    height: auto;
    border-radius: 6px;
    flex: none;
}

.rpt-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rpt-mini .t {
    position: relative;
    width: 60px;
    height: 6px;
    border-radius: 3px;
    background: var(--flow-track);
    overflow: hidden;
}

.rpt-mini .t span {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 3px;
}

/* the sockets, ranked */
.rpt-rank {
    display: grid;
    gap: 8px;
}

.rpt-rank .row {
    display: grid;
    grid-template-columns: minmax(110px, 170px) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 0;
    font-size: 13.5px;
}

.rpt-rank .t {
    height: 10px;
    border-radius: 3px;
    background: var(--flow-track);
    overflow: hidden;
}

.rpt-rank .t span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--flow-sock);
}

.rpt-rank .n {
    font-size: 12.5px;
    color: var(--flow-ink-soft);
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.rpt-rank .n b {
    color: var(--flow-ink);
}

@media (max-width: 575.98px) {
    .rpt-rank .row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .rpt-rank .t {
        grid-column: 1 / -1;
        order: 3;
    }
}

/* the rooms */
.rpt-rooms {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.rpt-rooms th,
.rpt-rooms td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--flow-rule);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rpt-rooms th:first-child,
.rpt-rooms td:first-child {
    text-align: left;
}

.rpt-rooms th {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--flow-ink-faint);
    font-weight: 600;
}

.rpt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dash-chip.bad {
    background: #fbeaec;
    color: var(--flow-heat);
}

.rpt-chart {
    position: relative;
}
