/* Cumulative tab: reports, status stats, charts, fullscreen overlay. */

.section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.surface {
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: var(--card);
    padding: 1.5rem;
}

.surface--tight {
    padding: 1rem;
}

.overview__head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.overview__badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    background: color-mix(in oklab, var(--primary) 10%, transparent);
    color: var(--primary);
}

.h2 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    margin: 0;
}

/* Date navigator */
.navigator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.navigator__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navigator__label {
    min-width: 180px;
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-lg);
    background: color-mix(in oklab, var(--muted) 30%, transparent);
    transition: background-color 150ms;
}

/* Buttons shared by the report toolbars */
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    padding: 0 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition:
        background-color 150ms,
        border-color 150ms,
        color 150ms;
}

.btn-sm:hover:not([disabled]):not([aria-pressed="true"]) {
    background: var(--accent);
}

.btn-sm[aria-pressed="true"] {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    width: 2rem;
    flex: none;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background: var(--background);
    color: var(--foreground);
    cursor: pointer;
    transition: background-color 150ms;
}

.btn-icon:hover {
    background: var(--accent);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

/* StatusStat (components/ui/status-stat.tsx) */
.stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
    .stats {
        flex-direction: row;
    }
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-xl);
    min-width: 160px;
    border: 1px solid;
}

.stat__dot {
    height: 0.75rem;
    width: 0.75rem;
    flex: none;
    border-radius: 999px;
}
.stat__label {
    font-size: 0.75rem;
    line-height: 1rem;
    margin: 0;
}
.stat__value {
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.stat--warning {
    background: color-mix(in oklab, var(--status-warning) 10%, transparent);
    border-color: color-mix(in oklab, var(--status-warning) 30%, transparent);
}
.stat--warning .stat__dot {
    background: var(--status-warning);
}
.stat--warning .stat__value {
    color: var(--status-warning);
}

.stat--error {
    background: color-mix(in oklab, var(--status-error) 10%, transparent);
    border-color: color-mix(in oklab, var(--status-error) 30%, transparent);
}
.stat--error .stat__dot {
    background: var(--status-error);
}
.stat--error .stat__value {
    color: var(--status-error);
}

.stat--info {
    background: color-mix(in oklab, var(--status-info) 10%, transparent);
    border-color: color-mix(in oklab, var(--status-info) 30%, transparent);
}
.stat--info .stat__dot {
    background: var(--status-info);
}
.stat--info .stat__value {
    color: var(--status-info);
}

.stat__dot--success {
    background: var(--status-success) !important;
}
.stat__dot--error {
    background: var(--status-error) !important;
}
.stat__value--plain {
    color: var(--foreground) !important;
}

/* Chart */
.chart {
    position: relative;
    width: 100%;
    min-height: 320px;
}
.chart svg {
    display: block;
    width: 100%;
    height: auto;
}
.chart__grid {
    stroke: color-mix(in oklab, var(--foreground) 8%, transparent);
    stroke-width: 1;
}
.chart__axis {
    stroke: color-mix(in oklab, var(--foreground) 22%, transparent);
    stroke-width: 1;
}
.chart__tick {
    fill: var(--muted-foreground);
    font-size: 11px;
}
.chart__title {
    fill: var(--muted-foreground);
    font-size: 12px;
}
.chart__bar {
    transition: opacity 120ms;
}
.chart__band {
    fill: transparent;
}
.chart__band[data-active="true"] {
    fill: color-mix(in oklab, var(--foreground) 6%, transparent);
}

.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding-top: 1.25rem;
}
.legend__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}
.legend__dot {
    height: 0.625rem;
    width: 0.625rem;
    border-radius: 999px;
    flex: none;
}

.chart-tooltip {
    position: absolute;
    z-index: 20;
    min-width: 8rem;
    border-radius: var(--radius-md);
    background: rgb(0 0 0 / 0.85);
    color: #fff;
    padding: 0.625rem 0.75rem;
    font-size: 0.75rem;
    line-height: 1.15rem;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%);
    transition: opacity 120ms;
    white-space: nowrap;
}

.chart-tooltip[data-open="true"] {
    opacity: 1;
}
.chart-tooltip__title {
    font-size: 0.8125rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
}
.chart-tooltip__row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}
.chart-tooltip__dot {
    height: 0.5rem;
    width: 0.5rem;
    border-radius: 999px;
    flex: none;
}

/* Fullscreen chart overlay */
.fullscreen {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--background);
    display: none;
    flex-direction: column;
}

.fullscreen[data-open="true"] {
    display: flex;
}

.fullscreen__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--card);
    flex: none;
}

.fullscreen__body {
    flex: 1;
    padding: 1rem;
    background: var(--card);
    min-height: 0;
}
.fullscreen__body .chart {
    height: 100%;
    min-height: 0;
}
.fullscreen__body .chart svg {
    height: auto;
}

/* Electricity package select */
.package {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}
@media (min-width: 640px) {
    .package {
        flex-direction: row;
    }
}

.select {
    height: 2.25rem;
    padding: 0 2rem 0 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--input);
    background: var(--background);
    color: var(--foreground);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position:
        right 1rem center,
        right 0.7rem center;
    background-size:
        5px 5px,
        5px 5px;
    background-repeat: no-repeat;
}
