.error-feedback {
    background: #fff0f0;
    border-color: #d87b7b;
    color: #7d2020;
}

.data-state {
    min-height: 0;
    padding: 2rem 1rem;
    color: var(--muted);
    text-align: center;
}

body:has(.recipe-page) {
    overflow: hidden;
}

body:has(.recipe-page) .sidebar {
    max-height: calc(100vh - 84px);
    overflow-y: auto;
}

.workspace:has(.recipe-page) {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 84px);
    overflow: hidden;
}

.workspace:has(.recipe-page) .app-footer {
    display: none;
}

.recipe-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    container-name: recipe-workspace;
    container-type: inline-size;
}

.recipe-page-heading {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    min-height: 29px;
    margin-bottom: 4px;
}

.recipe-page-heading h1 {
    margin: 0;
    font-size: 24px;
}

.origin-summary {
    flex: 0 0 auto;
    align-items: start;
    grid-auto-rows: 65px;
    display: grid;
    grid-template-columns: repeat(4, minmax(175px, 1fr));
    gap: 8px;
    margin-bottom: 7px;
}

.origin-card {
    display: grid;
    height: 65px;
    align-content: start;
    gap: 6px;
    min-height: 65px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #17324d;
    text-align: left;
    transition: box-shadow .15s, transform .15s;
}

.origin-card:hover {
    filter: none;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px #0a2e4f18;
}

.origin-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.origin-card-heading > span {
    font-size: 11px;
    font-weight: 700;
}

.origin-card-heading strong {
    font-size: 19px;
    line-height: 1;
}

.origin-state-counts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.origin-state-counts > span {
    display: flex;
    align-items: baseline;
    gap: 3px;
    min-width: 0;
}

.origin-state-counts b {
    font-size: 11px;
}

.origin-state-counts small {
    overflow: hidden;
    font-size: 8px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: .83;
}

.origin-card.outpatient {
    border-color: #bed8f4;
    background: #e8f3ff;
    color: #075ca8;
}

.origin-card.hospitalization {
    border-color: #b5ddd7;
    background: #e2f4f0;
    color: #087064;
}

.origin-card.emergency {
    border-color: #ecd39c;
    background: #fff2d4;
    color: #8a5a05;
}

.origin-card.active {
    border-color: currentColor;
    box-shadow: inset 0 0 0 1px currentColor;
}

.origin-card.all-origins {
    border-color: #d3dfeb;
    background: #fff;
    color: #45627f;
}

.recipe-content-layout {
    flex: 1 1 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    align-items: stretch;
    min-width: 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
}

.recipe-inbox-panel {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.recipe-inline-viewer {
    display: none;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.inline-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 52px;
    padding: 8px 11px 8px 14px;
    background: linear-gradient(100deg, #103f6c, #072c51);
    color: #fff;
}

.inline-viewer-header small {
    display: block;
    color: #bcd3e8;
    font-size: 9px;
    text-transform: uppercase;
}

.inline-viewer-header h2 {
    margin: 1px 0 0;
    font-size: 15px;
}

.inline-viewer-body {
    position: relative;
    min-height: 0;
    background: #dbe2e9;
}

.inline-viewer-footer {
    height: 30px;
    padding: 8px 12px;
    background: #fff;
    color: #62768a;
    font-size: 9px;
    text-transform: uppercase;
}

.wide-view-action {
    display: none;
}

.recipe-filters {
    display: grid;
    grid-template-columns: minmax(130px, .7fr) minmax(130px, .7fr) minmax(180px, 1.2fr) auto;
    gap: 8px;
    align-items: end;
    padding: 6px 12px;
}

.recipe-filters label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    font-size: 10px;
    font-weight: 650;
}

.recipe-filters.has-prescriber-filter {
    grid-template-columns: minmax(120px, .7fr) minmax(120px, .7fr) minmax(150px, 1fr) minmax(200px, 1.5fr) auto;
}

.recipe-filters input,
.recipe-filters select {
    width: 100%;
    min-width: 0;
    height: 28px;
    padding: 4px 7px;
    border: 1px solid #cdd8e6;
    border-radius: 5px;
    background: #fff;
    color: #213d5d;
    font-size: 11px;
}

.recipe-filter-actions,
.recipe-batch-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.recipe-table-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 27px;
    padding: 5px 12px;
    border-block: 1px solid var(--line);
    background: #f6f9fd;
    font-size: 11px;
}

.recipe-table-toolbar strong {
    flex: 1;
    color: #0762c3;
}

.recipe-table-toolbar span {
    color: var(--muted);
}

.recipe-table-wrap {
    min-height: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.recipe-table {
    min-width: 1040px;
    table-layout: auto;
}

.recipe-table th {
    position: sticky;
    z-index: 3;
    top: 0;
    padding: 8px 7px;
    box-shadow: 0 1px 0 #dce5ee;
}

.recipe-table td {
    padding: 6px 7px;
}

.recipe-table .selection-column {
    width: 34px;
    min-width: 34px;
    padding-inline: 8px;
    text-align: center;
}

.recipe-table .patient-cell {
    min-width: 155px;
    max-width: 230px;
    white-space: normal;
    font-weight: 600;
}

.recipe-table .view-recipe {
    white-space: nowrap;
    color: var(--navy);
    font-weight: 700;
}

.recipe-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 37px;
    padding: 5px 12px;
    color: #61748a;
    font-size: 10px;
}

.recipe-pagination > div {
    display: flex;
    align-items: center;
    gap: 9px;
}

.recipe-pagination .button {
    padding: 4px 10px;
}

.recipe-batch-bar {
    z-index: 5;
    display: grid;
    grid-template-columns: auto auto 1fr;
    align-items: center;
    gap: 8px 12px;
    min-height: 55px;
    padding: 9px 12px;
    border-top: 1px solid #cbd9e8;
    background: #f7faff;
    box-shadow: 0 -4px 10px #0b35530b;
}

.recipe-selection-count {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 170px;
}

.recipe-selection-count strong {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 29px;
    height: 29px;
    border-radius: 50%;
    background: #0b67c8;
    color: #fff;
}

.recipe-selection-count span {
    font-size: 10px;
}

.recipe-operation-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid #c5d3e1;
    border-radius: 7px;
    background: #e9f0f7;
}

.recipe-operation-switch button {
    min-height: 28px;
    padding: 5px 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #4b647d;
    font-size: 10px;
    font-weight: 700;
}

.recipe-operation-switch button.active {
    background: #fff;
    color: #075fac;
    box-shadow: 0 1px 4px #173c6026;
}

.recipe-batch-actions {
    justify-content: flex-end;
    gap: 8px;
}

.recipe-batch-actions .button {
    min-height: 34px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
}

.recipe-batch-actions .generate-action {
    border-color: #0059c7;
    background: linear-gradient(180deg, #0874e8, #005fc9);
    box-shadow: 0 2px 6px #0055aa35;
}

.recipe-batch-actions .future-sign {
    border-style: dashed;
}

.operation-spinner {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border: 5px solid #d1e5f7;
    border-top-color: #0969c5;
    border-radius: 50%;
    animation: recipe-spin .8s linear infinite;
}

@keyframes recipe-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .operation-spinner { animation-duration: 1.8s; }
}

.batch-modal-backdrop {
    position: fixed;
    z-index: 1300;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #061c315e;
    backdrop-filter: blur(1px);
}

.batch-operation-modal {
    display: grid;
    justify-items: center;
    width: min(520px, 94vw);
    max-height: min(640px, 90vh);
    overflow: auto;
    padding: 30px 32px 26px;
    border: 1px solid #b8cbdd;
    border-radius: 13px;
    background: #fff;
    text-align: center;
    box-shadow: 0 24px 70px #00182f52;
}

.batch-operation-modal h2 {
    margin: 17px 0 7px;
    color: #123f68;
    font-size: 21px;
}

.batch-operation-modal > p {
    color: #4e667c;
    font-size: 13px;
}

.batch-operation-modal > small {
    margin-top: 12px;
    color: #788b9d;
    font-size: 10px;
}

.batch-progress-track {
    width: min(340px, 78vw);
    height: 7px;
    margin-top: 17px;
    overflow: hidden;
    border-radius: 10px;
    background: #e2eaf1;
}

.batch-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0570d6, #25a1e5);
    transition: width .2s ease;
}

.batch-result-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #dcf5e8;
    color: #14733f;
    font-size: 29px;
    font-weight: 800;
}

.batch-operation-modal.partial-result .batch-result-icon {
    background: #fff0bc;
    color: #865709;
}

.batch-operation-modal.error-result .batch-result-icon {
    background: #ffebea;
    color: #b73434;
}

.batch-result-totals {
    display: grid;
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    gap: 9px;
    width: 100%;
    margin-top: 18px;
}

.batch-result-totals > span {
    display: grid;
    gap: 2px;
    padding: 11px;
    border: 1px solid #d8e2eb;
    border-radius: 8px;
    background: #f7fafc;
}

.batch-result-totals b {
    color: #164d7b;
    font-size: 22px;
}

.batch-result-totals small {
    color: #5c7185;
    font-size: 10px;
}

.batch-failures {
    width: 100%;
    margin-top: 14px;
    color: #743d3d;
    font-size: 10px;
}

.batch-failures summary {
    cursor: pointer;
    font-weight: 700;
}

.batch-failures ul {
    max-height: 120px;
    margin: 8px 0 0;
    overflow: auto;
    text-align: left;
}

.batch-accept {
    min-width: 150px;
    min-height: 38px;
    margin-top: 20px;
    font-size: 12px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.recipe-modal-backdrop {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 2vh 2vw;
    background: #001326b8;
}

.recipe-modal {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 94vw;
    height: 92vh;
    overflow: hidden;
    border: 1px solid #8ca7c0;
    border-radius: 10px;
    outline: none;
    background: #e8edf3;
    box-shadow: 0 24px 80px #00101fd9;
}

.recipe-modal-header {
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 58px;
    padding: 8px 12px 8px 17px;
    background: linear-gradient(100deg, #103f6c, #072c51);
    color: #fff;
}

.recipe-modal-header small {
    display: block;
    margin-bottom: 1px;
    color: #bcd3e8;
    font-size: 9px;
    letter-spacing: .7px;
    text-transform: uppercase;
}

.recipe-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.recipe-modal-header dl {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 0 0 0 auto;
}

.recipe-modal-header dl > div {
    display: flex;
    align-items: center;
    gap: 7px;
}

.recipe-modal-header dt {
    color: #bcd3e8;
    font-size: 9px;
    text-transform: uppercase;
}

.recipe-modal-header dd {
    margin: 0;
    font-size: 11px;
    font-weight: 650;
}

.recipe-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #ffffff4d;
    border-radius: 7px;
    background: #ffffff0f;
    color: #fff;
    font-size: 27px;
    line-height: 1;
}

.recipe-modal-close:hover {
    background: #ffffff24;
}

.recipe-modal-body {
    position: relative;
    min-height: 0;
    background: #dbe2e9;
}

.recipe-pdf-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #dbe2e9;
}

.recipe-viewer-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
}

.recipe-viewer-state > span {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #fff;
    color: #1768af;
    font-size: 28px;
}

.recipe-viewer-state h3 {
    margin: 13px 0 5px;
}

.recipe-viewer-state p {
    max-width: 600px;
    font-size: 12px;
}

.recipe-viewer-state .button {
    margin-top: 16px;
}

.recipe-viewer-state.error-state > span {
    color: #a92c2c;
}

.recipe-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 43px;
    padding: 6px 12px 6px 16px;
    border-top: 1px solid #c6d0db;
    background: #fff;
    color: #50677e;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .35px;
}

.signature-feedback {
    border: 1px solid #8fb7d8;
    background: #eef7ff;
    color: #163f63;
}

.recipe-page > .feedback {
    flex: 0 0 auto;
}

.recipe-modal-body.has-test-result {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.firma-test-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 14px;
    border-bottom: 1px solid #d6b55d;
    background: #fff8dc;
    color: #654c0b;
    font-size: 11px;
    flex-wrap: wrap;
}

.firma-test-banner strong {
    white-space: nowrap;
}

.firma-test-banner small {
    flex-basis: 100%;
    color: #746331;
}

.firma-test-banner.registered {
    border-bottom-color: #7bb88a;
    background: #eef9f0;
    color: #1f5d31;
}

.recipe-modal-actions {
    display: flex;
    gap: 8px;
}

@container recipe-workspace (min-width: 1450px) {
    .recipe-content-layout {
        grid-template-columns: minmax(0, 68fr) minmax(390px, 32fr);
    }

    .recipe-inline-viewer {
        display: grid;
        grid-template-rows: auto minmax(0, 1fr) auto;
        height: 100%;
    }

    .compact-view-action {
        display: none;
    }

    .wide-view-action {
        display: inline-flex;
    }
}

@container recipe-workspace (max-width: 900px) {
    .origin-summary {
        grid-template-columns: repeat(2, minmax(150px, 220px));
    }
}

@media (max-width: 1200px) {
    .recipe-filters.has-prescriber-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .recipe-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .recipe-filter-actions {
        grid-column: 1 / -1;
    }

    .recipe-batch-bar {
        grid-template-columns: 1fr;
    }

    .recipe-batch-actions {
        justify-content: flex-start;
    }

}

@media (max-width: 760px) {
    .recipe-filters .prescriber-filter {
        grid-column: 1 / -1;
    }
    body:has(.recipe-page) {
        overflow: auto;
    }

    body:has(.recipe-page) .sidebar {
        max-height: none;
        overflow-y: visible;
    }

    .workspace:has(.recipe-page) {
        display: block;
        height: auto;
        overflow: visible;
    }

    .recipe-page {
        display: block;
        overflow: visible;
    }

    .recipe-content-layout,
    .recipe-inbox-panel {
        display: block;
        height: auto;
        overflow: visible;
    }

    .recipe-table-wrap {
        max-height: 58vh;
    }

    .recipe-page-heading {
        align-items: flex-start;
    }

    .recipe-page-heading h1 {
        font-size: 21px;
    }

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

    .origin-card.all-origins {
        grid-column: 1 / -1;
    }

    .recipe-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .recipe-filters label:nth-child(3),
    .recipe-filter-actions {
        grid-column: 1 / -1;
    }

    .recipe-batch-actions .button {
        flex: 1 1 145px;
    }

    .recipe-modal-backdrop {
        padding: 1vh 1vw;
    }

    .recipe-modal {
        width: 98vw;
        height: 96vh;
        border-radius: 6px;
    }

    .recipe-modal-header {
        gap: 10px;
        padding-left: 11px;
    }

    .recipe-modal-header dl {
        gap: 8px;
    }

    .recipe-modal-header dl > div {
        display: block;
    }

    .recipe-modal-header dl > div:first-child {
        display: none;
    }

    .recipe-modal-footer {
        align-items: stretch;
    }

    .recipe-modal-footer span {
        display: none;
    }
}
.badge.neutral {
    background: #e8eef5;
    color: #42566e;
}

.badge.test-signed {
    background: #fff0c2;
    color: #6f5100;
    border: 1px solid #d8b550;
}

