/* Heaven Bound Care Groups — Print CSS */

@media print {

    @page {
        margin: 12mm;
    }

    html,
    body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
        font-family: Arial, sans-serif;
        font-size: 11pt;
        color: #000 !important;
    }

    /*
     * Most WordPress themes wrap page content inside several containers.
     * The old print CSS could hide the whole theme wrapper and accidentally
     * hide the Care Group directory too. This approach hides everything by
     * visibility, then restores only the Heaven Bound printable content.
     */
    body * {
        visibility: hidden !important;
    }

    .hb-wrap,
    .hb-wrap *,
    .caregroup-print-area,
    .caregroup-print-area * {
        visibility: visible !important;
    }

    .hb-wrap {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        color: #000 !important;
        background: #fff !important;
        box-shadow: none !important;
    }

    .no-print,
    .no-print *,
    .hb-print-btn,
    .hb-print-btn *,
    .hb-back-btn,
    .hb-back-btn *,
    .hb-header-actions,
    .hb-header-actions *,
    .hb-btn-logout,
    .hb-btn-logout *,
    #wpadminbar,
    #wpadminbar * {
        display: none !important;
        visibility: hidden !important;
    }

    .hb-header {
        background: none !important;
        color: #000 !important;
        border-bottom: 2px solid #000 !important;
        padding: 0 0 8px !important;
        margin: 0 0 12px !important;
        border-radius: 0 !important;
    }

    .hb-header h1 {
        color: #000 !important;
        font-size: 16pt !important;
        margin: 0 !important;
    }

    .caregroup-print-area {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .hb-card {
        border: none !important;
        padding: 0 0 12px !important;
        margin: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
    }

    .hb-section-title {
        background: none !important;
        color: #000 !important;
        border-bottom: 1.5px solid #000 !important;
        border-radius: 0 !important;
        padding: 4px 0 !important;
        margin: 0 0 8px !important;
        font-size: 13pt !important;
    }

    .hb-table,
    .hb-details-table {
        border-collapse: collapse !important;
        width: 100% !important;
        page-break-inside: auto;
    }

    .hb-table th,
    .hb-details-table th {
        background: #eee !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        border: 1px solid #888 !important;
        padding: 4px 6px !important;
        font-size: 10pt !important;
        color: #000 !important;
    }

    .hb-table td,
    .hb-details-table td {
        border: 1px solid #888 !important;
        padding: 4px 6px !important;
        font-size: 10pt !important;
        color: #000 !important;
    }

    .hb-table tr {
        page-break-inside: avoid;
    }

    .hb-section-members {
        page-break-before: auto;
    }
}

/* v1.1.28 — Quarterly monitoring print adjustments */
@media print {
    @page {
        size: landscape;
        margin: 10mm;
    }

    .hb-table th,
    .hb-table td,
    .hb-details-table th,
    .hb-details-table td {
        padding: 3px 4px !important;
        font-size: 8.5pt !important;
        line-height: 1.2 !important;
    }

    .hb-details-table th {
        width: 140px !important;
    }

    .hb-section-title {
        font-size: 11pt !important;
        margin-bottom: 6px !important;
    }

    .hb-card {
        padding-bottom: 8px !important;
    }
}

/* v1.1.33 — Colored leader quarterly summary print report */
@media print {
    @page {
        size: A4 landscape;
        margin: 12mm;
    }

    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
    }

    .hb-leader-wrap > .hb-header,
    .hb-leader-wrap > .hb-mgr-notice,
    .hb-leader-wrap > .hb-card,
    .hb-leader-wrap .hb-mgr-section-card,
    .hb-leader-wrap .hb-leader-assignment-card,
    .hb-leader-wrap .hb-leader-caregroup-card,
    .hb-leader-wrap .hb-leader-management-card {
        display: none !important;
        visibility: hidden !important;
    }

    .hb-leader-wrap > .hb-leader-quarterly-print-area,
    .hb-leader-wrap > .hb-leader-quarterly-print-area *,
    .hb-leader-quarterly-print-area,
    .hb-leader-quarterly-print-area * {
        visibility: visible !important;
    }

    .hb-leader-quarterly-print-area {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-family: Arial, sans-serif !important;
    }

    .hb-leader-quarterly-print-area .hb-card {
        display: block !important;
        visibility: visible !important;
        border: 1px solid #cccccc !important;
        border-top: none !important;
        padding: 18px 22px !important;
        margin: 0 !important;
        background: #ffffff !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
    }

    .hb-leader-quarterly-print-area .hb-card + .hb-card {
        border-top: 1px solid #cccccc !important;
    }

    .hb-leader-quarterly-print-area .hb-print-report-header-card {
        border: 1px solid #1a3a6b !important;
        border-radius: 4px 4px 0 0 !important;
        margin: 0 !important;
        padding: 14px 18px !important;
        background: #1a3a6b !important;
        color: #ffffff !important;
    }

    .hb-leader-quarterly-print-area .hb-print-report-title {
        margin: 0 0 4px !important;
        font-size: 16pt !important;
        line-height: 1.2 !important;
        color: #ffffff !important;
    }

    .hb-leader-quarterly-print-area .hb-print-report-subtitle {
        margin: 0 !important;
        font-size: 9pt !important;
        color: #ffffff !important;
        opacity: .95 !important;
    }

    .hb-leader-quarterly-print-area .hb-section-title {
        display: block !important;
        background: #1a3a6b !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 3px !important;
        padding: 8px 12px !important;
        margin: 0 0 10px !important;
        font-size: 12pt !important;
        line-height: 1.2 !important;
        font-weight: 700 !important;
        page-break-after: avoid !important;
    }

    .hb-leader-quarterly-print-area .hb-section-officers {
        background: #2e6da4 !important;
        color: #ffffff !important;
    }

    .hb-leader-quarterly-print-area .hb-section-members {
        background: #3d7a55 !important;
        color: #ffffff !important;
    }

    .hb-leader-quarterly-print-area .hb-table,
    .hb-leader-quarterly-print-area .hb-details-table {
        border-collapse: collapse !important;
        width: 100% !important;
        page-break-inside: auto !important;
        background: #ffffff !important;
    }

    .hb-leader-quarterly-print-area .hb-table th,
    .hb-leader-quarterly-print-area .hb-details-table th {
        background: #f4f6f9 !important;
        border: 1px solid #cccccc !important;
        padding: 6px 8px !important;
        font-size: 8.8pt !important;
        line-height: 1.2 !important;
        color: #1a3a6b !important;
        font-weight: 700 !important;
        text-align: left !important;
        vertical-align: top !important;
    }

    .hb-leader-quarterly-print-area .hb-table td,
    .hb-leader-quarterly-print-area .hb-details-table td {
        background: #ffffff !important;
        border: 1px solid #cccccc !important;
        padding: 6px 8px !important;
        font-size: 8.8pt !important;
        line-height: 1.2 !important;
        color: #000000 !important;
        vertical-align: top !important;
    }

    .hb-leader-quarterly-print-area .hb-details-table th {
        width: 175px !important;
    }

    .hb-leader-quarterly-print-area .hb-table tr,
    .hb-leader-quarterly-print-area .hb-details-table tr {
        page-break-inside: avoid !important;
    }

    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:first-child,
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:first-child {
        width: 38px !important;
        text-align: center !important;
    }

    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(4),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(5),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(6),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(7),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(8),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(4),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(5),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(6),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(7),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(8) {
        text-align: center !important;
        width: 54px !important;
    }

    .hb-leader-quarterly-print-area .hb-print-legend {
        display: block !important;
        margin: 10px 0 0 !important;
        padding: 8px 10px !important;
        border: 1px solid #cccccc !important;
        background: #f4f6f9 !important;
        color: #000000 !important;
        font-size: 9pt !important;
        line-height: 1.3 !important;
        page-break-inside: avoid !important;
    }

    .hb-leader-quarterly-print-area .hb-empty {
        text-align: center !important;
        font-style: italic !important;
        color: #666666 !important;
    }
}

/* v1.1.34 — Quarterly print footer */
@media print {
    .hb-leader-quarterly-print-area .hb-print-report-footer {
        display: flex !important;
        justify-content: space-between !important;
        gap: 12px !important;
        margin: 10px 0 0 !important;
        padding: 8px 10px !important;
        border-top: 1px solid #cccccc !important;
        color: #555555 !important;
        font-size: 8.5pt !important;
        line-height: 1.3 !important;
        page-break-inside: avoid !important;
    }

    .hb-leader-quarterly-print-area .hb-print-report-footer span {
        display: inline-block !important;
        color: #555555 !important;
    }
}


/* v1.1.37 — Unified colored print layout + repeating page footer */
@media print {
    @page {
        size: A4 landscape;
        margin: 12mm 12mm 22mm;
    }

    html,
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: Arial, sans-serif !important;
    }

    *,
    *::before,
    *::after {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        box-sizing: border-box !important;
    }

    /* Directory print header: make it match the Leader Dashboard report style. */
    .hb-wrap .hb-header {
        display: block !important;
        visibility: visible !important;
        border: 1px solid #1a3a6b !important;
        border-radius: 4px 4px 0 0 !important;
        margin: 0 !important;
        padding: 14px 18px !important;
        background: #1a3a6b !important;
        color: #ffffff !important;
        box-shadow: none !important;
    }

    .hb-wrap .hb-header h1 {
        color: #ffffff !important;
        font-size: 16pt !important;
        line-height: 1.2 !important;
        margin: 0 !important;
    }

    .caregroup-print-area,
    .hb-leader-quarterly-print-area {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 0 16mm !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-family: Arial, sans-serif !important;
    }

    .caregroup-print-area .hb-card,
    .hb-leader-quarterly-print-area .hb-card {
        display: block !important;
        visibility: visible !important;
        border: 1px solid #cccccc !important;
        border-top: none !important;
        padding: 18px 22px !important;
        margin: 0 !important;
        background: #ffffff !important;
        box-shadow: none !important;
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .caregroup-print-area .hb-card + .hb-card,
    .hb-leader-quarterly-print-area .hb-card + .hb-card {
        border-top: 1px solid #cccccc !important;
    }

    .caregroup-print-area .hb-print-report-header-card,
    .hb-leader-quarterly-print-area .hb-print-report-header-card {
        border: 1px solid #1a3a6b !important;
        border-radius: 4px 4px 0 0 !important;
        margin: 0 !important;
        padding: 14px 18px !important;
        background: #1a3a6b !important;
        color: #ffffff !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .caregroup-print-area .hb-print-report-title,
    .hb-leader-quarterly-print-area .hb-print-report-title {
        margin: 0 0 4px !important;
        font-size: 16pt !important;
        line-height: 1.2 !important;
        color: #ffffff !important;
    }

    .caregroup-print-area .hb-print-report-subtitle,
    .hb-leader-quarterly-print-area .hb-print-report-subtitle {
        margin: 0 !important;
        font-size: 9pt !important;
        color: #ffffff !important;
        opacity: .95 !important;
    }

    .caregroup-print-area .hb-section-title,
    .hb-leader-quarterly-print-area .hb-section-title {
        display: block !important;
        background: #1a3a6b !important;
        color: #ffffff !important;
        border: none !important;
        border-radius: 3px !important;
        padding: 8px 12px !important;
        margin: 0 0 10px !important;
        font-size: 12pt !important;
        line-height: 1.2 !important;
        font-weight: 700 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }

    .caregroup-print-area .hb-section-officers,
    .hb-leader-quarterly-print-area .hb-section-officers {
        background: #2e6da4 !important;
        color: #ffffff !important;
    }

    .caregroup-print-area .hb-section-members,
    .hb-leader-quarterly-print-area .hb-section-members {
        background: #3d7a55 !important;
        color: #ffffff !important;
    }

    .caregroup-print-area .hb-table,
    .caregroup-print-area .hb-details-table,
    .hb-leader-quarterly-print-area .hb-table,
    .hb-leader-quarterly-print-area .hb-details-table {
        border-collapse: collapse !important;
        width: 100% !important;
        page-break-inside: auto !important;
        break-inside: auto !important;
        background: #ffffff !important;
    }

    .caregroup-print-area thead,
    .hb-leader-quarterly-print-area thead {
        display: table-header-group !important;
    }

    .caregroup-print-area tfoot,
    .hb-leader-quarterly-print-area tfoot {
        display: table-footer-group !important;
    }

    .caregroup-print-area .hb-table th,
    .caregroup-print-area .hb-details-table th,
    .hb-leader-quarterly-print-area .hb-table th,
    .hb-leader-quarterly-print-area .hb-details-table th {
        background: #f4f6f9 !important;
        border: 1px solid #cccccc !important;
        padding: 6px 8px !important;
        font-size: 8.8pt !important;
        line-height: 1.2 !important;
        color: #1a3a6b !important;
        font-weight: 700 !important;
        text-align: left !important;
        vertical-align: top !important;
    }

    .caregroup-print-area .hb-table td,
    .caregroup-print-area .hb-details-table td,
    .hb-leader-quarterly-print-area .hb-table td,
    .hb-leader-quarterly-print-area .hb-details-table td {
        background: #ffffff !important;
        border: 1px solid #cccccc !important;
        padding: 6px 8px !important;
        font-size: 8.8pt !important;
        line-height: 1.2 !important;
        color: #000000 !important;
        vertical-align: top !important;
    }

    .caregroup-print-area .hb-details-table th,
    .hb-leader-quarterly-print-area .hb-details-table th {
        width: 175px !important;
    }

    .caregroup-print-area .hb-table tr,
    .caregroup-print-area .hb-details-table tr,
    .hb-leader-quarterly-print-area .hb-table tr,
    .hb-leader-quarterly-print-area .hb-details-table tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .caregroup-print-area .hb-print-quarterly-table th:first-child,
    .caregroup-print-area .hb-print-quarterly-table td:first-child,
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:first-child,
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:first-child,
    .caregroup-print-area .hb-table th:first-child,
    .caregroup-print-area .hb-table td:first-child {
        width: 38px !important;
        text-align: center !important;
    }

    .caregroup-print-area .hb-print-quarterly-table th:nth-child(4),
    .caregroup-print-area .hb-print-quarterly-table th:nth-child(5),
    .caregroup-print-area .hb-print-quarterly-table th:nth-child(6),
    .caregroup-print-area .hb-print-quarterly-table th:nth-child(7),
    .caregroup-print-area .hb-print-quarterly-table th:nth-child(8),
    .caregroup-print-area .hb-print-quarterly-table td:nth-child(4),
    .caregroup-print-area .hb-print-quarterly-table td:nth-child(5),
    .caregroup-print-area .hb-print-quarterly-table td:nth-child(6),
    .caregroup-print-area .hb-print-quarterly-table td:nth-child(7),
    .caregroup-print-area .hb-print-quarterly-table td:nth-child(8),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(4),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(5),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(6),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(7),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(8),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(4),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(5),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(6),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(7),
    .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(8) {
        text-align: center !important;
        width: 54px !important;
    }

    .caregroup-print-area .hb-print-legend,
    .hb-leader-quarterly-print-area .hb-print-legend {
        display: block !important;
        margin: 10px 0 0 !important;
        padding: 8px 10px !important;
        border: 1px solid #cccccc !important;
        background: #f4f6f9 !important;
        color: #000000 !important;
        font-size: 9pt !important;
        line-height: 1.3 !important;
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .caregroup-print-area .hb-empty,
    .hb-leader-quarterly-print-area .hb-empty {
        text-align: center !important;
        font-style: italic !important;
        color: #666666 !important;
    }

    .hb-print-page-footer {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 5mm !important;
        z-index: 9999 !important;
        display: flex !important;
        visibility: visible !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 10px !important;
        width: 100% !important;
        padding: 5px 0 0 !important;
        border-top: 1px solid #cccccc !important;
        background: #ffffff !important;
        color: #555555 !important;
        font-size: 8pt !important;
        line-height: 1.25 !important;
        box-shadow: none !important;
    }

    .hb-print-page-footer span {
        display: inline-block !important;
        visibility: visible !important;
        color: #555555 !important;
    }
}

/* v1.1.39 — User-selected print orientation compact adjustments.
 * Page orientation is injected by public.js immediately before printing so it
 * can override the older fixed landscape @page rules safely.
 */
@media print {
    html.hb-print-orientation-portrait .caregroup-print-area .hb-card,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-card {
        padding: 14px 16px !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-report-header-card,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-report-header-card,
    html.hb-print-orientation-portrait .hb-wrap .hb-header {
        padding: 12px 16px !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-report-title,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-report-title,
    html.hb-print-orientation-portrait .hb-wrap .hb-header h1 {
        font-size: 15pt !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-section-title,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-section-title {
        padding: 7px 10px !important;
        font-size: 11pt !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-table th,
    html.hb-print-orientation-portrait .caregroup-print-area .hb-details-table th,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-table th,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-details-table th,
    html.hb-print-orientation-portrait .caregroup-print-area .hb-table td,
    html.hb-print-orientation-portrait .caregroup-print-area .hb-details-table td,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-table td,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-details-table td {
        padding: 5px 6px !important;
        font-size: 8.7pt !important;
        line-height: 1.2 !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-details-table th,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-details-table th {
        width: 145px !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table th:nth-child(4),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table th:nth-child(5),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table th:nth-child(6),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table th:nth-child(7),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table th:nth-child(8),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table td:nth-child(4),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table td:nth-child(5),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table td:nth-child(6),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table td:nth-child(7),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-quarterly-table td:nth-child(8),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(4),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(5),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(6),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(7),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table th:nth-child(8),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(4),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(5),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(6),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(7),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-quarterly-table td:nth-child(8) {
        width: 45px !important;
    }

    html.hb-print-orientation-portrait .hb-print-page-footer {
        font-size: 7.8pt !important;
    }

    html.hb-print-orientation-landscape .caregroup-print-area .hb-table th,
    html.hb-print-orientation-landscape .caregroup-print-area .hb-details-table th,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-table th,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-details-table th,
    html.hb-print-orientation-landscape .caregroup-print-area .hb-table td,
    html.hb-print-orientation-landscape .caregroup-print-area .hb-details-table td,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-table td,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-details-table td {
        font-size: 8.8pt !important;
    }
}

/* v1.1.40 — Keep Directory and Leader Dashboard printable tables in sync. */
@media print {
    .caregroup-print-area .hb-print-directory-table th:first-child,
    .caregroup-print-area .hb-print-directory-table td:first-child,
    .hb-leader-quarterly-print-area .hb-print-directory-table th:first-child,
    .hb-leader-quarterly-print-area .hb-print-directory-table td:first-child {
        width: 34px !important;
        text-align: center !important;
    }

    .caregroup-print-area .hb-print-directory-table th:nth-child(6),
    .caregroup-print-area .hb-print-directory-table th:nth-child(7),
    .caregroup-print-area .hb-print-directory-table th:nth-child(8),
    .caregroup-print-area .hb-print-directory-table th:nth-child(9),
    .caregroup-print-area .hb-print-directory-table th:nth-child(10),
    .caregroup-print-area .hb-print-directory-table td:nth-child(6),
    .caregroup-print-area .hb-print-directory-table td:nth-child(7),
    .caregroup-print-area .hb-print-directory-table td:nth-child(8),
    .caregroup-print-area .hb-print-directory-table td:nth-child(9),
    .caregroup-print-area .hb-print-directory-table td:nth-child(10),
    .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(6),
    .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(7),
    .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(8),
    .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(9),
    .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(10),
    .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(6),
    .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(7),
    .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(8),
    .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(9),
    .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(10) {
        text-align: center !important;
        width: 43px !important;
        white-space: nowrap !important;
    }

    .caregroup-print-area .hb-print-directory-table th:nth-child(3),
    .caregroup-print-area .hb-print-directory-table th:nth-child(4),
    .caregroup-print-area .hb-print-directory-table td:nth-child(3),
    .caregroup-print-area .hb-print-directory-table td:nth-child(4),
    .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(3),
    .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(4),
    .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(3),
    .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(4) {
        white-space: normal !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table th,
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table td,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table th,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table td {
        font-size: 8.5pt !important;
        padding: 4px 5px !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table th:nth-child(6),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table th:nth-child(7),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table th:nth-child(8),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table th:nth-child(9),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table th:nth-child(10),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table td:nth-child(6),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table td:nth-child(7),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table td:nth-child(8),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table td:nth-child(9),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-directory-table td:nth-child(10),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(6),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(7),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(8),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(9),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table th:nth-child(10),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(6),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(7),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(8),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(9),
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-print-directory-table td:nth-child(10) {
        width: 38px !important;
    }
}

/* v1.1.41 — Admin can choose Directory print or Quarterly Care Group Monitoring print. */
@media print {
    /* The admin caregroup screen now uses the same report-card header as the
       Leader Dashboard. Hide the normal web header to avoid duplicate titles. */
    .hb-caregroup-view-wrap > .hb-header {
        display: none !important;
        visibility: hidden !important;
    }

    /* Default to Care Group Directory when no print-report class is present. */
    .hb-caregroup-view-wrap .hb-admin-quarterly-print-area {
        display: none !important;
        visibility: hidden !important;
    }

    .hb-caregroup-view-wrap .hb-admin-quarterly-print-area * {
        visibility: hidden !important;
    }

    html.hb-print-report-directory .hb-caregroup-view-wrap .hb-admin-directory-print-area,
    .hb-caregroup-view-wrap .hb-admin-directory-print-area {
        display: block !important;
        visibility: visible !important;
    }

    html.hb-print-report-directory .hb-caregroup-view-wrap .hb-admin-directory-print-area * {
        visibility: visible !important;
    }

    html.hb-print-report-directory .hb-caregroup-view-wrap .hb-admin-quarterly-print-area,
    html.hb-print-report-directory .hb-caregroup-view-wrap .hb-admin-quarterly-print-area * {
        display: none !important;
        visibility: hidden !important;
    }

    html.hb-print-report-quarterly .hb-caregroup-view-wrap .hb-admin-directory-print-area,
    html.hb-print-report-quarterly .hb-caregroup-view-wrap .hb-admin-directory-print-area * {
        display: none !important;
        visibility: hidden !important;
    }

    html.hb-print-report-quarterly .hb-caregroup-view-wrap .hb-admin-quarterly-print-area {
        display: block !important;
        visibility: visible !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    html.hb-print-report-quarterly .hb-caregroup-view-wrap .hb-admin-quarterly-print-area * {
        visibility: visible !important;
    }

    /* Basic directory tables have only directory fields. Keep Notes readable and
       do not apply the compact monitoring-column widths to these tables. */
    .caregroup-print-area .hb-print-basic-directory-table th:nth-child(6),
    .caregroup-print-area .hb-print-basic-directory-table td:nth-child(6),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-basic-directory-table th:nth-child(6),
    html.hb-print-orientation-portrait .caregroup-print-area .hb-print-basic-directory-table td:nth-child(6) {
        width: auto !important;
        min-width: 110px !important;
        text-align: left !important;
        white-space: normal !important;
    }
}


/* v1.1.43 — A4 Print-Safe Layout
 * Keeps all print reports on A4 and reserves enough bottom margin for the
 * repeating timestamp/footer so long member lists are not covered.
 */
@media print {
    @page {
        size: A4 landscape;
        margin: 10mm 10mm 28mm 10mm;
    }

    html.hb-print-orientation-portrait {
        /* Marker class is used by public.js; page size is injected there too. */
    }

    .caregroup-print-area,
    .hb-leader-quarterly-print-area {
        width: 100% !important;
        max-width: 100% !important;
        padding-bottom: 24mm !important;
        overflow: visible !important;
    }

    .caregroup-print-area .hb-card,
    .hb-leader-quarterly-print-area .hb-card {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .caregroup-print-area .hb-print-report-header-card,
    .hb-leader-quarterly-print-area .hb-print-report-header-card,
    .caregroup-print-area .hb-section-title,
    .hb-leader-quarterly-print-area .hb-section-title,
    .caregroup-print-area .hb-print-legend,
    .hb-leader-quarterly-print-area .hb-print-legend {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .caregroup-print-area table,
    .hb-leader-quarterly-print-area table {
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto !important;
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    .caregroup-print-area thead,
    .hb-leader-quarterly-print-area thead {
        display: table-header-group !important;
    }

    .caregroup-print-area tr,
    .hb-leader-quarterly-print-area tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .caregroup-print-area th,
    .caregroup-print-area td,
    .hb-leader-quarterly-print-area th,
    .hb-leader-quarterly-print-area td {
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }

    .hb-print-page-footer {
        position: fixed !important;
        left: 10mm !important;
        right: 10mm !important;
        bottom: 8mm !important;
        width: auto !important;
        min-height: 6mm !important;
        max-height: 12mm !important;
        padding: 3px 0 0 !important;
        margin: 0 !important;
        border-top: 1px solid #cccccc !important;
        background: #ffffff !important;
        color: #555555 !important;
        font-size: 8pt !important;
        line-height: 1.25 !important;
        overflow: hidden !important;
    }

    .hb-print-page-footer span:first-child {
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }

    .hb-print-page-footer span:last-child {
        flex: 0 0 auto !important;
        text-align: right !important;
        white-space: nowrap !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-card,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-card {
        padding: 12px 14px !important;
    }

    html.hb-print-orientation-portrait .caregroup-print-area .hb-table th,
    html.hb-print-orientation-portrait .caregroup-print-area .hb-details-table th,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-table th,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-details-table th,
    html.hb-print-orientation-portrait .caregroup-print-area .hb-table td,
    html.hb-print-orientation-portrait .caregroup-print-area .hb-details-table td,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-table td,
    html.hb-print-orientation-portrait .hb-leader-quarterly-print-area .hb-details-table td {
        font-size: 8.6pt !important;
        line-height: 1.22 !important;
        padding: 4px 5px !important;
    }

    html.hb-print-orientation-landscape .caregroup-print-area .hb-table th,
    html.hb-print-orientation-landscape .caregroup-print-area .hb-details-table th,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-table th,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-details-table th,
    html.hb-print-orientation-landscape .caregroup-print-area .hb-table td,
    html.hb-print-orientation-landscape .caregroup-print-area .hb-details-table td,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-table td,
    html.hb-print-orientation-landscape .hb-leader-quarterly-print-area .hb-details-table td {
        font-size: 8.8pt !important;
        line-height: 1.22 !important;
        padding: 5px 6px !important;
    }

    html.hb-print-orientation-portrait .hb-print-page-footer {
        left: 10mm !important;
        right: 10mm !important;
        bottom: 8mm !important;
        font-size: 7.8pt !important;
    }
}

/* v1.2.8 — Quarterly monitoring privacy and activity-space update.
 * Contact Number, Date of Birth, and Address / Purok are intentionally omitted
 * from the quarterly print markup. These rules use the released space for the
 * monitoring totals, especially Activity, while keeping Notes readable. */
@media print {
    .hb-print-quarterly-summary-table {
        table-layout: fixed !important;
    }

    .hb-print-quarterly-summary-table th,
    .hb-print-quarterly-summary-table td {
        vertical-align: middle !important;
    }

    .hb-print-quarterly-summary-table th:first-child,
    .hb-print-quarterly-summary-table td:first-child {
        width: 34px !important;
        text-align: center !important;
    }

    .hb-print-quarterly-officers-table th:nth-child(2),
    .hb-print-quarterly-officers-table td:nth-child(2),
    .hb-print-quarterly-members-table th:nth-child(2),
    .hb-print-quarterly-members-table td:nth-child(2) {
        width: 20% !important;
        text-align: left !important;
    }

    .hb-print-quarterly-officers-table th:nth-child(3),
    .hb-print-quarterly-officers-table td:nth-child(3) {
        width: 14% !important;
        text-align: left !important;
    }

    .hb-print-quarterly-officers-table th:nth-child(4),
    .hb-print-quarterly-officers-table th:nth-child(5),
    .hb-print-quarterly-officers-table th:nth-child(6),
    .hb-print-quarterly-officers-table th:nth-child(7),
    .hb-print-quarterly-officers-table td:nth-child(4),
    .hb-print-quarterly-officers-table td:nth-child(5),
    .hb-print-quarterly-officers-table td:nth-child(6),
    .hb-print-quarterly-officers-table td:nth-child(7),
    .hb-print-quarterly-members-table th:nth-child(3),
    .hb-print-quarterly-members-table th:nth-child(4),
    .hb-print-quarterly-members-table th:nth-child(5),
    .hb-print-quarterly-members-table th:nth-child(6),
    .hb-print-quarterly-members-table td:nth-child(3),
    .hb-print-quarterly-members-table td:nth-child(4),
    .hb-print-quarterly-members-table td:nth-child(5),
    .hb-print-quarterly-members-table td:nth-child(6) {
        width: 48px !important;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .hb-print-quarterly-summary-table .hb-print-activity-column {
        width: 76px !important;
        min-width: 76px !important;
        text-align: center !important;
        white-space: normal !important;
    }

    .hb-print-quarterly-summary-table .hb-print-status-column {
        width: 13% !important;
        text-align: left !important;
        white-space: normal !important;
    }

    .hb-print-quarterly-summary-table .hb-print-notes-column {
        width: auto !important;
        min-width: 22% !important;
        text-align: left !important;
        white-space: normal !important;
    }
}
