/* ============================================================
   EmergencyExe – Emergency Doctor Diagnose Page
   ============================================================ */

/* ---------- Page Container ---------- */
.exe-page {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    gap: 0;
    font-family: 'DroidKufi-Regular', sans-serif;
    background: #f0f2f5;
}

/* ---------- Patient Header Bar ---------- */
.exe-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
    position: relative;
    z-index: 10;
}


.exe-header-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.exe-header-item .label {
    opacity: .7;
    font-size: 11px;
}

.exe-header-item .value {
    font-weight: bold;
}

.exe-patient-name {
    font-size: 16px;
    font-weight: bold;
    letter-spacing: .3px;
}

/* Triage Badge */
.triage-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: .5px;
    min-width: 70px;
    text-align: center;
}

.triage-red {
    background: #e53935;
}

.triage-orange {
    background: #fb8c00;
}

.triage-yellow {
    background: #fdd835;
    color: #333;
}

.triage-green {
    background: #43a047;
}

.triage-blue {
    background: #1e88e5;
}

/* Allergy Alert */
.allergy-alert {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    background: #ff1744;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    animation: pulse-alert 1.5s ease-in-out infinite;
}

@keyframes pulse-alert {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .65;
    }
}

/* Timer */
.exe-timer {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .15);
    font-size: 13px;
    font-weight: bold;
}

/* ---------- Main Body (3 Panels) ---------- */
.exe-body {
    display: flex;
    flex: 1;
    gap: 8px;
    padding: 8px;
    overflow: hidden;
    min-height: 0;
}

/* ---------- Left Panel – Clinical Snapshot ---------- */
.exe-left {
    width: 240px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-left: 4px;
}

.vital-card {
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.vital-card-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: bold;
    color: #1a237e;
    margin-bottom: 12px;
    border-bottom: 2px solid #e8eaf6;
    padding-bottom: 6px;
}

/* Vital signs date/time row */
.vital-datetime {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #9e9e9e;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed #e8eaf6;
}

/* Add new vitals button in title */
.vital-new-btn {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e8eaf6;
    cursor: pointer;
    transition: background .2s;
}

.vital-new-btn:hover {
    background: #c5cae9;
}

.vital-new-btn .material-icons {
    font-size: 16px;
    color: #1a237e;
}

.vital-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
}

.vital-row:last-child {
    border-bottom: none;
}

.vital-label {
    color: #616161;
    font-weight: 500;
}

.vital-value {
    font-weight: bold;
    color: #1a237e;
    font-size: 14px;
}

.vital-value.critical {
    color: #e53935;
}

.nurse-notes-box,
.chief-complaint-box {
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.nurse-notes-box .section-label,
.chief-complaint-box .section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: bold;
    color: #1a237e;
    margin-bottom: 8px;
}

.nurse-notes-box p,
.chief-complaint-box p {
    font-size: 13px;
    color: #424242;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
}

/* ---------- Main Panel – Physician Assessment ---------- */
.exe-main {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.soap-section {
    background: #fff;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.soap-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8eaf6;
}

.soap-header .soap-icon {
    font-size: 20px;
}

.soap-header.subjective {
    color: #1565c0;
    border-color: #bbdefb;
}

.soap-header.objective {
    color: #2e7d32;
    border-color: #c8e6c9;
}

.soap-header.assessment {
    color: #6a1b9a;
    border-color: #e1bee7;
}

.soap-header.plan {
    color: #e65100;
    border-color: #ffe0b2;
}

/* Two fields side-by-side */
.soap-fields-row {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.soap-fields-row .soap-field-half {
    flex: 1 1 0;
    min-width: 0;
    margin-bottom: 0;
}

.soap-field {
    margin-bottom: 14px;
}

.soap-field label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: #616161;
    margin-bottom: 4px;
}

.soap-field textarea,
.soap-field input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color .2s;
    box-sizing: border-box;
    background: #fafafa;
}

.soap-field textarea:focus,
.soap-field input[type="text"]:focus {
    border-color: #3f51b5;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(63, 81, 181, .12);
}

.soap-field textarea {
    resize: vertical;
    min-height: 60px;
}

/* Systemic Examination Tabs */
.system-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0;
    padding: 4px 4px 0;
    border-bottom: 2px solid #c5cae9;
    position: relative;
    align-items: flex-end;
}

.system-tab {
    padding: 7px 16px 9px;
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: #eceff1;
    color: #546e7a;
    border: 1px solid #cfd8dc;
    border-bottom: none;
    margin-bottom: -2px;
    transition: background .15s, color .15s, transform .15s, box-shadow .15s;
    user-select: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.system-tab:hover:not(.active) {
    background: #e3f2fd;
    color: #1565c0;
    transform: translateY(-1px);
}

.system-tab.active {
    background: #3f51b5;
    color: #fff;
    border-color: #3f51b5;
    box-shadow: 0 -2px 6px rgba(63, 81, 181, 0.25);
    z-index: 2;
}

.system-tab.active::after {
    /* Continuous surface into the textarea below so it reads as a tab */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background: #3f51b5;
}

/* Small dot marker when that system already has notes recorded */
.system-tab .sys-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef5350;
    box-shadow: 0 0 0 2px rgba(239, 83, 80, 0.15);
    flex-shrink: 0;
}

.system-tab.active .sys-dot {
    background: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* The textarea that sits under the tabs — visually connected to the active tab */
.soap-field .system-tabs + textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top-color: #3f51b5;
}

/* ICD-10 Search */
.icd-search-wrapper {
    position: relative;
}

.icd-search-wrapper input {
    padding-right: 36px;
}

.icd-search-wrapper .search-icon {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    color: #9e9e9e;
    font-size: 18px;
    pointer-events: none;
}

.icd-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 6px 6px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.icd-result-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    transition: background .15s;
}

.icd-result-item:hover {
    background: #e8eaf6;
}

.icd-result-item .icd-code {
    font-weight: bold;
    color: #3f51b5;
    margin-left: 6px;
}

.diagnosis-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.diagnosis-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 16px;
    background: #e8eaf6;
    color: #283593;
    font-size: 12px;
    font-weight: 500;
}

.diagnosis-chip .remove-chip {
    cursor: pointer;
    font-size: 16px;
    color: #e53935;
    line-height: 1;
}

/* Plan Quick Actions */
.plan-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
}

.plan-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all .2s;
    font-size: 13px;
    overflow: hidden;
    position: relative;
}

.plan-action-item:hover {
    border-color: #3f51b5;
    background: #e8eaf6;
}

.plan-action-item.checked {
    border-color: #3f51b5;
    background: #e8eaf6;
    font-weight: bold;
}

.plan-action-item .plan-check {
    font-size: 20px;
    color: #9e9e9e;
    flex-shrink: 0;
}

.plan-action-item.checked .plan-check {
    color: #3f51b5;
}

.plan-action-item .plan-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.plan-action-item .plan-label {
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.plan-action-item md-checkbox {
    margin: 0;
}

/* ---------- Right Panel – Orders ---------- */
.exe-right {
    width: 280px;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding-right: 4px;
}

.order-section {
    background: #fff;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.order-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: bold;
    color: #1a237e;
    margin-bottom: 10px;
    cursor: pointer;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8eaf6;
}

.order-section-title .order-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #3f51b5;
    color: #fff;
    font-size: 11px;
}

.order-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px dashed #bdbdbd;
    background: #fafafa;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: #424242;
    transition: all .2s;
    margin-bottom: 6px;
}

.order-btn:hover {
    border-color: #3f51b5;
    background: #e8eaf6;
    color: #1a237e;
}

.order-btn .material-icons {
    font-size: 18px;
    color: #3f51b5;
}

.order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f5f5f5;
    margin-bottom: 4px;
    font-size: 12px;
}

.order-item .order-item-name {
    font-weight: 500;
}

.order-item .remove-order {
    cursor: pointer;
    color: #e53935;
    font-size: 16px;
}

/* Order Drawer / Modal */
.order-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 100;
    display: flex;
    justify-content: flex-end;
}

.order-drawer {
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, .15);
    padding: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slide-in-right .25s ease-out;
}

/* Drawer flex layout (Lab / Imaging / Procedure) */
.drawer-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.drawer-header {
    flex-shrink: 0;
}

.drawer-search-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.drawer-search-global {
    flex: 1;
    min-width: 0;
}

.drawer-search-fav {
    flex: 0 0 130px;
}

.drawer-search-fav input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    background: #fafafa;
    box-sizing: border-box;
    height: 37px;
}

.drawer-search-fav input[type="text"]:focus {
    border-color: #3f51b5;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(63,81,181,.12);
}

.drawer-list-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.drawer-footer {
    flex-shrink: 0;
    border-top: 1px solid #e8eaf6;
    padding-top: 10px;
    background: #fff;
}

/* Selected services compact bar */
.selected-services-container {
    border: 2px dashed #3f51b5;
    border-radius: 8px;
    padding: 8px 10px;
    background: #f5f5f5;
}

.selected-services-title {
    font-weight: bold;
    color: #3f51b5;
    font-size: 13px;
    margin-bottom: 6px;
}

.selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff;
    border: 1px solid #c5cae9;
    border-radius: 20px;
    padding: 3px 8px;
    font-size: 12px;
    font-weight: bold;
    color: #1a237e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.selected-chip .remove-order {
    cursor: pointer;
    color: #d32f2f;
    font-size: 15px !important;
}

/* Checkmark on selected list items */
.lab-group-items .order-item.order-item-selected {
    background: #e8f5e9;
    border-color: #a5d6a7;
    cursor: default;
}

.lab-group-items .order-item.order-item-selected .order-item-name {
    color: #2e7d32;
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.order-drawer-title {
    font-size: 16px;
    font-weight: bold;
    color: #1a237e;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8eaf6;
}

.order-drawer .soap-field {
    margin-bottom: 12px;
}

/* ---------- Disposition Section ---------- */
.exe-disposition {
    background: #fff;
    border-radius: 8px 8px 0 0;
    padding: 14px 20px;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, .06);
    transition: padding .25s ease;
}

.exe-disposition.collapsed {
    padding: 10px 20px;
}

.disposition-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: bold;
    color: #1a237e;
    margin-bottom: 12px;
    cursor: pointer;
    user-select: none;
    transition: margin-bottom .25s ease;
}

.exe-disposition.collapsed .disposition-title {
    margin-bottom: 0;
}

.disposition-toggle {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e8eaf6;
    transition: background .2s;
}

.disposition-title:hover .disposition-toggle {
    background: #c5cae9;
}

.disposition-toggle .material-icons {
    font-size: 20px;
    color: #1a237e;
}

.disposition-selected-badge {
    font-size: 12px;
    font-weight: bold;
    padding: 3px 12px;
    border-radius: 12px;
    background: #e8eaf6;
    color: #1a237e;
    letter-spacing: .3px;
}

.disposition-body {
    overflow: hidden;
}

.disposition-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.disposition-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 2px solid #e0e0e0;
    background: #fafafa;
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
}

.disposition-option:hover {
    border-color: #3f51b5;
}

.disposition-option.selected {
    border-color: #3f51b5;
    background: #e8eaf6;
    font-weight: bold;
    color: #1a237e;
}

.disposition-option.selected.discharge {
    border-color: #43a047;
    background: #e8f5e9;
    color: #2e7d32;
}

.disposition-option.selected.admit {
    border-color: #1565c0;
    background: #e3f2fd;
    color: #0d47a1;
}

.disposition-option.selected.icu {
    border-color: #e53935;
    background: #ffebee;
    color: #c62828;
}

.disposition-option.selected.observation {
    border-color: #ff8f00;
    background: #fff8e1;
    color: #e65100;
}

.disposition-option.selected.transfer {
    border-color: #6a1b9a;
    background: #f3e5f5;
    color: #4a148c;
}

.disposition-option.selected.lama {
    border-color: #757575;
    background: #f5f5f5;
    color: #424242;
}

.disposition-option.selected.dead {
    border-color: #212121;
    background: #e0e0e0;
    color: #212121;
}

/* Fixed-height container for disposition details – consistent regardless of decision */
.disposition-details-container {
    height: 110px;
    min-height: 110px;
    max-height: 110px;
    overflow-y: auto;
    padding: 10px 0 4px;
    border-top: 1px solid #e8eaf6;
}

/* Grid layout: fields flow side-by-side */
.disposition-details-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    align-items: flex-start;
}

/* Half-width field (textarea-style) */
.disposition-details-grid .disp-field-half {
    flex: 1 1 calc(50% - 8px);
    min-width: 220px;
    margin-bottom: 0;
}

/* Quarter-width field (short inputs) */
.disposition-details-grid .disp-field-quarter {
    flex: 0 0 calc(25% - 12px);
    min-width: 140px;
    margin-bottom: 0;
}

/* Compact textarea inside disposition */
.disposition-details-grid textarea {
    resize: none;
    max-height: 52px;
}

/* Compact input inside disposition */
.disposition-details-grid input {
    height: 34px;
}

/* ---------- Footer Actions ---------- */
.exe-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 10px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.exe-footer-actions .md-button {
    min-width: 120px;
}

/* ---------- Add New Patient Button ---------- */
.exe-add-patient-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 4px 16px !important;
    margin: 0 !important;
    min-height: 32px !important;
    height: 32px !important;
    line-height: 32px !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, .2) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: bold;
    cursor: pointer;
    transition: background .2s;
    margin-right: auto !important;
}

.exe-add-patient-btn:hover {
    background: rgba(255, 255, 255, .35) !important;
}

.exe-add-patient-btn .material-icons {
    font-size: 18px;
}

/* ---------- Choice Dialog ---------- */
.exe-choice-dialog {
    border-radius: 12px !important;
    min-width: 340px;
}

.exe-choice-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: bold;
    color: #1a237e;
    padding: 20px 24px 12px;
    font-family: 'DroidKufi-Regular', sans-serif;
}

.exe-choice-options {
    display: flex;
    gap: 16px;
    padding: 12px 24px 24px;
    justify-content: center;
}

.exe-choice-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    width: 130px !important;
    height: 110px !important;
    border-radius: 12px !important;
    font-size: 15px !important;
    font-weight: bold;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    font-family: 'DroidKufi-Regular', sans-serif;
}

.exe-choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
}

.exe-choice-btn.normal {
    background: #e8f5e9 !important;
    color: #2e7d32 !important;
    border: 2px solid #a5d6a7 !important;
}

.exe-choice-btn.normal:hover {
    background: #c8e6c9 !important;
}

.exe-choice-btn.normal .material-icons {
    font-size: 36px;
    color: #2e7d32;
}

.exe-choice-btn.accident {
    background: #fce4ec !important;
    color: #c62828 !important;
    border: 2px solid #ef9a9a !important;
}

.exe-choice-btn.accident:hover {
    background: #f8bbd0 !important;
}

.exe-choice-btn.accident .material-icons {
    font-size: 36px;
    color: #c62828;
}

/* ---------- New Patient (Reception) Dialog ---------- */
.exe-reception-dialog {
    min-width: 900px;
    max-width: 1100px;
    width: 90vw;
    max-height: 90vh;
    border-radius: 12px !important;
    overflow: visible !important;
    font-family: 'IBM-Plex', 'DroidKufi-Regular', sans-serif;
}

.exe-reception-dialog md-dialog-content {
    padding: 12px 16px !important;
    background: #f5f6fa;
}

.exe-reception-dialog md-toolbar {
    min-height: 48px;
}

.exe-reception-dialog md-toolbar .md-toolbar-tools {
    height: 48px;
    min-height: 48px;
}

/* ---- Fieldset / Card ---- */
.exe-reception-dialog fieldset.card {
    margin: 0 0 12px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid #d0d5dd;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.exe-reception-dialog fieldset.card legend {
    color: #1a237e;
    font-weight: 700;
    font-size: 13px;
    padding: 0 8px;
}

/* ---- Emergency fields (radio groups row) ---- */
.exe-reception-dialog .dlg-emergency-fields {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.exe-reception-dialog .dlg-emergency-fields md-input-container {
    margin: 0 !important;
    padding: 0 !important;
}

.exe-reception-dialog .dlg-emergency-fields label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #37474f !important;
    margin-bottom: 4px !important;
}

.exe-reception-dialog .dlg-emergency-fields md-radio-button {
    margin: 2px 0 !important;
}

/* ---- Patient data grid ---- */
.exe-reception-dialog .dlg-patient-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 10px;
}

.exe-reception-dialog .dlg-patient-grid .dlg-span-2 {
    grid-column: span 2;
}

.exe-reception-dialog .dlg-patient-grid md-input-container {
    margin: 4px 0 !important;
    min-width: 0;
}

.exe-reception-dialog .dlg-patient-grid md-autocomplete {
    min-width: 0;
}

/* ---- Visit type radio row ---- */
.exe-reception-dialog .dlg-radio-row {
    padding: 4px 0;
}

.exe-reception-dialog .dlg-radio-row md-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.exe-reception-dialog .dlg-radio-row md-radio-button {
    margin: 0 !important;
    white-space: nowrap;
}

/* ---- Insurance grid ---- */
.exe-reception-dialog .dlg-insurance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px 10px;
    margin-top: 10px;
}

.exe-reception-dialog .dlg-insurance-grid md-input-container,
.exe-reception-dialog .dlg-insurance-grid md-autocomplete {
    margin: 4px 0 !important;
    min-width: 0;
}

/* ---- Dialog actions ---- */
.exe-reception-dialog md-dialog-actions {
    padding: 8px 16px !important;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.exe-reception-dialog md-dialog-actions .md-button.md-primary {
    background-color: #1a237e !important;
    color: #fff !important;
    border-radius: 6px;
    min-width: 100px;
}

.exe-reception-dialog md-dialog-actions .md-button:not(.md-primary) {
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    min-width: 80px;
}

/* ---- Remarks textarea ---- */
.exe-reception-dialog .other-data textarea {
    resize: vertical;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
    .exe-reception-dialog .dlg-emergency-fields {
        grid-template-columns: repeat(2, 1fr);
    }

    .exe-reception-dialog .dlg-patient-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .exe-reception-dialog .dlg-insurance-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}




.exe-new-patient-dialog .patient-data-container {
    margin-bottom: 0;
    border-radius: 0;
    overflow: visible;
    border: none;
    background: white;
}

.exe-new-patient-dialog .patient-data-header {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: none;
    border-radius: 12px 12px 0 0;
}

.exe-new-patient-dialog .patient-data-header.active {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
}

.exe-new-patient-dialog .patient-data-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #fff;
    font-weight: 600;
}

.exe-new-patient-dialog .patient-data-summary i.material-icons {
    color: #90caf9 !important;
    font-size: 22px;
}

/* ---- Body: flex column of rows ---- */
.exe-new-patient-dialog .patient-data-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}

/* ---- Each patient-line is its own flex row ---- */
.exe-new-patient-dialog .patient-line {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-end;
}

.exe-new-patient-dialog .patient-line:last-child {
    border-bottom: none;
}

/* ---- md-input-container reset ---- */
.exe-new-patient-dialog .patient-line md-input-container {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}

/* ---- Labels: visible above the field ---- */
.exe-new-patient-dialog .patient-line label {
    position: static !important;
    transform: none !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #546e7a !important;
    margin-bottom: 4px !important;
    display: block !important;
    white-space: nowrap;
    pointer-events: none;
}

/* ---- Inputs & selects ---- */
.exe-new-patient-dialog .patient-line input,
.exe-new-patient-dialog .patient-line md-select {
    height: 36px !important;
    line-height: 36px !important;
    padding: 0 10px !important;
    border: 1px solid #cfd8dc !important;
    border-radius: 6px !important;
    background: #fafafa !important;
    box-shadow: none !important;
    font-size: 13px !important;
    transition: border-color .2s, background .2s !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.exe-new-patient-dialog .patient-line input:focus,
.exe-new-patient-dialog .patient-line md-select:focus {
    border-color: #3f51b5 !important;
    background: #fff !important;
    box-shadow: 0 0 0 2px rgba(63, 81, 181, .12) !important;
}

/* Remove md-input-container underline */
.exe-new-patient-dialog .patient-line md-input-container .md-errors-spacer {
    display: none !important;
}

.exe-new-patient-dialog .patient-line md-input-container .md-input:focus~.md-input-messages-animation,
.exe-new-patient-dialog .patient-line md-input-container .md-char-counter {
    display: none !important;
}

/* Hide the default md-input-container underline bar */
.exe-new-patient-dialog .patient-line md-input-container .md-input-focused,
.exe-new-patient-dialog .patient-line md-input-container .md-input~.md-input-underline {
    display: none !important;
}

/* ---- Field sizing per class ---- */
.exe-new-patient-dialog .patient-line .field-sex {
    flex: 0 0 120px;
    min-width: 100px;
}

.exe-new-patient-dialog .patient-line .field-nationalid {
    flex: 1 1 220px;
    min-width: 160px;
}

.exe-new-patient-dialog .patient-line .field-name {
    flex: 1 1 0;
    min-width: 0;
}

.exe-new-patient-dialog .patient-line .field-dob {
    flex: 0 0 160px;
    min-width: 130px;
}

.exe-new-patient-dialog .patient-line .field-mobile {
    flex: 0 0 140px;
    min-width: 110px;
}

/* ---- Age group: 3 small fields side by side ---- */
.exe-new-patient-dialog .patient-line .age-group {
    display: flex;
    gap: 6px;
    align-items: flex-end;
    flex: 0 0 180px;
    min-width: 150px;
}

.exe-new-patient-dialog .patient-line .age-group md-input-container {
    flex: 1;
    min-width: 0;
}

.exe-new-patient-dialog .patient-line .age-group input {
    text-align: center !important;
    padding: 0 4px !important;
}

/* ---- Dialog actions (buttons) ---- */
.exe-np-actions {
    padding: 10px 20px !important;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-start;
    gap: 8px;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.exe-np-actions .md-button.md-primary {
    background-color: #1a237e !important;
    color: #fff !important;
    border-radius: 6px;
    min-width: 100px;
}

.exe-np-actions .md-button:not(.md-primary) {
    border: 1px solid #cfd8dc;
    border-radius: 6px;
    min-width: 80px;
}

/* ---- Nationality & Religion field sizing ---- */
.exe-new-patient-dialog .patient-line .field-nationality {
    flex: 0 0 130px;
    min-width: 110px;
}

.exe-new-patient-dialog .patient-line .field-religion {
    flex: 0 0 110px;
    min-width: 90px;
}

/* ---- Payment Type Row ---- */
.exe-np-payment-row {
    padding: 12px 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    border-bottom: 1px solid #e0e0e0;
}

.exe-np-option-group label {
    font-size: 12px;
    font-weight: 600;
    color: #546e7a;
    margin-bottom: 6px;
    display: block;
}

.exe-np-btn-group {
    display: flex;
    background: #e8eaf6;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #c5cae9;
}

.exe-np-mini-btn {
    flex: 1;
    min-width: 80px !important;
    min-height: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    font-size: 13px !important;
    font-weight: 600;
    color: #37474f !important;
    background: transparent !important;
    border: none !important;
    transition: all .2s;
}

.exe-np-mini-btn:not(:last-child) {
    border-left: 1px solid #c5cae9 !important;
}

.exe-np-mini-btn.active {
    background: #1a237e !important;
    color: #fff !important;
    box-shadow: 0 2px 6px rgba(26, 35, 126, .25);
}

/* ---- Insurance Section ---- */
.exe-np-insurance-section {
    margin-top: 0;
}

.exe-np-insurance-section .patient-data-body.expanded {
    padding: 16px 20px !important;
}

/* Letter Row */
.exe-np-letter-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e0e0e0;
}

.exe-np-letter-btn {
    margin: 0 !important;
    min-width: auto !important;
    min-height: 36px !important;
    height: 36px !important;
    line-height: 36px !important;
    padding: 0 12px !important;
    font-size: 13px !important;
    font-weight: 600;
    display: flex !important;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    border-radius: 6px !important;
    border: 1px solid #cfd8dc !important;
    background: #fafafa !important;
}

.exe-np-letter-btn .material-icons {
    font-size: 20px;
    color: #1a237e;
}

/* Letter row inputs inherit dialog input styles */
.exe-np-letter-row md-input-container {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}

.exe-np-letter-row label {
    position: static !important;
    transform: none !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    color: #546e7a !important;
    margin-bottom: 3px !important;
    display: block !important;
    white-space: nowrap;
}

.exe-np-letter-row input {
    height: 36px !important;
    line-height: 36px !important;
    padding: 0 8px !important;
    border: 1px solid #cfd8dc !important;
    border-radius: 6px !important;
    background: #fafafa !important;
    box-shadow: none !important;
    font-size: 13px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Insurance Grid (3 columns) */
.exe-np-insurance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.exe-np-insurance-grid md-input-container {
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    display: flex;
    flex-direction: column;
}

.exe-np-insurance-grid label {
    position: static !important;
    transform: none !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #546e7a !important;
    margin-bottom: 4px !important;
    display: block !important;
    white-space: nowrap;
}

.exe-np-insurance-grid input,
.exe-np-insurance-grid md-select {
    height: 36px !important;
    line-height: 36px !important;
    padding: 0 10px !important;
    border: 1px solid #cfd8dc !important;
    border-radius: 6px !important;
    background: #fafafa !important;
    box-shadow: none !important;
    font-size: 13px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.exe-np-insurance-grid md-input-container .md-errors-spacer {
    display: none !important;
}


/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .exe-left {
        width: 200px;
        min-width: 180px;
    }

    .exe-right {
        width: 240px;
        min-width: 220px;
    }
}

@media (max-width: 900px) {
    .exe-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .exe-left,
    .exe-right {
        width: 100%;
        min-width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-y: visible;
    }

    .exe-left>*,
    .exe-right>* {
        flex: 1 1 280px;
    }
}

/* ---------- Call Doctor Section ---------- */
.call-doctor-action {
    margin: 16px 0;
    display: flex;
    justify-content: center;
}

.call-doctor-action .md-button {
    margin: 0;
    padding: 8px 24px;
    border-radius: 8px;
    font-family: 'DroidKufi-Regular', sans-serif;
    font-weight: bold;
    font-size: 14px;
}

.call-doctor-action .call-btn {
    background-color: #1a237e !important;
    color: white !important;
}

.call-doctor-action .arrived-btn {
    animation: blink-bg 1s infinite alternate;
}

@keyframes blink-bg {
    from {
        background-color: #d32f2f;
    }

    to {
        background-color: #b71c1c;
    }
}

.call-results-display {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.call-res-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.call-res-item .res-label {
    font-size: 11px;
    color: #6c757d;
    font-weight: bold;
}

.call-res-item .res-value {
    font-size: 13px;
    color: #212529;
    font-weight: bold;
}

/* Multiple called doctors list */
.called-doctors-list {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.called-doctor-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 8px 10px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    flex: 0 1 calc(33.333% - 8px);
    min-width: 200px;
    box-sizing: border-box;
}

.called-doctor-card.is-active {
    border-color: #ffb300;
    background: #fff8e1;
}

.called-doctor-card.is-arrived {
    border-color: #66bb6a;
    background: #e8f5e9;
}

.called-doctor-card .cd-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.called-doctor-card .cd-header {
    justify-content: space-between;
    font-weight: bold;
    font-size: 14px;
    color: #1a237e;
    border-bottom: 1px dashed #cfd8dc;
    padding-bottom: 4px;
    margin-bottom: 2px;
}

.called-doctor-card .cd-spec {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.called-doctor-card .cd-spec .material-icons {
    color: #1976d2;
    font-size: 18px;
}

.called-doctor-card .cd-remove {
    cursor: pointer;
    color: #d32f2f;
    font-size: 18px;
}

.called-doctor-card .res-label {
    font-size: 11px;
    color: #6c757d;
    font-weight: bold;
}

.called-doctor-card .res-value {
    font-size: 13px;
    color: #212529;
    font-weight: bold;
}

.called-doctor-card .cd-actions {
    margin-top: 4px;
}

.called-doctor-card .cd-actions .md-button {
    margin: 0;
    width: 100%;
}

/* ========================================
   RECEIPTS SIDEBAR STYLES (EMERGENCY)
   ======================================== */

/* Floating Toggle Button */
.receipts-sidebar-toggle {
    position: fixed;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 15px 8px;
    cursor: pointer;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 999;
    transition: all 0.3s ease;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-weight: bold;
    font-size: 14px;
}

.receipts-sidebar-toggle:hover {
    right: 0;
    box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.3);
}

.receipts-sidebar-toggle i {
    display: block;
    margin-bottom: 8px;
    writing-mode: horizontal-tb;
    font-size: 24px;
}

/* Sidebar Container */
.receipts-sidebar {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.receipts-sidebar.open {
    right: 0;
}

/* Sidebar Header */
.receipts-sidebar-header {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.receipts-sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.receipts-sidebar-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.receipts-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.receipts-sidebar-close i {
    font-size: 24px;
}

/* Sidebar Body */
.receipts-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* Receipts Table */
.receipts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.receipts-table thead {
    background: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 1;
}

.receipts-table th {
    padding: 10px 8px;
    text-align: right;
    font-weight: 600;
    color: #1976d2;
    border-bottom: 2px solid #1976d2;
}

.receipts-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background 0.2s;
}

.receipts-table tbody tr:hover {
    background: #f9f9f9;
}

.receipts-table td {
    padding: 12px 8px;
    text-align: right;
}

.receipts-table td.receipt-number {
    font-weight: 600;
    color: #1976d2;
}

/* Toggle button state overrides */
.receipts-sidebar-toggle .toggle-close {
    display: none;
}

.receipts-sidebar-toggle.sidebar-open {
    right: 395px;
    background: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
}

.receipts-sidebar-toggle.sidebar-open .toggle-open {
    display: none;
}

.receipts-sidebar-toggle.sidebar-open .toggle-close {
    display: block;
}

/* Empty State */
.receipts-empty {
    text-align: center;
    padding: 40px 20px;
    color: #757575;
}

.receipts-empty i {
    font-size: 64px;
    opacity: 0.3;
    display: block;
    margin-bottom: 15px;
}

/* ========================================
   GROUPED LAB TESTS DRAWER STYLES
   ======================================== */

.lab-groups-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Reduced gap to fit more */
    margin-top: 15px;
    padding-bottom: 20px;
}

.lab-group {
    flex: 1 1 100%;
    min-width: 180px; /* Narrower min-width */
}

/* Multi-column layout for larger screens */
@media (min-width: 1000px) {
    .order-drawer {
        width: 1100px; /* Wider drawer to accommodate 4 columns */
    }
    .lab-group {
        flex: 1 1 calc(25% - 10px); /* Target 4 columns */
    }
}

@media (min-width: 600px) and (max-width: 999px) {
    .order-drawer {
        width: 650px;
    }
    .lab-group {
        flex: 1 1 calc(50% - 10px); /* 2 columns */
    }
}

.lab-group-header {
    background: #eceff1;
    color: #455a64;
    padding: 6px 10px;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 13px; /* Slightly smaller */
    border-right: 3px solid #607d8b;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lab-group-items {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lab-group-items .order-item {
    padding: 5px 8px;
    border-radius: 4px;
    background: #ffffff;
    border: 1px solid #eeeeee;
    transition: all 0.2s;
    margin-bottom: 0px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lab-group-items .order-item:hover {
    background: #f5f5f5;
    border-color: #bdbdbd;
    transform: none;
}

.lab-group-items .order-item-name {
    font-size: 12px; /* Smaller text to fit narrow columns */
    color: #212121;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.order-btn-send {
    flex: 1;
    background: #2e7d32;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.order-btn-send:hover:not([disabled]) {
    background: #1b5e20;
}

.order-btn-send[disabled] {
    background: #c8e6c9;
    cursor: not-allowed;
    opacity: 0.7;
}

.order-btn-send i {
    font-size: 18px;
}

.order-action-row {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.sent-order {
    font-size: 18px;
    color: #2e7d32;
    cursor: default;
}


/* ---------- Dispense Actions ---------- */
.dispense-actions-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
}

.order-btn-dispense {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding: 0 12px;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    color: #495057;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    font-family: 'DroidKufi-Regular', sans-serif;
    white-space: nowrap;
    overflow: hidden;
}

.order-btn-dispense:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.06);
}

.order-btn-dispense.meds {
    border-right: 4px solid #e65100;
}

.order-btn-dispense.meds i {
    color: #e65100;
    font-size: 18px;
}

.order-btn-dispense.meds:hover {
    background: #fff3e0;
    border-color: #ffb74d;
    color: #e65100;
}

.order-btn-dispense.items {
    border-right: 4px solid #00838f;
}

.order-btn-dispense.items i {
    color: #00838f;
    font-size: 18px;
}

.order-btn-dispense.items:hover {
    background: #e0f2f1;
    border-color: #4db6ac;
    color: #00695c;
}

/* ===== Medical History – collapsible single-row section ===== */
.medical-history-collapsible {
    width: 100%;
    border: 1px solid #d7e2ef;
    border-radius: 8px;
    background: #f7fafd;
    overflow: hidden;
}

.medical-history-collapsible .mh-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    cursor: pointer;
    user-select: none;
    background: linear-gradient(180deg, #eef4fb, #e1ebf6);
    color: #17406b;
    font-weight: 600;
    font-size: 13px;
}

.medical-history-collapsible .mh-header .material-icons {
    font-size: 18px;
}

.medical-history-collapsible .mh-title {
    flex: 0 0 auto;
}

.medical-history-collapsible .mh-summary {
    flex: 1 1 auto;
    display: flex;
    gap: 6px;
    font-size: 11px;
    font-weight: 500;
    color: #4a6a8a;
}

.medical-history-collapsible .mh-summary span {
    background: #ffffff;
    border: 1px solid #cfdcea;
    border-radius: 10px;
    padding: 1px 8px;
}

.medical-history-collapsible .mh-toggle {
    margin-inline-start: auto;
}

.medical-history-collapsible .mh-body {
    padding: 8px 10px 10px;
    background: #ffffff;
}

.medical-history-collapsible .mh-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.medical-history-collapsible .mh-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #4a6a8a;
    margin-bottom: 3px;
}

.medical-history-collapsible .mh-field textarea {
    width: 100%;
    border: 1px solid #c9d6e3;
    border-radius: 5px;
    padding: 5px 6px;
    font-size: 12px;
    resize: vertical;
}

.medical-history-collapsible .mh-field textarea:focus {
    border-color: #17406b;
    outline: none;
    box-shadow: 0 0 0 2px rgba(23, 64, 107, 0.12);
}

@media (max-width: 900px) {
    .medical-history-collapsible .mh-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Drug History – structured rows ===== */
.drug-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.drug-history-table thead th {
    background: #eef4fb;
    color: #17406b;
    font-weight: 600;
    text-align: start;
    padding: 6px 8px;
    border-bottom: 1px solid #cfdcea;
}

.drug-history-table thead th .req {
    color: #c62828;
    font-weight: 700;
    margin-inline-start: 2px;
}

.drug-history-table tbody td {
    padding: 4px 6px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}

.drug-history-table tbody td input[type="text"],
.drug-history-table tbody td input[type="date"] {
    width: 100%;
    border: 1px solid #c9d6e3;
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 12px;
    background: #ffffff;
}

.drug-history-table tbody td input:focus {
    border-color: #17406b;
    outline: none;
    box-shadow: 0 0 0 2px rgba(23, 64, 107, 0.1);
}

.drug-history-table md-autocomplete {
    height: 30px;
    min-height: 30px;
    background: #ffffff;
}

.drug-history-table .dh-add-btn,
.drug-history-table .dh-remove-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 50%;
}

.drug-history-table .dh-add-btn:hover {
    background: #e8f5e9;
    color: #2e7d32;
}

.drug-history-table .dh-remove-btn:hover {
    background: #fdecea;
    color: #c62828;
}

.drug-history-table .dh-empty {
    text-align: center;
    color: #8aa0b7;
    padding: 10px;
    font-style: italic;
}
