/* ============================================================
   ORDER ENTRY PAGE
   ============================================================ */

.order-page {
    width: 100%;
    padding: 0.75rem;
    box-sizing: border-box;
}

.order-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}


/* ============================================================
   COMMON SECTION
   ============================================================ */

.order-section {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    background: #fff;
    overflow: hidden;
}

.order-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    padding: 0.4rem 0.8rem;
    background: #f3f6f9;
    border-bottom: 1px solid #cfd8e3;
}

    .order-section-header h2 {
        margin: 0;
        color: #24468E;
        font-size: 1rem;
        font-weight: 700;
    }

.order-section-body {
    padding: 0.7rem 0.8rem;
}


/* ============================================================
   COMMON FORM FIELDS
   ============================================================ */

.form-field {
    min-width: 0;
}

    .form-field label {
        display: block;
        margin-bottom: 0.2rem;
        font-size: 0.88rem;
        font-weight: 500;
    }

.form-control,
.form-select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.form-control {
    min-height: 34px;
}

.form-select {
    min-height: 34px;
}


/* ============================================================
   PATIENT + DISPENSING PROVIDER
   ============================================================ */

.order-demographics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
    align-items: stretch;
}


/* ============================================================
   PATIENT
   ============================================================ */

.patient-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem 0.75rem;
}


/* ============================================================
   DISPENSING PROVIDER
   ============================================================ */

.provider-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.65rem;
}

.provider-details {
    line-height: 1.35;
    font-size: 0.9rem;
}

    .provider-details strong {
        font-weight: 700;
    }

.provider-name {
    color: #24468E;
    font-weight: 700;
}

.provider-address {
    margin-top: 0.15rem;
}

.provider-contact {
    margin-top: 0.25rem;
}

.prescriber-section {
    padding-top: 0.55rem;
    border-top: 1px solid #d9e0e7;
}

    .prescriber-section h3 {
        margin: 0 0 0.45rem;
        color: #24468E;
        font-size: 0.9rem;
        font-weight: 700;
    }

.prescriber-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}


/* ============================================================
   FRAME
   ============================================================ */

.frame-search {
    width: 100%;
}

.frame-search-results {
    position: relative;
}

.frame-result-table {
    width: 100%;
    border-collapse: collapse;
}

    .frame-result-table th,
    .frame-result-table td {
        padding: 0.4rem 0.5rem;
        border: 1px solid #d8dee6;
        font-size: 0.85rem;
    }

    .frame-result-table th {
        background: #f3f6f9;
        font-weight: 700;
    }

.frame-expected-date {
    background: #ffe7e7;
    color: #b11d23;
}

.frame-backorder {
    color: #B11D23;
    font-weight: 700;
    white-space: nowrap;
}


/* ============================================================
   RX SECTION
   ============================================================ */

.rx-section .order-section-body {
    padding: 0.55rem 0.7rem 0.7rem;
}


/* ============================================================
   RX TOOLBAR
   ============================================================ */

.rx-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 0.6rem;
}

    .rx-toolbar > .form-field {
        width: 225px;
        flex: 0 0 225px;
    }

.rx-vision-control,
.rx-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-bottom: 0.15rem;
}

.rx-control-label,
.rx-radio-label {
    font-size: 0.8rem;
    font-weight: 700;
}

.rx-vision-control .input-radio-group,
.rx-radio-group .input-radio-group {
    display: flex;
    gap: 0.75rem;
}

.rx-vision-control label,
.rx-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    white-space: nowrap;
    font-size: 0.82rem;
}


/* ============================================================
   RX WARNING
   ============================================================ */

.rx-warning {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.6rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid #e3b341;
    border-radius: 5px;
    background: #fff8df;
    font-size: 0.85rem;
}

    .rx-warning .link-button {
        border: 0;
        background: transparent;
        color: #24468E;
        font-weight: 700;
        text-decoration: underline;
        cursor: pointer;
        white-space: nowrap;
    }


/* ============================================================
   RX AREA LAYOUT

   We use Flexbox instead of a rigid CSS Grid here.

   This is intentional because the width of Fitting and PD
   changes based on Rx Type and Mono/Binocular PD mode.
   ============================================================ */

.rx-area-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.55rem;
    width: 100%;
    box-sizing: border-box;
}


/* ============================================================
   COMMON RX AREA
   ============================================================ */

.rx-area {
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #cfd8e3;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

    .rx-area > h3,
    .rx-pd-header {
        min-height: 30px;
        margin: 0;
        padding: 0.3rem 0.55rem;
        box-sizing: border-box;
        background: #f3f6f9;
        border-bottom: 1px solid #cfd8e3;
        color: #24468E;
        font-size: 0.82rem;
        font-weight: 700;
    }

    .rx-area > h3 {
        display: flex;
        align-items: center;
    }

.rx-area-body {
    padding: 0;
}


/* ============================================================
   PRESCRIPTION AREA

   Sphere / Cylinder / Axis

   This area's structure does not change based on Rx Type,
   so it has a predictable width.
   ============================================================ */

.rx-power-area {
    flex: 0 0 335px;
    width: 335px;
}

.rx-axis-inactive {
    background-color: #f1f3f5;
    color: #8a929a;
    cursor: not-allowed;
}


/* ============================================================
   FITTING AREA

   The Razor component assigns one of:

       rx-fitting-cols-1
       rx-fitting-cols-2
       rx-fitting-cols-3
       rx-fitting-cols-4

   based on how many fitting fields are currently visible.
   ============================================================ */

.rx-fitting-area {
    flex-grow: 0;
    flex-shrink: 0;
}


/* Eye + one visible fitting field */
.rx-fitting-cols-1 {
    flex-basis: 260px;
    width: 260px;
}


/* Eye + two visible fitting fields */
.rx-fitting-cols-2 {
    flex-basis: 350px;
    width: 350px;
}


/* Eye + three visible fitting fields */
.rx-fitting-cols-3 {
    flex-basis: 440px;
    width: 440px;
}


/* Eye + four visible fitting fields */
.rx-fitting-cols-4 {
    flex-basis: 525px;
    width: 525px;
}


/* ============================================================
   PD AREA

   Razor assigns:

       rx-pd-cols-1
       rx-pd-cols-2

   depending on whether one or two PD columns are displayed.
   ============================================================ */

.rx-pd-area {
    flex-grow: 0;
    flex-shrink: 0;
}


/* Binocular PD, or Mono PD with only one visible value */
.rx-pd-cols-1 {
    flex-basis: 235px;
    width: 235px;
}


/* Mono PD with both FPD + NPD */
.rx-pd-cols-2 {
    flex-basis: 315px;
    width: 315px;
}


/* ============================================================
   PRISM AREA

   Prism gets whatever horizontal space remains.

   If there isn't enough room, Flexbox moves it to the next
   line automatically.
   ============================================================ */

.rx-prism-area {
    flex: 1 1 520px;
    min-width: 500px;
}


/* ============================================================
   RX MINI TABLES
   ============================================================ */

.rx-mini-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 0;
}

    .rx-mini-table th,
    .rx-mini-table td {
        height: 34px;
        padding: 0.2rem 0.25rem;
        box-sizing: border-box;
        border-right: 1px solid #d8dee6;
        border-bottom: 1px solid #d8dee6;
        vertical-align: middle;
    }

    .rx-mini-table tr:last-child th,
    .rx-mini-table tr:last-child td {
        border-bottom: 0;
    }

    .rx-mini-table th:last-child,
    .rx-mini-table td:last-child {
        border-right: 0;
    }

    .rx-mini-table thead th {
        height: 27px;
        padding: 0.15rem 0.2rem;
        background: #f5f7f9;
        text-align: center;
        font-size: 0.72rem;
        font-weight: 700;
        white-space: nowrap;
    }

    .rx-mini-table tbody th {
        background: #f8f9fa;
        font-size: 0.73rem;
        font-weight: 700;
        white-space: nowrap;
    }

    .rx-mini-table td {
        background: #fff;
    }


    /* ============================================================
   RX INPUTS

   The input fills the cell.

   The CARD/CELL determines how wide the field appears.
   ============================================================ */

    .rx-mini-table .form-control,
    .rx-mini-table .form-select,
    .rx-mini-table input,
    .rx-mini-table select {
        display: block;
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 27px;
        min-height: 27px;
        margin: 0;
        padding: 0.15rem 0.3rem;
        box-sizing: border-box;
        font-size: 0.78rem;
    }

        .rx-mini-table input[type="number"] {
            text-align: center;
        }


/* ============================================================
   PRESCRIPTION TABLE
   ============================================================ */

.rx-power-table th:first-child {
    width: 92px;
}

.rx-power-table th:not(:first-child) {
    width: 80px;
}


/* ============================================================
   FITTING TABLE

   Don't target nth-child(2), nth-child(3), etc. because
   Razor is dynamically adding/removing columns.

   Every visible data column receives the same width.
   ============================================================ */

.rx-fitting-table th:first-child {
    width: 92px;
}

.rx-fitting-table th:not(:first-child) {
    width: 95px;
}


/* ============================================================
   PD HEADER
   ============================================================ */

.rx-pd-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

    .rx-pd-header h3 {
        margin: 0;
        color: #24468E;
        font-size: 0.82rem;
        font-weight: 700;
    }

.rx-mono-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin: 0;
    color: #222;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

    .rx-mono-toggle input {
        margin: 0;
    }


/* ============================================================
   BINOCULAR PD TABLE
   ============================================================ */

.rx-binocular-pd-table th:first-child {
    width: 70px;
}

.rx-binocular-pd-table td,
.rx-binocular-pd-table th:last-child {
    width: 120px;
}


/* ============================================================
   MONOCULAR PD TABLE
   ============================================================ */

.rx-mono-pd-table th:first-child {
    width: 92px;
}

.rx-mono-pd-table th:not(:first-child) {
    width: 90px;
}


/* ============================================================
   PRISM TABLE
   ============================================================ */

.rx-prism-table th:first-child {
    width: 92px;
}

.rx-prism-table th:not(:first-child) {
    width: 90px;
}


/* ============================================================
   LENS SELECTION
   ============================================================ */

.lens-selection-grid {
    display: grid;
    grid-template-columns: minmax(180px, 0.8fr) minmax(180px, 0.8fr) minmax(260px, 1.4fr);
    gap: 0.75rem;
    align-items: end;
}


/* ============================================================
   JOB OPTIONS
   ============================================================ */

.job-options-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

.job-option-group {
    min-width: 0;
}

    .job-option-group h3 {
        margin: 0 0 0.4rem;
        color: #24468E;
        font-size: 0.9rem;
        font-weight: 700;
    }

.tint-details-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(110px, 0.4fr);
    gap: 0.6rem;
    margin-top: 0.5rem;
}


/* ============================================================
   INSTRUCTIONS
   ============================================================ */

.instructions-section .order-section-body {
    padding: 0.65rem 0.8rem 0.75rem;
}

.instructions-field {
    width: 100%;
}

.instructions-label {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
    font-size: 0.88rem;
    font-weight: 600;
}

    .instructions-label label {
        margin: 0;
    }

.instructions-count {
    color: #66717d;
    font-size: 0.78rem;
    font-weight: 400;
}

    .instructions-count.at-limit {
        color: #B11D23;
        font-weight: 700;
    }

.instructions-textarea {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 70px;
    padding: 0.45rem 0.55rem;
    box-sizing: border-box;
    resize: vertical;
}


/* ============================================================
   FOOTER
   ============================================================ */

.order-entry-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.65rem;
    padding: 0.7rem 0;
}

    .order-entry-footer button {
        min-width: 120px;
    }


/* ============================================================
   RESPONSIVE - MEDIUM
   ============================================================ */

@media (max-width: 1150px) {

    .order-demographics-grid {
        grid-template-columns: 1fr;
    }

    /*
     * Let RX cards wrap naturally.
     * Prism gets its own row when necessary.
     */

    .rx-prism-area {
        flex-basis: 100%;
        min-width: 0;
    }
}


/* ============================================================
   RESPONSIVE - SMALL
   ============================================================ */

@media (max-width: 760px) {

    .order-page {
        padding: 0.4rem;
    }


    .patient-grid,
    .prescriber-grid,
    .lens-selection-grid,
    .job-options-grid,
    .tint-details-grid {
        grid-template-columns: 1fr;
    }


    /* --------------------------------------------------------
       RX TOOLBAR
       -------------------------------------------------------- */

    .rx-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 0.5rem;
    }

        .rx-toolbar > .form-field {
            width: 100%;
            flex-basis: auto;
        }


    /* --------------------------------------------------------
       RX AREAS

       Stack every card vertically on narrow displays.
       -------------------------------------------------------- */

    .rx-area-grid {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        width: 100%;
    }

    .rx-power-area,
    .rx-fitting-area,
    .rx-pd-area,
    .rx-prism-area,
    .rx-fitting-cols-1,
    .rx-fitting-cols-2,
    .rx-fitting-cols-3,
    .rx-fitting-cols-4,
    .rx-pd-cols-1,
    .rx-pd-cols-2 {
        width: 100%;
        max-width: 100%;
        flex-basis: auto;
        min-width: 0;
    }


    /*
     * On extremely narrow displays the larger tables may
     * scroll INSIDE their card rather than forcing the entire
     * page to scroll horizontally.
     */

    .rx-area-body {
        overflow-x: auto;
    }

    .rx-power-table {
        min-width: 310px;
    }

    .rx-fitting-table {
        min-width: 260px;
    }

    .rx-prism-table {
        min-width: 500px;
    }
}

/* ============================================================
   ORDER SUMMARY OVERLAY
   ============================================================ */

.order-summary-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(20, 30, 45, 0.68);
}

.order-summary-modal {
    display: flex;
    flex-direction: column;
    width: min(1050px, 100%);
    max-height: calc(100vh - 2rem);
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.order-summary-print-area {
    overflow-y: auto;
    padding: 1rem 1.15rem 1.25rem;
}


/* ============================================================
   SUMMARY BRANDING
   ============================================================ */

.summary-brand-header {
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr) 190px;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #24468E;
}

.summary-logo-wrap {
    display: flex;
    align-items: center;
}

.summary-logo-right {
    justify-content: flex-end;
}

.summary-avesis-logo {
    display: block;
    max-width: 125px;
    max-height: 60px;
    object-fit: contain;
}

.summary-pds-logo {
    display: block;
    max-width: 175px;
    max-height: 75px;
    object-fit: contain;
}

.summary-heading {
    text-align: center;
}

    .summary-heading h1 {
        margin: 0;
        color: #24468E;
        font-size: 1.45rem;
        font-weight: 700;
    }

.summary-order-number {
    margin-top: 0.2rem;
    font-size: 1rem;
    font-weight: 700;
}

.summary-status {
    margin: 0.8rem 0;
    padding: 0.45rem 0.7rem;
    border-left: 4px solid #24468E;
    background: #f3f6fa;
    color: #24468E;
    font-weight: 700;
}


/* ============================================================
   SUMMARY LAYOUT
   ============================================================ */

.summary-two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.7rem;
    margin-bottom: 0.7rem;
}

.summary-card {
    margin-bottom: 0.7rem;
    border: 1px solid #d4dce6;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

    .summary-card h2 {
        margin: 0;
        padding: 0.4rem 0.6rem;
        background: #f3f6f9;
        border-bottom: 1px solid #d4dce6;
        color: #24468E;
        font-size: 0.88rem;
        font-weight: 700;
    }

.summary-data-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 0.25rem 0.6rem 0.55rem;
}

.summary-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 0.35rem 0.45rem;
}

.summary-field-label {
    color: #687482;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.summary-field-value {
    margin-top: 0.08rem;
    color: #1f2933;
    font-size: 0.82rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.summary-provider {
    padding: 0.6rem 0.9rem;
    line-height: 1.35;
    font-size: 0.82rem;
}

.summary-referring {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0.25rem 0.6rem;
    border-top: 1px solid #e1e6ec;
}

.summary-options-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-backorder {
    padding: 0.4rem 0.9rem 0.6rem;
    color: #B11D23;
    font-size: 0.78rem;
    font-weight: 700;
}


/* ============================================================
   SUMMARY RX TABLE
   ============================================================ */

.summary-rx-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

    .summary-rx-table th,
    .summary-rx-table td {
        padding: 0.4rem 0.45rem;
        border-right: 1px solid #dce2e8;
        border-bottom: 1px solid #dce2e8;
        text-align: center;
    }

        .summary-rx-table th:last-child,
        .summary-rx-table td:last-child {
            border-right: 0;
        }

    .summary-rx-table tr:last-child th,
    .summary-rx-table tr:last-child td {
        border-bottom: 0;
    }

    .summary-rx-table thead th {
        background: #f7f8fa;
        font-size: 0.7rem;
    }

    .summary-rx-table tbody th {
        background: #f8f9fa;
        text-align: left;
        white-space: nowrap;
    }

.summary-pd-table {
    width: auto;
    min-width: 250px;
}


/* ============================================================
   SUMMARY INSTRUCTIONS
   ============================================================ */

.summary-instructions {
    min-height: 48px;
    padding: 0.65rem 0.8rem;
    white-space: pre-wrap;
    font-size: 0.82rem;
}


/* ============================================================
   SUMMARY ACTIONS
   ============================================================ */

.order-summary-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
    padding: 0.8rem 1rem;
    border-top: 1px solid #d4dce6;
    background: #f7f8fa;
}

    .order-summary-actions button {
        min-width: 135px;
    }


/* ============================================================
   PRINT
   ============================================================ */

@media print {

    @page {
        size: Letter landscape;
        margin: 0.25in;
    }

    body * {
        visibility: hidden !important;
    }

    .order-summary-print-area,
    .order-summary-print-area * {
        visibility: visible !important;
    }

    .order-summary-backdrop {
        position: static;
        display: block;
        padding: 0;
        background: none;
    }

    .order-summary-modal {
        position: static;
        display: block;
        width: 100%;
        max-height: none;
        overflow: visible;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .order-summary-print-area {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        overflow: visible;
    }

    .order-summary-actions {
        display: none !important;
    }

    .summary-card,
    .summary-two-column,
    .summary-rx-table {
        break-inside: avoid;
    }

    .summary-heading h1 {
        font-size: 16pt;
    }

    .summary-field-value,
    .summary-rx-table {
        font-size: 9pt;
    }
}


/* ============================================================
   SUMMARY RESPONSIVEa
   ============================================================ */

@media print {

    @page {
        size: Letter landscape;
        margin: 0.25in;
    }

    /*
     * Prevent the document itself from generating extra
     * printable height.
     */
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: hidden !important;
    }

    /*
     * Blazor/bootstrap layouts often have min-height: 100vh
     * or other sizing that continues producing print pages.
     */
    .page,
    main,
    .content,
    .container,
    .container-fluid {
        min-height: 0 !important;
        height: auto !important;
    }

        body * {
            visibility: hidden !important;
        }

    .order-summary-print-area,
    .order-summary-print-area * {
        visibility: visible !important;
    }

    /*
     * THIS is the important part.
     * Detach the printable content from the modal/flex layout
     * and place it at the actual top-left of the printed page.
     */
    .order-summary-print-area {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        transform: none !important;
        zoom: 1 !important;
        background: #fff !important;
    }

    /*
     * Completely neutralize the modal shell.
     */
    .order-summary-backdrop {
        position: static !important;
        display: block !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        transform: none !important;
    }

    .order-summary-modal {
        position: static !important;
        display: block !important;
        width: auto !important;
        max-width: none !important;
        height: auto !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .order-summary-actions {
        display: none !important;
    }

    .order-summary-print-area,
    .order-summary-print-area * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }


    /* ========================================================
       HEADER
       ======================================================== */

    .summary-brand-header {
        display: grid !important;
        grid-template-columns: 140px minmax(0, 1fr) 170px !important;
        align-items: center !important;
        gap: 0.5rem !important;
        margin: 0 !important;
        padding: 0 0 0.35rem !important;
        border-bottom: 2px solid #24468E !important;
    }

    .summary-avesis-logo {
        max-width: 105px !important;
        max-height: 48px !important;
    }

    .summary-pds-logo {
        max-width: 145px !important;
        max-height: 58px !important;
    }

    .summary-heading h1 {
        margin: 0 !important;
        font-size: 18pt !important;
        line-height: 1.05 !important;
    }

    .summary-order-number {
        margin-top: 0.1rem !important;
        font-size: 10pt !important;
    }


    /* ========================================================
       STATUS
       ======================================================== */

    .summary-status {
        margin: 0.3rem 0 !important;
        padding: 0.25rem 0.45rem !important;
        font-size: 9pt !important;
    }


    /* ========================================================
       TWO-COLUMN GROUPS
       ======================================================== */

    .summary-two-column {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.35rem !important;
        margin-bottom: 0.35rem !important;
    }


    /* ========================================================
       CARDS
       ======================================================== */

    .summary-card {
        margin: 0 0 0.35rem !important;
        border: 1px solid #cfd8e3 !important;
        border-radius: 4px !important;
        overflow: hidden !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

        .summary-card h2 {
            margin: 0 !important;
            padding: 0.25rem 0.4rem !important;
            font-size: 9pt !important;
            line-height: 1.1 !important;
        }


    /* ========================================================
       FIELD GRIDS
       ======================================================== */

    .summary-data-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        padding: 0.15rem 0.35rem 0.25rem !important;
    }

    .summary-field {
        padding: 0.15rem 0.25rem !important;
    }

    .summary-field-label {
        font-size: 6.5pt !important;
        line-height: 1.05 !important;
    }

    .summary-field-value {
        margin-top: 0.05rem !important;
        font-size: 8pt !important;
        line-height: 1.15 !important;
    }


    /* ========================================================
       PROVIDER
       ======================================================== */

    .summary-provider {
        padding: 0.35rem 0.55rem !important;
        font-size: 8pt !important;
        line-height: 1.2 !important;
    }

    .summary-referring {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        padding: 0.1rem 0.25rem !important;
    }


    /* ========================================================
       TABLES
       ======================================================== */

    .summary-rx-table {
        width: 100% !important;
        table-layout: fixed !important;
        border-collapse: collapse !important;
        font-size: 8pt !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

        .summary-rx-table th,
        .summary-rx-table td {
            padding: 0.2rem 0.25rem !important;
            font-size: 8pt !important;
            line-height: 1.1 !important;
        }

        .summary-rx-table thead th {
            font-size: 7pt !important;
        }

    .summary-pd-table {
        width: 100% !important;
        min-width: 0 !important;
    }


    /* ========================================================
       OPTIONS / INSTRUCTIONS
       ======================================================== */

    .summary-options-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    }

    .summary-backorder {
        padding: 0.2rem 0.45rem 0.3rem !important;
        font-size: 7.5pt !important;
    }

    .summary-instructions {
        min-height: 0 !important;
        padding: 0.3rem 0.45rem !important;
        font-size: 8pt !important;
        line-height: 1.2 !important;
    }
}

/* ============================================================
   Error UI
   ============================================================ */

.submit-error-sticky {
    position: fixed;
    top: 1rem;
    left: 50%;
    z-index: 5000;
    width: min(900px, calc(100vw - 2rem));
    transform: translateX(-50%);
}

.submit-error-sticky .alert {
    margin: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}