/* Power Meter module. Visual language adapted from the legacy PM screen. */
.pm-module {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.pm-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.pm-eyebrow,
.pm-card-title,
.pm-label,
.pm-section-label {
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.pm-eyebrow {
    font-size: 11px;
    font-weight: 600;
}

.pm-title {
    margin: 2px 0 0;
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
}

.pm-connection {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 500;
}

.pm-connection.online {
    color: var(--success, #22c55e);
}

.pm-connection-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.pm-connection.online .pm-connection-dot {
    background: var(--success, #22c55e);
    box-shadow: 0 0 6px rgba(34, 197, 94, .35);
}

.pm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.pm-card {
    min-width: 0;
    padding: 16px;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-default, #e8e6df);
    border-radius: 12px;
}

.pm-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 11px;
    font-weight: 600;
}

.pm-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.pm-phase-table {
    width: 100%;
    border-collapse: collapse;
}

.pm-phase-table th {
    padding: 6px 7px;
    border-bottom: 1px solid var(--border-default, #e8e6df);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .3px;
    text-align: right;
}

.pm-phase-table th:first-child {
    text-align: left;
}

.pm-phase-table td {
    padding: 8px 7px;
    border-bottom: 1px solid var(--border-default, #e8e6df);
    font-family: var(--font-mono, 'DM Mono', monospace);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
}

.pm-phase-table td:first-child {
    font-family: var(--font-sans, 'DM Sans', sans-serif);
    font-weight: 500;
    text-align: left;
}

.pm-phase-table tr:last-child td {
    border-bottom: none;
}

.pm-phase-chip {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 2px;
    vertical-align: middle;
}

.pm-phase-chip.phase-1 { background: #ef4444; }
.pm-phase-chip.phase-2 { background: #f59e0b; }
.pm-phase-chip.phase-3 { background: #3b82f6; }

.pm-single-row,
.pm-total-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.pm-total-row {
    margin-top: 12px;
}

.pm-kpi-box,
.pm-energy-box {
    min-width: 0;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg-panel, #fafaf7);
}

.pm-label {
    font-size: 10px;
    font-weight: 500;
}

.pm-value {
    margin-top: 2px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.pm-no-data-value {
    color: var(--text-tertiary, #a3a3a3);
    font-weight: 500;
}

.pm-unit {
    margin-left: 2px;
    color: var(--text-secondary);
    font-family: var(--font-sans, 'DM Sans', sans-serif);
    font-size: 10px;
    font-weight: 500;
}

.pm-section-label {
    margin: 12px 0 8px;
    padding: 10px 0 6px;
    border-bottom: 1px solid var(--border-default, #e8e6df);
    font-size: 10px;
    font-weight: 600;
}

.pm-energy-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.pm-energy-many {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pm-energy-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pm-energy-box .pm-value {
    font-size: 14px;
    white-space: nowrap;
}

.pm-no-data {
    min-height: 90px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    background: var(--bg-panel, #fafaf7);
    color: var(--text-tertiary);
    font-size: 12px;
}

@media (max-width: 860px) {
    .pm-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .pm-phase-table {
        font-size: 11px;
    }

    .pm-phase-table th,
    .pm-phase-table td {
        padding-left: 4px;
        padding-right: 4px;
    }

    .pm-single-row,
    .pm-total-row,
    .pm-energy-row,
    .pm-energy-many {
        grid-template-columns: 1fr;
    }
}
