﻿/* ==========================================================================
   Outpatient: CPT catalogue, work orders, cancellations
   ========================================================================== */

.cpt-search { display: flex; align-items: center; gap: 10px; }

.cpt-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    border: 1px solid var(--panel-border);
    background: var(--surface);
}

.cpt-head, .cpt-row { display: flex; }

.cpt-head {
    background: linear-gradient(#f2f6fa, #dfe9f1);
    border-bottom: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
}

.cpt-body { flex: 1; overflow-y: auto; max-height: 520px; }
.cpt-row { font-size: 12px; border-bottom: 1px solid #eef2f6; cursor: pointer; }
.cpt-row:hover { background: #e8f2fa; }
.cpt-row-selected { background: #2f6ea5; color: #fff; }

.cpt-col { padding: 3px 6px; border-right: 1px solid #eef2f6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpt-col-section { width: 118px; flex-shrink: 0; }
.cpt-col-code { width: 64px; flex-shrink: 0; }
.cpt-col-name { flex: 1; min-width: 160px; }
.cpt-col-sample { width: 168px; flex-shrink: 0; }
.cpt-col-day { width: 118px; flex-shrink: 0; }
.cpt-col-type { width: 96px; flex-shrink: 0; }
.cpt-col-due { width: 106px; flex-shrink: 0; }
.cpt-col-rate { width: 62px; flex-shrink: 0; text-align: right; }
.cpt-col-format { width: 58px; flex-shrink: 0; text-align: right; border-right: none; }

.cpt-foot {
    padding: 3px 8px;
    background: var(--panel-caption);
    border-top: 1px solid var(--panel-border);
    font-size: 11px;
    color: var(--ink-muted);
    text-align: right;
}

/* -- work order ---------------------------------------------------------- */

.order-search { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.order-search-option { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.order-search-option .search-input { width: 170px; }

.order-patients {
    border: 1px solid var(--panel-border);
    background: var(--surface);
}

.order-patients .appt-lookup-body { max-height: 118px; }

.order-patient-head { display: flex; gap: 40px; font-size: 13px; }
.order-label { color: var(--ink-muted); margin-right: 8px; }
.order-value { color: #a02020; font-weight: 700; }
.order-value-mark { background: #fdf3b6; padding: 0 4px; }

.order-banner {
    padding: 5px 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.order-banner-blue { background: #1c74c4; }
.order-banner-maroon { background: #8b1c22; }
.order-banner-purple { background: #7b2f8f; }
.order-banner-brown { background: #7a4a1e; }
.order-banner-green { background: #1f7a3c; }
.order-banner-teal { background: #14707a; }

.order-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px;
    border: 1px solid var(--panel-border);
    background: var(--surface);
}

.order-picker-code { width: 96px; }
.order-picker-name { flex: 1; min-width: 200px; }
.order-picker-field { display: flex; align-items: center; gap: 4px; }
.order-picker-field-grow { flex: 1; min-width: 160px; }
.order-picker-field-grow .entry-input { flex: 1; }
.order-picker-small { width: 84px; }

.order-add {
    width: 30px;
    height: 26px;
    background: linear-gradient(#eaf7e9, #c9e8c6);
    border: 1px solid #7fae7c;
    border-radius: 4px;
    color: #1f7a3c;
    font-size: 13px;
}

.order-add:disabled { opacity: 0.45; }

.order-lines {
    display: flex;
    flex-direction: column;
    min-height: 150px;
    border: 1px solid var(--panel-border);
    background: var(--surface);
}

.order-lines-head, .order-lines-row { display: flex; }

.order-lines-head {
    background: linear-gradient(#f2f6fa, #dfe9f1);
    border-bottom: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
}

.order-lines-body { flex: 1; overflow-y: auto; max-height: 220px; }
.order-lines-row { font-size: 12px; border-bottom: 1px solid #eef2f6; }

.ol-col { padding: 3px 6px; border-right: 1px solid #eef2f6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-col-code { width: 100px; flex-shrink: 0; }
.ol-col-name { flex: 1; min-width: 140px; }
.ol-col-small { width: 90px; flex-shrink: 0; text-align: right; }
.ol-col-action { width: 40px; flex-shrink: 0; text-align: center; border-right: none; }

.order-remove { background: none; border: none; color: var(--brand-red); font-size: 14px; line-height: 1; }
.order-remove:disabled { opacity: 0.3; }

.order-lines-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 3px 46px 3px 8px;
    background: var(--panel-caption);
    border-top: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 700;
}

.order-lines-foot span { min-width: 84px; text-align: right; }

.order-history { display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.order-history-row { display: flex; gap: 18px; align-items: center; }
.order-history-no { font-weight: 700; color: #a02020; min-width: 70px; }
.order-history-cancelled { color: var(--brand-red); font-weight: 700; }

/* -- cancellation -------------------------------------------------------- */

.cancel-top { display: flex; gap: 10px; align-items: stretch; }
.cancel-search-panel { flex: 0 0 330px; }
.cancel-search { display: flex; align-items: center; gap: 8px; }
.cancel-search .search-input { flex: 1; }

.cancel-hero { flex: 1; overflow: hidden; border: 1px solid var(--panel-border); }
.cancel-hero svg { width: 100%; height: 100%; display: block; }

.cancel-lines {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    border: 1px solid var(--panel-border);
    background: var(--surface);
}

.cancel-lines-head, .cancel-lines-row { display: flex; }

.cancel-lines-head {
    background: linear-gradient(#f2f6fa, #dfe9f1);
    border-bottom: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
}

.cancel-lines-body { flex: 1; overflow-y: auto; max-height: 240px; }
.cancel-lines-row { font-size: 12px; border-bottom: 1px solid #eef2f6; cursor: pointer; }
.cancel-lines-row:hover { background: #e8f2fa; }
.cancel-line-done { background: #f7dbd6; color: #7a2a20; }

.cl-col { padding: 3px 6px; border-right: 1px solid #eef2f6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-col-tick { width: 30px; flex-shrink: 0; text-align: center; }
.cl-col-order { width: 78px; flex-shrink: 0; }
.cl-col-mr { width: 78px; flex-shrink: 0; }
.cl-col-name { width: 150px; flex-shrink: 0; }
.cl-col-ref { width: 118px; flex-shrink: 0; }
.cl-col-code { width: 66px; flex-shrink: 0; }
.cl-col-desc { flex: 1; min-width: 140px; }
.cl-col-small { width: 78px; flex-shrink: 0; text-align: right; }
.cl-col-entry { width: 124px; flex-shrink: 0; }

.cancel-lines-foot {
    padding: 3px 8px;
    background: var(--panel-caption);
    border-top: 1px solid var(--panel-border);
    font-size: 11px;
    color: var(--ink-muted);
}

.cancel-detail { display: flex; gap: 10px; align-items: flex-start; }
.cancel-detail > * { flex: 1; }

.cancel-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 12px; }
.cancel-signature-note { font-size: 12px; color: var(--ink-muted); }

