.financial-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin: 0 0 24px;
}

.print-only {
    display: none !important;
}

.code-ltr,
.money-nowrap {
    white-space: nowrap;
}

.financial-summary-grid article,
.queue-financial-summary div {
    background: #f5fafb;
    border: 1px solid #d8e7ea;
    border-radius: 14px;
    padding: 16px;
}

.financial-summary-grid span,
.queue-financial-summary dt {
    color: #55717d;
    display: block;
    font-size: .86rem;
    margin-bottom: 6px;
}

.financial-summary-grid strong,
.queue-financial-summary dd {
    color: #123f4d;
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
}

.financial-summary-grid .is-total {
    background: #0f5964;
    border-color: #0f5964;
}

.financial-summary-grid .is-total span,
.financial-summary-grid .is-total strong {
    color: #fff;
}

.checkout-layout,
.narrow-container {
    max-width: 980px;
}

.financial-card {
    background: #fff;
    border: 1px solid #d8e7ea;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(18, 63, 77, .07);
    margin-bottom: 24px;
    padding: 24px;
}

.financial-form fieldset {
    border: 1px solid #d8e7ea;
    border-radius: 14px;
    margin: 0 0 20px;
    padding: 18px;
}

.financial-form legend {
    color: #123f4d;
    font-weight: 800;
    padding: 0 8px;
}

.choice-row {
    align-items: flex-start;
    background: #f8fbfc;
    border: 1px solid #d8e7ea;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    gap: 12px;
    margin: 10px 0;
    padding: 14px;
}

.choice-row input {
    margin-top: 4px;
}

.choice-row span,
.choice-row small {
    display: block;
}

.choice-row small {
    color: #637b84;
    margin-top: 4px;
}

.choice-warning {
    background: #fff9e9;
    border-color: #efd998;
}

.button-wide {
    justify-content: center;
    width: 100%;
}

.queue-financial-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 16px 0;
}

.queue-financial-summary div {
    padding: 10px;
}

.queue-financial-summary dt {
    margin: 0 0 3px;
}

.queue-financial-summary dd {
    font-size: .95rem;
}

.financial-item-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.financial-item-list li {
    align-items: center;
    border-bottom: 1px solid #e7eff1;
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
}

.table-scroll {
    overflow-x: auto;
}

.financial-table,
.receipt-allocations table {
    border-collapse: collapse;
    min-width: 680px;
    width: 100%;
}

.financial-table th,
.financial-table td,
.receipt-allocations th,
.receipt-allocations td {
    border-bottom: 1px solid #dfeaec;
    padding: 12px;
    text-align: right;
    vertical-align: top;
}

.financial-table th,
.receipt-allocations th {
    background: #f2f7f8;
    color: #294f5b;
}

.patient-financial-section h3 {
    color: #123f4d;
    margin-top: 28px;
}

.reverse-form {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) auto;
    gap: 8px;
    min-width: 300px;
}

.reverse-form label {
    grid-column: 1 / -1;
    color: #55717d;
    font-size: .78rem;
    font-weight: 800;
}

.reverse-form input {
    min-height: 44px;
    min-width: 170px;
}

.collection-status {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .82rem;
    font-weight: 800;
    white-space: nowrap;
}

.collection-status.is-posted {
    background: #e5f7f0;
    color: #116b55;
}

.collection-status.is-reversed {
    background: #fdecec;
    color: #923737;
}

.collection-action-state {
    display: inline-block;
    max-width: 220px;
    color: #637b84;
    font-size: .82rem;
    line-height: 1.55;
}

.receipt-container {
    max-width: 900px;
}

.receipt-toolbar {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.receipt-paper {
    background: #fff;
    border: 1px solid #ccdadd;
    box-shadow: 0 10px 35px rgba(18, 63, 77, .1);
    color: #152f38;
    padding: 38px;
}

.receipt-header {
    align-items: center;
    border-bottom: 2px solid #123f4d;
    display: grid;
    gap: 18px;
    grid-template-columns: auto 1fr auto;
    padding-bottom: 22px;
}

.receipt-header h1 {
    font-size: 1.35rem;
    margin: 0 0 5px;
}

.receipt-header p {
    margin: 0;
}

.receipt-details {
    display: grid;
    gap: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 28px 0;
}

.receipt-details div {
    border-bottom: 1px solid #e0e9eb;
    padding: 12px;
}

.receipt-details dt {
    color: #607781;
    font-size: .86rem;
}

.receipt-details dd {
    font-weight: 700;
    margin: 5px 0 0;
}

.receipt-balance {
    background: #edf6f7;
    border-radius: 10px;
    font-size: 1.08rem;
    margin-top: 24px;
    padding: 16px;
}

.receipt-warning {
    border-top: 1px dashed #9eb1b7;
    color: #8a4b28;
    font-weight: 800;
    margin-top: 30px;
    padding-top: 20px;
    text-align: center;
}

@media (max-width: 700px) {
    .financial-card,
    .receipt-paper {
        padding: 16px;
    }

    .receipt-header,
    .receipt-details {
        grid-template-columns: 1fr;
    }

    .queue-financial-summary {
        grid-template-columns: 1fr;
    }

    .page-admin-collections .collections-hero .page-hero-inner {
        align-items: stretch;
        gap: 10px;
    }

    .page-admin-collections .collections-hero {
        padding-block: 18px;
    }

    .page-admin-collections .collections-hero .eyebrow {
        margin-bottom: 4px;
    }

    .page-admin-collections .collections-hero h1 {
        margin-bottom: 4px;
        font-size: 1.55rem;
    }

    .page-admin-collections .collections-hero p {
        font-size: .82rem;
        line-height: 1.5;
    }

    .page-admin-collections .collections-hero .button {
        width: 100%;
    }

    .page-admin-collections .collections-card {
        padding: 14px;
    }

    .page-admin-collections > .site-main,
    .page-admin-collections .section {
        min-height: 0;
    }

    .page-admin-collections .section {
        padding-block: 18px 32px;
    }

    .page-admin-collections .collections-card .section-heading {
        margin-bottom: 12px;
    }

    .page-admin-collections .collections-table-wrap {
        overflow: visible;
    }

    .page-admin-collections .collections-table,
    .page-admin-collections .collections-table tbody,
    .page-admin-collections .collections-table tr,
    .page-admin-collections .collections-table td {
        display: block;
        width: 100%;
    }

    .page-admin-collections .collections-table {
        min-width: 0;
    }

    .page-admin-collections .collections-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .page-admin-collections .collections-table tbody {
        display: grid;
        gap: 14px;
    }

    .page-admin-collections .collections-table tr {
        padding: 12px;
        border: 1px solid #d8e7ea;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 7px 20px rgba(18, 63, 77, .06);
    }

    .page-admin-collections .collections-table td {
        min-width: 0;
        display: grid;
        grid-template-columns: minmax(82px, .42fr) minmax(0, 1fr);
        gap: 10px;
        padding: 9px 0;
        overflow-wrap: anywhere;
    }

    .page-admin-collections .collections-table td::before {
        color: #55717d;
        content: attr(data-label);
        font-size: .78rem;
        font-weight: 800;
    }

    .page-admin-collections .collections-table .collection-action-cell {
        display: block;
        padding-top: 12px;
    }

    .page-admin-collections .collections-table .collection-action-cell::before {
        display: block;
        margin-bottom: 8px;
    }

    .page-admin-collections .reverse-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .page-admin-collections .reverse-form label {
        grid-column: auto;
    }

    .page-admin-collections .reverse-form input,
    .page-admin-collections .reverse-form .button {
        width: 100%;
        min-width: 0;
        min-height: 46px;
    }
}

@media print {
    @page {
        margin: 12mm;
        size: A4;
    }

    .site-header,
    .site-nav,
    .nav-toggle,
    .site-footer,
    .skip-link,
    .no-print,
    .flash-message,
    .pagination,
    .reverse-form,
    .collection-action-state,
    .button,
    button,
    input,
    select,
    textarea {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }

    html,
    body,
    .site-main,
    .section {
        min-height: 0 !important;
        height: auto !important;
        background: #fff !important;
        margin: 0;
        padding: 0;
    }

    body {
        color: #111;
        font-size: 10pt;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    .container {
        width: 100%;
        max-width: none;
    }

    .collections-hero {
        display: block !important;
        padding: 0 0 5mm;
        border-bottom: 1px solid #7d929a;
        background: #fff !important;
    }

    .collections-hero .page-hero-inner {
        display: block;
    }

    .collections-hero .eyebrow,
    .collections-hero p,
    .collections-hero .button {
        display: none !important;
    }

    .collections-hero h1 {
        margin: 0;
        font-size: 18pt;
    }

    .page-admin-collections .section {
        padding-top: 5mm;
    }

    .table-scroll,
    .collections-table-wrap {
        overflow: visible !important;
    }

    .financial-table,
    .collections-table,
    .receipt-allocations table {
        display: table !important;
        min-width: 0 !important;
        width: 100% !important;
        table-layout: fixed;
    }

    .financial-table thead,
    .collections-table thead {
        position: static !important;
        display: table-header-group !important;
        width: auto !important;
        height: auto !important;
        overflow: visible !important;
        clip: auto !important;
        clip-path: none !important;
        white-space: normal !important;
    }

    .financial-table tbody,
    .collections-table tbody {
        display: table-row-group !important;
    }

    .financial-table tr,
    .collections-table tr {
        display: table-row !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .financial-table th,
    .financial-table td,
    .collections-table th,
    .collections-table td {
        display: table-cell !important;
        width: auto !important;
        padding: 6px !important;
        overflow-wrap: anywhere;
        font-size: 8.5pt;
    }

    .collections-table th:last-child,
    .collections-table td:last-child {
        display: none !important;
    }

    .collections-table td::before {
        display: none !important;
        content: none !important;
    }

    .financial-summary-grid article,
    .queue-card,
    .clinical-treatment-card,
    .clinical-history-card,
    .clinical-summary-card,
    .patient-treatment-card,
    .receipt-details > div,
    .receipt-paper {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .financial-card {
        border: 0;
        box-shadow: none;
        margin-bottom: 8mm;
        padding: 0;
    }

    .financial-card h2,
    .section-heading {
        break-after: avoid;
        page-break-after: avoid;
    }

    .page-clinical-visit .clinical-mobile-header,
    .page-clinical-visit .clinical-form,
    .page-clinical-visit .clinical-history {
        display: none !important;
    }

    .page-clinical-visit .clinical-section,
    .page-clinical-visit .clinical-layout {
        display: block;
        min-height: 0 !important;
        padding: 0;
        background: #fff !important;
    }

    .clinical-print-summary {
        color: #152f38;
        font-size: 9.5pt;
        line-height: 1.45;
    }

    .clinical-print-summary h1,
    .clinical-print-summary h2,
    .clinical-print-summary p,
    .clinical-print-summary dl,
    .clinical-print-summary dd {
        margin-top: 0;
    }

    .clinical-print-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 8mm;
        padding-bottom: 4mm;
        border-bottom: 2px solid #123f4d;
    }

    .clinical-print-header span {
        color: #55717d;
        font-size: 8.5pt;
    }

    .clinical-print-header h1 {
        margin-bottom: 0;
        font-size: 17pt;
    }

    .clinical-print-header > strong {
        padding: 2mm 3mm;
        border: 1px solid #b8c8cd;
        border-radius: 3mm;
        font-size: 11pt;
    }

    .clinical-print-identity,
    .clinical-print-values {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0;
        margin: 4mm 0;
        border: 1px solid #d8e7ea;
    }

    .clinical-print-identity > div,
    .clinical-print-values > div {
        min-width: 0;
        padding: 2mm 3mm;
        border-bottom: 1px solid #e2eaee;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .clinical-print-identity dt,
    .clinical-print-values dt {
        color: #55717d;
        font-size: 8pt;
    }

    .clinical-print-identity dd,
    .clinical-print-values dd {
        margin-bottom: 0;
        overflow-wrap: anywhere;
        font-weight: 700;
    }

    .clinical-print-block,
    .clinical-print-treatment {
        margin-top: 4mm;
        padding: 3mm;
        border: 1px solid #d8e7ea;
        border-radius: 3mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .clinical-print-block h2,
    .clinical-print-treatments > h2 {
        margin-bottom: 2mm;
        font-size: 12pt;
    }

    .clinical-print-block p,
    .clinical-print-note p {
        margin-bottom: 0;
    }

    .clinical-print-note + .clinical-print-note {
        margin-top: 2mm;
        padding-top: 2mm;
        border-top: 1px solid #e2eaee;
    }

    .clinical-print-treatment > header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 5mm;
        margin-bottom: 2mm;
    }

    .clinical-print-treatment > header span {
        color: #16775f;
        font-weight: 800;
    }

    .clinical-print-values {
        margin: 0;
        border: 0;
    }

    .clinical-print-values > div {
        padding-inline: 0;
    }

    .receipt-paper {
        border: 0;
        box-shadow: none;
        padding: 0;
    }
}


/* Admin daily A4 report */
.daily-report-page{display:grid;gap:1rem}
.report-toolbar{display:flex;align-items:flex-end;justify-content:space-between;gap:1rem;flex-wrap:wrap;padding:1rem;border:1px solid #d8e8e5;border-radius:18px;background:#fff}
.report-toolbar form{display:flex;align-items:flex-end;gap:.7rem;flex-wrap:wrap}
.report-toolbar label{display:grid;gap:.35rem;font-weight:700;color:#183c45}
.report-toolbar input{min-width:170px;padding:.75rem;border:1px solid #bcd3cf;border-radius:10px;background:#fff}
.report-actions{display:flex;gap:.6rem;flex-wrap:wrap}
.report-button{display:inline-flex;align-items:center;justify-content:center;min-height:42px;padding:.65rem 1rem;border:0;border-radius:10px;background:#087da4;color:#fff;font-weight:800;text-decoration:none;cursor:pointer}
.report-button.secondary{background:#eef6f4;color:#164650;border:1px solid #c8ded9}
.report-sheet{width:min(100%,1200px);margin-inline:auto;padding:1.2rem;border:1px solid #d8e8e5;border-radius:18px;background:#fff;box-shadow:0 12px 30px rgba(18,68,78,.08)}
.report-header{display:flex;justify-content:space-between;gap:1rem;align-items:center;padding-bottom:.8rem;border-bottom:2px solid #0b8790}
.report-brand h1{margin:0;color:#123c46;font-size:1.55rem}
.report-brand p,.report-meta p{margin:.2rem 0;color:#577077}
.report-meta{text-align:left;font-size:.88rem}
.report-section{margin-top:1rem}
.report-section h2{margin:0 0 .65rem;font-size:1.05rem;color:#123c46}
.report-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:.55rem}
.report-card{padding:.65rem;border:1px solid #d8e8e5;border-radius:11px;background:#f8fcfb;text-align:center}
.report-card span{display:block;color:#5b7177;font-size:.76rem}
.report-card strong{display:block;margin-top:.2rem;color:#113b45;font-size:1.05rem}
.report-card.financial strong{font-size:.92rem}
.doctor-strip{display:flex;gap:.5rem;flex-wrap:wrap}
.doctor-chip{padding:.45rem .7rem;border:1px solid #cce0dc;border-radius:999px;background:#f3faf8;color:#164650;font-size:.82rem}
.table-wrap{overflow-x:auto;border:1px solid #d8e8e5;border-radius:11px}
.report-table{width:100%;border-collapse:collapse;font-size:.79rem}
.report-table th,.report-table td{padding:.5rem .42rem;border-bottom:1px solid #e2ecea;text-align:right;vertical-align:top;white-space:nowrap}
.report-table th{background:#eaf5f3;color:#153e47;font-weight:800}
.report-table tbody tr:last-child td{border-bottom:0}
.empty-row{text-align:center!important;color:#6c7e82;padding:1.2rem!important}
.status-pill{display:inline-block;padding:.18rem .45rem;border-radius:999px;background:#edf6f4;color:#14545b;font-weight:700}
.report-footer{display:grid;grid-template-columns:repeat(3,1fr);gap:2rem;margin-top:1.4rem;padding-top:1rem;border-top:1px solid #cbdedb;color:#36565d;font-size:.8rem}
.signature{padding-top:1.5rem;border-bottom:1px solid #8ca4a5;text-align:center}
.screen-note{margin:.5rem 0 0;color:#64777b;font-size:.78rem}
@media (max-width:900px){
    .report-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
    .report-header{align-items:flex-start;flex-direction:column}
    .report-meta{text-align:right}
}
@media print{
    @page{size:A4 landscape;margin:8mm}
    body{background:#fff!important;color:#111}
    .site-header,.site-footer,.report-toolbar,.screen-note{display:none!important}
    .site-main{padding:0!important;margin:0!important;max-width:none!important}
    .daily-report-page{display:block}
    .report-sheet{width:100%;max-width:none;margin:0;padding:0;border:0;border-radius:0;box-shadow:none}
    .report-header{padding-bottom:5mm}
    .report-section{margin-top:4mm}
    .report-grid{grid-template-columns:repeat(6,1fr);gap:2mm}
    .report-card{padding:2mm;border-radius:2mm}
    .report-table{font-size:7.5pt}
    .report-table th,.report-table td{padding:1.5mm 1.2mm}
    .report-table thead{display:table-header-group}
    .report-table tr,.report-card{break-inside:avoid;page-break-inside:avoid}
    .report-footer{break-inside:avoid;page-break-inside:avoid}
}


/* Comprehensive patient file attachments */
.patient-attachments-card{margin-top:1.25rem;padding:1.25rem;border:1px solid #d5e5e2;border-radius:18px;background:#fff;box-shadow:0 10px 26px rgba(17,62,70,.06)}
.patient-attachments-header{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;margin-bottom:1rem}
.patient-attachments-header h2{margin:.2rem 0;color:#123c46}
.patient-attachments-header p{margin:0;color:#62777c}
.attachment-count{display:inline-flex;align-items:center;justify-content:center;min-width:72px;padding:.4rem .65rem;border-radius:999px;background:#eaf5f3;color:#15515a;font-weight:800;white-space:nowrap}
.patient-attachment-form{display:grid;grid-template-columns:minmax(150px,.7fr) minmax(240px,1.3fr) minmax(240px,1.4fr) auto;gap:.75rem;align-items:end;margin-bottom:1rem;padding:1rem;border:1px solid #dce9e7;border-radius:14px;background:#f7fbfa}
.patient-attachment-form label{display:grid;gap:.35rem;color:#244b53;font-weight:750}
.patient-attachment-form input,.patient-attachment-form select{width:100%;min-height:43px;padding:.65rem .75rem;border:1px solid #bdd3cf;border-radius:10px;background:#fff;color:#173d45}
.patient-attachment-form input[type=file]{padding:.45rem}
.patient-attachment-form small{color:#708287;font-weight:500}
.patient-attachments-grid{display:grid;gap:.7rem}
.patient-attachment-item{display:flex;align-items:center;gap:.85rem;padding:.8rem;border:1px solid #dce9e7;border-radius:13px;background:#fbfdfd}
.patient-attachment-icon{display:flex;align-items:center;justify-content:center;width:48px;height:48px;border-radius:12px;background:#dff1ee;color:#126473;font-weight:900;flex:0 0 auto}
.patient-attachment-copy{min-width:0;flex:1}
.patient-attachment-copy h3{margin:.25rem 0;font-size:1rem}
.patient-attachment-copy h3 a{color:#0e6578;text-decoration:none;overflow-wrap:anywhere}
.patient-attachment-copy p{margin:.18rem 0;color:#667b80;font-size:.82rem}
.patient-attachment-copy .attachment-note{color:#284e56}
.patient-attachments-empty{margin:0}
@media (max-width:1000px){
    .patient-attachment-form{grid-template-columns:1fr 1fr}
}
@media (max-width:650px){
    .patient-attachments-header,.patient-attachment-item{align-items:stretch;flex-direction:column}
    .patient-attachment-form{grid-template-columns:1fr}
    .patient-attachment-item>.button{width:100%}
}
@media print{
    @page{size:A4 portrait;margin:9mm}
    .page-patient-file .site-header,
    .page-patient-file .site-footer,
    .page-patient-file .patient-file-actions,
    .page-patient-file .no-print,
    .page-patient-file .skip-link{display:none!important}
    .page-patient-file,
    .page-patient-file .site-main{background:#fff!important;margin:0!important;padding:0!important}
    .page-patient-file .patient-file-hero{padding:0 0 5mm!important;background:#fff!important;color:#111!important}
    .page-patient-file .patient-file-hero-inner{padding:0!important}
    .page-patient-file .file-number,
    .page-patient-file .patient-file-hero h1,
    .page-patient-file .patient-badge{color:#111!important}
    .page-patient-file .section{padding:0!important}
    .page-patient-file .container{width:100%!important;max-width:none!important;padding:0!important}
    .page-patient-file .patient-file-layout{display:block!important}
    .page-patient-file .card,
    .page-patient-file .patient-attachments-card{margin:0 0 4mm!important;padding:3mm!important;border:1px solid #aaa!important;border-radius:2mm!important;box-shadow:none!important;break-inside:avoid;page-break-inside:avoid}
    .page-patient-file .patient-treatment-timeline>li,
    .page-patient-file table tr,
    .page-patient-file .patient-attachment-item{break-inside:avoid;page-break-inside:avoid}
    .page-patient-file table{font-size:8pt}
    .page-patient-file .patient-attachments-grid{gap:2mm}
    .page-patient-file .patient-attachment-item{padding:2mm;border:1px solid #bbb}
    .page-patient-file .patient-attachment-icon{width:10mm;height:10mm}
}

/* Compact receptionist checkout, independent of reports and receipt layouts. */
.page-checkout .page-hero { padding-block: 16px; }
.page-checkout .page-hero h1 { font-size: 1.55rem; }
.page-checkout .section { padding-block: 18px; }
.checkout-simple .financial-card { padding: 18px; margin-bottom: 12px; }
.checkout-simple .financial-summary-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.checkout-simple .financial-summary-grid article { padding: 12px; }
.checkout-simple .form-grid { gap: 14px; }
.checkout-simple .field-help { margin-block: 12px; }
.checkout-treatment-details summary { cursor: pointer; font-weight: 700; }
@media (max-width: 600px) {
    .checkout-simple .financial-summary-grid { grid-template-columns: 1fr; }
}
