/* View Patient Page Redesign - Matching Edit Modal Style */

/* Modal Overlay with Blur Effect */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1055;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 3% 1rem;
    overflow-y: auto;
}

/* Container as Modal - Exact Match to Edit Modal */







/* Container as Modal - Exact Match to Edit Modal */
.view-patient-container {
    position: relative;
    max-width: 1500px;
    width: 100% !important;
    max-width: 100%;
    background: #08151d;
    padding: 0;
    margin: 0 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow-x: hidden;
}


[data-bs-theme="light"] .view-patient-container {
    background: #f0f0f0 !important;
    border: none;
}

/* Modal Header - Matching Edit Modal Style */
.view-patient-container .modal-header {
    background: #08151d !important;
    border-bottom: 1px solid #2a3f5f;
    padding: 1.5rem 2rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-bs-theme="light"] .view-patient-container .modal-header {
    background: #f0f0f0 !important;
    border-bottom: 1px solid rgba(13, 110, 253, 0.1);
}

.view-patient-container .modal-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

[data-bs-theme="light"] .view-patient-container .modal-title {
    color: #000000c7;
}

/* Ensure modal titles opened from the View Patient modal are black-ish in light theme */
[data-bs-theme="light"] #viewPatientModal .modal-title,
[data-bs-theme="light"] #viewTreatmentModal .modal-title,
[data-bs-theme="light"] .modal-title,
[data-bs-theme="light"] #editTreatmentModal .modal-title,
[data-bs-theme="light"] .modal-title,
[data-bs-theme="light"] #addTreatmentModal .modal-title,
[data-bs-theme="light"] .modal-title,
[data-bs-theme="light"] .crm-conversation-modal .modal-title,
[data-bs-theme="light"] .crm-treatment-modal .modal-title {
    color: #000000b9 !important;
}

.view-patient-container .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

.view-patient-container .btn-close:hover {
    opacity: 1;
}

.view-patient-container .btn-close:focus,
.view-patient-container .btn-close:focus-visible,
.view-patient-container .btn-close:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

[data-bs-theme="light"] .view-patient-container .btn-close {
    filter: none;
    opacity: 1;
}

/* Modal Body */
.modal-body-custom {
    padding: 0rem 2rem 1rem 2rem !important;
}

/* Grid Layout - Matching Edit Modal */
.patient-info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.5rem;
}

/* Shared with Add patient modal: location pair, lead row, file drop */
.patient-info-grid > .patient-info-grid--lead-pair {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.5rem;
}

.add-patient-location-compact {
    min-width: 0;
}

.add-patient-location-compact-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1rem;
    align-items: end;
}

.add-patient-location-compact-inner .patient-field {
    min-width: 0;
}

.add-patient-file-drop {
    position: relative;
    border: 1px dashed rgba(0, 186, 255, 0.45);
    border-radius: 8px;
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
    min-height: 9.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.add-patient-file-drop:hover,
.add-patient-file-drop.is-dragover {
    border-color: #00baff;
    background: rgba(0, 186, 255, 0.06);
}

.add-patient-file-drop--readonly {
    cursor: default;
    pointer-events: none;
}

.add-patient-file-drop--readonly:hover {
    border-color: rgba(0, 186, 255, 0.45);
    background: transparent;
}

.add-patient-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.add-patient-file-drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    pointer-events: none;
}

.add-patient-file-drop-inner i {
    font-size: 1.5rem;
    color: #00baff;
}

.add-patient-file-drop-names {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.75);
    word-break: break-word;
    width: 100%;
    text-align: center;
}

[data-bs-theme="light"] .add-patient-file-drop-names {
    color: #4b5563;
}

.edit-patient-existing-docs {
    text-align: left;
    margin-top: 0.75rem;
}

.edit-patient-doc-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.file-item--pending {
    outline: 1px dashed rgba(0, 186, 255, 0.35);
}

.edit-patient-pending-docs:not([hidden]) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.edit-patient-doc-thumb {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.2);
}

[data-bs-theme="light"] .edit-patient-doc-thumb {
    border-color: rgba(0, 0, 0, 0.12);
    background: #f3f4f6;
}

.edit-patient-doc-thumb-link {
    display: block;
    width: 100%;
    height: 100%;
}

.edit-patient-doc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.edit-patient-doc-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(220, 53, 69, 0.92);
    color: #fff;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.edit-patient-doc-remove:hover {
    background: #dc3545;
}

.edit-patient-doc-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.15);
    max-width: 100%;
}

[data-bs-theme="light"] .edit-patient-doc-file {
    border-color: rgba(0, 0, 0, 0.12);
    background: #f9fafb;
}

.edit-patient-doc-file-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.edit-patient-doc-file-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.edit-patient-doc-remove--inline {
    position: static;
    flex-shrink: 0;
}

.view-patient-body-intro {
    padding: 1rem 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    margin-left: 0.2rem;
}

.view-patient-body-intro--compact {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #f8fafc;
    margin-top: 0;
    margin-bottom: 1rem;
}

[data-bs-theme="light"] .view-patient-body-intro--compact {
    color: #1e293b;
}

/* View patient — bento identity panel */
.view-patient-container .crm-patient-identity-panel,
#viewPatientModalBody .crm-patient-identity-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Portal actions: keep the flex row from collapsing when children start hidden */
.crm-patient-portal-account {
    grid-column: 1 / -1;
    min-width: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    border-radius: 14px;
    border: 1px solid rgba(0, 186, 255, 0.28);
    background: linear-gradient(135deg, rgba(0, 186, 255, 0.07) 0%, rgba(15, 23, 42, 0.58) 72%);
}

[data-bs-theme="light"] .crm-patient-portal-account {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.06) 0%, #f8fafc 85%);
    border-color: rgba(13, 110, 253, 0.22);
}

.crm-portal-access__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    min-width: 0;
}

.crm-portal-access__heading {
    min-width: 0;
    flex: 1 1 auto;
}

.crm-portal-access__title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.2rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.3;
}

.crm-portal-access__title i {
    color: #00baff;
    font-size: 0.95rem;
}

.crm-patient-bento .crm-portal-access__title {
    display: none;
}

.crm-portal-access__desc {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(148, 163, 184, 0.95);
}

[data-bs-theme="light"] .crm-portal-access__title {
    color: #1e293b;
}

[data-bs-theme="light"] .crm-portal-access__title i {
    color: #0284c7;
}

[data-bs-theme="light"] .crm-portal-access__desc {
    color: #64748b;
}

.crm-portal-status-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: min(100%, 18rem);
    padding: 0.22rem 0.7rem;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crm-portal-status-badge::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.crm-portal-status-badge--active {
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

.crm-portal-status-badge--pending {
    background: rgba(234, 179, 8, 0.16);
    border-color: rgba(234, 179, 8, 0.4);
    color: #fde68a;
}

.crm-portal-status-badge--setup {
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}

.crm-portal-status-badge--blocked {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.crm-portal-status-badge--muted {
    background: rgba(125, 211, 252, 0.12);
    border-color: rgba(125, 211, 252, 0.35);
    color: #bae6fd;
}

[data-bs-theme="light"] .crm-portal-status-badge {
    background: rgba(100, 116, 139, 0.12);
    border-color: rgba(100, 116, 139, 0.28);
    color: #475569;
}

[data-bs-theme="light"] .crm-portal-status-badge--active {
    background: rgba(34, 197, 94, 0.14);
    border-color: rgba(34, 197, 94, 0.32);
    color: #166534;
}

[data-bs-theme="light"] .crm-portal-status-badge--pending {
    background: rgba(234, 179, 8, 0.14);
    border-color: rgba(202, 138, 4, 0.32);
    color: #854d0e;
}

[data-bs-theme="light"] .crm-portal-status-badge--setup {
    background: rgba(100, 116, 139, 0.12);
    border-color: rgba(100, 116, 139, 0.28);
    color: #475569;
}

[data-bs-theme="light"] .crm-portal-status-badge--blocked {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #b91c1c;
}

[data-bs-theme="light"] .crm-portal-status-badge--muted {
    background: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.25);
    color: #1e3a5f;
}

.crm-portal-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem 1.25rem;
    min-width: 0;
}

.crm-portal-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.crm-portal-field__label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.95);
    line-height: 1.2;
}

.crm-portal-field__value {
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f1f5f9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-portal-email {
    font-weight: 650;
}

.crm-portal-email:empty::after {
    content: "—";
    color: rgba(148, 163, 184, 0.85);
    font-weight: 600;
}

[data-bs-theme="light"] .crm-portal-email:empty::after {
    color: #94a3b8;
}

[data-bs-theme="light"] .crm-portal-field__label {
    color: #64748b;
}

[data-bs-theme="light"] .crm-portal-field__value {
    color: #1e293b;
}

.crm-portal-status-text {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: rgba(148, 163, 184, 0.95);
}

[data-bs-theme="light"] .crm-portal-status-text {
    color: #64748b;
}

.crm-portal-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-height: 2rem;
    overflow: visible;
}

.crm-portal-actions > .btn {
    align-items: center;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.crm-portal-actions .crm-portal-claim-btn {
    color: #0d6efd;
    border-color: #0d6efd;
    background: transparent;
}

.crm-portal-actions .crm-portal-claim-btn:hover,
.crm-portal-actions .crm-portal-claim-btn:focus {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
}

[data-bs-theme="dark"] .crm-portal-actions .crm-portal-claim-btn {
    color: #6ea8fe;
    border-color: #6ea8fe;
}

[data-bs-theme="dark"] .crm-portal-actions .crm-portal-claim-btn:hover,
[data-bs-theme="dark"] .crm-portal-actions .crm-portal-claim-btn:focus {
    color: #fff;
    background-color: #6ea8fe;
    border-color: #6ea8fe;
}

.crm-portal-actions .crm-portal-generate-btn {
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.55);
    background: transparent;
}

.crm-portal-actions .crm-portal-generate-btn:hover,
.crm-portal-actions .crm-portal-generate-btn:focus {
    color: #fff;
    background-color: rgba(148, 163, 184, 0.22);
    border-color: #94a3b8;
}

[data-bs-theme="light"] .crm-portal-actions .crm-portal-generate-btn {
    color: #475569;
    border-color: #94a3b8;
}

[data-bs-theme="light"] .crm-portal-actions .crm-portal-generate-btn:hover,
[data-bs-theme="light"] .crm-portal-actions .crm-portal-generate-btn:focus {
    color: #1e293b;
    background-color: rgba(100, 116, 139, 0.12);
    border-color: #64748b;
}

.crm-portal-actions > .btn:last-child {
    margin-right: 0;
}

.crm-portal-actions > .btn:focus-visible {
    outline: 2px solid #00baff;
    outline-offset: 2px;
}

@supports (gap: 0.5rem) {
    .crm-portal-actions > .btn {
        margin-right: 0;
        margin-bottom: 0;
    }
}

.crm-patient-portal-account .crm-portal-password-once {
    margin-top: 0;
}

@media (max-width: 575px) {
    .crm-portal-fields {
        grid-template-columns: 1fr;
    }

    .crm-portal-access__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .crm-portal-status-badge {
        max-width: 100%;
        white-space: normal;
    }

    .crm-portal-field__value {
        white-space: normal;
        overflow: visible;
        word-break: break-word;
    }
}

/* Banner hero */
.crm-patient-identity-banner {
    position: relative;
    overflow: hidden;
    padding: 1.15rem 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(0, 186, 255, 0.28);
    background: linear-gradient(125deg, rgba(0, 186, 255, 0.16) 0%, rgba(99, 102, 241, 0.08) 45%, rgba(0, 0, 0, 0.15) 100%);
}

.crm-patient-identity-banner__glow {
    position: absolute;
    top: -40%;
    right: -10%;
    width: 55%;
    height: 140%;
    background: radial-gradient(ellipse at center, rgba(0, 186, 255, 0.22) 0%, transparent 70%);
    pointer-events: none;
}

[data-bs-theme="light"] .crm-patient-identity-banner {
    background: linear-gradient(125deg, rgba(13, 110, 253, 0.1) 0%, rgba(99, 102, 241, 0.06) 50%, #fff 100%);
    border-color: rgba(13, 110, 253, 0.2);
}

.crm-patient-identity-banner__main {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1.15rem;
    min-width: 0;
}

.crm-patient-identity-avatar-ring {
    flex: 0 0 auto;
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(145deg, #00baff, #6366f1, #00baff);
    box-shadow: 0 0 24px rgba(0, 186, 255, 0.35);
}

button.crm-patient-identity-avatar-ring.crm-patient-profile-photo-trigger {
    border: none;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    transition: box-shadow 0.15s ease;
}

button.crm-patient-identity-avatar-ring.crm-patient-profile-photo-trigger:hover {
    box-shadow: 0 0 28px rgba(0, 186, 255, 0.42);
}

button.crm-patient-identity-avatar-ring.crm-patient-profile-photo-trigger:focus-visible {
    outline: 2px solid rgba(0, 186, 255, 0.9);
    outline-offset: 3px;
}

.crm-patient-profile-photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 11050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(6, 10, 18, 0.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    animation: crm-patient-photo-lightbox-in 0.2s ease-out;
}

.crm-patient-profile-photo-lightbox[hidden] {
    display: none !important;
}

@keyframes crm-patient-photo-lightbox-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.crm-patient-profile-photo-lightbox__img {
    max-width: min(92vw, 640px);
    max-height: min(88vh, 80vh);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
    animation: crm-patient-photo-lightbox-img-in 0.25s ease-out;
}

@keyframes crm-patient-photo-lightbox-img-in {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.crm-patient-profile-photo-lightbox__close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #e8f0ff;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.crm-patient-profile-photo-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

.crm-patient-profile-photo-lightbox__close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

.crm-patient-identity-avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #e8f7ff;
    background: linear-gradient(160deg, #0c4a6e 0%, #0369a1 50%, #0284c7 100%);
    overflow: hidden;
}

.crm-patient-identity-avatar__photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.crm-patient-identity-avatar__initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.crm-patient-identity-avatar__photo[hidden],
.crm-patient-identity-avatar__initials[hidden] {
    display: none !important;
}

[data-bs-theme="light"] .crm-patient-identity-avatar {
    color: #fff;
    background: linear-gradient(160deg, #1d4ed8 0%, #2563eb 50%, #3b82f6 100%);
}

.crm-patient-identity-banner__body {
    min-width: 0;
    flex: 1 1 auto;
}

.crm-patient-identity-eyebrow {
    margin: 0 0 0.2rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(0, 186, 255, 0.8);
}

[data-bs-theme="light"] .crm-patient-identity-eyebrow {
    color: rgba(13, 110, 253, 0.75);
}

.crm-patient-identity-name {
    margin: 0 0 0.55rem;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.15;
    color: #f8fafc;
    word-break: break-word;
}

[data-bs-theme="light"] .crm-patient-identity-name {
    color: #0f172a;
}

.crm-patient-identity-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.crm-patient-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(232, 247, 255, 0.95);
    background: rgba(0, 186, 255, 0.16);
    border: 1px solid rgba(0, 186, 255, 0.32);
}

.crm-patient-chip--patient {
    border-radius: 6px;
}

.crm-patient-chip--global {
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(129, 140, 248, 0.4);
}

.crm-patient-chip--yes {
    border-radius: 4px 12px 4px 12px;
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(34, 197, 94, 0.4);
    color: #bbf7d0;
}

.crm-patient-chip--no {
    border-radius: 12px 4px 12px 4px;
    background: rgba(148, 163, 184, 0.14);
    border-color: rgba(148, 163, 184, 0.3);
    color: #cbd5e1;
}

[data-bs-theme="light"] .crm-patient-chip {
    color: #1e3a5f;
    background: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.22);
}

[data-bs-theme="light"] .crm-patient-chip--yes {
    color: #166534;
    background: rgba(34, 197, 94, 0.14);
}

[data-bs-theme="light"] .crm-patient-chip--no {
    color: #475569;
    background: rgba(100, 116, 139, 0.12);
}

.crm-patient-chip--protocol {
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.16);
    border-color: rgba(56, 189, 248, 0.45);
    color: #e0f2fe;
}

button.crm-patient-chip--protocol {
    font: inherit;
    cursor: pointer;
    line-height: inherit;
}

.crm-patient-protocol-menu {
    position: relative;
    display: inline-flex;
}

.crm-patient-protocol-menu__arrow {
    margin-left: 0.15rem;
    font-size: 0.68rem;
    opacity: 0.85;
}

.crm-patient-protocol-menu.is-open .crm-patient-protocol-menu__arrow {
    transform: rotate(180deg);
}

.crm-patient-protocol-menu__panel {
    min-width: 220px;
    padding: 0.35rem;
    border-radius: 12px;
    background: #0b1c2e;
    border: 1px solid rgba(56, 189, 248, 0.45);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.crm-patient-protocol-menu__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
}

.crm-patient-protocol-menu__item + .crm-patient-protocol-menu__item {
    margin-top: 0.15rem;
}

.crm-patient-protocol-menu__hospital {
    color: rgba(226, 232, 240, 0.82);
    font-size: 0.78rem;
    font-weight: 600;
}

.crm-patient-protocol-menu__no {
    color: #f8fafc;
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

[data-bs-theme="light"] .crm-patient-chip--protocol {
    color: #0369a1;
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.28);
}

[data-bs-theme="light"] .crm-patient-protocol-menu__panel {
    background: #fff;
    border-color: rgba(14, 165, 233, 0.35);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

[data-bs-theme="light"] .crm-patient-protocol-menu__hospital {
    color: #475569;
}

[data-bs-theme="light"] .crm-patient-protocol-menu__no {
    color: #0f172a;
}

/* Bento mosaic */
.crm-patient-bento {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.crm-patient-bento__label {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0.15rem 0 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.95);
}

.crm-patient-bento__label i {
    font-size: 0.8rem;
    color: rgba(0, 186, 255, 0.85);
}

.crm-patient-bento__label--contact i {
    color: rgba(52, 211, 153, 0.9);
}

.crm-patient-bento__label--ids i {
    color: rgba(251, 191, 36, 0.9);
}

.crm-patient-bento__label--app i {
    color: rgba(0, 186, 255, 0.9);
}

[data-bs-theme="light"] .crm-patient-bento__label {
    color: #64748b;
}

/* Lead & source — blue info boxes (view modal), tile height parity with Identity */
.crm-lead-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.crm-lead-view__group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0.65rem 0 0.45rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #f8fafc;
}

.crm-lead-view__group:first-child {
    margin-top: 0;
}

.crm-lead-view__group > i {
    font-size: 0.72rem;
    color: #00baff;
    flex-shrink: 0;
}

[data-bs-theme="light"] .crm-lead-view__group {
    color: #1e293b;
}

[data-bs-theme="light"] .crm-lead-view__group > i {
    color: #0284c7;
}

.crm-lead-view__row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: stretch;
    min-width: 0;
}

.crm-lead-view__row--labels {
    margin-bottom: 0;
}

.crm-lead-view__row--labels .crm-lead-view__group {
    margin: 0.5rem 0 0.35rem;
}

.crm-lead-view__row--labels .crm-lead-view__group:first-child {
    margin-top: 0.5rem;
}

.crm-lead-view__group--span-2 {
    grid-column: span 2;
}

.crm-lead-box--span-2 {
    grid-column: span 2;
}

.crm-lead-box {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0, 186, 255, 0.08) 0%, rgba(15, 23, 42, 0.55) 70%);
    border: 1px solid rgba(0, 186, 255, 0.28);
}

[data-bs-theme="light"] .crm-lead-box {
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.06) 0%, #f8fafc 85%);
    border-color: rgba(13, 110, 253, 0.22);
}

.crm-lead-box__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: rgba(0, 186, 255, 0.2);
    border: 1px solid rgba(0, 186, 255, 0.35);
    color: #7dd3fc;
    font-size: 1.1rem;
}

[data-bs-theme="light"] .crm-lead-box__icon {
    background: rgba(13, 110, 253, 0.1);
    border-color: rgba(13, 110, 253, 0.25);
    color: #0284c7;
}

.crm-lead-box__body {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.crm-lead-box__split {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    width: 100%;
    min-width: 0;
}

.crm-lead-box__cell {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.crm-lead-box__cell + .crm-lead-box__cell {
    padding-left: 1rem;
    margin-left: 1rem;
    border-left: 1px solid rgba(0, 186, 255, 0.22);
}

[data-bs-theme="light"] .crm-lead-box__cell + .crm-lead-box__cell {
    border-left-color: rgba(13, 110, 253, 0.18);
}

.crm-lead-box__label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.95);
    line-height: 1.2;
}

[data-bs-theme="light"] .crm-lead-box__label {
    color: #64748b;
}

.crm-lead-box__value {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f1f5f9;
    word-break: break-word;
}

.crm-lead-box__value--muted {
    color: rgba(148, 163, 184, 0.85);
    font-weight: 600;
}

[data-bs-theme="light"] .crm-lead-box__value {
    color: #1e293b;
}

.crm-lead-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.45rem;
    line-height: 1.35;
}

.crm-lead-flow__channel {
    font-size: 1.05rem;
    font-weight: 700;
    color: #7dd3fc;
}

.crm-lead-flow__sub {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f1f5f9;
}

.crm-lead-flow__sep {
    font-size: 0.85rem;
    font-weight: 700;
    color: rgba(125, 211, 252, 0.65);
}

[data-bs-theme="light"] .crm-lead-flow__channel {
    color: #0369a1;
}

[data-bs-theme="light"] .crm-lead-flow__sub {
    color: #1e293b;
}

[data-bs-theme="light"] .crm-lead-flow__sep {
    color: #7dd3fc;
}

@media (max-width: 991px) {
    .crm-lead-view__row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-lead-box--span-2 {
        grid-column: span 2;
    }
}

@media (max-width: 575px) {
    .crm-lead-view__row {
        grid-template-columns: 1fr;
    }

    .crm-lead-box--span-2 {
        grid-column: span 1;
    }
}

/* View patient companions — emergency contact tiles (2x2, same boxes as Lead & source) */
#viewPatientModal .crm-companion-emergency-view .crm-lead-view__row,
#viewPatientModalBody .crm-companion-emergency-view .crm-lead-view__row,
.view-patient-container .crm-companion-emergency-view .crm-lead-view__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 575px) {
    #viewPatientModal .crm-companion-emergency-view .crm-lead-view__row,
    #viewPatientModalBody .crm-companion-emergency-view .crm-lead-view__row,
    .view-patient-container .crm-companion-emergency-view .crm-lead-view__row {
        grid-template-columns: 1fr;
    }
}

.crm-patient-tile {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    min-width: 0;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

[data-bs-theme="light"] .crm-patient-tile {
    background: #f8fafc;
    border-color: rgba(0, 0, 0, 0.08);
}

.crm-patient-tile--dob {
    grid-column: span 1;
    border-radius: 14px;
    border-color: rgba(0, 186, 255, 0.22);
}

.crm-patient-tile--gender {
    grid-column: span 1;
    border-radius: 14px;
    border-color: rgba(139, 92, 246, 0.25);
}

.crm-patient-tile--gender-male {
    border-color: rgba(96, 165, 250, 0.3);
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.14) 0%, rgba(15, 23, 42, 0.6) 60%);
}

.crm-patient-tile--gender-female {
    border-color: rgba(244, 114, 182, 0.3);
    background: linear-gradient(135deg, rgba(244, 114, 182, 0.14) 0%, rgba(15, 23, 42, 0.6) 60%);
}

[data-bs-theme="light"] .crm-patient-tile--gender-male {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, #eff6ff 80%);
}

[data-bs-theme="light"] .crm-patient-tile--gender-female {
    background: linear-gradient(135deg, rgba(244, 114, 182, 0.1) 0%, #fdf2f8 80%);
}

.crm-patient-tile--location {
    grid-column: span 2;
    align-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(15, 23, 42, 0.6) 60%);
    border-color: rgba(52, 211, 153, 0.28);
}

[data-bs-theme="light"] .crm-patient-tile--location {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, #f0fdf4 80%);
}

.crm-patient-tile--action {
    grid-column: span 2;
    align-items: center;
    padding: 1rem 1.1rem;
}

.crm-patient-tile--phone {
    border-radius: 14px;
    border-left: 4px solid #34d399;
    background: linear-gradient(90deg, rgba(52, 211, 153, 0.1) 0%, rgba(15, 23, 42, 0.5) 35%);
}

.crm-patient-tile--email {
    border-radius: 14px;
    border-left: 4px solid #60a5fa;
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.1) 0%, rgba(15, 23, 42, 0.5) 35%);
}

[data-bs-theme="light"] .crm-patient-tile--phone {
    background: linear-gradient(90deg, rgba(52, 211, 153, 0.08) 0%, #f8fafc 40%);
}

[data-bs-theme="light"] .crm-patient-tile--email {
    background: linear-gradient(90deg, rgba(96, 165, 250, 0.08) 0%, #f8fafc 40%);
}

a.crm-patient-tile--action:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border-color: rgba(255, 255, 255, 0.18);
}

a.crm-patient-tile--phone:hover {
    border-left-color: #6ee7b7;
}

a.crm-patient-tile--email:hover {
    border-left-color: #93c5fd;
}

.crm-patient-tile--id-doc {
    grid-column: span 2;
    padding: 0;
    overflow: hidden;
    border-radius: 10px;
    border-style: dashed;
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(15, 23, 42, 0.4);
}

.crm-patient-tile--passport {
    border-color: rgba(244, 114, 182, 0.35);
}

[data-bs-theme="light"] .crm-patient-tile--id-doc {
    background: #fffbeb;
}

[data-bs-theme="light"] .crm-patient-tile--passport {
    background: #fdf2f8;
}

.crm-patient-tile__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.1rem;
    color: #e0f2fe;
}

.crm-patient-tile__icon--round {
    border-radius: 50%;
    background: rgba(0, 186, 255, 0.2);
    border: 1px solid rgba(0, 186, 255, 0.35);
}

.crm-patient-tile__icon--squircle {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: rgba(139, 92, 246, 0.22);
    border: 1px solid rgba(167, 139, 250, 0.4);
}

.crm-patient-tile__icon--hex {
    border-radius: 12px;
    transform: rotate(-6deg);
    background: rgba(52, 211, 153, 0.2);
    border: 1px solid rgba(52, 211, 153, 0.4);
}

.crm-patient-tile__icon--cyan { color: #7dd3fc; }
.crm-patient-tile__icon--violet { color: #c4b5fd; }
.crm-patient-tile__icon--emerald { color: #6ee7b7; }

.crm-patient-tile__icon--gender-male {
    background: rgba(96, 165, 250, 0.22);
    border: 1px solid rgba(147, 197, 253, 0.45);
    color: #93c5fd;
}

.crm-patient-tile__icon--gender-female {
    background: rgba(244, 114, 182, 0.22);
    border: 1px solid rgba(251, 113, 133, 0.45);
    color: #f9a8d4;
}

.crm-patient-tile__icon--gender-neutral,
.crm-patient-tile__icon--gender-other {
    background: rgba(139, 92, 246, 0.22);
    border: 1px solid rgba(167, 139, 250, 0.4);
    color: #c4b5fd;
}

.crm-patient-tile__body {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.crm-patient-tile__label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.95);
}

.crm-patient-tile__value {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f1f5f9;
    word-break: break-word;
}

.crm-patient-tile__value--lg {
    font-size: 1.2rem;
    letter-spacing: 0.01em;
}

.crm-patient-tile__value--stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.crm-patient-tile__value--mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
}

.crm-patient-tile__value--action {
    font-size: 1.08rem;
}

.crm-patient-tile__value--muted {
    color: rgba(148, 163, 184, 0.8);
    font-weight: 600;
}

[data-bs-theme="light"] .crm-patient-tile__value {
    color: #1e293b;
}

.crm-patient-location-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.crm-patient-location-country {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.15rem;
    font-weight: 700;
}

.crm-patient-location-flag {
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.crm-patient-location-sep {
    color: rgba(148, 163, 184, 0.75);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1;
}

.crm-patient-location-city {
    font-size: 1.15rem;
    font-weight: 600;
    color: rgba(203, 213, 225, 0.95);
}

[data-bs-theme="light"] .crm-patient-location-city {
    color: #475569;
}

.crm-patient-tile__action-icon {
    flex: 0 0 auto;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.25rem;
}

.crm-patient-tile--phone .crm-patient-tile__action-icon {
    background: rgba(52, 211, 153, 0.18);
    color: #6ee7b7;
    border-radius: 50% 12px 50% 12px;
}

.crm-patient-tile--email .crm-patient-tile__action-icon {
    background: rgba(96, 165, 250, 0.18);
    color: #93c5fd;
    border-radius: 12px 50% 12px 50%;
}

.crm-patient-tile__chevron {
    flex: 0 0 auto;
    opacity: 0.45;
    font-size: 0.85rem;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

a.crm-patient-tile--action:hover .crm-patient-tile__chevron {
    opacity: 1;
    transform: translateX(3px);
}

.crm-patient-id-strip {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 4.5rem;
}

.crm-patient-id-strip__icon {
    flex: 0 0 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: #fcd34d;
    background: rgba(251, 191, 36, 0.12);
    border-right: 1px dashed rgba(251, 191, 36, 0.35);
}

.crm-patient-id-strip__icon--passport {
    color: #f9a8d4;
    background: rgba(244, 114, 182, 0.12);
    border-right-color: rgba(244, 114, 182, 0.35);
}

.crm-patient-id-strip__body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
    min-width: 0;
}

@media (max-width: 991px) {
    .crm-patient-bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .crm-patient-tile--location,
    .crm-patient-tile--action,
    .crm-patient-tile--id-doc {
        grid-column: span 2;
    }
}

@media (max-width: 575px) {
    .crm-patient-identity-banner__main {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .crm-patient-bento {
        grid-template-columns: 1fr;
    }

    .crm-patient-tile--dob,
    .crm-patient-tile--gender,
    .crm-patient-tile--location,
    .crm-patient-tile--action,
    .crm-patient-tile--id-doc {
        grid-column: span 1;
    }
}

.patient-info-grid.add-patient-documents-row {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
}

#editPatientModalBody .add-patient-documents-row > .patient-field,
#addPatientModal .add-patient-documents-row > .patient-field,
#addPatientModalIndex .add-patient-documents-row > .patient-field,
.view-patient-container .add-patient-documents-row > .patient-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#editPatientModalBody .add-patient-documents-row .add-patient-file-drop,
#addPatientModal .add-patient-documents-row .add-patient-file-drop,
#addPatientModalIndex .add-patient-documents-row .add-patient-file-drop,
.view-patient-container .add-patient-documents-row .add-patient-file-drop,
#viewPatientModalBody .add-patient-documents-row .add-patient-file-drop {
    flex: 1 1 auto;
}

#editPatientModalBody .add-patient-documents-row .add-patient-comments-field,
#addPatientModal .add-patient-documents-row .add-patient-comments-field,
#addPatientModalIndex .add-patient-documents-row .add-patient-comments-field,
.view-patient-container .add-patient-documents-row .add-patient-comments-field {
    display: flex;
    flex-direction: column;
}

#editPatientModalBody .add-patient-documents-row .add-patient-comments-input,
#addPatientModal .add-patient-documents-row .add-patient-comments-input,
#addPatientModalIndex .add-patient-documents-row .add-patient-comments-input,
.view-patient-container .add-patient-documents-row .add-patient-comments-input {
    flex: 1 1 auto;
    min-height: 9.5rem;
    resize: vertical;
}

.view-patient-container .add-patient-documents-row .edit-patient-existing-docs,
#viewPatientModalBody .add-patient-documents-row .edit-patient-existing-docs {
    flex: 1 1 auto;
    min-height: 9.5rem;
    padding: 0.75rem;
    border: 1px dashed rgba(0, 186, 255, 0.45);
    border-radius: 8px;
    box-sizing: border-box;
    overflow: auto;
}

/* Form Field */
.patient-field {
    display: flex;
    flex-direction: column;
}

.patient-id-docs-hint {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #94a3b8;
}

[data-bs-theme="light"] .patient-id-docs-hint {
    color: #64748b;
}

.patient-field .invalid-feedback[data-patient-id-docs-error],
.form-group .invalid-feedback[data-patient-id-docs-error],
.crm-patient-companions-block .invalid-feedback[data-patient-id-docs-error],
.crm-patient-companions-block .invalid-feedback[data-companion-phone-error],
.crm-treatment-travel-block .invalid-feedback[data-patient-id-docs-error],
.crm-treatment-travel-block .invalid-feedback[data-companion-phone-error] {
    display: none !important;
}

.patient-field input[name="PersonalNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
.patient-field input[name="PassportNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
.patient-field input[name="Email"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
.patient-field input[name="PersonalNo"].is-invalid ~ .invalid-feedback,
.patient-field input[name="PassportNo"].is-invalid ~ .invalid-feedback,
.patient-field input[name="Email"].is-invalid ~ .invalid-feedback,
.form-group input[name="PersonalNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
.form-group input[name="PassportNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
.form-group input[name="Email"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
.form-group input[name="PersonalNo"].is-invalid ~ .invalid-feedback,
.form-group input[name="PassportNo"].is-invalid ~ .invalid-feedback,
.form-group input[name="Email"].is-invalid ~ .invalid-feedback {
    display: block !important;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #f87171 !important;
}

[data-bs-theme="light"] .patient-field input[name="PersonalNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
[data-bs-theme="light"] .patient-field input[name="PassportNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
[data-bs-theme="light"] .patient-field input[name="Email"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
[data-bs-theme="light"] .patient-field input[name="PersonalNo"].is-invalid ~ .invalid-feedback,
[data-bs-theme="light"] .patient-field input[name="PassportNo"].is-invalid ~ .invalid-feedback,
[data-bs-theme="light"] .patient-field input[name="Email"].is-invalid ~ .invalid-feedback,
[data-bs-theme="light"] .form-group input[name="PersonalNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
[data-bs-theme="light"] .form-group input[name="PassportNo"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
[data-bs-theme="light"] .form-group input[name="Email"]:not(:placeholder-shown):invalid ~ .invalid-feedback,
[data-bs-theme="light"] .form-group input[name="PersonalNo"].is-invalid ~ .invalid-feedback,
[data-bs-theme="light"] .form-group input[name="PassportNo"].is-invalid ~ .invalid-feedback,
[data-bs-theme="light"] .form-group input[name="Email"].is-invalid ~ .invalid-feedback {
    color: #dc2626 !important;
}

.patient-field .form-control[name="PersonalNo"].is-invalid,
.patient-field .form-control[name="PassportNo"].is-invalid,
.patient-field .form-control[name="Email"].is-invalid,
.patient-field .form-control[name="PersonalNo"]:not(:placeholder-shown):invalid,
.patient-field .form-control[name="PassportNo"]:not(:placeholder-shown):invalid,
.patient-field .form-control[name="Email"]:not(:placeholder-shown):invalid,
.form-group input[name="PersonalNo"].is-invalid,
.form-group input[name="PassportNo"].is-invalid,
.form-group input[name="Email"].is-invalid,
.form-group input[name="PersonalNo"]:not(:placeholder-shown):invalid,
.form-group input[name="PassportNo"]:not(:placeholder-shown):invalid,
.form-group input[name="Email"]:not(:placeholder-shown):invalid {
    border-color: #f5576c !important;
    box-shadow: 0 0 0 0.2rem rgba(245, 87, 108, 0.28) !important;
}

.form-group input[name="Email"].is-invalid,
.crm-patient-companion-new-phone.is-invalid,
.crm-patient-companion-new-email.is-invalid,
.crm-travel-companion-new-phone.is-invalid,
.crm-travel-companion-new-email.is-invalid,
.form-group input[name="CompanionPhoneNo"].is-invalid,
.form-group input[name="CompanionEmail"].is-invalid {
    border-color: #f5576c !important;
    box-shadow: 0 0 0 0.2rem rgba(245, 87, 108, 0.28) !important;
}

[data-bs-theme="light"] .crm-patient-companion-new-phone.is-invalid,
[data-bs-theme="light"] .crm-patient-companion-new-email.is-invalid,
[data-bs-theme="light"] .crm-travel-companion-new-phone.is-invalid,
[data-bs-theme="light"] .crm-travel-companion-new-email.is-invalid,
[data-bs-theme="light"] .form-group input[name="CompanionPhoneNo"].is-invalid,
[data-bs-theme="light"] .form-group input[name="CompanionEmail"].is-invalid {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.22) !important;
}

/* Labels with Icons - Exact Match */
.patient-field label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.4rem;
}

[data-bs-theme="dark"] .patient-field label {
    color: #9CA3AF;
}

/* Light theme: make labels darker inside the view-patient modal */
[data-bs-theme="light"] .view-patient-container .patient-field label {
    color: #333 !important;
}

.patient-field label i {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Country flag inside readonly field (view patient) */
.crm-country-input-wrap {
    position: relative;
    width: 100%;
}

.crm-country-input-wrap .crm-country-input-flag {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 15px;
    object-fit: cover;
    pointer-events: none;
    z-index: 2;
}

#viewPatientModalBody .patient-field .crm-country-input-with-flag[readonly],
.view-patient-container .patient-field .crm-country-input-with-flag[readonly] {
    padding-left: 2.5rem;
}

/* Read-only Input Fields — view modal only (edit modal flatpickr alt inputs stay form-control size) */
#viewPatientModalBody .patient-field input[readonly],
#viewPatientModalBody .patient-field textarea[readonly] {
    background: #172635;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 0.65rem 0.9rem;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s ease;
}

[data-bs-theme="light"] #viewPatientModalBody .patient-field input[readonly],
[data-bs-theme="light"] #viewPatientModalBody .patient-field textarea[readonly] {
    background: #f8f9fa;
    border: 1px solid #c8c8c8;
    color: #212529;
}

#viewPatientModalBody .patient-field input[readonly]:focus,
#viewPatientModalBody .patient-field textarea[readonly]:focus {
    outline: none;
    border-color: #0d6efd;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.1);
}

[data-bs-theme="light"] #viewPatientModalBody .patient-field input[readonly]:focus,
[data-bs-theme="light"] #viewPatientModalBody .patient-field textarea[readonly]:focus {
    border-color: #007bff;
    background: #ffffff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.1);
}

/* Full Width Fields */
.patient-field.full-width {
    grid-column: 1 / -1;
}

/* Section Dividers */
.section-divider {
    height: 1px;
    grid-column: 1 / -1;
}

[data-bs-theme="light"] .section-divider {
    background: rgba(0, 0, 0, 0.1) 
}
    
.section-divider {
    background: #E5E7EB;
}

/* Document Display */
.document-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.document-display a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #0d6efd;
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

[data-bs-theme="light"] .document-display a {
    background: #f8f9fa;
    border-color: rgba(0, 0, 0, 0.1);
    color: #0d6efd;
}

.document-display a:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #0d6efd;
}

[data-bs-theme="light"] .document-display a:hover {
    background: #e9ecef;
    border-color: #0d6efd;
}

.document-display img {
    max-width: 180px;
    height: auto;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="light"] .document-display img {
    border-color: rgba(0, 0, 0, 0.1);
}

/* Data Tables Section */
.data-tables-section {
    margin-top: 3rem;
}


/* Contact with Patient Table - Override Bootstrap */
.section-content .table,
.data-tables-section .table,
.section-content table.table,
.collapsible-section .table {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    background-color: #172635 !important;
    table-layout: fixed;
    width: 100%;
    --bs-table-bg: #162126 !important;
    --bs-table-color: #ffffff !important;
    --bs-table-striped-bg: #162126 !important;
    --bs-table-hover-bg: #162126 !important;
    --bs-table-active-bg: #162126 !important;
}

[data-bs-theme="light"] .section-content .table,
[data-bs-theme="light"] .data-tables-section .table {
    background-color: #ffffff !important;
    --bs-table-bg: #ffffff !important;
    --bs-table-color: #212529 !important;
}

/* Ensure dark theme Contact/Conversations tables have the requested background */
[data-bs-theme="dark"] .section-content .table,
[data-bs-theme="dark"] .data-tables-section .table,
[data-bs-theme="dark"] .section-content table.table,
[data-bs-theme="dark"] .collapsible-section .table {
    background-color: #172635 !important;
}

.section-content .table th,
.data-tables-section .table th,
.section-content table.table th,
.collapsible-section .table th {
    font-weight: 600;
    font-size: 0.75rem;
    background-color: #162126 !important;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

[data-bs-theme="light"] .section-content .table th,
[data-bs-theme="light"] .data-tables-section .table th {
    background-color: #f8f9fa !important;
}

.section-content .table td,
.data-tables-section .table td,
.section-content table.table td,
.collapsible-section .table td {
    background-color: #162126 !important;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
    padding: 0.75rem;
}

[data-bs-theme="light"] .section-content .table td,
[data-bs-theme="light"] .data-tables-section .table td {
    background-color: #fbfbfb !important;
}

.crm-treatment-no-col {
    width: 3.25rem;
    max-width: 3.25rem;
    white-space: nowrap;
    text-align: center;
    vertical-align: top;
}

.section-content table.table:has(#treatmentsTableBody) {
    width: 100%;
}

.crm-treatment-complaints-col {
    width: 36%;
    min-width: 11rem;
}

.crm-treatment-type-col {
    width: 26%;
    min-width: 8rem;
}

.crm-treatment-travel-col {
    width: 7.5rem;
    min-width: 7.5rem;
    white-space: nowrap;
}

.crm-treatment-paid-col {
    width: 5rem;
    min-width: 5rem;
    white-space: nowrap;
    text-align: center;
}

.crm-treatment-actions-col {
    width: auto;
    min-width: 6.5rem;
    white-space: nowrap;
    text-align: right;
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
    vertical-align: top;
}

.collapsible-section .table th.crm-treatment-no-col,
.collapsible-section .table th.crm-treatment-paid-col,
.collapsible-section .table th.crm-treatment-travel-col,
.collapsible-section .table th.crm-treatment-actions-col {
    white-space: nowrap;
    word-wrap: normal;
    overflow-wrap: normal;
}

.crm-treatment-actions {
    display: inline-flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
    width: max-content;
    margin-left: auto;
}

#treatmentsTableBody .crm-treatment-actions .btn-view-treatment,
#treatmentsTableBody .crm-treatment-actions .btn-edit-treatment,
#treatmentsTableBody .crm-treatment-actions .btn-delete-treatment,
#treatmentsTableBody .crm-treatment-actions .btn-delete-conversation {
    width: 100%;
    height: auto !important;
    min-height: unset !important;
    padding: 7px 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    display: inline-block !important;
    line-height: normal !important;
    text-align: center;
    box-sizing: border-box;
}

.crm-treatment-complaints-cell {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    line-height: 1.4;
    max-height: calc(1.4em * 4);
    word-break: break-word;
    white-space: normal;
}

.section-content .table tbody tr,
.data-tables-section .table tbody tr,
.section-content table.table tbody tr,
.collapsible-section .table tbody tr {
    background-color: #162126 !important;
}

.section-content .table thead,
.data-tables-section .table thead,
.section-content table.table thead,
.collapsible-section .table thead {
    background-color: #162126 !important;
}


[data-bs-theme="dark"] .section-content .table thead,
[data-bs-theme="dark"] .data-tables-section .table thead,
[data-bs-theme="dark"] .section-content table.table thead,
[data-bs-theme="dark"] .collapsible-section .table thead,
[data-bs-theme="dark"] .section-content .table th,
[data-bs-theme="dark"] .data-tables-section .table th,
[data-bs-theme="dark"] .section-content table.table th,
[data-bs-theme="dark"] .collapsible-section .table th {
    background-color: #08151d !important;
}

[data-bs-theme="dark"] .section-content .table tbody,
[data-bs-theme="dark"] .data-tables-section .table tbody,
[data-bs-theme="dark"] .section-content table.table tbody,
[data-bs-theme="dark"] .collapsible-section .table tbody {
    background-color: transparent !important;
}

/* Even rows (0, 2, 4...) - #08151d */
[data-bs-theme="dark"] .section-content .table tbody tr:nth-child(even),
[data-bs-theme="dark"] .data-tables-section .table tbody tr:nth-child(even),
[data-bs-theme="dark"] .section-content table.table tbody tr:nth-child(even),
[data-bs-theme="dark"] .collapsible-section .table tbody tr:nth-child(even),
[data-bs-theme="dark"] .section-content .table tbody tr:nth-child(even) td,
[data-bs-theme="dark"] .data-tables-section .table tbody tr:nth-child(even) td,
[data-bs-theme="dark"] .section-content table.table tbody tr:nth-child(even) td,
[data-bs-theme="dark"] .collapsible-section .table tbody tr:nth-child(even) td {
    background-color: #172635 !important;
    --bs-table-bg: #172635 !important;
    --bs-table-striped-bg: #172635 !important;
    --bs-table-hover-bg: #172635 !important;
    --bs-table-active-bg: #172635 !important;
}

/* Odd rows (1, 3, 5...) - #101c26 */
[data-bs-theme="dark"] .section-content .table tbody tr:nth-child(odd),
[data-bs-theme="dark"] .data-tables-section .table tbody tr:nth-child(odd),
[data-bs-theme="dark"] .section-content table.table tbody tr:nth-child(odd),
[data-bs-theme="dark"] .collapsible-section .table tbody tr:nth-child(odd),
[data-bs-theme="dark"] .section-content .table tbody tr:nth-child(odd) td,
[data-bs-theme="dark"] .data-tables-section .table tbody tr:nth-child(odd) td,
[data-bs-theme="dark"] .section-content table.table tbody tr:nth-child(odd) td,
[data-bs-theme="dark"] .collapsible-section .table tbody tr:nth-child(odd) td {
    background-color: #101c26 !important;
    --bs-table-bg: #101c26 !important;
    --bs-table-striped-bg: #101c26 !important;
    --bs-table-hover-bg: #101c26 !important;
    --bs-table-active-bg: #101c26 !important;
}















[data-bs-theme="light"] .section-content .table thead,
[data-bs-theme="light"] .data-tables-section .table thead,
[data-bs-theme="light"] .section-content table.table thead,
[data-bs-theme="light"] .collapsible-section .table thead,
[data-bs-theme="light"] .section-content .table th,
[data-bs-theme="light"] .data-tables-section .table th,
[data-bs-theme="light"] .section-content table.table th,
[data-bs-theme="light"] .collapsible-section .table th {
    background-color: #fbfbfb !important;
}

[data-bs-theme="light"] .section-content .table tbody,
[data-bs-theme="light"] .data-tables-section .table tbody,
[data-bs-theme="light"] .section-content table.table tbody,
[data-bs-theme="light"] .collapsible-section .table tbody {
    background-color: transparent !important;
}

/* Even rows (0, 2, 4...) - #172635 */
[data-bs-theme="light"] .section-content .table tbody tr:nth-child(even),
[data-bs-theme="light"] .data-tables-section .table tbody tr:nth-child(even),
[data-bs-theme="light"] .section-content table.table tbody tr:nth-child(even),
[data-bs-theme="light"] .collapsible-section .table tbody tr:nth-child(even),
[data-bs-theme="light"] .section-content .table tbody tr:nth-child(even) td,
[data-bs-theme="light"] .data-tables-section .table tbody tr:nth-child(even) td,
[data-bs-theme="light"] .section-content table.table tbody tr:nth-child(even) td,
[data-bs-theme="light"] .collapsible-section .table tbody tr:nth-child(even) td {
    background-color: #fbfbfb !important;
    --bs-table-bg: #fbfbfb !important;
    --bs-table-striped-bg: #fbfbfb !important;
    --bs-table-hover-bg: #fbfbfb !important;
    --bs-table-active-bg: #fbfbfb !important;
}

/* Odd rows (1, 3, 5...) - #101c26 */
[data-bs-theme="light"] .section-content .table tbody tr:nth-child(odd),
[data-bs-theme="light"] .data-tables-section .table tbody tr:nth-child(odd),
[data-bs-theme="light"] .section-content table.table tbody tr:nth-child(odd),
[data-bs-theme="light"] .collapsible-section .table tbody tr:nth-child(odd),
[data-bs-theme="light"] .section-content .table tbody tr:nth-child(odd) td,
[data-bs-theme="light"] .data-tables-section .table tbody tr:nth-child(odd) td,
[data-bs-theme="light"] .section-content table.table tbody tr:nth-child(odd) td,
[data-bs-theme="light"] .collapsible-section .table tbody tr:nth-child(odd) td {
    background-color: #f0f0f0 !important;
    --bs-table-bg: #f0f0f0 !important;
    --bs-table-striped-bg: #f0f0f0 !important;
    --bs-table-hover-bg: #f0f0f0 !important;
    --bs-table-active-bg: #f0f0f0 !important;
}

















[data-bs-theme="dark"] .section-content .table td,
[data-bs-theme="dark"] .data-tables-section .table td,
[data-bs-theme="dark"] .section-content table.table td,
[data-bs-theme="dark"] .collapsible-section .table td {
    --bs-table-color: #ffffff !important;
}

.section-content .table tbody,
.data-tables-section .table tbody,
.section-content table.table tbody,
.collapsible-section .table tbody {
    background-color: #162126 !important;
}

/* Action Buttons Section */
.action-buttons-row {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
}

.action-buttons-row form {
    margin: 0;
}

.action-buttons-row .btn {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    white-space: nowrap;
    width: auto;
    color: #00baff;
    background: rgba(0, 186, 255, 0.05);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.25);
    font-weight: 500;
    border-color: #00baff !important;

}

.action-buttons-row .btn:hover{
    transform: scale(1.05) !important;
    color: white !important;
    background-color: #00baff !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

/* View Conversation Button Styling */
.btn-view-conversation {
    font-size: 0.9rem;
    padding: 0.2rem 1rem;
    white-space: nowrap;
    color: #FFFFFF !important;
    font-weight: 500;
    height: 30px !important;
    border: none;
    border-radius: 5px;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);

}

.btn-view-conversation:hover {
    transform: scale(1.05) !important;
    background-color: #00baff !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;


    color: white;
    background: linear-gradient(145deg, #00baff, #0077cc);
    color: white;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);

}

/* Contact with Patient: Conversation Delete button */
.btn-delete-conversation {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-align: center;
    font-size: 0.9rem;
    padding: 0 0.7rem;
    white-space: nowrap;
    height: 30px !important;
    font-weight: 500;
    border-radius: 5px;
    color: #dc3545 !important;
    border: 1px solid #dc3545 !important;
    background: rgba(220, 53, 69, 0.05) !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.15) !important;
}

.btn-delete-conversation:hover {
    background-color: #dc3545 !important;
    color: #fff !important;
    box-shadow: 0 0 20px #dc3545, 0 0 40px rgba(220, 53, 69, 0.3) !important;
}


/* Add Patient Conversation/Treatment Buttons */
.data-tables-section .btn-outline-primary,
.data-tables-section .btn-outline-warning,
.section-content .btn-outline-primary:not(.crm-portal-claim-btn):not(.crm-portal-generate-btn),
.section-content .btn-outline-warning {
    white-space: nowrap !important;
    font-weight: 500 !important;
    color: white;
    border: none;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);
    padding: 0.6rem 1.5rem !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;

}

.data-tables-section .btn-outline-primary:hover,
.data-tables-section .btn-outline-warning:hover,
.section-content .btn-outline-primary:not(.crm-portal-claim-btn):not(.crm-portal-generate-btn):hover,
.section-content .btn-outline-warning:hover {
    transform: scale(1.05) !important;
    color: white !important;
    background-color: #00baff !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
    border-color: #00baff !important;
}


/* Email Section */
.email-info-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

[data-bs-theme="light"] .email-info-section {
    background: #f8f9fa;
    border-color: rgba(0, 0, 0, 0.1);
}

.email-section-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* [data-bs-theme]{
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
} */

[data-bs-theme="light"] .metadata-section {
    border-top-color: rgba(0, 0, 0, 0.1);
}

/* Modal Footer */
.modal-footer-custom {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(13, 110, 253, 0.1);
    /* background: rgba(0, 0, 0, 0.2); */
    display: flex !important;
    border-radius: 0 0 12px 12px;
}

.footer-buttons-right {
    display: flex !important;
    gap: 0.75rem !important;
    margin-left: auto !important;
}

[data-bs-theme="dark"] .modal-footer-custom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="light"] .modal-footer-custom {
    background: rgba(0, 0, 0, 0.03);
}

.modal-footer-custom .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Primary action left, Cancel/dismiss always rightmost in patient modals */
.add-patient-modal-footer-actions,
.modal-footer.custom-modal-footer,
.modal-footer-custom .footer-buttons-right,
.crm-treatment-modal .modal-footer,
.crm-conversation-modal .modal-footer {
    justify-content: flex-end;
}

.add-patient-modal-footer-actions .btn-add-patient,
.add-patient-modal-footer-actions .btn-primary,
.add-patient-modal-footer-actions button[type="submit"]:not([data-bs-dismiss="modal"]),
.modal-footer.custom-modal-footer .btn-primary,
.modal-footer.custom-modal-footer .btn-success,
.modal-footer.custom-modal-footer .btn-danger:not([data-bs-dismiss="modal"]),
.modal-footer-custom .footer-buttons-right .btn-save-changes,
.modal-footer-custom .footer-buttons-right .btn-primary,
.modal-footer-custom .footer-buttons-right .btn-view-treatment,
.modal-footer-custom .footer-buttons-right .crm-modal-footer-edit-btn {
    order: 1;
}

.add-patient-modal-footer-actions .btn-delete[data-bs-dismiss="modal"],
.modal-footer.custom-modal-footer .btn-delete[data-bs-dismiss="modal"],
.modal-footer.custom-modal-footer .btn-light[data-bs-dismiss="modal"],
.modal-footer-custom .footer-buttons-right .btn-delete[data-bs-dismiss="modal"],
.modal-footer-custom .footer-buttons-right .btn-delete[onclick*="history.back"] {
    order: 10;
}

[data-bs-theme="light"] .metadata-section {
    border-top-color: #E5E7EB;
}

/* Hide Scrollbar */
/* .modal-overlay,
.view-patient-container,
.modal-body-custom {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-overlay::-webkit-scrollbar,
.view-patient-container::-webkit-scrollbar,
.modal-body-custom::-webkit-scrollbar {
    display: none;
    width: 0px;
    height: 0px;
} */

/* Edit Patient modal (patients.php wrapper): allow scroll but hide scrollbar */
/* #editPatientModalBody {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#editPatientModalBody::-webkit-scrollbar {
    display: none;
    width: 0px;
    height: 0px;
} */

/* Responsive */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 2% 0.5rem;
    }
    
    .view-patient-container {
        width: 98%;
    }
    
    .modal-header-custom {
        padding: 1.5rem 1rem;
    }
    
    .modal-body-custom {
        padding: 1rem;
    }
    
    .patient-info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .action-buttons-row {
        justify-content: stretch;
    }

    .action-buttons-row form {
        width: 100%;
    }

    .action-buttons-row .btn {
        width: 100%;
    }
    
    .modal-close-btn {
        top: 0.5rem;
        right: 0.5
    }
    .patient-view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .modal-close-btn {
        top: 1rem;
        right: 1rem;
    }
}


/* Collapsible Sections */
.collapsible-section {
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
}

.collapsible-section.active {
    overflow: visible;
}

/* Patient + Treatment modals — CSS-only animated accordion */
#viewPatientModalBody .collapsible-section,
#editPatientModalBody .collapsible-section,
.view-patient-container .collapsible-section,
#viewTreatmentModal .collapsible-section .collapsible-section,
#editTreatmentModal .collapsible-section .collapsible-section,
#addTreatmentModal .collapsible-section .collapsible-section {
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#viewPatientModalBody .collapsible-section.active,
#editPatientModalBody .collapsible-section.active,
.view-patient-container .collapsible-section.active,
#viewTreatmentModal .collapsible-section.active .collapsible-section.active,
#editTreatmentModal .collapsible-section.active .collapsible-section.active,
#addTreatmentModal .collapsible-section.active .collapsible-section.active {
    overflow: hidden;
}

#viewPatientModalBody .section-content,
#editPatientModalBody .section-content,
.view-patient-container .section-content,
#viewTreatmentModal .section-content .section-content,
#editTreatmentModal .section-content .section-content,
#addTreatmentModal .section-content .section-content {
    display: block !important;
    max-height: 0;
    overflow: hidden;
    padding: 0 1.5rem;
    opacity: 0;
    box-sizing: border-box;
    transition: max-height 0.26s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.22s ease,
                padding 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

#viewPatientModalBody .collapsible-section.active > .section-content,
#editPatientModalBody .collapsible-section.active > .section-content,
.view-patient-container .collapsible-section.active > .section-content,
#viewTreatmentModal .collapsible-section.active > .section-content .collapsible-section.active > .section-content,
#editTreatmentModal .collapsible-section.active > .section-content .collapsible-section.active > .section-content,
#addTreatmentModal .collapsible-section.active > .section-content .collapsible-section.active > .section-content {
    max-height: 5000px;
    opacity: 1;
    padding: 0.75rem 1.25rem 1.25rem;
}

#viewPatientModalBody .collapsible-section.active:not(.crm-accordion-init) > .section-content,
#editPatientModalBody .collapsible-section.active:not(.crm-accordion-init) > .section-content,
.view-patient-container .collapsible-section.active:not(.crm-accordion-init) > .section-content,
#viewTreatmentModal .collapsible-section.active:not(.crm-accordion-init) > .section-content .collapsible-section.active:not(.crm-accordion-init) > .section-content,
#editTreatmentModal .collapsible-section.active:not(.crm-accordion-init) > .section-content .collapsible-section.active:not(.crm-accordion-init) > .section-content,
#addTreatmentModal .collapsible-section.active:not(.crm-accordion-init) > .section-content .collapsible-section.active:not(.crm-accordion-init) > .section-content {
    max-height: 5000px;
    opacity: 1;
    padding: 0.75rem 1.25rem 1.25rem;
}

[data-bs-theme="dark"] #viewPatientModalBody .collapsible-section.active,
[data-bs-theme="dark"] #editPatientModalBody .collapsible-section.active,
[data-bs-theme="dark"] .view-patient-container .collapsible-section.active,
[data-bs-theme="dark"] #viewTreatmentModal .collapsible-section.active,
[data-bs-theme="dark"] .collapsible-section.active,
[data-bs-theme="dark"] #editTreatmentModal .collapsible-section.active,
[data-bs-theme="dark"] .collapsible-section.active,
[data-bs-theme="dark"] #addTreatmentModal .collapsible-section.active,
[data-bs-theme="dark"] .collapsible-section.active {
    border-color: rgba(0, 186, 255, 0.62) !important;
    box-shadow: 0 0 14px rgba(0, 186, 255, 0.12), inset 0 0 0 1px rgba(0, 186, 255, 0.2);
    overflow: hidden;
}

[data-bs-theme="light"] #viewPatientModalBody .collapsible-section.active,
[data-bs-theme="light"] #editPatientModalBody .collapsible-section.active,
[data-bs-theme="light"] .view-patient-container .collapsible-section.active,
[data-bs-theme="light"] #viewTreatmentModal .collapsible-section.active,
[data-bs-theme="light"] .collapsible-section.active,
[data-bs-theme="light"] #editTreatmentModal .collapsible-section.active,
[data-bs-theme="light"] .collapsible-section.active,
[data-bs-theme="light"] #addTreatmentModal .collapsible-section.active,
[data-bs-theme="light"] .collapsible-section.active {
    border-color: rgba(13, 110, 253, 0.42) !important;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.08), inset 0 0 0 1px rgba(13, 110, 253, 0.1);
}

#viewPatientModalBody .collapsible-section > .section-header,
#editPatientModalBody .collapsible-section > .section-header,
.view-patient-container .collapsible-section > .section-header,
#viewTreatmentModal .collapsible-section > .section-header .collapsible-section > .section-header,
#editTreatmentModal .collapsible-section > .section-header .collapsible-section > .section-header,
#addTreatmentModal .collapsible-section > .section-header .collapsible-section > .section-header {
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

[data-bs-theme="light"] #viewPatientModalBody .collapsible-section > .section-header,
[data-bs-theme="light"] #editPatientModalBody .collapsible-section > .section-header,
[data-bs-theme="light"] .view-patient-container .collapsible-section > .section-header,
[data-bs-theme="light"] #viewTreatmentModal .collapsible-section > .section-header,
[data-bs-theme="light"] .collapsible-section > .section-header,
[data-bs-theme="light"] #editTreatmentModal .collapsible-section > .section-header,
[data-bs-theme="light"] .collapsible-section > .section-header,
[data-bs-theme="light"] #addTreatmentModal .collapsible-section > .section-header,
[data-bs-theme="light"] .collapsible-section > .section-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-bs-theme="light"] .collapsible-section {
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    cursor: pointer;
    background: #08151d;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    outline: none;
}

.section-header:focus,
.section-header:focus-visible {
    outline: none;
    box-shadow: none;
}

[data-bs-theme="light"] .section-header {
    background: #fbfbfb;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.473) !important;
}

[data-bs-theme="light"] .section-header:hover {
    background: #fbfbfb;
}

[data-bs-theme="light"] .section-header:hover {
    background: #bfbfbf65;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
}

.section-title.section-title--with-inline-warning {
    flex-wrap: wrap;
    row-gap: 0.35rem;
}

[data-bs-theme="light"] .section-title {
    color: #000000b9;
}

/* Active section header fill — outer border/glow is on .collapsible-section.active */
[data-bs-theme="dark"] #viewPatientModalBody .collapsible-section.active > .section-header,
[data-bs-theme="dark"] #editPatientModalBody .collapsible-section.active > .section-header,
[data-bs-theme="dark"] .view-patient-container .collapsible-section.active > .section-header,
[data-bs-theme="dark"] #viewTreatmentModal .collapsible-section.active > .section-header,
[data-bs-theme="dark"] .collapsible-section.active > .section-header,
[data-bs-theme="dark"] #editTreatmentModal .collapsible-section.active > .section-header,
[data-bs-theme="dark"] .collapsible-section.active > .section-header,
[data-bs-theme="dark"] #addTreatmentModal .collapsible-section.active > .section-header,
[data-bs-theme="dark"] .collapsible-section.active > .section-header {
    background: rgba(0, 100, 180, 0.32) !important;
    border-bottom-color: rgba(0, 186, 255, 0.35) !important;
}

[data-bs-theme="light"] #viewPatientModalBody .collapsible-section.active > .section-header,
[data-bs-theme="light"] #editPatientModalBody .collapsible-section.active > .section-header,
[data-bs-theme="light"] .view-patient-container .collapsible-section.active > .section-header,
[data-bs-theme="light"] #viewTreatmentModal .collapsible-section.active > .section-header,
[data-bs-theme="light"] .collapsible-section.active > .section-header,
[data-bs-theme="light"] #editTreatmentModal .collapsible-section.active > .section-header,
[data-bs-theme="light"] .collapsible-section.active > .section-header,
[data-bs-theme="light"] #addTreatmentModal .collapsible-section.active > .section-header,
[data-bs-theme="light"] .collapsible-section.active > .section-header {
    background: rgba(13, 110, 253, 0.1) !important;
    border-bottom-color: rgba(13, 110, 253, 0.28) !important;
}

.section-title i {
    color: #ffffff;
    font-size: 1.1rem;
}

#viewPatientModal .section-title,
#viewPatientModalBody .section-title,
#editPatientModalBody .section-title,
#editPatientModal .section-title,
#addPatientModal .section-title,
#addPatientModalIndex .section-title,
#viewConversationModal .section-title,
#viewTreatmentModal .section-title,
#editTreatmentModal .section-title,
#addTreatmentModal .section-title {
    font-weight: 700;
    color: #ffffff;
}

#viewPatientModal .section-title strong,
#viewPatientModalBody .section-title strong,
#editPatientModalBody .section-title strong,
#editPatientModal .section-title strong,
#addPatientModal .section-title strong,
#addPatientModalIndex .section-title strong,
#viewConversationModal .section-title strong,
#viewTreatmentModal .section-title strong,
#editTreatmentModal .section-title strong,
#addTreatmentModal .section-title strong {
    color: #ffffff;
}

[data-bs-theme="light"] .section-title i {
    color: #6b7280;
}

[data-bs-theme="light"] #viewPatientModal .section-title,
[data-bs-theme="light"] #viewPatientModalBody .section-title,
[data-bs-theme="light"] #editPatientModalBody .section-title,
[data-bs-theme="light"] #editPatientModal .section-title,
[data-bs-theme="light"] #addPatientModal .section-title,
[data-bs-theme="light"] #addPatientModalIndex .section-title,
[data-bs-theme="light"] #viewConversationModal .section-title,
[data-bs-theme="light"] #viewTreatmentModal .section-title,
[data-bs-theme="light"] #editTreatmentModal .section-title,
[data-bs-theme="light"] #addTreatmentModal .section-title,
[data-bs-theme="light"] #viewPatientModal .section-title strong,
[data-bs-theme="light"] #viewPatientModalBody .section-title strong,
[data-bs-theme="light"] #editPatientModalBody .section-title strong,
[data-bs-theme="light"] #editPatientModal .section-title strong,
[data-bs-theme="light"] #addPatientModal .section-title strong,
[data-bs-theme="light"] #addPatientModalIndex .section-title strong,
[data-bs-theme="light"] #viewConversationModal .section-title strong,
[data-bs-theme="light"] #viewTreatmentModal .section-title strong,
[data-bs-theme="light"] #editTreatmentModal .section-title strong,
[data-bs-theme="light"] #addTreatmentModal .section-title strong {
    color: #1e293b;
}

.toggle-icon {
    color: #00baff !important;
    transition: transform 0.3s ease;
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0.8;
    display: inline-block;
    min-width: 20px;
    text-align: center;
}

[data-bs-theme="light"] .toggle-icon {
    color: #0d6efd !important;
    opacity: 0.7;
}

.section-header:hover .toggle-icon {
    opacity: 1;
}

/* Top-level section chevrons only — not nested travel sub-accordions */
.collapsible-section.active > .section-header:not(.crm-travel-header) > .toggle-icon,
.collapsible-section.active > .section-header:not(.crm-travel-header) .section-title > .toggle-icon {
    transform: rotate(180deg);
}

.crm-treatment-travel-block > .crm-travel-accordion:not(.active) > .crm-travel-header .toggle-icon {
    transform: rotate(0deg);
}

.crm-treatment-travel-block > .crm-travel-accordion.active > .crm-travel-header .toggle-icon {
    transform: rotate(180deg);
}

.section-content {
    display: none;
    padding: 1.5rem;
    background: #08151d !important;
    overflow-anchor: none;
}

#viewPatientModalBody .modal-body-custom,
#editPatientModalBody .modal-body-custom,
#addPatientModalBody .modal-body-custom,
#addPatientModalIndexBody .modal-body-custom {
    overflow-anchor: none;
}

[data-bs-theme="dark"] .section-content {
    display: none;
    padding: 1.5rem;
    background: #08151d !important;
}

[data-bs-theme="light"] .section-content {
    background: #fbfbfb !important;
}

/* Treatment + legacy modals keep display toggle; patient modals use height animation above */
.collapsible-section.active > .section-content {
    display: block;
}

/* Travel sub-accordions (To Hospital / From Hospital / Companion) */
.crm-treatment-travel-block > .crm-travel-accordion {
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.02);
    position: relative;
    z-index: 1;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.crm-treatment-travel-block > .crm-travel-accordion.active,
.crm-treatment-travel-block > .crm-travel-accordion.crm-travel-calendar-open {
    z-index: 30;
}

.crm-treatment-travel-block > .crm-travel-accordion.crm-travel-calendar-open {
    overflow: visible;
}

[data-bs-theme="dark"] .crm-treatment-travel-block > .crm-travel-accordion.active {
    border-color: rgba(0, 186, 255, 0.62) !important;
    box-shadow: 0 0 14px rgba(0, 186, 255, 0.12), inset 0 0 0 1px rgba(0, 186, 255, 0.2);
}

[data-bs-theme="light"] .crm-treatment-travel-block > .crm-travel-accordion.active {
    border-color: rgba(13, 110, 253, 0.42) !important;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.08), inset 0 0 0 1px rgba(13, 110, 253, 0.1);
}

[data-bs-theme="light"] .crm-treatment-travel-block > .crm-travel-accordion {
    border-color: rgba(0, 0, 0, 0.1);
    background: #f8f9fa;
}

.crm-treatment-travel-block > .crm-travel-accordion .crm-travel-header {
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
}

.crm-treatment-travel-block > .crm-travel-accordion .crm-travel-header .section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.crm-treatment-travel-block > .crm-travel-accordion .crm-travel-header .section-title .toggle-icon {
    order: 2;
    margin-left: auto;
}

[data-bs-theme="light"] .crm-treatment-travel-block > .crm-travel-accordion .crm-travel-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-bs-theme="dark"] .crm-treatment-travel-block > .crm-travel-accordion.active > .crm-travel-header {
    background: rgba(0, 100, 180, 0.32) !important;
    border-bottom-color: rgba(0, 186, 255, 0.35) !important;
}

[data-bs-theme="light"] .crm-treatment-travel-block > .crm-travel-accordion.active > .crm-travel-header {
    background: rgba(13, 110, 253, 0.1) !important;
    border-bottom-color: rgba(13, 110, 253, 0.28) !important;
}

.crm-treatment-travel-block > .crm-travel-accordion > .crm-travel-panel {
    display: block !important;
    max-height: 0;
    overflow: hidden;
    padding: 0 1rem;
    opacity: 0;
    box-sizing: border-box;
    transition: max-height 0.26s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.22s ease,
                padding 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.crm-treatment-travel-block > .crm-travel-accordion.active > .crm-travel-panel,
.crm-treatment-travel-block > .crm-travel-accordion.crm-travel-calendar-open > .crm-travel-panel {
    max-height: 5000px;
    opacity: 1;
    padding: 0.75rem 1rem 0.75rem;
    overflow: visible;
    position: relative;
    z-index: 31;
}

.crm-treatment-travel-block > .crm-travel-accordion.active:not(.crm-accordion-init) > .crm-travel-panel {
    max-height: 5000px;
    opacity: 1;
    padding: 0.75rem 1rem 0.75rem;
}

.crm-treatment-travel-block > .crm-travel-accordion .toggle-icon {
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
}

#editTreatmentModal .modal-body .modal-body,
#addTreatmentModal .modal-body .modal-body {
    position: relative;
}

#editTreatmentModal .flatpickr-calendar.open .flatpickr-calendar.open,
#addTreatmentModal .flatpickr-calendar.open .flatpickr-calendar.open {
    position: absolute !important;
    z-index: 100000 !important;
    margin: 0 !important;
}

#editTreatmentModal .flatpickr-calendar.static .flatpickr-calendar.static,
#addTreatmentModal .flatpickr-calendar.static .flatpickr-calendar.static {
    position: absolute !important;
}

/* flatpickr z-index for travel — see flatpickr-hospitals-parity.css */

/* Treatment companion table (Hospitals Emergency Contact parity) */
.crm-travel-companions-table-wrap {
    width: 100%;
}

.crm-travel-companions-table {
    width: 100%;
}

#viewPatientModal .crm-travel-companions-table.table-sm > :not(caption) > * > *,
#viewPatientModalBody .crm-travel-companions-table.table-sm > :not(caption) > * > *,
.view-patient-container .crm-travel-companions-table.table-sm > :not(caption) > * > *,
#viewPatientModal .crm-travel-companions-table th,
#viewPatientModal .crm-travel-companions-table td,
#viewPatientModalBody .crm-travel-companions-table th,
#viewPatientModalBody .crm-travel-companions-table td,
.view-patient-container .crm-travel-companions-table th,
.view-patient-container .crm-travel-companions-table td {
    padding: 6px 12px;
}

.crm-treatment-travel-block .crm-travel-companion-alert {
    border-color: rgba(13, 202, 240, 0.35);
    background: rgba(13, 202, 240, 0.08);
    color: inherit;
}

.crm-treatment-travel-block .crm-travel-companion-row {
    cursor: pointer;
}

.crm-treatment-travel-block .crm-travel-companion-row.table-active {
    --bs-table-bg-state: rgba(13, 110, 253, 0.2);
}

[data-bs-theme="light"] .crm-treatment-travel-block .crm-travel-companion-alert {
    background: rgba(13, 202, 240, 0.12);
}

/* Transport row — pills (2/3) + pick-up switch (1/3), bottoms aligned */
.crm-travel-transport-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    column-gap: 1rem;
    row-gap: 0.2rem;
    align-items: end;
}

.crm-travel-transport-row__label,
.crm-travel-transport-row__flight-label {
    grid-row: 1;
    margin-bottom: 0.35rem !important;
    padding-bottom: 0;
    line-height: 1.25;
    align-self: end;
}

.crm-travel-transport-row__label {
    grid-column: 1;
}

.crm-travel-transport-row__flight-label {
    grid-column: 2;
}

.crm-travel-transport-row__modes {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    align-self: end;
}

.crm-travel-transport-row__flight {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
    min-width: 0;
}

.crm-travel-flight-row--hidden,
.crm-travel-return-flight-row.crm-travel-flight-row--hidden {
    visibility: hidden;
    pointer-events: none;
}

.crm-travel-pickup-row {
    min-width: 0;
}

.crm-travel-legs-row {
    --bs-gutter-x: 1rem;
}

.crm-travel-leg-panel {
    height: 100%;
    border: 1px solid rgba(0, 186, 255, 0.22);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.crm-travel-leg-panel__heading {
    padding: 0.55rem 0.85rem;
    font-weight: 700;
    font-size: 0.84rem;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.18);
}

#viewTreatmentModal .crm-travel-leg-panel__heading > i,
#editTreatmentModal .crm-travel-leg-panel__heading > i,
#addTreatmentModal .crm-travel-leg-panel__heading > i {
    color: #00baff;
}

.crm-travel-leg-panel__body {
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.crm-travel-leg-panel__body > div {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.crm-travel-leg-panel__body .form-label {
    margin-bottom: 0.35rem;
}

[data-bs-theme="light"] .crm-travel-leg-panel {
    border-color: rgba(13, 110, 253, 0.22);
    background: rgba(13, 110, 253, 0.03);
}

[data-bs-theme="light"] .crm-travel-leg-panel__heading {
    color: #1e293b;
    border-bottom-color: rgba(0, 0, 0, 0.06);
    background: rgba(13, 110, 253, 0.05);
}

.crm-treatment-travel-block .form-control:not([type="file"]),
.crm-treatment-travel-block .flatpickr-wrapper input.form-control.input,
.crm-treatment-travel-block .flatpickr-wrapper input.form-control.flatpickr-input[readonly],
.crm-treatment-travel-block input.flatpickr-alt-input.form-control {
    background: #172635 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

.crm-treatment-travel-block .form-control:not([type="file"]):focus,
.crm-treatment-travel-block .flatpickr-wrapper input.form-control.input:focus,
.crm-treatment-travel-block .flatpickr-wrapper input.form-control.flatpickr-input[readonly]:focus,
.crm-treatment-travel-block input.flatpickr-alt-input.form-control:focus {
    background: #1a2930 !important;
    border-color: #00baff !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 186, 255, 0.25) !important;
    color: #ffffff !important;
}

[data-bs-theme="light"] .crm-treatment-travel-block .form-control:not([type="file"]),
[data-bs-theme="light"] .crm-treatment-travel-block .flatpickr-wrapper input.form-control.input,
[data-bs-theme="light"] .crm-treatment-travel-block .flatpickr-wrapper input.form-control.flatpickr-input[readonly],
[data-bs-theme="light"] .crm-treatment-travel-block input.flatpickr-alt-input.form-control {
    background: #f0f0f0 !important;
    border-color: #c8c8c8 !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .crm-treatment-travel-block .form-control:not([type="file"]):focus,
[data-bs-theme="light"] .crm-treatment-travel-block .flatpickr-wrapper input.form-control.input:focus,
[data-bs-theme="light"] .crm-treatment-travel-block .flatpickr-wrapper input.form-control.flatpickr-input[readonly]:focus,
[data-bs-theme="light"] .crm-treatment-travel-block input.flatpickr-alt-input.form-control:focus {
    background: #ffffff !important;
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
    color: #212529 !important;
}

@media (max-width: 767.98px) {
    .crm-travel-transport-row {
        grid-template-columns: 1fr;
    }

    .crm-travel-transport-row__flight {
        grid-column: 1;
        grid-row: 3;
    }
}

/* Transport type — horizontal pill chips (icon + label inline) */
.crm-travel-mode-field .crm-travel-mode-picker {
    width: 100%;
}

.crm-travel-mode-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.45rem;
}

.crm-travel-mode-btn {
    flex: 1 1 0;
    min-width: 4.75rem;
    min-height: 2.75rem;
    padding: 0.4rem 0.65rem 0.4rem 0.45rem;
    border: 1px solid rgba(0, 186, 255, 0.32);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.72);
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
    line-height: 1.2;
}

.crm-travel-mode-btn-icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(0, 186, 255, 0.1);
    color: rgba(125, 211, 252, 0.95);
    transition: background 0.18s ease, color 0.18s ease;
}

.crm-travel-mode-btn-icon i {
    font-size: 0.95rem;
    line-height: 1;
}

.crm-travel-mode-btn-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.crm-travel-mode-btn:hover:not(.selected):not(.crm-travel-mode-btn--readonly) {
    border-color: rgba(0, 186, 255, 0.55);
    background: rgba(0, 186, 255, 0.07);
    color: rgba(255, 255, 255, 0.92);
    transform: translateY(-1px);
}

.crm-travel-mode-btn:hover:not(.selected):not(.crm-travel-mode-btn--readonly) .crm-travel-mode-btn-icon {
    background: rgba(0, 186, 255, 0.18);
    color: #7dd3fc;
}

.crm-travel-mode-btn.selected {
    border-color: rgba(0, 186, 255, 0.65);
    background: linear-gradient(135deg, rgba(0, 186, 255, 0.28) 0%, rgba(99, 102, 241, 0.22) 100%);
    color: #f0f9ff;
    box-shadow: 0 2px 10px rgba(0, 186, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.crm-travel-mode-btn.selected:hover,
.crm-travel-mode-btn.selected:focus-visible {
    border-color: rgba(0, 186, 255, 0.78);
    background: linear-gradient(135deg, rgba(0, 186, 255, 0.32) 0%, rgba(99, 102, 241, 0.26) 100%);
    color: #f0f9ff;
    box-shadow: 0 2px 14px rgba(0, 186, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transform: none;
}

.crm-travel-mode-btn.selected .crm-travel-mode-btn-icon {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.crm-travel-mode-btn.selected:hover .crm-travel-mode-btn-icon,
.crm-travel-mode-btn.selected:focus-visible .crm-travel-mode-btn-icon {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.crm-travel-mode-btn--readonly {
    cursor: default;
    pointer-events: none;
}

.crm-travel-mode-picker--readonly .crm-travel-mode-btn:not(.selected) {
    opacity: 0.55;
}

[data-bs-theme="light"] .crm-travel-mode-btn {
    border-color: rgba(13, 110, 253, 0.28);
    background: rgba(255, 255, 255, 0.85);
    color: rgba(33, 37, 41, 0.78);
}

[data-bs-theme="light"] .crm-travel-mode-btn-icon {
    background: rgba(13, 110, 253, 0.1);
    color: #0d6efd;
}

[data-bs-theme="light"] .crm-travel-mode-btn:hover:not(.selected):not(.crm-travel-mode-btn--readonly) {
    border-color: rgba(13, 110, 253, 0.5);
    background: rgba(13, 110, 253, 0.06);
    color: #212529;
}

[data-bs-theme="light"] .crm-travel-mode-btn.selected {
    border-color: rgba(13, 110, 253, 0.55);
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.16) 0%, rgba(99, 102, 241, 0.12) 100%);
    color: #0c4a6e;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

[data-bs-theme="light"] .crm-travel-mode-btn.selected .crm-travel-mode-btn-icon {
    background: #0d6efd;
    color: #fff;
}

[data-bs-theme="light"] .crm-travel-mode-btn.selected:hover,
[data-bs-theme="light"] .crm-travel-mode-btn.selected:focus-visible {
    border-color: rgba(13, 110, 253, 0.68);
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.2) 0%, rgba(99, 102, 241, 0.14) 100%);
    box-shadow: 0 2px 12px rgba(13, 110, 253, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

/* Feature switch — shiny panel with inline toggle (Minor / Pick Up pattern) */
.crm-feature-switch {
    display: block;
    width: 100%;
    margin: 0;
    cursor: pointer;
    user-select: none;
}

.crm-feature-switch--readonly {
    cursor: default;
    pointer-events: none;
}

.crm-feature-switch--disabled {
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.62;
}

.crm-feature-switch--readonly .crm-feature-switch__status {
    white-space: nowrap;
    max-width: none;
    text-align: right;
}

.crm-feature-switch__input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.crm-feature-switch__panel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(
        125deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(120, 130, 145, 0.08) 45%,
        rgba(0, 0, 0, 0.22) 100%
    );
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.crm-feature-switch__glow {
    position: absolute;
    top: -35%;
    right: -8%;
    width: 42%;
    height: 130%;
    background: radial-gradient(ellipse at center, rgba(0, 186, 255, 0.2) 0%, transparent 72%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.crm-feature-switch__icon {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.55);
    font-size: 1.1rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.crm-feature-switch__body {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.crm-feature-switch__title {
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.92);
}

.crm-feature-switch__hint {
    font-size: 0.7rem;
    line-height: 1.25;
    color: rgba(255, 255, 255, 0.52);
}

.crm-feature-switch__track {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 2.5rem;
    height: 1.45rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.14);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.crm-feature-switch__thumb {
    position: absolute;
    top: 50%;
    left: 0.14rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
    transform: translateY(-50%);
    transition: left 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.crm-feature-switch:not(.is-on):hover .crm-feature-switch__panel,
.crm-feature-switch__input:not(:checked) + .crm-feature-switch__panel:hover {
    border-color: rgba(255, 255, 255, 0.16);
    background: linear-gradient(
        125deg,
        rgba(255, 255, 255, 0.06) 0%,
        rgba(120, 130, 145, 0.1) 45%,
        rgba(0, 0, 0, 0.2) 100%
    );
}

.crm-feature-switch.is-on:hover .crm-feature-switch__panel,
.crm-feature-switch__input:checked + .crm-feature-switch__panel:hover {
    border-color: rgba(0, 186, 255, 0.78);
    background: linear-gradient(
        125deg,
        rgba(0, 186, 255, 0.3) 0%,
        rgba(99, 102, 241, 0.2) 52%,
        rgba(0, 0, 0, 0.08) 100%
    );
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.crm-feature-switch.is-on .crm-feature-switch__panel,
.crm-feature-switch__input:checked + .crm-feature-switch__panel {
    border-color: rgba(0, 186, 255, 0.62);
    background: linear-gradient(
        125deg,
        rgba(0, 186, 255, 0.24) 0%,
        rgba(99, 102, 241, 0.16) 52%,
        rgba(0, 0, 0, 0.08) 100%
    );
    box-shadow: 0 0 16px rgba(0, 186, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.crm-feature-switch.is-on .crm-feature-switch__glow,
.crm-feature-switch__input:checked + .crm-feature-switch__panel .crm-feature-switch__glow {
    opacity: 1;
}

.crm-feature-switch.is-on .crm-feature-switch__icon,
.crm-feature-switch__input:checked + .crm-feature-switch__panel .crm-feature-switch__icon {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.crm-feature-switch.is-on .crm-feature-switch__track,
.crm-feature-switch__input:checked + .crm-feature-switch__panel .crm-feature-switch__track {
    background: rgba(0, 186, 255, 0.55);
    border-color: rgba(0, 186, 255, 0.75);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.35);
}

.crm-feature-switch.is-on .crm-feature-switch__thumb,
.crm-feature-switch__input:checked + .crm-feature-switch__panel .crm-feature-switch__thumb {
    left: calc(100% - 1.05rem - 0.14rem);
    background: #fff;
    box-shadow: 0 0 8px rgba(0, 186, 255, 0.45);
}

.crm-feature-switch__status {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: right;
    white-space: nowrap;
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    border: 1px solid transparent;
}

.crm-feature-switch__status--yes {
    color: #e0f2fe;
    background: rgba(0, 186, 255, 0.2);
    border-color: rgba(0, 186, 255, 0.35);
}

.crm-feature-switch__status--no {
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="light"] .crm-feature-switch__panel {
    border-color: rgba(15, 23, 42, 0.12);
    background: linear-gradient(125deg, #f3f4f6 0%, #e5e7eb 52%, #f8fafc 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-bs-theme="light"] .crm-feature-switch__icon {
    background: rgba(15, 23, 42, 0.06);
    color: #94a3b8;
}

[data-bs-theme="light"] .crm-feature-switch__status--yes {
    color: #0369a1;
    background: rgba(13, 110, 253, 0.12);
    border-color: rgba(13, 110, 253, 0.28);
}

[data-bs-theme="light"] .crm-feature-switch__status--no {
    color: #64748b;
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.1);
}

[data-bs-theme="light"] .crm-feature-switch__title {
    color: #0f172a;
}

[data-bs-theme="light"] .crm-feature-switch__hint {
    color: #64748b;
}

[data-bs-theme="light"] .crm-feature-switch.is-on .crm-feature-switch__icon,
[data-bs-theme="light"] .crm-feature-switch__input:checked + .crm-feature-switch__panel .crm-feature-switch__icon {
    background: rgba(13, 110, 253, 0.12);
    color: #0d6efd;
}

[data-bs-theme="light"] .crm-feature-switch__track {
    background: rgba(15, 23, 42, 0.08);
    border-color: rgba(15, 23, 42, 0.12);
}

[data-bs-theme="light"] .crm-feature-switch.is-on .crm-feature-switch__panel,
[data-bs-theme="light"] .crm-feature-switch__input:checked + .crm-feature-switch__panel {
    border-color: rgba(13, 110, 253, 0.5);
    background: linear-gradient(125deg, rgba(13, 110, 253, 0.14) 0%, rgba(99, 102, 241, 0.08) 55%, #fff 100%);
    box-shadow: 0 0 12px rgba(13, 110, 253, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-bs-theme="light"] .crm-feature-switch.is-on:hover .crm-feature-switch__panel,
[data-bs-theme="light"] .crm-feature-switch__input:checked + .crm-feature-switch__panel:hover {
    border-color: rgba(13, 110, 253, 0.65);
    background: linear-gradient(125deg, rgba(13, 110, 253, 0.18) 0%, rgba(99, 102, 241, 0.1) 55%, #fff 100%);
    box-shadow: 0 0 16px rgba(13, 110, 253, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

[data-bs-theme="light"] .crm-feature-switch.is-on .crm-feature-switch__track,
[data-bs-theme="light"] .crm-feature-switch__input:checked + .crm-feature-switch__panel .crm-feature-switch__track {
    background: #0d6efd;
    border-color: #0d6efd;
}

/* Legacy TravelDate/ReturnDate — never show in UI (synced from datetime fields in JS) */
input.crm-travel-compat-travel-date,
input.crm-travel-compat-return-date {
    display: none !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Specific background for Contact with Patient section */
.data-tables-section,
.section-content .table {
    background-color: #162126 !important;
}

[data-bs-theme="light"] .data-tables-section,
[data-bs-theme="light"] .section-content .table {
    background-color: #fbfbfb !important;
}

/* View Treatment Modal Styles — shell layout in treatment_modal.css */
#viewTreatmentModal .modal-header,
#editTreatmentModal .modal-header,
#addTreatmentModal .modal-header {
    background: #08151d !important;
    border-bottom: 1px solid #2a3f5f;
}

[data-bs-theme="light"] #viewTreatmentModal .modal-header {
    background: #f0f0f0 !important;
    border-bottom: 1px solid rgba(13, 110, 253, 0.1);
}

#viewTreatmentModal .modal-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
}

[data-bs-theme="light"] #viewTreatmentModal .modal-title {
    color: #000000b9;
}

#viewTreatmentModal .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

[data-bs-theme="light"] #viewTreatmentModal .btn-close {
    filter: none;
    opacity: 1;
}

#viewTreatmentModal .modal-body,
#viewTreatmentModal .modal-body-custom {
    background: #08151d;
    color: #ffffff;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
}

[data-bs-theme="light"] #viewTreatmentModal .modal-body,
[data-bs-theme="light"] #viewTreatmentModal .modal-body-custom {
    background: #f0f0f0;
    color: #212529;
}

/* Light theme: set footer background for View Treatment modal */
[data-bs-theme="light"] #viewTreatmentModal .custom-modal-footer {
    background: #f0f0f0 !important;
    color: #212529 !important;
}

/* Dark theme: set footer background for View Treatment modal */
[data-bs-theme="dark"] #viewTreatmentModal .custom-modal-footer {
    background: #08151d !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #e2e8f0 !important;
}

/* Treatment Modal Section Styles */
#viewTreatmentModal .collapsible-section {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background: #0f1e26;
}

[data-bs-theme="light"] #viewTreatmentModal .collapsible-section {
    background: #f8f9fa;
}

#viewTreatmentModal .section-header {
    background: #08151d;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: none;
    transition: all 0.3s ease;
}

#viewTreatmentModal .collapsible-section.active > .section-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

[data-bs-theme="light"] #viewTreatmentModal .section-header {
    background: #fbfbfb;
    border-bottom: none;
}

[data-bs-theme="light"] #viewTreatmentModal .collapsible-section.active > .section-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}


[data-bs-theme="light"] #viewTreatmentModal .section-header:hover {
    background: #e9ecef;
}

#viewTreatmentModal .section-content .section-content {
    background: #0a1419;
}

[data-bs-theme="light"] #viewTreatmentModal .section-content,
[data-bs-theme="light"] .section-content {
    background: #ffffff;
}

#viewTreatmentModal .form-control,
#viewTreatmentModal .input-group-text {
    background: #172635;
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-bs-theme="light"] #viewTreatmentModal .form-control,
[data-bs-theme="light"] #viewTreatmentModal .input-group-text {
    background: #f0f0f0;
    border-color: #c8c8c8;
    color: #212529;
}

#viewTreatmentModal .form-control:focus {
    background: #1a2930;
    border-color: #00baff;
    box-shadow: 0 0 0 0.2rem rgba(0, 186, 255, 0.25);
    color: #ffffff;
}

[data-bs-theme="light"] #viewTreatmentModal .form-control:focus {
    background: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    color: #212529;
}

#viewPatientModal .form-label,
#viewPatientModalBody .form-label,
#editPatientModalBody .form-label,
#editPatientModal .form-label,
#addPatientModal .form-label,
#addPatientModalIndex .form-label,
#viewConversationModal .form-label,
#viewTreatmentModal .form-label,
#editTreatmentModal .form-label,
#addTreatmentModal .form-label {
    color: #f8fafc;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

#viewPatientModal .form-label > i,
#viewPatientModalBody .form-label > i,
#editPatientModalBody .form-label > i,
#editPatientModal .form-label > i,
#addPatientModal .form-label > i,
#addPatientModalIndex .form-label > i,
#viewConversationModal .form-label > i,
#viewTreatmentModal .form-label > i,
#editTreatmentModal .form-label > i,
#addTreatmentModal .form-label > i {
    color: #00baff;
}

#viewTreatmentModal .crm-travel-transport-row__label,
#viewTreatmentModal .crm-travel-transport-row__flight-label,
#editTreatmentModal .crm-travel-transport-row__label,
#editTreatmentModal .crm-travel-transport-row__flight-label,
#addTreatmentModal .crm-travel-transport-row__label,
#addTreatmentModal .crm-travel-transport-row__flight-label {
    margin-bottom: 0.35rem !important;
}

#viewTreatmentModal .crm-travel-transport-row__label > i,
#viewTreatmentModal .crm-travel-transport-row__flight-label > i,
#editTreatmentModal .crm-travel-transport-row__label > i,
#editTreatmentModal .crm-travel-transport-row__flight-label > i,
#addTreatmentModal .crm-travel-transport-row__label > i,
#addTreatmentModal .crm-travel-transport-row__flight-label > i {
    color: #00baff;
}

[data-bs-theme="light"] #viewPatientModal .form-label,
[data-bs-theme="light"] #viewPatientModalBody .form-label,
[data-bs-theme="light"] #editPatientModalBody .form-label,
[data-bs-theme="light"] #editPatientModal .form-label,
[data-bs-theme="light"] #addPatientModal .form-label,
[data-bs-theme="light"] #addPatientModalIndex .form-label,
[data-bs-theme="light"] #viewConversationModal .form-label,
[data-bs-theme="light"] #viewTreatmentModal .form-label,
[data-bs-theme="light"] #editTreatmentModal .form-label,
[data-bs-theme="light"] #addTreatmentModal .form-label {
    color: #1e293b;
}

[data-bs-theme="light"] #viewPatientModal .form-label > i,
[data-bs-theme="light"] #viewPatientModalBody .form-label > i,
[data-bs-theme="light"] #editPatientModalBody .form-label > i,
[data-bs-theme="light"] #editPatientModal .form-label > i,
[data-bs-theme="light"] #addPatientModal .form-label > i,
[data-bs-theme="light"] #addPatientModalIndex .form-label > i,
[data-bs-theme="light"] #viewConversationModal .form-label > i,
[data-bs-theme="light"] #viewTreatmentModal .form-label > i,
[data-bs-theme="light"] #editTreatmentModal .form-label > i,
[data-bs-theme="light"] #addTreatmentModal .form-label > i {
    color: #0284c7;
}

/* Attachments Container */
#viewTreatmentModal .attachments-container {
    padding: 1rem;
    background: #172635;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-bs-theme="light"] #viewTreatmentModal .attachments-container {
    background: #f0f0f0;
    border: 1px solid #c8c8c8;
}

#viewTreatmentModal .attachments-container img {
    border: 2px solid rgba(0, 186, 255, 0.3);
    transition: all 0.3s ease;
}

#viewTreatmentModal .attachments-container img:hover {
    border-color: #00baff;
    transform: scale(1.05);
}

[data-bs-theme="light"] #viewTreatmentModal .attachments-container img {
    border: 2px solid rgba(13, 110, 253, 0.3);
}

[data-bs-theme="light"] #viewTreatmentModal .attachments-container img:hover {
    border-color: #0d6efd;
}

/* Edit Treatment Button */
.btn-edit-treatment {
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    border: none;
    border-radius: 5px;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);
    font-size: 0.9rem;
    padding: 0.2rem 1rem;

    white-space: nowrap;
    height: 30px !important;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);

}

.btn-edit-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;

}

.btn-edit-treatment:active {
    transform: translateY(0) !important;
}

[data-bs-theme="light"] .btn-edit-treatment {
    color: white;
    border: none;
    border-radius: 5px;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);



}

[data-bs-theme="light"] .btn-edit-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

/* Download Files Buttons */
/* Download Files Buttons (view treatment modal) */
.btn-download-files,
#viewTreatmentModal .btn-download-files .btn-download-files {
    font-size: 0.9rem !important;
    padding: 0.6rem 1rem !important;
    white-space: nowrap !important;
    color: #00baff !important;
    background: rgba(0, 186, 255, 0.05) !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.25) !important;
    font-weight: 500 !important;
    border: 1px solid #00baff !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center !important;
    transition: all 0.25s ease !important;
}

.btn-download-files:hover,
#viewTreatmentModal .btn-download-files:hover .btn-download-files:hover {
    transform: scale(1.05) !important;
    color: #ffffff !important;
    background-color: #00baff !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

/* Ensure light-theme variant matches desired accent */
[data-bs-theme="light"] .btn-download-files,
[data-bs-theme="light"] #viewTreatmentModal .btn-download-files,
[data-bs-theme="light"] .btn-download-files {
    color: #00baff !important;
    background: rgba(0, 186, 255, 0.05) !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.25) !important;
    border-color: #00baff !important;
}

[data-bs-theme="light"] .btn-download-files:hover,
[data-bs-theme="light"] #viewTreatmentModal .btn-download-files:hover,
[data-bs-theme="light"] .btn-download-files:hover {
    background-color: #00baff !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

/* View Treatment Button in Table */
.btn-view-treatment {
    color: white !important;
    border: none !important;
    border-radius: 5px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4) !important;
    white-space: nowrap;
    font-size: 0.9rem;
    padding: 0.2rem 1rem;
    font-weight: 500;
    height: 30px !important;    
}

.btn-view-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

[data-bs-theme="light"] .btn-view-treatment {
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4) !important;
}

[data-bs-theme="light"] .btn-view-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

/* Edit Treatment Modal Styles — shell layout in treatment_modal.css */
#editTreatmentModal .modal-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
}

[data-bs-theme="light"] #editTreatmentModal .modal-title {
    color: #000000b9;
}

#editTreatmentModal .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

[data-bs-theme="light"] #editTreatmentModal .btn-close {
    filter: none;
    opacity: 1;
}

#editTreatmentModal .modal-body,
#editTreatmentModal .modal-body-custom {
    background: #08151d;
    color: #ffffff;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
}

[data-bs-theme="light"] #editTreatmentModal .modal-body,
[data-bs-theme="light"] #editTreatmentModal .modal-body-custom {
    background: #f0f0f0;
    color: #212529;
}

/* Edit Treatment Modal Section Styles */
#editTreatmentModal .collapsible-section {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background: #0f1e26;
}

#editTreatmentModal .collapsible-section.active > .section-content:has(.crm-treatment-travel-block) .collapsible-section.active > .section-content:has(.crm-treatment-travel-block),
#addTreatmentModal .collapsible-section.active > .section-content:has(.crm-treatment-travel-block) .collapsible-section.active > .section-content:has(.crm-treatment-travel-block) {
    overflow: visible;
}

[data-bs-theme="light"] #editTreatmentModal .collapsible-section {
    background: #f8f9fa;
}

#editTreatmentModal .section-header {
    background: #08151d;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

[data-bs-theme="light"] #editTreatmentModal .section-header {
    background: #fbfbfb;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#editTreatmentModal .section-header:hover {
    background: #08151d;
}

[data-bs-theme="light"] #editTreatmentModal .section-header:hover {
    background: #e9ecef;
}

/* Move the chevron/toggle icon to the right for edit modal headers */
#editTreatmentModal .section-header {
    display: flex;
    align-items: center;
}

#editTreatmentModal .section-header:not(.crm-travel-header) .section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

#editTreatmentModal .section-header:not(.crm-travel-header) .section-title .toggle-icon {
    order: 2;
    margin-left: auto;
}

/* Also ensure the chevron is on the right for the index page's edit modal instance */ .section-header {
    display: flex;
    align-items: center;
} .section-header:not(.crm-travel-header) .section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
} .section-header:not(.crm-travel-header) .section-title .toggle-icon {
    order: 2;
    margin-left: auto;
}

/* Move the chevron to the right for view and add treatment modals on index page */ .section-header .section-header {
    display: flex;
    align-items: center;
} .section-header:not(.crm-travel-header) .section-title .section-header:not(.crm-travel-header) .section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
} .section-header:not(.crm-travel-header) .section-title .toggle-icon .section-header:not(.crm-travel-header) .section-title .toggle-icon {
    order: 2;
    margin-left: auto;
}


#viewTreatmentModal .section-header:not(.crm-travel-header) .section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

#viewTreatmentModal .section-header:not(.crm-travel-header) .section-title .toggle-icon {
    order: 2;
    margin-left: auto;
}




#addTreatmentModal .section-header:not(.crm-travel-header) .section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

#addTreatmentModal .section-header:not(.crm-travel-header) .section-title .toggle-icon {
    order: 2;
    margin-left: auto;
}






#editTreatmentModal .section-content .section-content {
    background: #0a1419;
}

[data-bs-theme="light"] #editTreatmentModal .section-content,
[data-bs-theme="light"] .section-content {
    background: #ffffff;
}

#editTreatmentModal .form-control,
#editTreatmentModal .input-group-text,
#editTreatmentModal select {
    background: #172635;
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-bs-theme="light"] #editTreatmentModal .form-control,
[data-bs-theme="light"] #editTreatmentModal .input-group-text,
[data-bs-theme="light"] #editTreatmentModal select {
    background: #f0f0f0;
    border-color: #c8c8c8;
    color: #212529;
}

#editTreatmentModal .form-control:focus,
#editTreatmentModal select:focus {
    background: #1a2930;
    border-color: #00baff;
    box-shadow: 0 0 0 0.2rem rgba(0, 186, 255, 0.25);
    color: #ffffff;
}

[data-bs-theme="light"] #editTreatmentModal .form-control:focus,
[data-bs-theme="light"] #editTreatmentModal select:focus {
    background: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    color: #212529;
}

#editTreatmentModal .form-label {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

#editTreatmentModal .crm-travel-transport-row__label,
#editTreatmentModal .crm-travel-transport-row__flight-label {
    margin-bottom: 0.35rem !important;
}

[data-bs-theme="light"] #editTreatmentModal .form-label {
    color: #495057;
}

/* Edit Treatment Modal — interactive cursors */
#editTreatmentModal select,
#editTreatmentModal select.form-control select select.form-control {
    cursor: pointer !important;
}

#editTreatmentModal input[type="file"] input[type="file"] {
    cursor: pointer !important;
}

#editTreatmentModal .form-check-input .form-check-input {
    cursor: pointer !important;
}

#editTreatmentModal .form-check-label .form-check-label {
    cursor: pointer !important;
}

#editTreatmentModal .btn,
#editTreatmentModal .btn-close,
#editTreatmentModal a.btn .btn .btn-close a.btn {
    cursor: pointer !important;
}

#editTreatmentModal .priority-badge-option .priority-badge-option {
    cursor: pointer !important;
}

#editTreatmentModal .section-header,
#editTreatmentModal .crm-travel-header .section-header .crm-travel-header {
    cursor: pointer !important;
}

#editTreatmentModal .crm-travel-companion-row .crm-travel-companion-row {
    cursor: pointer !important;
}

#editTreatmentModal input.flatpickr-input,
#editTreatmentModal .crm-travel-datetime,
#editTreatmentModal .flatpickr-wrapper input.form-control input.flatpickr-input .crm-travel-datetime .flatpickr-wrapper input.form-control {
    cursor: pointer !important;
}

#editTreatmentModal input.form-control[readonly]:not(.flatpickr-input):not(.crm-travel-datetime),
#editTreatmentModal .crm-travel-companion-name,
#editTreatmentModal .crm-travel-companion-phone,
#editTreatmentModal .crm-travel-companion-email,
#editTreatmentModal .crm-travel-companion-relation input.form-control[readonly]:not(.flatpickr-input):not(.crm-travel-datetime) .crm-travel-companion-name .crm-travel-companion-phone .crm-travel-companion-email .crm-travel-companion-relation {
    cursor: not-allowed !important;
}

#editTreatmentModal textarea.form-control,
#editTreatmentModal input.form-control:not([type="file"]):not([readonly]),
#editTreatmentModal input[type="number"].form-control textarea.form-control input.form-control:not([type="file"]):not([readonly]) input[type="number"].form-control {
    cursor: text;
}

#editTreatmentModal .flatpickr-calendar .flatpickr-day:not(.flatpickr-disabled):not(.disabled),
#editTreatmentModal .flatpickr-calendar .flatpickr-months .flatpickr-prev-month,
#editTreatmentModal .flatpickr-calendar .flatpickr-months .flatpickr-next-month .flatpickr-calendar .flatpickr-day:not(.flatpickr-disabled):not(.disabled) .flatpickr-calendar .flatpickr-months .flatpickr-prev-month .flatpickr-calendar .flatpickr-months .flatpickr-next-month {
    cursor: pointer !important;
}

/* Modal Action Buttons */
.btn-modal-action {
    font-size: 0.9rem !important;
    padding: 0.6rem 1rem !important;
    white-space: nowrap !important;
    font-weight: 500 !important;
    border-radius: 5px !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    transition: all 0.3s ease !important;
    border: 1px solid !important;
}

.btn-save {
    color: white;
    border-radius: 5px;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);
    border: none !important;

}

.btn-save:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;

}

.btn-cancel {
    color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.05) !important;
    border-color: #dc3545 !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.15) !important;
}


.btn-cancel:hover {
    transform: scale(1.05) !important;
    color: white !important;
    background-color: #dc3545 !important;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.6), 0 0 40px rgba(220, 53, 69, 0.3) !important;
}

[data-bs-theme="light"] .btn-save {
    color: white;
    border: none;
    border-radius: 5px;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);

}

[data-bs-theme="light"] .btn-save:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;

}

[data-bs-theme="light"] .btn-cancel {
    color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.05) !important;
    border-color: #dc3545 !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.15) !important;
}

/* Light theme: keep same delete styling */
[data-bs-theme="light"] .btn-delete-conversation {
    color: #dc3545 !important;
    border: 1px solid #dc3545 !important;
    background: rgba(220, 53, 69, 0.05) !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.15) !important;
}

[data-bs-theme="light"] .btn-delete-conversation:hover {
    background-color: #dc3545 !important;
    color: #fff !important;
    box-shadow: 0 0 20px #dc3545, 0 0 40px rgba(220, 53, 69, 0.3) !important;
}

[data-bs-theme="light"] .btn-cancel:hover {
    background-color: #dc3545 !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(220, 53, 69, 0.6), 0 0 40px rgba(220, 53, 69, 0.3) !important;
}

/* Add Treatment Button */
.btn-add-patient-treatment {
    color: white !important;
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4) !important;
    padding: 0.6rem 1.5rem !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    border: none !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    cursor: pointer !important;
}

.btn-add-patient-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

[data-bs-theme="light"] .btn-add-patient-treatment {
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4) !important;
}

[data-bs-theme="light"] .btn-add-patient-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

/* Add Treatment Modal Button */
.btn-add-treatment {
    color: white !important;
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
    border: none !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4) !important;
}

.btn-add-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    background: linear-gradient(145deg, #0099cc, #0066aa) !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

[data-bs-theme="light"] .btn-add-treatment {
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4) !important;
}

[data-bs-theme="light"] .btn-add-treatment:hover {
    transform: scale(1.05) !important;
    color: white !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}

/* Add Treatment Modal Styles — shell layout in treatment_modal.css */
#addTreatmentModal .modal-title {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 600;
}

[data-bs-theme="light"] #addTreatmentModal .modal-title {
    color: #000000b9;
}

#addTreatmentModal .btn-close {
    filter: invert(1);
    opacity: 0.7;
}

[data-bs-theme="light"] #addTreatmentModal .btn-close {
    filter: none;
    opacity: 1;
}

#addTreatmentModal .modal-body,
#addTreatmentModal .modal-body-custom {
    background: #08151d;
    color: #ffffff;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
}

[data-bs-theme="light"] #addTreatmentModal .modal-body,
[data-bs-theme="light"] #addTreatmentModal .modal-body-custom {
    background: #f0f0f0;
    color: #212529;
}

/* Add Treatment Modal Section Styles */
#addTreatmentModal .collapsible-section {
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background: #0f1e26;
}

[data-bs-theme="light"] #addTreatmentModal .collapsible-section {
    background: #f8f9fa;
}

#addTreatmentModal .section-header {
    background: #08151d;
    padding: 1rem 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

[data-bs-theme="light"] #addTreatmentModal .section-header {
    background: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

#addTreatmentModal .section-header:hover {
    background: #152129;
}

[data-bs-theme="light"] #addTreatmentModal .section-header:hover {
    background: #e9ecef;
}

#addTreatmentModal .section-content .section-content {
    background: #0a1419;
}

[data-bs-theme="light"] #addTreatmentModal .section-content,
[data-bs-theme="light"] .section-content {
    background: #ffffff;
}

#addTreatmentModal .form-control,
#addTreatmentModal .input-group-text,
#addTreatmentModal select {
    background: #172635;
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

[data-bs-theme="light"] #addTreatmentModal .form-control,
[data-bs-theme="light"] #addTreatmentModal .input-group-text,
[data-bs-theme="light"] #addTreatmentModal select {
    background: #f0f0f0;
    border-color: #c8c8c8;
    color: #212529;
}

#addTreatmentModal .form-control:focus,
#addTreatmentModal select:focus {
    background: #1a2930;
    border-color: #00baff;
    box-shadow: 0 0 0 0.2rem rgba(0, 186, 255, 0.25);
    color: #ffffff;
}

[data-bs-theme="light"] #addTreatmentModal .form-control:focus,
[data-bs-theme="light"] #addTreatmentModal select:focus {
    background: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    color: #212529;
}

#addTreatmentModal .form-label {
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

[data-bs-theme="light"] #addTreatmentModal .form-label {
    color: #495057;
}

/* Priority Badge Styles - Matching Patient Page Datatable */
.priority-badges-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.priority-radio {
    display: none;
}

.priority-badge-option {
    cursor: pointer;
    padding: 5px 13px;
    border-radius: 60px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.priority-radio:checked + .priority-badge-option {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 0 10px currentColor;
}

.priority-badge-option:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Badge Pill Base */
.badge-pill {
    background-color: #4a5a6e;
    color: #d5dce6;
    padding: 5px 13px;
    font-size: 12px;
    display: inline-block;
    font-weight: 400;
}


/* Priority High Badge */
.badge-pill.priority-high {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-weight: 500;
    border-radius: 60px;
}

/* Priority Medium Badge */
.badge-pill.priority-medium {
    background: rgba(234, 179, 8, 0.2);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.3);
    font-weight: 500;
    border-radius: 60px;
}

[data-bs-theme="light"] .badge-pill.priority-medium {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
    border: 1px solid #ca8a04;
}

/* Priority Low Badge */
.badge-pill.priority-low {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
    font-weight: 500;
    border-radius: 60px;
}



/* Patient report search input: dark-theme background */
html[data-bs-theme="dark"] input[type="search"].form-control[aria-controls="debtsTable"],
html[data-bs-theme="dark"] .patient-report input[type="search"].form-control,
html[data-bs-theme="dark"] #patient-report input[type="search"].form-control {
    background-color: #08151d !important;
    color: #e6f0f4 !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
}

/* Save Changes Button */
.btn-save-changes {
    color: white;
    border: none;
    border-radius: 5px;
    background: linear-gradient(145deg, #00baff, #0077cc);
    box-shadow: 0 0 10px rgba(0, 186, 255, 0.4);
}

.btn-save-changes:hover {
    transform: scale(1.05) !important;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 0 20px rgba(0, 186, 255, 0.6), 0 0 40px rgba(0, 186, 255, 0.3) !important;
}



.conversation-buttons{
    display: flex;
    gap: 0.55rem;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.crm-conv-treatment-group .conversation-buttons,
.crm-conv-patient-level-group .conversation-buttons {
    display: inline-flex;
    flex-direction: column;
    gap: 0.4rem;
    align-items: stretch;
    width: max-content;
    margin-left: auto;
    flex-wrap: nowrap;
}

.crm-conv-treatment-group .conversation-buttons .btn-view-conversation,
.crm-conv-treatment-group .conversation-buttons .btn-delete-conversation,
.crm-conv-patient-level-group .conversation-buttons .btn-view-conversation,
.crm-conv-patient-level-group .conversation-buttons .btn-delete-conversation {
    width: 100%;
    height: auto !important;
    min-height: unset !important;
    padding: 7px 14px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    display: inline-block !important;
    line-height: normal !important;
    text-align: center;
    box-sizing: border-box;
}

.crm-conv-treatment-group .crm-conv-date-col,
.crm-conv-patient-level-group .crm-conv-date-col {
    width: 6.75rem;
    min-width: 6.75rem;
    max-width: 6.75rem;
    white-space: nowrap;
    word-wrap: normal;
    overflow-wrap: normal;
}

.crm-conv-treatment-group .crm-conv-next-action-cell,
.crm-conv-patient-level-group .crm-conv-next-action-cell {
    padding-right: 0.45rem;
    white-space: nowrap;
}

.crm-conv-treatment-group .crm-conv-next-action-cell .crm-conv-next-action-badge {
    padding: 0.38rem 0.7rem;
    font-size: 0.75rem;
}

.crm-conv-treatment-group .crm-conv-actions-col,
.crm-conv-treatment-group .crm-conv-actions-cell,
.crm-conv-patient-level-group .crm-conv-actions-col,
.crm-conv-patient-level-group .crm-conv-actions-cell {
    width: auto;
    min-width: 6.5rem;
    max-width: 7rem;
    white-space: nowrap;
    padding-left: 0.12rem;
    text-align: right;
    vertical-align: top;
}

.crm-conv-treatment-group {
    margin-top: 1.75rem;
}

.crm-conv-patient-level-group {
    margin-top: 0;
}

.crm-conv-patient-level-group__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.crm-conv-patient-level-group__header > i {
    color: #34d399;
    opacity: 0.95;
}

.crm-conv-patient-level-group__empty {
    padding-left: 0.15rem;
    font-size: 0.9rem;
}

.crm-conv-treatment-groups-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.75rem 0 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.85);
}

.crm-conv-treatment-groups-divider::before,
.crm-conv-treatment-groups-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(148, 163, 184, 0.25);
}

[data-bs-theme="light"] .crm-conv-patient-level-group__header {
    color: #374151;
}

[data-bs-theme="light"] .crm-conv-patient-level-group__header > i {
    color: #059669;
}

[data-bs-theme="light"] .crm-conv-treatment-groups-divider {
    color: #6b7280;
}

[data-bs-theme="light"] .crm-conv-treatment-groups-divider::before,
[data-bs-theme="light"] .crm-conv-treatment-groups-divider::after {
    background: rgba(107, 114, 128, 0.25);
}

.crm-conv-treatment-group:first-child {
    margin-top: 0;
}

.crm-conv-treatment-group:last-child .table {
    margin-bottom: 0;
}

.crm-conv-add-action,
.crm-section-add-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
}

.crm-conv-treatment-group__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="light"] .crm-conv-treatment-group__header {
    color: #374151;
}

/* Table status badges — companions primary, conversation counts */
.crm-table-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
    vertical-align: middle;
}

.crm-table-badge i {
    font-size: 0.7rem;
    opacity: 0.95;
}

.crm-table-badge--primary {
    background: rgba(52, 211, 153, 0.22);
    border-color: rgba(52, 211, 153, 0.65);
    color: #6ee7b7;
    box-shadow: 0 0 14px rgba(52, 211, 153, 0.18);
}

[data-bs-theme="light"] .crm-table-badge--primary {
    background: #d1fae5;
    border-color: #10b981;
    color: #047857;
    box-shadow: none;
}

.crm-table-badge--count {
    min-width: 1.65rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.45);
    color: #cbd5e1;
}

[data-bs-theme="light"] .crm-table-badge--count {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #475569;
}

.crm-companion-set-primary-btn {
    color: #7dd3fc !important;
    border: 1px solid rgba(56, 189, 248, 0.65) !important;
    background: rgba(56, 189, 248, 0.14) !important;
    font-weight: 600;
    font-size: 0.8125rem;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.12);
}

.crm-companion-set-primary-btn:hover,
.crm-companion-set-primary-btn:focus {
    color: #fff !important;
    border-color: transparent !important;
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
    box-shadow: 0 0 14px rgba(0, 186, 255, 0.35);
}

[data-bs-theme="light"] .crm-companion-set-primary-btn {
    color: #0369a1 !important;
    border-color: #0ea5e9 !important;
    background: #e0f2fe !important;
    box-shadow: none;
}

[data-bs-theme="light"] .crm-companion-set-primary-btn:hover,
[data-bs-theme="light"] .crm-companion-set-primary-btn:focus {
    color: #fff !important;
    border-color: transparent !important;
    background: linear-gradient(145deg, #00baff, #0077cc) !important;
}

.view-patient-container .crm-patient-companions-tbody td,
.crm-conv-treatment-group .table td,
.crm-conv-patient-level-group .table td {
    vertical-align: middle;
}

#logFollowupAttemptModal .modal-body {
    padding: 2rem;
    position: relative;
}

#logFollowupAttemptModalIndex .modal-body {
    position: relative;
}

/* Minor checkbox: cyan when checked */
#MinorCheckbox {
    accent-color: #00baff;
}

/* Bootstrap .form-check-input uses custom background/border when checked */
#MinorCheckbox.form-check-input:checked {
    background-color: #00baff;
    border-color: #00baff;
}




html[data-bs-theme="dark"] .flatpickr-day {
  /* background: #c8c8c83d !important; */
  color: #ffffff !important;
  /* border-color: rgba(0,0,0,0.08) !important; */
}
html[data-bs-theme="dark"] .flatpickr-day.selected,
html[data-bs-theme="dark"] .flatpickr-day.startRange,
html[data-bs-theme="dark"] .flatpickr-day.endRange {
  background: #42a5f5 !important; /* keep selected highlight visible */
  color: #fff !important;
}




/* Hovered day — keep circle highlight + white text (parity sheet owns colors) */
html[data-bs-theme="dark"] .flatpickr-day:hover:not(.flatpickr-disabled):not(.disabled) {
  color: #fff !important;
}




/* Make the calendar background (the area behind day circles) use #c8c8c8 in dark theme */
html[data-bs-theme="dark"] .flatpickr-calendar,
html[data-bs-theme="dark"] .flatpickr-months,
html[data-bs-theme="dark"] .flatpickr-days,
html[data-bs-theme="dark"] .flatpickr-innerContainer {
  background: #172635 !important;
  color: #fff !important;
}






        /* Flatpickr month dropdown: default white background for non-selected options,
           with selected/hover states using the green highlight (#42a575). Scoped to this page. */
        .flatpickr-current-month select option,
        a.flatpickr-monthDropdown-month,
        .flatpickr-monthDropdown-months option {
            background-color: #ffffff !important;
            color: #333333 !important;
        }


        .flatpickr-current-month select option:checked,
        .flatpickr-current-month select option[selected],
        .flatpickr-current-month select option:active,
        .flatpickr-monthDropdown-month:hover,
        .flatpickr-monthDropdown-months option:hover {
            background-color: #42a5f5 !important;
            color: #ffffff !important;
        }






        [data-bs-theme="dark"] .flatpickr-current-month select option,
        [data-bs-theme="dark"] a.flatpickr-monthDropdown-month,
        [data-bs-theme="dark"] .flatpickr-monthDropdown-months option {
            background-color: #172635 !important;
            color: #ffffff !important;
        }






        [data-bs-theme="dark"] .flatpickr-current-month select option:checked,
        [data-bs-theme="dark"] .flatpickr-current-month select option[selected],
        [data-bs-theme="dark"] .flatpickr-current-month select option:active,
        [data-bs-theme="dark"] .flatpickr-monthDropdown-month:hover,
        [data-bs-theme="dark"] .flatpickr-monthDropdown-months option:hover {
            background-color: #42a5f5 !important;
            color: #ffffff !important;
        }
       
/* Treatment metadata two-column grid for view modal */
#viewTreatmentModal .treatment-meta-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1.25rem;
    align-items: start;
    margin-left: 0;
    margin-right: 0;
}

#viewTreatmentModal .treatment-meta-row > .col-md-6 {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: none;
    padding-left: 0;
    padding-right: 0;
}

#viewTreatmentModal .treatment-meta-row .crm-treatment-view-value {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 767.98px) {
    #viewTreatmentModal .treatment-meta-row {
        grid-template-columns: 1fr;
    }
}

[data-bs-theme="light"] #viewTreatmentModal .treatment-meta-row .form-control[readonly] {
    background-color: #fff;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}


[data-bs-theme="dark"] #viewTreatmentModal .treatment-meta-row .form-control[readonly] {
    background-color: #172635;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
}


/* Scoped Delete Treatment button style for View Patient modal */
#viewPatientModal .btn-delete-treatment {
    color: #dc3545;
    border: 1px solid #dc3545;
    background: rgba(220, 53, 69, 0.05);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.15);
    transition: background-color 150ms ease, box-shadow 180ms ease, color 150ms ease;
    padding: 0.2rem 1rem !important;
    font-size: 0.9rem !important;
}

#viewPatientModal .btn-delete-treatment:hover {
    background-color: #dc3545 !important;
    box-shadow: 0 0 20px #dc3545, 0 0 40px rgba(220, 53, 69, 0.3) !important;
    color: #ffffff !important;
}

/* Scoped Delete Treatment button style for Edit Patient modal */
#editPatientModal .btn-delete-treatment {
    color: #dc3545;
    border: 1px solid #dc3545;
    background: rgba(220, 53, 69, 0.05);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.15);
    transition: background-color 150ms ease, box-shadow 180ms ease, color 150ms ease;
    padding: 0.2rem 1rem !important;
    font-size: 0.9rem !important;
}

#editPatientModal .btn-delete-treatment:hover {
    background-color: #dc3545 !important;
    box-shadow: 0 0 20px #dc3545, 0 0 40px rgba(220, 53, 69, 0.3) !important;
    color: #ffffff !important;
}

/* Global Delete Treatment button style (fallback for all contexts) */
.btn-delete-treatment {
    color: #dc3545 !important;
    border: 1px solid #dc3545 !important;
    background: rgba(220, 53, 69, 0.05) !important;
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.15) !important;
    transition: background-color 150ms ease, box-shadow 180ms ease, color 150ms ease !important;
    padding: 0.2rem 1rem !important;
    font-size: 0.9rem !important;
}

.btn-delete-treatment:hover {
    background-color: #dc3545 !important;
    box-shadow: 0 0 20px #dc3545, 0 0 40px rgba(220, 53, 69, 0.3) !important;
    color: #ffffff !important;
}

/* Send to Hospital / Booking center popups (Patient Details + Treatment modal) */
.crm-send-hospital-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    background: rgba(4, 10, 18, 0.72);
    backdrop-filter: blur(10px) saturate(120%);
    -webkit-backdrop-filter: blur(10px) saturate(120%);
}

[data-bs-theme="light"] .crm-send-hospital-overlay {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px) saturate(110%);
    -webkit-backdrop-filter: blur(8px) saturate(110%);
}

#hospitalModalOverlay {
    z-index: 9990;
}

#treatmentHospitalPickerOverlay {
    z-index: 2000;
}

.crm-send-hospital-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 92%;
    max-width: 520px;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

#hospitalModal,
#bookingModal {
    max-width: 500px;
    z-index: 9991;
}

#treatmentHospitalPicker {
    z-index: 2001;
}

/* Dark theme (default — matches view patient / treatment modals) */
#hospitalModal,
#treatmentHospitalPicker,
#bookingModal {
    background: #0b1622;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}

#hospitalModal h5,
#treatmentHospitalPicker h5,
#bookingModal h5 {
    color: #ffffff;
    font-weight: 600;
}

#hospitalModal .crm-send-hospital-hint,
#treatmentHospitalPicker .crm-send-hospital-hint,
#bookingModal .crm-send-hospital-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
}

#hospitalModal .form-check-label,
#treatmentHospitalPicker .form-check-label,
#bookingModal .form-check-label {
    color: rgba(255, 255, 255, 0.9);
}

#hospitalModal .form-control,
#treatmentHospitalPicker .form-control,
#bookingModal .form-control {
    background: #172635;
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

#hospitalModal .form-control:focus,
#treatmentHospitalPicker .form-control:focus,
#bookingModal .form-control:focus {
    background: #1a2930;
    border-color: #00baff;
    box-shadow: 0 0 0 0.2rem rgba(0, 186, 255, 0.25);
    color: #ffffff;
}

#hospitalModal .form-control::placeholder,
#treatmentHospitalPicker .form-control::placeholder,
#bookingModal .form-control::placeholder {
    color: rgba(255, 255, 255, 0.45);
    opacity: 1;
}

#hospitalModal select.form-control option,
#treatmentHospitalPicker select.form-control option,
#bookingModal select.form-control option {
    background: #172635;
    color: #ffffff;
}

/* Light theme */
[data-bs-theme="light"] #hospitalModal,
[data-bs-theme="light"] #treatmentHospitalPicker,
[data-bs-theme="light"] #bookingModal {
    background: #ffffff;
    border: 1px solid rgba(13, 110, 253, 0.15);
    color: #212529;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

[data-bs-theme="light"] #hospitalModal h5,
[data-bs-theme="light"] #treatmentHospitalPicker h5,
[data-bs-theme="light"] #bookingModal h5 {
    color: #212529;
}

[data-bs-theme="light"] #hospitalModal .crm-send-hospital-hint,
[data-bs-theme="light"] #treatmentHospitalPicker .crm-send-hospital-hint,
[data-bs-theme="light"] #bookingModal .crm-send-hospital-hint {
    color: #6c757d;
}

[data-bs-theme="light"] #hospitalModal .form-check-label,
[data-bs-theme="light"] #treatmentHospitalPicker .form-check-label,
[data-bs-theme="light"] #bookingModal .form-check-label {
    color: #212529;
}

[data-bs-theme="light"] #hospitalModal .form-control,
[data-bs-theme="light"] #treatmentHospitalPicker .form-control,
[data-bs-theme="light"] #bookingModal .form-control {
    background: #ffffff;
    border-color: #ced4da;
    color: #212529;
}

[data-bs-theme="light"] #hospitalModal .form-control:focus,
[data-bs-theme="light"] #treatmentHospitalPicker .form-control:focus,
[data-bs-theme="light"] #bookingModal .form-control:focus {
    background: #ffffff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    color: #212529;
}

[data-bs-theme="light"] #hospitalModal .form-control::placeholder,
[data-bs-theme="light"] #treatmentHospitalPicker .form-control::placeholder,
[data-bs-theme="light"] #bookingModal .form-control::placeholder {
    color: #6c757d;
}

[data-bs-theme="light"] #hospitalModal select.form-control option,
[data-bs-theme="light"] #treatmentHospitalPicker select.form-control option,
[data-bs-theme="light"] #bookingModal select.form-control option {
    background: #ffffff;
    color: #212529;
}

/* Status segment (page permissions–style toggle, per-option colors) */
.crm-send-hospital-modal .crm-send-hospital-label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-send-hospital-label {
    color: #495057;
}

.crm-send-hospital-modal .crm-status-segment.perms-view-toggle {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    background: #122331;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-status-segment.perms-view-toggle {
    background: #f0f0f0;
    border-color: rgba(0, 0, 0, 0.1);
}

.crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn {
    color: #6b7280;
}

.crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn:hover {
    color: #f2f8fc;
    background: rgba(255, 255, 255, 0.08);
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn:hover {
    color: #1f2937;
    background: rgba(0, 0, 0, 0.05);
}

.crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn.active.crm-status-tone-0 {
    background: #14b8a6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.45);
}

.crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn.active.crm-status-tone-1 {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
}

.crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn.active.crm-status-tone-2 {
    background: #8b5cf6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.45);
}

.crm-send-hospital-modal .crm-status-segment .crm-status-segment-btn.active.crm-status-tone-3 {
    background: #f59e0b;
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.45);
}

/* Hospital combobox (dropdown opens on focus / chevron) */
.crm-send-hospital-modal .crm-list-autocomplete {
    position: relative;
}

.crm-send-hospital-modal .crm-list-autocomplete-input-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

.crm-send-hospital-modal .crm-list-autocomplete-search {
    padding-right: 2.25rem;
    border-radius: 0.375rem;
}

.crm-send-hospital-modal .crm-list-autocomplete.has-clear .crm-list-autocomplete-search {
    padding-right: 4.25rem;
}

.crm-send-hospital-modal .crm-list-autocomplete-clear {
    position: absolute;
    top: 0;
    right: 2.25rem;
    bottom: 0;
    width: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    border-radius: 0.25rem;
    transition: color 0.15s ease, background 0.15s ease;
}

.crm-send-hospital-modal .crm-list-autocomplete-clear:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.08);
}

.crm-send-hospital-modal .crm-list-autocomplete-clear[hidden] {
    display: none !important;
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-clear {
    color: #adb5bd;
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-clear:hover {
    color: #495057;
    background: rgba(0, 0, 0, 0.06);
}

.crm-send-hospital-modal .crm-list-autocomplete-clear .bi-x-lg {
    font-size: 0.75rem;
    line-height: 1;
}

.crm-send-hospital-modal .crm-list-autocomplete-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    cursor: pointer;
    border-radius: 0 0.375rem 0.375rem 0;
    transition: color 0.15s ease, transform 0.15s ease;
}

.crm-send-hospital-modal .crm-list-autocomplete.is-open .crm-list-autocomplete-toggle {
    color: #00baff;
    transform: rotate(180deg);
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-toggle {
    color: #6c757d;
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete.is-open .crm-list-autocomplete-toggle {
    color: #0d6efd;
}

.crm-send-hospital-modal .crm-list-autocomplete-panel {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 12;
    margin-top: 2px;
    max-height: 11rem;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.375rem;
    background: #172635;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-panel {
    background: #ffffff;
    border-color: #ced4da;
}

.crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: #e2e8f0;
    font-size: 0.875rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion:last-child {
    border-bottom: none;
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion {
    color: #212529;
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

.crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion:hover,
.crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion.active {
    background: rgba(0, 186, 255, 0.15);
}

.crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion.selected {
    background: rgba(0, 186, 255, 0.28);
    font-weight: 600;
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion:hover,
[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion.active,
[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-panel .suggestion.selected {
    background: rgba(13, 110, 253, 0.12);
}

.crm-send-hospital-modal .crm-list-autocomplete-empty {
    padding: 0.65rem 0.75rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.55);
}

[data-bs-theme="light"] .crm-send-hospital-modal .crm-list-autocomplete-empty {
    color: #6c757d;
}

/* Add / Edit Patient: calendar is appended to modal-body; hide any stray inline copy in the wrapper. */
#addPatientModal .flatpickr-wrapper > .flatpickr-calendar,
#addPatientModalIndex .flatpickr-wrapper > .flatpickr-calendar,
#editPatientModalBody .flatpickr-wrapper > .flatpickr-calendar {
    display: none !important;
}

#addPatientModal .modal-body-custom,
#addPatientModalIndex .modal-body-custom,
#addPatientModalBody,
#addPatientModalIndexBody,
#editPatientModalBody.modal-body {
    position: relative;
}

/* Add Patient modal — collapsible section accordion (parity with treatment modals) */
#addPatientModal .collapsible-section,
#addPatientModalIndex .collapsible-section {
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#addPatientModal .collapsible-section.active,
#addPatientModalIndex .collapsible-section.active {
    overflow: hidden;
}

#addPatientModal .section-content,
#addPatientModalIndex .section-content {
    display: block !important;
    max-height: 0;
    overflow: hidden;
    padding: 0 1.5rem;
    opacity: 0;
    box-sizing: border-box;
    transition: max-height 0.26s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.22s ease,
                padding 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

#addPatientModal .collapsible-section.active > .section-content,
#addPatientModalIndex .collapsible-section.active > .section-content {
    max-height: 5000px;
    opacity: 1;
    padding: 0.75rem 1.25rem 1.25rem;
}

#addPatientModal .collapsible-section.active:not(.crm-accordion-init) > .section-content,
#addPatientModalIndex .collapsible-section.active:not(.crm-accordion-init) > .section-content {
    max-height: 5000px;
    opacity: 1;
    padding: 0.75rem 1.25rem 1.25rem;
}

[data-bs-theme="dark"] #addPatientModal .collapsible-section.active,
[data-bs-theme="dark"] #addPatientModalIndex .collapsible-section.active {
    border-color: rgba(0, 186, 255, 0.62) !important;
    box-shadow: 0 0 14px rgba(0, 186, 255, 0.12), inset 0 0 0 1px rgba(0, 186, 255, 0.2);
}

[data-bs-theme="light"] #addPatientModal .collapsible-section.active,
[data-bs-theme="light"] #addPatientModalIndex .collapsible-section.active {
    border-color: rgba(13, 110, 253, 0.42) !important;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.08), inset 0 0 0 1px rgba(13, 110, 253, 0.1);
}

#addPatientModal .collapsible-section > .section-header,
#addPatientModalIndex .collapsible-section > .section-header {
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

[data-bs-theme="light"] #addPatientModal .collapsible-section > .section-header,
[data-bs-theme="light"] #addPatientModalIndex .collapsible-section > .section-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

[data-bs-theme="dark"] #addPatientModal .collapsible-section.active > .section-header,
[data-bs-theme="dark"] #addPatientModalIndex .collapsible-section.active > .section-header {
    background: rgba(0, 186, 255, 0.06);
}

[data-bs-theme="light"] #addPatientModal .collapsible-section.active > .section-header,
[data-bs-theme="light"] #addPatientModalIndex .collapsible-section.active > .section-header {
    background: rgba(13, 110, 253, 0.04);
}

#addPatientModal .collapsible-section.active .toggle-icon,
#addPatientModalIndex .collapsible-section.active .toggle-icon {
    transform: rotate(180deg);
}

/* CRM patient/treatment modals — shared field labels, doc card titles, bento groups */
#viewPatientModalBody .patient-field > label,
#editPatientModalBody .patient-field > label,
#editPatientModal .patient-field > label,
#addPatientModal .patient-field > label,
#addPatientModalIndex .patient-field > label,
.view-patient-container .patient-field > label {
    color: #f8fafc;
    font-weight: 700;
}

#viewPatientModalBody .patient-field > label > i,
#editPatientModalBody .patient-field > label > i,
#editPatientModal .patient-field > label > i,
#addPatientModal .patient-field > label > i,
#addPatientModalIndex .patient-field > label > i,
.view-patient-container .patient-field > label > i {
    color: #00baff;
    opacity: 1;
    display: inline-block;
}

#viewPatientModalBody .crm-patient-bento__label,
#editPatientModalBody .crm-patient-bento__label,
#editPatientModal .crm-patient-bento__label,
#addPatientModal .crm-patient-bento__label,
#addPatientModalIndex .crm-patient-bento__label {
    color: #f8fafc;
    font-weight: 700;
}

#viewPatientModalBody .crm-patient-bento__label > i,
#editPatientModalBody .crm-patient-bento__label > i,
#editPatientModal .crm-patient-bento__label > i,
#addPatientModal .crm-patient-bento__label > i,
#addPatientModalIndex .crm-patient-bento__label > i {
    color: #00baff;
}

#viewPatientModalBody .crm-portal-field__label,
#editPatientModalBody .crm-portal-field__label,
#viewPatientModalBody .crm-portal-access__desc,
#editPatientModalBody .crm-portal-access__desc,
#viewPatientModalBody .crm-portal-status-text,
#editPatientModalBody .crm-portal-status-text {
    color: rgba(226, 232, 240, 0.82);
}

#viewPatientModalBody .crm-portal-field__value,
#editPatientModalBody .crm-portal-field__value,
#viewPatientModalBody .crm-portal-access__title,
#editPatientModalBody .crm-portal-access__title {
    color: #f8fafc;
}

#viewPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title,
#viewPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title,
#editPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title,
#editPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title,
#addPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title,
#addPatientModalIndex .crm-doc-card-ui .crm-treatment-doc-card__title,
#viewConversationModal .crm-doc-card-ui .crm-treatment-doc-card__title,
#viewTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title,
#editTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title,
#addTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title {
    font-weight: 700;
    color: #f8fafc;
}

#viewPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#viewPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#editPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#editPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#addPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#addPatientModalIndex .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#viewConversationModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#viewTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#editTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
#addTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title > i {
    color: #00baff;
}

#viewPatientModalBody .crm-lead-view__group,
#viewPatientModal .crm-lead-view__group,
#editPatientModalBody .crm-lead-view__group,
#editPatientModal .crm-lead-view__group,
#addPatientModal .crm-lead-view__group,
#addPatientModalIndex .crm-lead-view__group {
    color: #f8fafc;
    font-weight: 700;
}

#viewPatientModalBody .crm-lead-view__group > i,
#viewPatientModal .crm-lead-view__group > i,
#editPatientModalBody .crm-lead-view__group > i,
#editPatientModal .crm-lead-view__group > i,
#addPatientModal .crm-lead-view__group > i,
#addPatientModalIndex .crm-lead-view__group > i {
    color: #00baff;
}

[data-bs-theme="light"] #viewPatientModalBody .patient-field > label,
[data-bs-theme="light"] #editPatientModalBody .patient-field > label,
[data-bs-theme="light"] #editPatientModal .patient-field > label,
[data-bs-theme="light"] #addPatientModal .patient-field > label,
[data-bs-theme="light"] #addPatientModalIndex .patient-field > label,
[data-bs-theme="light"] .view-patient-container .patient-field > label {
    color: #1e293b;
}

[data-bs-theme="light"] #viewPatientModalBody .patient-field > label > i,
[data-bs-theme="light"] #editPatientModalBody .patient-field > label > i,
[data-bs-theme="light"] #editPatientModal .patient-field > label > i,
[data-bs-theme="light"] #addPatientModal .patient-field > label > i,
[data-bs-theme="light"] #addPatientModalIndex .patient-field > label > i,
[data-bs-theme="light"] .view-patient-container .patient-field > label > i {
    color: #0284c7;
}

[data-bs-theme="light"] #viewPatientModalBody .crm-patient-bento__label,
[data-bs-theme="light"] #editPatientModalBody .crm-patient-bento__label,
[data-bs-theme="light"] #editPatientModal .crm-patient-bento__label,
[data-bs-theme="light"] #addPatientModal .crm-patient-bento__label,
[data-bs-theme="light"] #addPatientModalIndex .crm-patient-bento__label {
    color: #1e293b;
}

[data-bs-theme="light"] #viewPatientModalBody .crm-patient-bento__label > i,
[data-bs-theme="light"] #editPatientModalBody .crm-patient-bento__label > i,
[data-bs-theme="light"] #editPatientModal .crm-patient-bento__label > i,
[data-bs-theme="light"] #addPatientModal .crm-patient-bento__label > i,
[data-bs-theme="light"] #addPatientModalIndex .crm-patient-bento__label > i {
    color: #0284c7;
}

[data-bs-theme="light"] #viewPatientModalBody .crm-portal-field__label,
[data-bs-theme="light"] #editPatientModalBody .crm-portal-field__label,
[data-bs-theme="light"] #viewPatientModalBody .crm-portal-access__desc,
[data-bs-theme="light"] #editPatientModalBody .crm-portal-access__desc,
[data-bs-theme="light"] #viewPatientModalBody .crm-portal-status-text,
[data-bs-theme="light"] #editPatientModalBody .crm-portal-status-text {
    color: #64748b;
}

[data-bs-theme="light"] #viewPatientModalBody .crm-portal-field__value,
[data-bs-theme="light"] #editPatientModalBody .crm-portal-field__value,
[data-bs-theme="light"] #viewPatientModalBody .crm-portal-access__title,
[data-bs-theme="light"] #editPatientModalBody .crm-portal-access__title {
    color: #1e293b;
}

[data-bs-theme="light"] #viewPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #viewPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #editPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #editPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #addPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #addPatientModalIndex .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #viewConversationModal .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #viewTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #editTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title,
[data-bs-theme="light"] #addTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title {
    color: #1e293b;
}

[data-bs-theme="light"] #viewPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #viewPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #editPatientModalBody .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #editPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #addPatientModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #addPatientModalIndex .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #viewConversationModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #viewTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #editTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title > i,
[data-bs-theme="light"] #addTreatmentModal .crm-doc-card-ui .crm-treatment-doc-card__title > i {
    color: #0284c7;
}

[data-bs-theme="light"] #viewPatientModalBody .crm-lead-view__group,
[data-bs-theme="light"] #viewPatientModal .crm-lead-view__group,
[data-bs-theme="light"] #editPatientModalBody .crm-lead-view__group,
[data-bs-theme="light"] #editPatientModal .crm-lead-view__group,
[data-bs-theme="light"] #addPatientModal .crm-lead-view__group,
[data-bs-theme="light"] #addPatientModalIndex .crm-lead-view__group {
    color: #1e293b;
}

[data-bs-theme="light"] #viewPatientModalBody .crm-lead-view__group > i,
[data-bs-theme="light"] #viewPatientModal .crm-lead-view__group > i,
[data-bs-theme="light"] #editPatientModalBody .crm-lead-view__group > i,
[data-bs-theme="light"] #editPatientModal .crm-lead-view__group > i,
[data-bs-theme="light"] #addPatientModal .crm-lead-view__group > i,
[data-bs-theme="light"] #addPatientModalIndex .crm-lead-view__group > i {
    color: #0284c7;
}

#viewPatientModal .crm-conv-treatment-group__header,
#viewPatientModalBody .crm-conv-treatment-group__header,
#editPatientModalBody .crm-conv-treatment-group__header,
#editPatientModal .crm-conv-treatment-group__header,
#addPatientModal .crm-conv-treatment-group__header,
#addPatientModalIndex .crm-conv-treatment-group__header,
#viewConversationModal .crm-conv-treatment-group__header,
#editTreatmentModal .crm-conv-treatment-group__header,
#addTreatmentModal .crm-conv-treatment-group__header,
#viewPatientModal .crm-conv-patient-level-group__header,
#viewPatientModalBody .crm-conv-patient-level-group__header,
#editPatientModalBody .crm-conv-patient-level-group__header,
#editPatientModal .crm-conv-patient-level-group__header,
#addPatientModal .crm-conv-patient-level-group__header,
#addPatientModalIndex .crm-conv-patient-level-group__header {
    font-weight: 700;
    color: #f8fafc;
}

#viewPatientModal .crm-conv-treatment-group__header > i,
#viewPatientModalBody .crm-conv-treatment-group__header > i,
#editPatientModalBody .crm-conv-treatment-group__header > i,
#editPatientModal .crm-conv-treatment-group__header > i,
#addPatientModal .crm-conv-treatment-group__header > i,
#addPatientModalIndex .crm-conv-treatment-group__header > i,
#viewConversationModal .crm-conv-treatment-group__header > i,
#editTreatmentModal .crm-conv-treatment-group__header > i,
#addTreatmentModal .crm-conv-treatment-group__header > i {
    color: #00baff;
}

#viewPatientModal .crm-conv-patient-level-group__header > i,
#viewPatientModalBody .crm-conv-patient-level-group__header > i,
#editPatientModalBody .crm-conv-patient-level-group__header > i,
#editPatientModal .crm-conv-patient-level-group__header > i,
#addPatientModal .crm-conv-patient-level-group__header > i,
#addPatientModalIndex .crm-conv-patient-level-group__header > i {
    color: #34d399;
}

[data-bs-theme="light"] #viewPatientModal .crm-conv-treatment-group__header,
[data-bs-theme="light"] #viewPatientModalBody .crm-conv-treatment-group__header,
[data-bs-theme="light"] #editPatientModalBody .crm-conv-treatment-group__header,
[data-bs-theme="light"] #editPatientModal .crm-conv-treatment-group__header,
[data-bs-theme="light"] #addPatientModal .crm-conv-treatment-group__header,
[data-bs-theme="light"] #addPatientModalIndex .crm-conv-treatment-group__header,
[data-bs-theme="light"] #viewConversationModal .crm-conv-treatment-group__header,
[data-bs-theme="light"] #editTreatmentModal .crm-conv-treatment-group__header,
[data-bs-theme="light"] #addTreatmentModal .crm-conv-treatment-group__header,
[data-bs-theme="light"] #viewPatientModal .crm-conv-patient-level-group__header,
[data-bs-theme="light"] #viewPatientModalBody .crm-conv-patient-level-group__header,
[data-bs-theme="light"] #editPatientModalBody .crm-conv-patient-level-group__header,
[data-bs-theme="light"] #editPatientModal .crm-conv-patient-level-group__header,
[data-bs-theme="light"] #addPatientModal .crm-conv-patient-level-group__header,
[data-bs-theme="light"] #addPatientModalIndex .crm-conv-patient-level-group__header {
    color: #1e293b;
}

[data-bs-theme="light"] #viewPatientModal .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #viewPatientModalBody .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #editPatientModalBody .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #editPatientModal .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #addPatientModal .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #addPatientModalIndex .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #viewConversationModal .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #editTreatmentModal .crm-conv-treatment-group__header > i,
[data-bs-theme="light"] #addTreatmentModal .crm-conv-treatment-group__header > i {
    color: #0284c7;
}

[data-bs-theme="light"] #viewPatientModal .crm-conv-patient-level-group__header > i,
[data-bs-theme="light"] #viewPatientModalBody .crm-conv-patient-level-group__header > i,
[data-bs-theme="light"] #editPatientModalBody .crm-conv-patient-level-group__header > i,
[data-bs-theme="light"] #editPatientModal .crm-conv-patient-level-group__header > i,
[data-bs-theme="light"] #addPatientModal .crm-conv-patient-level-group__header > i,
[data-bs-theme="light"] #addPatientModalIndex .crm-conv-patient-level-group__header > i {
    color: #059669;
}

/* Patient view modal — blue tile readonly fields */
#viewPatientModalBody .treatment-meta-row,
#viewPatientModal .treatment-meta-row,
.view-patient-container .treatment-meta-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1.25rem;
    align-items: start;
    margin-left: 0;
    margin-right: 0;
}

#viewPatientModalBody .treatment-meta-row > .col-md-6,
#viewPatientModal .treatment-meta-row > .col-md-6,
#viewPatientModalBody .treatment-meta-row > .patient-field,
#viewPatientModal .treatment-meta-row > .patient-field,
.view-patient-container .treatment-meta-row > .col-md-6,
.view-patient-container .treatment-meta-row > .patient-field {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: none;
    padding-left: 0;
    padding-right: 0;
}

#viewPatientModalBody .treatment-meta-row .crm-treatment-view-value,
#viewPatientModal .treatment-meta-row .crm-treatment-view-value,
.view-patient-container .treatment-meta-row .crm-treatment-view-value {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 767.98px) {
    #viewPatientModalBody .treatment-meta-row,
    #viewPatientModal .treatment-meta-row,
    .view-patient-container .treatment-meta-row {
        grid-template-columns: 1fr;
    }
}

#viewPatientModalBody .add-patient-comments-field .crm-treatment-view-prose,
.view-patient-container .add-patient-comments-field .crm-treatment-view-prose,
#viewPatientModalBody .patient-field.full-width .crm-treatment-view-prose,
.view-patient-container .patient-field.full-width .crm-treatment-view-prose {
    min-height: 9rem;
}

#viewPatientModalBody .add-patient-documents-row,
.view-patient-container .add-patient-documents-row {
    gap: 1rem 1.25rem;
}

#viewPatientModalBody .crm-treatment-view-value,
.view-patient-container .crm-treatment-view-value {
    margin-top: 0.15rem;
}

/* Add treatment modal — ensure top-level accordion content is visible when active */
#addTreatmentModal .crm-treatment-form > .collapsible-section.active > .section-content,
#addTreatmentModalBody .crm-treatment-form > .collapsible-section.active > .section-content {
    max-height: 5000px !important;
    opacity: 1 !important;
}

#viewTreatmentModal .collapsible-section.active > .section-content,
#editTreatmentModal .collapsible-section.active > .section-content,
#addTreatmentModal .collapsible-section.active > .section-content {
    padding: 0.75rem 1.25rem 1.25rem;
}

#viewPatientModalBody .collapsible-section.active > .section-content > :first-child,
#viewPatientModal .collapsible-section.active > .section-content > :first-child,
#editPatientModalBody .collapsible-section.active > .section-content > :first-child,
#editPatientModal .collapsible-section.active > .section-content > :first-child,
#addPatientModal .collapsible-section.active > .section-content > :first-child,
#addPatientModalIndex .collapsible-section.active > .section-content > :first-child,
.view-patient-container .collapsible-section.active > .section-content > :first-child,
#viewTreatmentModal .collapsible-section.active > .section-content > :first-child,
#editTreatmentModal .collapsible-section.active > .section-content > :first-child,
#addTreatmentModal .collapsible-section.active > .section-content > :first-child,
#viewTreatmentModal .collapsible-section.active > .section-content .collapsible-section.active > .section-content > :first-child,
#editTreatmentModal .collapsible-section.active > .section-content .collapsible-section.active > .section-content > :first-child,
#addTreatmentModal .collapsible-section.active > .section-content .collapsible-section.active > .section-content > :first-child,
.crm-treatment-travel-block > .crm-travel-accordion.active > .crm-travel-panel > :first-child {
    margin-top: 0 !important;
}

/* Secondary popups — keep label chrome consistent */
#hospitalModal .form-label,
#bookingModal .form-label,
#treatmentHospitalPicker .form-label {
    color: #f8fafc;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

#hospitalModal .form-label > i,
#bookingModal .form-label > i,
#treatmentHospitalPicker .form-label > i {
    color: #00baff;
}

[data-bs-theme="light"] #hospitalModal .form-label,
[data-bs-theme="light"] #bookingModal .form-label,
[data-bs-theme="light"] #treatmentHospitalPicker .form-label {
    color: #1e293b;
}

[data-bs-theme="light"] #hospitalModal .form-label > i,
[data-bs-theme="light"] #bookingModal .form-label > i,
[data-bs-theme="light"] #treatmentHospitalPicker .form-label > i {
    color: #0284c7;
}

/* -------------------------------------------------------------------------
 * Patient / treatment modal header chrome — Hospitals parity (keep last)
 * ------------------------------------------------------------------------- */
#viewPatientModalBody .view-patient-container > .modal-header,
#editPatientModalBody .view-patient-container > .modal-header,
#addPatientModalBody .view-patient-container > .modal-header,
#addPatientModalIndexBody .view-patient-container > .modal-header,
#viewTreatmentModalShell .view-patient-container > .modal-header,
#editTreatmentModalShell .view-patient-container > .modal-header,
#addTreatmentModalShell .view-patient-container > .modal-header,
#viewTreatmentModal .modal-header,
#editTreatmentModal .modal-header,
#addTreatmentModal .modal-header,
.view-patient-container > .modal-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 1rem !important;
    min-height: auto !important;
    padding: 1.5rem 2rem !important;
    border-bottom: 1px solid #2a3f5f !important;
    border-radius: 12px 12px 0 0 !important;
    background: #08151d !important;
    flex: 0 0 auto !important;
}

[data-bs-theme="light"] #viewPatientModalBody .view-patient-container > .modal-header,
[data-bs-theme="light"] #editPatientModalBody .view-patient-container > .modal-header,
[data-bs-theme="light"] #addPatientModalBody .view-patient-container > .modal-header,
[data-bs-theme="light"] #addPatientModalIndexBody .view-patient-container > .modal-header,
[data-bs-theme="light"] #viewTreatmentModalShell .view-patient-container > .modal-header,
[data-bs-theme="light"] #editTreatmentModalShell .view-patient-container > .modal-header,
[data-bs-theme="light"] #addTreatmentModalShell .view-patient-container > .modal-header,
[data-bs-theme="light"] #viewTreatmentModal .modal-header,
[data-bs-theme="light"] #editTreatmentModal .modal-header,
[data-bs-theme="light"] #addTreatmentModal .modal-header,
[data-bs-theme="light"] .view-patient-container > .modal-header {
    border-bottom-color: rgba(13, 110, 253, 0.1) !important;
    background: #f0f0f0 !important;
}

.view-patient-container > .modal-header .modal-title-container,
.view-patient-container > .modal-header > div:first-child:not(.d-flex),
#viewTreatmentModal .modal-header .modal-title-container,
#editTreatmentModal .modal-header .modal-title-container,
#addTreatmentModal .modal-header .modal-title-container {
    flex: 1 1 auto;
    min-width: 0;
}

#viewPatientModalBody .view-patient-container > .modal-header .modal-title,
#editPatientModalBody .view-patient-container > .modal-header .modal-title,
#addPatientModalBody .view-patient-container > .modal-header .modal-title,
#addPatientModalIndexBody .view-patient-container > .modal-header .modal-title,
#viewTreatmentModalShell .view-patient-container > .modal-header .modal-title,
#editTreatmentModalShell .view-patient-container > .modal-header .modal-title,
#addTreatmentModalShell .view-patient-container > .modal-header .modal-title,
#viewTreatmentModal .modal-header .modal-title,
#editTreatmentModal .modal-header .modal-title,
#addTreatmentModal .modal-header .modal-title,
.view-patient-container > .modal-header .modal-title,
.crm-treatment-modal .modal-header .modal-title {
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
    color: #ffffff !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    margin: 0 !important;
}

[data-bs-theme="light"] #viewPatientModalBody .view-patient-container > .modal-header .modal-title,
[data-bs-theme="light"] #editPatientModalBody .view-patient-container > .modal-header .modal-title,
[data-bs-theme="light"] #addPatientModalBody .view-patient-container > .modal-header .modal-title,
[data-bs-theme="light"] #addPatientModalIndexBody .view-patient-container > .modal-header .modal-title,
[data-bs-theme="light"] #viewTreatmentModal .modal-header .modal-title,
[data-bs-theme="light"] #editTreatmentModal .modal-header .modal-title,
[data-bs-theme="light"] #addTreatmentModal .modal-header .modal-title,
[data-bs-theme="light"] .view-patient-container > .modal-header .modal-title,
[data-bs-theme="light"] .crm-treatment-modal .modal-header .modal-title {
    color: #000000c7 !important;
}

.view-patient-container .add-patient-modal-subtitle,
#viewPatientModal .add-patient-modal-subtitle,
#editPatientModal .add-patient-modal-subtitle,
#addPatientModal .add-patient-modal-subtitle,
#addPatientModalIndex .add-patient-modal-subtitle {
    margin-top: 0.375rem !important;
    margin-bottom: 0 !important;
    color: rgba(203, 213, 225, 0.78) !important;
    font-size: 0.875rem !important;
    line-height: 1.35 !important;
    font-weight: 400 !important;
}

[data-bs-theme="light"] .view-patient-container .add-patient-modal-subtitle,
[data-bs-theme="light"] #viewPatientModal .add-patient-modal-subtitle,
[data-bs-theme="light"] #editPatientModal .add-patient-modal-subtitle,
[data-bs-theme="light"] #addPatientModal .add-patient-modal-subtitle,
[data-bs-theme="light"] #addPatientModalIndex .add-patient-modal-subtitle {
    color: #64748b !important;
}

#viewPatientModalBody .view-patient-container > .modal-body-custom,
#editPatientModalBody .view-patient-container > .modal-body-custom,
#addPatientModalBody .view-patient-container > .modal-body-custom,
#addPatientModalIndexBody .view-patient-container > .modal-body-custom {
    padding: 1rem 2rem 1rem 2rem !important;
}

#viewTreatmentModalShell .view-patient-container > .modal-body-custom,
#editTreatmentModalShell .view-patient-container > .modal-body-custom,
#addTreatmentModalShell .view-patient-container > .modal-body-custom {
    padding: 1.25rem 2rem 1.5rem !important;
}

/* Add/edit patient modals — required field asterisks stay red on dark labels */
#addPatientModalBody .text-danger,
#addPatientModalIndexBody .text-danger,
#editPatientModalBody .text-danger,
#addPatientModal .text-danger,
#editPatientModal .text-danger,
#addPatientModalBody .patient-field > label .text-danger,
#addPatientModalIndexBody .patient-field > label .text-danger,
#editPatientModalBody .patient-field > label .text-danger,
#addPatientModalBody .add-patient-form-hint .text-danger,
#addPatientModalIndexBody .add-patient-form-hint .text-danger,
#editPatientModalBody .add-patient-form-hint .text-danger {
    color: #f87171 !important;
}

[data-bs-theme="light"] #addPatientModalBody .text-danger,
[data-bs-theme="light"] #addPatientModalIndexBody .text-danger,
[data-bs-theme="light"] #editPatientModalBody .text-danger,
[data-bs-theme="light"] #addPatientModal .text-danger,
[data-bs-theme="light"] #editPatientModal .text-danger,
[data-bs-theme="light"] #addPatientModalBody .patient-field > label .text-danger,
[data-bs-theme="light"] #addPatientModalIndexBody .patient-field > label .text-danger,
[data-bs-theme="light"] #editPatientModalBody .patient-field > label .text-danger,
[data-bs-theme="light"] #addPatientModalBody .add-patient-form-hint .text-danger,
[data-bs-theme="light"] #addPatientModalIndexBody .add-patient-form-hint .text-danger,
[data-bs-theme="light"] #editPatientModalBody .add-patient-form-hint .text-danger {
    color: #dc2626 !important;
}

/* Special Precautions styles moved to crm_special_precautions.css (patient + treatment modals). */

.crm-patient-precautions-top__text.crm-treatment-view-prose,
.crm-patient-precautions-top__text {
    margin-bottom: 0;
}
