#energy-panel {
    position: fixed;
    inset: 0;
    z-index: 1000;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.45s;
}

.main-wrapper.energy-active #energy-panel {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition-delay: 0s;
}

.energy-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.energy-periods {
    display: inline-flex;
    border: 1px solid #383d41;
    border-radius: 6px;
    overflow: hidden;
}

.energy-period,
.energy-date-button,
.energy-refresh {
    border: 0;
    border-right: 1px solid #383d41;
    background: #202326;
    color: #cfd4d7;
    font: inherit;
    cursor: pointer;
}

.energy-period {
    min-width: 78px;
    padding: 9px 12px;
}

.energy-period:last-child,
.energy-date-button:last-child {
    border-right: 0;
}

.energy-period.active {
    background: #3a291d;
    color: #ffbd87;
}

.energy-date-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    color: #dfe4e6;
    font-size: 0.82rem;
}

.energy-date-button {
    width: 34px;
    height: 34px;
    border: 1px solid #383d41;
    border-radius: 5px;
}

.energy-refresh {
    margin-left: auto;
    padding: 9px 12px;
    border: 1px solid #414649;
    border-radius: 5px;
}

.energy-status {
    min-height: 18px;
    margin-bottom: 12px;
    color: #aeb4b8;
    font-size: 0.78rem;
}

.energy-status.is-error {
    color: #dd756d;
}

.energy-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.energy-summary-card,
.energy-breakdown,
.energy-history,
.energy-activity {
    border: 1px solid #383d41;
    border-radius: 7px;
    background: #1c1f22;
}

.energy-summary-card {
    min-height: 84px;
    padding: 14px;
}

.energy-summary-card span {
    display: block;
    margin-bottom: 9px;
    color: #aeb4b8;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.energy-summary-card strong {
    color: #edf0f2;
    font-size: 1.35rem;
}

.energy-layout {
    display: grid;
    grid-template-columns: minmax(230px, 0.75fr) minmax(0, 1.25fr);
    gap: 12px;
    margin-bottom: 12px;
}

.energy-breakdown,
.energy-history,
.energy-activity {
    padding: 14px;
}

.energy-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.energy-section-heading h2 {
    margin: 0;
    color: #dfe4e6;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.energy-breakdown-bar {
    display: flex;
    height: 16px;
    overflow: hidden;
    margin-bottom: 12px;
    border-radius: 4px;
    background: #25292c;
}

.energy-breakdown-segment {
    min-width: 2px;
    height: 100%;
}

.energy-category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.energy-category-row {
    display: grid;
    grid-template-columns: minmax(100px, 1fr) auto;
    align-items: center;
    gap: 8px;
    color: #dfe4e6;
    font-size: 0.78rem;
}

.energy-category-name {
    display: flex;
    align-items: center;
    gap: 7px;
}

.energy-category-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.energy-category-value {
    color: #f4a15c;
    font-variant-numeric: tabular-nums;
}

.energy-history-chart {
    min-height: 210px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border-bottom: 1px solid #383d41;
}

.energy-history-column {
    flex: 1 1 0;
    min-width: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 210px;
}

.energy-history-bar {
    width: min(38px, 70%);
    min-height: 3px;
    border-radius: 3px 3px 0 0;
    background: #ed8738;
    position: relative;
}

.energy-history-bar span {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 5px);
    transform: translateX(-50%);
    color: #aeb4b8;
    font-size: 0.68rem;
    white-space: nowrap;
}

#energy-category-filter {
    border: 1px solid #414649;
    border-radius: 5px;
    background: #202326;
    color: #dfe4e6;
    padding: 7px 9px;
    font: inherit;
    font-size: 0.78rem;
}

.energy-activity-list {
    display: flex;
    flex-direction: column;
    max-height: 310px;
    overflow-y: auto;
}

.energy-activity-row {
    display: grid;
    grid-template-columns: 82px 110px minmax(180px, 1fr) 90px;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    border-top: 1px solid #303438;
    color: #dfe4e6;
    font-size: 0.78rem;
}

.energy-activity-row:first-child {
    border-top: 0;
}

.energy-confidence {
    display: inline-flex;
    width: fit-content;
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid #414649;
    color: #cfd4d7;
    font-size: 0.68rem;
}

.energy-confidence.confirmed {
    border-color: rgba(130, 201, 145, 0.45);
    color: #82c991;
}

.energy-confidence.estimated {
    border-color: rgba(237, 135, 56, 0.55);
    color: #ffa052;
}

.energy-confidence.unknown {
    border-color: rgba(221, 117, 109, 0.45);
    color: #dd756d;
}

@media (max-width: 900px) {
    .energy-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .energy-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .energy-activity-row {
        grid-template-columns: 74px 100px minmax(140px, 1fr);
    }

    .energy-activity-row > :last-child {
        display: none;
    }
}

@media (max-width: 600px) {
    .energy-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .energy-toolbar {
        align-items: stretch;
    }

    .energy-periods {
        width: 100%;
    }

    .energy-period {
        flex: 1;
        min-width: 0;
    }

    .energy-refresh {
        width: 100%;
        margin-left: 0;
    }

    .energy-activity-row {
        grid-template-columns: 64px 94px minmax(100px, 1fr);
    }

    .energy-activity-row > :nth-child(4),
    .energy-activity-row > :nth-child(5) {
        display: none;
    }
}

.energy-history-canvas-wrap {
    position: relative;
    height: 280px;
}

.energy-focus-days {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.energy-day-chip {
    border: 1px solid #383d41;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.75rem;
    color: #cdd3dc;
    background: #232629;
}

.energy-day-chip.is-empty {
    opacity: 0.45;
}

.energy-activity-range {
    font-size: 0.75rem;
    font-weight: 400;
    color: #8e94a9;
    margin-left: 8px;
}
