/* ==========================================================================
   Executive Infographic Report Stylesheet
   Replicating the clean, high-impact aesthetic of the sample Monthly Report
   ========================================================================== */

.infographic-wrapper {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid #cbd5e1;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   Infographic Header
   -------------------------------------------------------------------------- */
.info-header {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0c4a6e 100%);
    color: white;
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-bottom: 3px solid #38bdf8;
}
@media (min-width: 768px) {
    .info-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.info-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.info-header-logo {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    backdrop-filter: blur(4px);
}

.info-header-title h2 {
    color: white;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin-bottom: 2px;
}
.info-header-title p {
    color: #bae6fd;
    font-size: 12px;
    font-weight: 500;
}

.info-header-period {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(6px);
}
.info-header-period i {
    font-size: 20px;
    color: #38bdf8;
}
.period-badge-title {
    font-size: 10px;
    color: #bae6fd;
    text-transform: uppercase;
    font-weight: 700;
}
.period-badge-dates {
    font-size: 12px;
    font-weight: 800;
    color: white;
}

/* --------------------------------------------------------------------------
   Infographic Body
   -------------------------------------------------------------------------- */
.info-body {
    padding: 12px 16px;
    background: #f8fafc;
}

/* 4 Big Metrics Row */
.info-metrics-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}
@media (min-width: 768px) {
    .info-metrics-row {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
}

.info-metric-card {
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid #e2e8f0;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.metric-circle-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
}
.metric-circle-income { background: #0284c7; }
.metric-circle-expense { background: #ef4444; }
.metric-circle-profit { background: #0d9488; }
.metric-circle-customers { background: #2563eb; }

.metric-details {
    flex: 1;
    min-width: 0;
}
.metric-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
}
.metric-val {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (min-width: 992px) {
    .metric-val {
        font-size: 20px;
    }
}
.metric-sub {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Sections Headers (1. Rekap Pendapatan, 2. Rekap Pengeluaran)
   -------------------------------------------------------------------------- */
.section-banner-title {
    background: #0284c7;
    color: white;
    font-size: 13px;
    font-weight: 800;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    letter-spacing: -0.2px;
}
.section-banner-title i {
    font-size: 16px;
}

/* Section Grid (Table + Chart Side-by-Side or Stacked) */
.section-panel-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
@media (min-width: 768px) {
    .section-panel-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .section-panel-grid > div {
        min-width: 0;
    }
}

.info-table-wrap {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.report-table th {
    background: #e2e8f0;
    color: #1e293b;
    font-weight: 700;
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #cbd5e1;
}
.report-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.report-table tr:nth-child(even) td {
    background: #f8fafc;
}
.report-table tr.total-row td {
    background: #e2e8f0;
    font-weight: 800;
    color: #0f172a;
    border-top: 2px solid #94a3b8;
}

/* Chart Card inside Infographic */
.info-chart-card {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
}
.info-chart-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
    text-align: center;
}

/* --------------------------------------------------------------------------
   Section 3: Rekap Pembayaran Pelanggan (4 Pills)
   -------------------------------------------------------------------------- */
.cust-status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
@media (min-width: 768px) {
    .cust-status-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.cust-status-card {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.cust-icon-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}
.cust-icon-blue { background: #0284c7; }
.cust-icon-green { background: #10b981; }
.cust-icon-red { background: #ef4444; }
.cust-icon-teal { background: #06b6d4; }

.cust-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}
.cust-count {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}
.cust-desc {
    font-size: 10.5px;
    color: #64748b;
}

/* --------------------------------------------------------------------------
   Sections 4, 5, 6: Insight, Kendala & Planning (Exact from Image)
   -------------------------------------------------------------------------- */
.bottom-sections-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 768px) {
    .bottom-sections-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.bottom-box {
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.bottom-box-header {
    background: #0284c7;
    color: white;
    padding: 6px 12px;
    font-size: 12.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}
.bottom-box-body {
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #334155;
}

.insight-bullets {
    list-style: none;
    padding: 0;
}
.insight-bullets li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
}
.insight-bullets li::before {
    content: "•";
    position: absolute;
    left: 4px;
    top: -2px;
    color: #0284c7;
    font-size: 20px;
    font-weight: bold;
}

.numbered-bullets {
    padding-left: 18px;
}
.numbered-bullets li {
    margin-bottom: 8px;
}

/* Note Action item buttons */
.note-input-row {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
}

/* Export Floating Buttons */
.report-actions-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
}

/* ==========================================================================
   A4 Portrait Print Layout Stylesheet
   Executive Infographic Report - Pixel-Perfect Multi-Unit Financial Summary
   ========================================================================== */

@page {
    size: A4 portrait;
    margin: 6mm 8mm 6mm 8mm;
}

@media print {
    /* 1. Global Page & Color Reset */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
    }

    html, body {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #0f172a !important;
        font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
        font-size: 11px !important;
        line-height: 1.3 !important;
    }

    /* 2. Hide ALL non-report interface elements */
    .app-header,
    .mobile-business-bar,
    .filter-bar,
    .bottom-nav,
    .fab-btn,
    .desktop-sidebar,
    .report-actions-bar,
    .note-input-row,
    .toast-container,
    .modal-overlay,
    #authScreen,
    #dashLeakBanner,
    .tab-view:not(#view-infographic),
    #infoIssuesList button,
    #infoPlansList button {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 3. Reset Layout Hierarchy from Grid/Flex to Full-Width Block */
    .app-layout {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        grid-template-columns: none !important;
    }

    main {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: none !important;
    }

    .app-container {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #view-infographic {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 4. Infographic Main Container */
    .infographic-wrapper {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }

    .info-body {
        padding: 6px 0 0 0 !important;
        background: #ffffff !important;
    }

    /* 5. Header Banner */
    .info-header {
        background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0c4a6e 100%) !important;
        color: #ffffff !important;
        padding: 8px 14px !important;
        border-radius: 8px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        border-bottom: 3px solid #38bdf8 !important;
        margin-bottom: 8px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .info-header-brand {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }

    .info-header-logo {
        width: 34px !important;
        height: 34px !important;
        background: rgba(255, 255, 255, 0.22) !important;
        border: 1.5px solid rgba(255, 255, 255, 0.4) !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 18px !important;
        color: #ffffff !important;
        flex-shrink: 0 !important;
    }

    .info-header-title h2 {
        color: #ffffff !important;
        font-size: 15px !important;
        font-weight: 800 !important;
        margin: 0 0 2px 0 !important;
        letter-spacing: -0.2px !important;
    }

    .info-header-title p {
        color: #bae6fd !important;
        font-size: 10px !important;
        margin: 0 !important;
        font-weight: 500 !important;
    }

    .info-header-period {
        background: rgba(255, 255, 255, 0.2) !important;
        border: 1px solid rgba(255, 255, 255, 0.35) !important;
        border-radius: 6px !important;
        padding: 4px 10px !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .info-header-period i {
        font-size: 16px !important;
        color: #38bdf8 !important;
    }

    .period-badge-title {
        font-size: 8.5px !important;
        color: #bae6fd !important;
        text-transform: uppercase !important;
        font-weight: 700 !important;
    }

    .period-badge-dates {
        font-size: 11px !important;
        font-weight: 800 !important;
        color: #ffffff !important;
    }

    /* 6. Top 4 Metric KPI Cards */
    .info-metrics-row {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .info-metrics-row > div {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .info-metric-card {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 6px !important;
        padding: 5px 6px !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        box-shadow: none !important;
    }

    .metric-circle-icon {
        width: 28px !important;
        height: 28px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        color: #ffffff !important;
        flex-shrink: 0 !important;
    }

    .metric-label {
        font-size: 8.5px !important;
        font-weight: 700 !important;
        color: #64748b !important;
        margin-bottom: 1px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .metric-val {
        font-size: 12.5px !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        line-height: 1.2 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .metric-sub {
        font-size: 8px !important;
        color: #64748b !important;
        margin-top: 1px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* 7. Section 1 (Income) & Section 2 (Expense) Grid - Strictly 50% / 50% */
    .section-panel-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-bottom: 8px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .section-panel-grid > div {
        min-width: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    .section-banner-title {
        color: #ffffff !important;
        font-size: 10px !important;
        font-weight: 800 !important;
        padding: 4px 6px !important;
        border-radius: 4px !important;
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
        margin-bottom: 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .info-table-wrap {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 4px !important;
        margin-bottom: 5px !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
    }

    .report-table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        font-size: 8.5px !important;
    }

    .report-table th {
        background: #e2e8f0 !important;
        color: #0f172a !important;
        font-weight: 700 !important;
        padding: 3px 4px !important;
        border-bottom: 1px solid #cbd5e1 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .report-table td {
        padding: 3px 4px !important;
        border-bottom: 1px solid #f1f5f9 !important;
        color: #334155 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .report-table tr:nth-child(even) td {
        background: #f8fafc !important;
    }

    .report-table tr.total-row td {
        background: #e2e8f0 !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        border-top: 1.5px solid #94a3b8 !important;
    }

    .info-chart-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 4px !important;
        padding: 5px 6px !important;
        background: #ffffff !important;
        box-sizing: border-box !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .info-chart-title {
        font-size: 8.5px !important;
        font-weight: 700 !important;
        color: #334155 !important;
        margin-bottom: 2px !important;
        text-align: center !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .chart-container {
        height: 175px !important;
        max-height: 175px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        position: relative !important;
    }

    .chart-container canvas {
        width: 100% !important;
        max-width: 100% !important;
        height: 175px !important;
        max-height: 175px !important;
        display: block !important;
    }

    /* 8. Section 3: Customer Status Grid */
    .cust-status-grid {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 6px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 8px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .cust-status-grid > div {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    .cust-status-card {
        border: 1px solid #cbd5e1 !important;
        border-radius: 4px !important;
        padding: 5px 6px !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        background: #ffffff !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .cust-icon-circle {
        width: 24px !important;
        height: 24px !important;
        font-size: 12px !important;
        border-radius: 50% !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .cust-label {
        font-size: 8.5px !important;
        font-weight: 600 !important;
        color: #64748b !important;
    }

    .cust-count {
        font-size: 12px !important;
        font-weight: 800 !important;
        color: #0f172a !important;
        line-height: 1.1 !important;
    }

    .cust-desc {
        font-size: 8px !important;
        color: #64748b !important;
    }

    /* 9. Sections 4, 5, 6: Insight, Kendala & Action Plan */
    .bottom-sections-grid {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .bottom-box {
        border: 1px solid #cbd5e1 !important;
        border-radius: 4px !important;
        background: #ffffff !important;
        overflow: hidden !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .bottom-box-header {
        font-size: 10px !important;
        font-weight: 800 !important;
        padding: 4px 8px !important;
        color: #ffffff !important;
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .bottom-box-body {
        padding: 6px 8px !important;
        font-size: 9.5px !important;
        line-height: 1.4 !important;
        color: #334155 !important;
    }

    .insight-bullets {
        margin: 0 !important;
        padding: 0 !important;
        list-style: none !important;
    }

    .insight-bullets li {
        position: relative !important;
        padding-left: 12px !important;
        margin-bottom: 3px !important;
    }

    .insight-bullets li::before {
        content: "•" !important;
        position: absolute !important;
        left: 2px !important;
        top: -1px !important;
        color: #0284c7 !important;
        font-size: 14px !important;
        font-weight: bold !important;
    }

    .numbered-bullets {
        margin: 0 !important;
        padding-left: 14px !important;
    }

    .numbered-bullets li {
        margin-bottom: 3px !important;
    }

    /* 10. Official Footer Stamp */
    .print-footer {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-top: 8px !important;
        padding-top: 5px !important;
        border-top: 1px solid #cbd5e1 !important;
        font-size: 8.5px !important;
        color: #94a3b8 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
}
