/* Báo cáo đo điện — trang chi tiết sản phẩm (khách) */
.pt-pub {
    --pt-ink: #161B22;
    --pt-ink-soft: #4B5563;
    --pt-muted: #8A93A3;
    --pt-line: #E7EAEF;
    --pt-line-soft: #F0F2F6;
    --pt-run: #1E9E5A;
    --pt-run-soft: #E7F7EE;
    --pt-rest: #94A0B4;
    --pt-rest-soft: #F1F3F7;
    --pt-accent: #3E5FE0;
    --pt-accent-deep: #5B3FD6;
    font-family: 'Manrope', system-ui, sans-serif;
}

/* ── Compact teaser trên cột thông tin SP ── */
.pt-pub-teaser {
    border: 1px solid var(--pt-line);
    border-radius: 16px;
    padding: 14px 15px 15px;
    background: linear-gradient(165deg, #F7F9FF 0%, #FFFFFF 42%, #F6FBF8 100%);
    box-shadow: 0 8px 24px -16px rgba(23, 30, 49, 0.35);
}
.pt-pub-teaser-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}
.pt-pub-teaser-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pt-accent) 0%, var(--pt-accent-deep) 100%);
    color: #fff;
    font-size: 14px;
}
.pt-pub-teaser-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--pt-ink);
    line-height: 1.3;
}
.pt-pub-teaser-sub {
    font-size: 11.5px;
    color: var(--pt-muted);
    font-weight: 600;
    margin-top: 2px;
}
.pt-pub-teaser-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.pt-pub-teaser-stat {
    background: #fff;
    border: 1px dashed var(--pt-line);
    border-radius: 11px;
    padding: 10px 8px;
    text-align: center;
}
.pt-pub-teaser-stat .val {
    display: block;
    font-size: 18px;
    font-weight: 800;
    color: var(--pt-accent-deep);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    line-height: 1.1;
}
.pt-pub-teaser-stat .unit {
    font-size: 11px;
    font-weight: 700;
    color: var(--pt-muted);
    margin-left: 2px;
}
.pt-pub-teaser-stat .lbl {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--pt-muted);
    margin-top: 3px;
}
.pt-pub-teaser-bar-wrap { margin-bottom: 12px; }
.pt-pub-teaser-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: var(--pt-rest-soft);
    overflow: hidden;
}
.pt-pub-teaser-seg {
    height: 100%;
    background: linear-gradient(90deg, #1E9E5A, #2CB86B);
    border-radius: 999px 0 0 999px;
}
.pt-pub-teaser-bar-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--pt-ink-soft);
}
.pt-pub-teaser-bar-meta b {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: var(--pt-run);
}
.pt-pub-teaser-btn {
    width: 100%;
    border: 1px solid #C9D3F5;
    background: #fff;
    color: var(--pt-accent);
    font-size: 12.5px;
    font-weight: 700;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background .15s ease, border-color .15s ease;
}
.pt-pub-teaser-btn:hover {
    background: #F3F6FF;
    border-color: var(--pt-accent);
    color: var(--pt-accent-deep);
}

/* ── Modal báo cáo ── */
#ptPublicDetailModal {
    z-index: 1060;
}
#ptPublicDetailModal .modal-dialog {
    margin: 1.75rem auto;
}
.pt-pub-dialog { max-width: 640px; }
.pt-pub-modal {
    border: none;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 20px 50px -12px rgba(23, 30, 49, 0.28);
    display: flex;
    flex-direction: column;
    max-height: min(90vh, 720px);
}
.pt-pub-dialog.modal-dialog-scrollable .pt-pub-modal {
    max-height: min(90vh, 720px);
}
.pt-pub-dialog.modal-dialog-scrollable .pt-pub-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
.pt-pub-head {
    background: linear-gradient(120deg, #3E5FE0 0%, #5B3FD6 100%);
    padding: 20px 22px 18px;
    color: #fff;
    border-bottom: none;
    align-items: flex-start;
    flex-shrink: 0;
}
.pt-pub-head-title {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.pt-pub-head-sub {
    margin-top: 4px;
    font-size: 12.5px;
    opacity: 0.82;
    font-weight: 500;
    color: #fff;
}
.pt-pub-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 1;
}
.pt-pub-close:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }
.pt-pub-body { padding: 18px 22px 8px; }
.pt-pub-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--pt-muted);
    margin-bottom: 16px;
}
.pt-pub-meta i { width: 14px; text-align: center; }

.pt-pub-section-label {
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: var(--pt-muted);
    text-transform: uppercase;
    margin: 0 0 10px 2px;
}
.pt-pub-raw {
    border: 1px solid var(--pt-line);
    border-radius: 12px;
    padding: 15px 17px 16px;
    margin-bottom: 20px;
    background: #fff;
}
.pt-pub-raw-top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 13px;
}
.pt-pub-lbl {
    font-size: 11.5px;
    color: var(--pt-muted);
    font-weight: 600;
    margin-bottom: 3px;
}
.pt-pub-energy-val {
    font-size: 23px;
    font-weight: 800;
    color: var(--pt-ink);
    line-height: 1;
}
.pt-pub-energy-val .unit {
    font-size: 13px;
    font-weight: 700;
    color: var(--pt-muted);
    margin-left: 2px;
}
.pt-pub-total { text-align: right; }
.pt-pub-total-val {
    font-size: 14px;
    font-weight: 800;
    color: var(--pt-ink-soft);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.pt-pub-run-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--pt-rest-soft);
    overflow: hidden;
}
.pt-pub-run-seg {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #1E9E5A, #2CB86B);
    border-radius: 999px 0 0 999px;
    transition: width 1.1s cubic-bezier(.4, 0, .2, 1);
}
.pt-pub-bar-legend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.pt-pub-bl-item { display: flex; align-items: center; gap: 6px; }
.pt-pub-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: none;
}
.pt-pub-dot.is-run { background: var(--pt-run); }
.pt-pub-dot.is-rest { background: var(--pt-rest); }
.pt-pub-bl-text {
    font-size: 12px;
    color: var(--pt-ink-soft);
    font-weight: 600;
}
.pt-pub-bl-text b {
    color: var(--pt-ink);
    font-weight: 800;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12.5px;
}

.pt-pub-daily {
    border: 1px solid var(--pt-line);
    border-radius: 18px;
    padding: 18px 18px 18px;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #FBFCFE 0%, #FFFFFF 55%);
}
.pt-pub-daily-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.pt-pub-daily-title {
    margin: 0;
    font-size: 14.5px;
    font-weight: 800;
    color: var(--pt-ink);
    display: flex;
    align-items: center;
    gap: 6px;
}
.pt-pub-daily-title i { color: var(--pt-accent); font-size: 13px; }
.pt-pub-daily-period {
    font-size: 11.5px;
    color: var(--pt-muted);
    font-weight: 600;
}
.pt-pub-daily-sub {
    font-size: 12.5px;
    color: var(--pt-muted);
    margin: 0 0 16px;
}
.pt-pub-daily-flex {
    display: flex;
    align-items: center;
    gap: 22px;
}
.pt-pub-clock-wrap {
    position: relative;
    width: 140px;
    height: 140px;
    flex: none;
    --run-deg: 0deg;
}
.pt-pub-clock {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: conic-gradient(var(--pt-run) 0deg var(--run-deg), var(--pt-rest) var(--run-deg) 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 1.1s cubic-bezier(.4, 0, .2, 1);
}
.pt-pub-clock::after {
    content: "";
    width: 98px;
    height: 98px;
    border-radius: 50%;
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--pt-line-soft);
}
.pt-pub-clock-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.pt-pub-clock-pct {
    font-size: 20px;
    font-weight: 800;
    color: var(--pt-ink);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.pt-pub-clock-pct-lbl {
    font-size: 9.5px;
    color: var(--pt-muted);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 1px;
}
.pt-pub-tick {
    position: absolute;
    font-size: 9px;
    color: var(--pt-muted);
    font-weight: 600;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}
.pt-pub-tick.t0 { top: -2px; left: 50%; transform: translateX(-50%); }
.pt-pub-tick.t6 { top: 50%; right: -14px; transform: translateY(-50%); }
.pt-pub-tick.t12 { bottom: -2px; left: 50%; transform: translateX(-50%); }
.pt-pub-tick.t18 { top: 50%; left: -16px; transform: translateY(-50%); }

.pt-pub-daily-legend {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.pt-pub-leg-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 13px;
    border-radius: 11px;
    background: var(--pt-line-soft);
}
.pt-pub-leg-row.is-run { background: var(--pt-run-soft); }
.pt-pub-leg-left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pt-pub-leg-row .pt-pub-dot { width: 9px; height: 9px; }
.pt-pub-leg-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--pt-ink-soft);
}
.pt-pub-leg-val {
    font-size: 14px;
    font-weight: 800;
    color: var(--pt-ink);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    white-space: nowrap;
}
.pt-pub-leg-row.is-run .pt-pub-leg-val { color: var(--pt-run); }

.pt-pub-energy-strip {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.pt-pub-energy-card {
    flex: 1;
    border: 1px dashed var(--pt-line);
    border-radius: 11px;
    padding: 12px 10px;
    text-align: center;
}
.pt-pub-e-lbl {
    font-size: 11.5px;
    color: var(--pt-muted);
    font-weight: 600;
    margin-bottom: 4px;
}
.pt-pub-e-val {
    font-size: 16px;
    font-weight: 800;
    color: var(--pt-accent-deep);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.pt-pub-note {
    font-size: 12.5px;
    color: var(--pt-muted);
    margin: 0 0 4px;
    line-height: 1.45;
}
.pt-pub-foot {
    display: flex;
    justify-content: flex-end;
    padding: 12px 22px 18px;
    border-top: 1px solid var(--pt-line);
    background: #fff;
    flex-shrink: 0;
}
.pt-pub-close-btn {
    background: #EEF0F4;
    color: var(--pt-ink-soft);
    border: none;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 20px;
    border-radius: 9px;
    cursor: pointer;
}
.pt-pub-close-btn:hover { background: #E2E5EB; color: var(--pt-ink-soft); }

@media (max-width: 575.98px) {
    #ptPublicDetailModal .pt-pub-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
        min-height: 100%;
        align-items: flex-end;
    }
    #ptPublicDetailModal .pt-pub-dialog.modal-dialog-centered {
        min-height: 100%;
        align-items: flex-end;
    }
    .pt-pub-modal,
    .pt-pub-dialog.modal-dialog-scrollable .pt-pub-modal {
        border-radius: 18px 18px 0 0;
        max-height: min(92dvh, 92vh);
        height: auto;
        width: 100%;
    }
    /* Ẩn thanh Gọi/Zalo/Mua khi báo cáo mở — tránh che nội dung */
    body.modal-open:has(#ptPublicDetailModal.show) .fixed-contact {
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }
    .pt-pub-head {
        padding: 14px 16px 13px;
    }
    .pt-pub-head-title {
        font-size: 15px;
    }
    .pt-pub-head-sub {
        font-size: 12px;
        line-height: 1.35;
        max-width: 85%;
    }
    .pt-pub-body {
        padding: 14px 16px 10px;
    }
    .pt-pub-meta {
        font-size: 12px;
        margin-bottom: 12px;
        flex-wrap: wrap;
        line-height: 1.4;
    }
    .pt-pub-section-label {
        margin-bottom: 8px;
    }
    .pt-pub-raw {
        padding: 13px 14px 14px;
        margin-bottom: 14px;
        border-radius: 12px;
    }
    .pt-pub-energy-val {
        font-size: 21px;
    }
    .pt-pub-daily {
        padding: 14px;
        margin-bottom: 10px;
        border-radius: 14px;
    }
    .pt-pub-daily-sub {
        margin-bottom: 12px;
        font-size: 12px;
    }
    .pt-pub-daily-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .pt-pub-clock-wrap {
        align-self: center;
        width: 128px;
        height: 128px;
    }
    .pt-pub-clock {
        width: 128px;
        height: 128px;
    }
    .pt-pub-clock::after {
        width: 88px;
        height: 88px;
    }
    .pt-pub-clock-pct {
        font-size: 18px;
    }
    .pt-pub-energy-strip {
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
    }
    .pt-pub-energy-card {
        padding: 10px;
    }
    .pt-pub-e-val {
        font-size: 15px;
    }
    .pt-pub-raw-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .pt-pub-total {
        text-align: left;
    }
    .pt-pub-bar-legend {
        gap: 6px 12px;
    }
    .pt-pub-note {
        font-size: 12px;
        margin-bottom: 2px;
    }
    .pt-pub-foot {
        padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .pt-pub-close-btn {
        width: 100%;
        padding: 12px 16px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .pt-pub-daily-flex { flex-direction: column; align-items: stretch; }
    .pt-pub-clock-wrap { align-self: center; }
    .pt-pub-energy-strip { flex-direction: column; }
    .pt-pub-raw-top { flex-direction: column; align-items: flex-start; }
    .pt-pub-total { text-align: left; }
}
