/* Medibox 3.13.46 — UI patterns adapted from the attached primary-care project.
   Presentation only: existing routes, forms and business logic are preserved. */

/* Shared register layout: patients and reviews */
.reference-register-card {
    overflow: hidden;
    padding: 0;
    border: 1px solid #dde5f2;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(39, 49, 109, .07);
}
.reference-register-toolbar {
    min-height: 64px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
    border-bottom: 1px solid #e2e8f2;
}
.reference-register-filter {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: center;
    gap: 12px;
}
.reference-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.reference-search-control {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
}
.reference-search-control > .ui-icon {
    position: absolute;
    left: 13px;
    z-index: 2;
    width: 17px;
    height: 17px;
    color: #6366f1;
    pointer-events: none;
}
.reference-search-control input {
    width: 100%;
    height: 40px;
    padding: 0 14px 0 40px;
    border: 1px solid #d7e0ed;
    border-radius: 11px;
    color: #24324a;
    background: #fff;
    font: inherit;
    font-size: 12px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .035);
    transition: border-color .16s ease, box-shadow .16s ease;
}
.reference-search-control input:focus {
    outline: 0;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .10);
}
.reference-select-control {
    position: relative;
    min-width: 148px;
    display: flex;
    align-items: center;
}
.reference-select-control select {
    width: 100%;
    height: 40px;
    appearance: none;
    padding: 0 38px 0 13px;
    border: 1px solid #d7e0ed;
    border-radius: 11px;
    color: #40516d;
    background: #fff;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
.reference-select-control > .ui-icon {
    position: absolute;
    right: 12px;
    width: 14px;
    height: 14px;
    color: #76849a;
    pointer-events: none;
}
.reference-filter-button,
.reference-add-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
}
.reference-total-count {
    min-width: 68px;
    height: 40px;
    padding: 5px 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid #dde5f2;
    border-radius: 11px;
    color: #52627c;
    background: #f8faff;
}
.reference-total-count strong { color: #312e81; font-size: 15px; line-height: 1; }
.reference-total-count small { font-size: 9px; font-weight: 800; }

.reference-table-wrap {
    max-height: calc(100dvh - 190px);
    overflow: auto;
    background: #fff;
}
.reference-data-table {
    width: 100%;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}
.reference-data-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}
.reference-data-table th {
    padding: 11px 13px;
    border-bottom: 1px solid #dfe6f0;
    color: #66758c;
    background: #f8fafd;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .055em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}
.reference-data-table td {
    padding: 11px 13px;
    border-bottom: 1px solid #edf1f6;
    color: #334155;
    background: #fff;
    font-size: 11px;
    vertical-align: middle;
}
.reference-data-table tbody tr:last-child td { border-bottom: 0; }
.reference-record-row td { transition: background .16s ease; }
.reference-record-row:hover td { background: #fafbff; }
.reference-record-row:hover td:first-child { box-shadow: inset 3px 0 0 #4f46e5; }
.reference-record-row.is-inactive { opacity: .70; }

.reference-person-cell {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}
.reference-person-photo,
.reference-person-avatar {
    width: 37px;
    height: 37px;
    flex: 0 0 37px;
    border-radius: 11px;
}
.reference-person-photo { object-fit: cover; border: 1px solid #dfe6f1; }
.reference-person-avatar {
    display: grid;
    place-items: center;
    color: #4338ca;
    background: linear-gradient(145deg, #eef2ff, #e8faf4);
    border: 1px solid #d8defb;
    font-size: 11px;
    font-weight: 900;
}
.reference-person-copy { min-width: 0; display: grid; gap: 3px; }
.reference-person-copy strong {
    overflow: hidden;
    color: #1f2f49;
    font-size: 12px;
    font-weight: 820;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reference-person-copy small,
.reference-secondary-value {
    display: block;
    overflow: hidden;
    color: #7a879a;
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reference-primary-value {
    display: block;
    color: #34445e;
    font-size: 11px;
    font-weight: 760;
    line-height: 1.35;
}
.reference-phone-link { color: #334155; text-decoration: none; }
.reference-phone-link:hover { color: #4f46e5; }
.reference-date-value { display: inline-grid; gap: 2px; }
.reference-date-value strong { color: #293955; font-size: 11px; font-weight: 820; }
.reference-date-value small { color: #8090a5; font-size: 9px; font-weight: 700; }
.reference-status-badge {
    min-height: 27px;
    padding: 5px 9px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: inherit;
    font-size: 9px;
    font-weight: 850;
    cursor: pointer;
}
.reference-status-badge i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent);
}
.reference-status-badge.is-active { color: #0f8a61; border-color: #c8efe1; background: #ecfdf5; }
.reference-status-badge.is-inactive { color: #7c8798; border-color: #dfe5ec; background: #f5f7fa; }
.reference-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.reference-row-actions form { margin: 0; }
.action-icon-button {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid #d9e2ef;
    border-radius: 9px;
    color: #50617c;
    background: linear-gradient(180deg, #fff, #f8faff);
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.action-icon-button .ui-icon { width: 15px; height: 15px; }
.action-icon-button:hover { transform: translateY(-1px); color: #4f46e5; border-color: #bdc8f4; box-shadow: 0 6px 14px rgba(79, 70, 229, .10); }
.action-icon-button.warning { color: #b76a08; background: #fffbeb; border-color: #f5dfad; }
.action-icon-button.danger { color: #c2414b; background: #fff5f5; border-color: #f3d1d5; }
.reference-pagination {
    min-height: 55px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid #e7edf4;
    color: #748198;
    background: #fbfcff;
    font-size: 10px;
    font-weight: 700;
}
.reference-pagination nav { display: flex; gap: 7px; }

/* Patient registry column proportions */
.patient-reference-table th:nth-child(1) { width: 22%; }
.patient-reference-table th:nth-child(2) { width: 11%; }
.patient-reference-table th:nth-child(3) { width: 14%; }
.patient-reference-table th:nth-child(4) { width: 18%; }
.patient-reference-table th:nth-child(5) { width: 9%; }
.patient-reference-table th:nth-child(6) { width: 12%; }
.patient-reference-table th:nth-child(7) { width: 9%; }
.patient-reference-table th:nth-child(8) { width: 132px; }

/* Calendar: centered status cards and right-side date navigation */
#weeklyCalendarApp .reference-calendar-toolbar {
    min-height: 76px;
    padding: 11px 16px;
    display: grid;
    grid-template-columns: minmax(190px, 1fr) auto minmax(190px, 1fr);
    align-items: center;
    gap: 18px;
    background: #fff;
    border-bottom: 1px solid #e4eaf2;
}
.reference-calendar-balance { min-width: 0; }
.reference-calendar-status-cards {
    grid-column: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(112px, 1fr));
    gap: 8px;
    justify-self: center;
}
.reference-calendar-status-card {
    min-width: 112px;
    min-height: 50px;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    color: #475569;
    background: #fff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, .045);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.reference-calendar-status-card:hover {
    transform: translateY(-1px);
    border-color: #cbd5e1;
    box-shadow: 0 7px 18px rgba(15, 23, 42, .08);
}
.reference-calendar-status-card[aria-pressed="true"] {
    border-color: rgba(79, 70, 229, .42);
    background: linear-gradient(180deg, #fff, #f5f4ff);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .08), 0 7px 18px rgba(79, 70, 229, .10);
}
.reference-calendar-status-icon {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border-radius: 9px;
}
.reference-calendar-status-icon .ui-icon { width: 17px; height: 17px; }
.reference-calendar-status-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.reference-calendar-status-copy small { color: #64748b; font-size: 9px; font-weight: 800; white-space: nowrap; }
.reference-calendar-status-copy strong { margin-top: 4px; color: #0f172a; font-size: 15px; font-weight: 900; }
.reference-calendar-status-card.status-all .reference-calendar-status-icon,
.reference-calendar-status-card.status-scheduled .reference-calendar-status-icon { color: #4f46e5; background: #eef2ff; }
.reference-calendar-status-card.status-waiting .reference-calendar-status-icon { color: #d97706; background: #fffbeb; }
.reference-calendar-status-card.status-exam .reference-calendar-status-icon { color: #0f766e; background: #ecfdf5; }
.reference-calendar-navigation {
    grid-column: 3;
    justify-self: end;
    margin: 0 !important;
    grid-template-columns: 38px minmax(154px, 190px) 38px !important;
}
.reference-calendar-navigation .calendar-current-date {
    min-height: 44px;
    padding: 5px 12px;
    display: grid;
    place-items: center;
    gap: 1px;
    border: 1px solid #e2e8f0 !important;
    border-radius: 11px;
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .05);
}
.reference-calendar-navigation .calendar-current-date small { color: #7a879a; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.reference-calendar-navigation .calendar-current-date strong { color: #293955; font-size: 12px; }
#weeklyCalendarApp .weekly-calendar-scroll { max-height: calc(100vh - 166px); }

/* Appointment cards: patient identity pattern from the reference project */
.reference-appointment-patient {
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.reference-appointment-avatar {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: #4338ca;
    background: linear-gradient(145deg, #eef2ff, #e8faf4);
    border: 1px solid #d8defb;
    font-size: 7px;
    font-weight: 900;
}
.reference-appointment-patient-copy { min-width: 0; display: grid; gap: 1px; }
.calendar-appointment .reference-appointment-patient-copy h3 {
    margin: 0;
    overflow: hidden;
    color: #1f334f;
    font-size: 9.5px !important;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reference-appointment-patient-copy small { color: #8591a4; font-size: 6.8px; font-weight: 700; }
.calendar-appointment .reference-appointment-meta {
    margin: 3px 0 0;
    display: flex !important;
    align-items: center;
    gap: 3px;
    color: #66758b;
    font-size: 7px;
}
.reference-appointment-meta .ui-icon { width: 9px; height: 9px; }
.calendar-appointment .reference-appointment-reason {
    display: block !important;
    margin-top: 2px;
    overflow: hidden;
    color: #77859a;
    font-size: 6.8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Reviews registry */
.reviews-reference-table { min-width: 1080px; }
.reviews-reference-table th:nth-child(1) { width: 105px; }
.reviews-reference-table th:nth-child(2) { width: 230px; }
.reviews-reference-table th:nth-child(3) { width: 180px; }
.reviews-reference-table th:nth-child(4) { width: auto; }
.reviews-reference-table th:nth-child(5) { width: 105px; }
.reviews-reference-table th:nth-child(6) { width: 115px; }
.reviews-reference-table th:nth-child(7) { width: 110px; }
.reference-reason-value {
    display: -webkit-box;
    overflow: hidden;
    color: #4a5a72;
    font-size: 10.5px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.reference-service-count { display: inline-flex; align-items: baseline; gap: 4px; }
.reference-service-count strong { color: #312e81; font-size: 14px; }
.reference-service-count small { color: #7a879a; font-size: 8px; font-weight: 800; }
.reviews-reference-table .review-status-badge { min-height: 26px; padding: 5px 8px; font-size: 8.5px; white-space: nowrap; }

@media (max-width: 1180px) {
    #weeklyCalendarApp .reference-calendar-toolbar { grid-template-columns: 1fr auto; }
    .reference-calendar-balance { display: none; }
    .reference-calendar-status-cards { grid-column: 1; justify-self: start; grid-template-columns: repeat(3, minmax(102px, 1fr)); }
    .reference-calendar-navigation { grid-column: 2; }
}

@media (max-width: 900px) {
    .reference-register-filter { grid-template-columns: 1fr; }
    .reference-toolbar-actions { justify-content: flex-end; }
    .reference-table-wrap { max-height: none; overflow: visible; }

    #weeklyCalendarApp .reference-calendar-toolbar { grid-template-columns: 1fr; gap: 10px; }
    .reference-calendar-status-cards { grid-column: 1; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .reference-calendar-status-card { min-width: 0; justify-content: center; }
    .reference-calendar-navigation { grid-column: 1; justify-self: end; }
}

@media (max-width: 720px) {
    .reference-register-toolbar { padding: 10px; }
    .reference-toolbar-actions { width: 100%; }
    .reference-select-control { flex: 1; min-width: 0; }

    .reference-data-table,
    .patient-reference-table,
    .reviews-reference-table { min-width: 0; display: block; }
    .reference-data-table thead { display: none; }
    .reference-data-table tbody { display: grid; gap: 9px; padding: 10px; }
    .reference-data-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px 12px;
        padding: 12px;
        border: 1px solid #dde5f2;
        border-radius: 13px;
        background: #fff;
        box-shadow: 0 5px 15px rgba(39, 49, 109, .05);
    }
    .reference-data-table td {
        display: block;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }
    .reference-record-row:hover td:first-child { box-shadow: none; }

    .patient-reference-table td:nth-child(1) { grid-column: 1 / -1; }
    .patient-reference-table td:nth-child(2) { grid-column: 1; }
    .patient-reference-table td:nth-child(3) { grid-column: 2; grid-row: 2; text-align: right; }
    .patient-reference-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
    .patient-reference-table td:nth-child(5) { grid-column: 1; grid-row: 4; }
    .patient-reference-table td:nth-child(6) { grid-column: 2; grid-row: 4; text-align: right; }
    .patient-reference-table td:nth-child(7) { grid-column: 1; grid-row: 5; }
    .patient-reference-table td:nth-child(8) { grid-column: 2; grid-row: 5; }

    .reviews-reference-table td:nth-child(1) { grid-column: 2; grid-row: 1; text-align: right; }
    .reviews-reference-table td:nth-child(2) { grid-column: 1; grid-row: 1; }
    .reviews-reference-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
    .reviews-reference-table td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; }
    .reviews-reference-table td:nth-child(5) { grid-column: 1; grid-row: 4; }
    .reviews-reference-table td:nth-child(6) { grid-column: 2; grid-row: 4; text-align: right; }
    .reviews-reference-table td:nth-child(7) { grid-column: 1 / -1; grid-row: 5; }
    .reviews-reference-table .reference-row-actions { justify-content: flex-end; }

    .reference-pagination { align-items: stretch; flex-direction: column; }
    .reference-pagination nav { justify-content: flex-end; }
}

@media (max-width: 620px) {
    .reference-calendar-status-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reference-calendar-status-card { justify-content: flex-start; }
    .reference-calendar-navigation { width: 100%; grid-template-columns: 36px minmax(130px, 1fr) 36px !important; }
    #weeklyCalendarApp .weekly-calendar-scroll { max-height: calc(100vh - 270px); }
}

@media (max-width: 480px) {
    .reference-register-filter { gap: 9px; }
    .reference-toolbar-actions { flex-wrap: wrap; }
    .reference-total-count { order: -1; }
    .reference-person-photo,
    .reference-person-avatar { width: 34px; height: 34px; flex-basis: 34px; }
}


/* Medibox 3.13.47 — patient profile tabs adapted from the supplied reference project */
.patient-profile-tabs-shell {
    overflow: hidden;
    border: 1px solid #dfe5ef;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(41, 51, 118, .08);
}
.patient-profile-tabs {
    display: flex;
    align-items: stretch;
    gap: 3px;
    overflow-x: auto;
    padding: 7px;
    border-bottom: 1px solid #e5eaf2;
    background: linear-gradient(180deg, #fbfcff, #f6f8fc);
    scrollbar-width: thin;
}
.patient-profile-tab {
    position: relative;
    min-width: max-content;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #68778e;
    background: transparent;
    font: inherit;
    font-size: 10px;
    font-weight: 850;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.patient-profile-tab .ui-icon { width: 16px; height: 16px; }
.patient-profile-tab > b {
    min-width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    color: #697890;
    background: #edf1f7;
    font-size: 8px;
}
.patient-profile-tab:hover { color: #4338ca; background: #f3f4ff; }
.patient-profile-tab.is-active {
    color: #3730a3;
    border-color: #d4d8fb;
    background: #eef2ff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, .10);
}
.patient-profile-tab.is-active > b { color: #3730a3; background: #fff; }
.patient-profile-tab-alert {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}
.patient-profile-panels { min-height: 360px; }
.patient-profile-panel { padding: 16px; }
.patient-profile-panel[hidden] { display: none !important; }
.patient-profile-identity-grid {
    display: grid;
    grid-template-columns: 1.15fr 1.15fr .7fr;
    gap: 12px;
}
.patient-profile-detail-card {
    min-width: 0;
    padding: 14px;
    border: 1px solid #e0e6ef;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(38, 50, 97, .055);
}
.patient-profile-detail-card > header,
.patient-profile-panel-header,
.patient-profile-panel-header > div {
    display: flex;
    align-items: center;
}
.patient-profile-detail-card > header { gap: 9px; margin-bottom: 12px; }
.patient-profile-detail-card > header > div { min-width: 0; flex: 1; }
.patient-profile-detail-card h2,
.patient-profile-panel-header h2 { margin: 1px 0 0; color: #263653; font-size: 13px; font-weight: 900; }
.patient-profile-detail-card small,
.patient-profile-panel-header small { color: #8996a9; font-size: 8px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.patient-profile-detail-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #4f46e5;
    background: #eef2ff;
}
.patient-profile-detail-icon.is-mint { color: #0f8a61; background: #e8faf4; }
.patient-profile-detail-icon.is-warning { color: #b45309; background: #fff5df; }
.patient-profile-detail-icon .ui-icon { width: 17px; height: 17px; }
.patient-profile-data-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 0 13px;
    margin: 0;
}
.patient-profile-data-list > div { min-width: 0; padding: 8px 0; border-bottom: 1px solid #edf1f5; }
.patient-profile-data-list > div.is-wide { grid-column: 1 / -1; }
.patient-profile-data-list dt { margin: 0 0 3px; color: #8a97a9; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.patient-profile-data-list dd { overflow: hidden; margin: 0; color: #31435e; font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.patient-profile-photo-card { text-align: center; }
.patient-profile-photo-preview {
    width: 104px;
    height: 104px;
    display: grid;
    place-items: center;
    overflow: hidden;
    margin: 12px auto 9px;
    padding: 0;
    border: 4px solid #f0f2ff;
    border-radius: 24px;
    color: #4338ca;
    background: linear-gradient(145deg, #eef2ff, #e8faf4);
    font-size: 25px;
    font-weight: 900;
    cursor: pointer;
}
.patient-profile-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.patient-profile-photo-name { display: block; color: #263653; font-size: 12px; }
.patient-profile-photo-card > small { display: block; margin-top: 4px; color: #8a97a9; font-size: 9px; }
.patient-profile-panel-header { justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.patient-profile-panel-header > div { min-width: 0; gap: 9px; }
.patient-safety-overview-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.patient-safety-overview-card {
    min-height: 170px;
    padding: 17px;
    border: 1px solid #e1e7ef;
    border-radius: 13px;
    background: #fbfcff;
}
.patient-safety-overview-card > span { width: 35px; height: 35px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 10px; color: #0f8a61; background: #e8faf4; }
.patient-safety-overview-card.has-alert { border-color: #fecaca; background: #fffafa; }
.patient-safety-overview-card.has-alert > span { color: #dc2626; background: #fee2e2; }
.patient-safety-overview-card small { color: #7f8ca0; font-size: 9px; font-weight: 900; text-transform: uppercase; }
.patient-safety-overview-card p { margin: 10px 0 0; color: #34455f; font-size: 11px; line-height: 1.65; }
.patient-profile-preview-table-wrap { border: 1px solid #e1e7ef; border-radius: 12px; }
.patient-profile-preview-table { min-width: 780px; font-size: 9px; }
.patient-profile-preview-table th { padding: 8px 10px; font-size: 8px; }
.patient-profile-preview-table td { padding: 9px 10px; }
.patient-profile-preview-table td > small,
.patient-profile-preview-table td > strong + small { display: block; margin-top: 2px; color: #8592a5; font-size: 8px; }
.patient-profile-empty { min-height: 180px; display: grid; place-items: center; color: #8491a4; font-size: 11px; font-weight: 750; }
.patient-profile-xray-preview-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; }
.patient-profile-xray-preview { overflow: hidden; border: 1px solid #e0e6ef; border-radius: 12px; color: inherit; background: #fff; text-decoration: none; }
.patient-profile-xray-preview img { width: 100%; aspect-ratio: 16/10; display: block; object-fit: cover; background: #eef2f7; }
.patient-profile-xray-preview > span { display: grid; gap: 3px; padding: 9px 10px; }
.patient-profile-xray-preview strong { overflow: hidden; color: #31435e; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.patient-profile-xray-preview small { color: #8996a9; font-size: 8px; }
.patient-profile-finance-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 11px; margin-bottom: 13px; }
.patient-profile-finance-summary article { display: grid; grid-template-columns: 36px 1fr; gap: 2px 10px; align-items: center; padding: 13px; border: 1px solid #e0e6ef; border-radius: 12px; background: #fbfcff; }
.patient-profile-finance-summary article > span { grid-row: 1/3; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #0f8a61; background: #e8faf4; }
.patient-profile-finance-summary article small { color: #8491a4; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.patient-profile-finance-summary article strong { color: #263653; font-size: 14px; }
.patient-profile-finance-summary article.is-debt > span { color: #b45309; background: #fff5df; }
.reference-row-actions .action-icon-button:first-child { color: #4338ca; background: #f4f5ff; border-color: #d8dcfb; }
.reference-row-actions .action-icon-button:first-child:hover { color: #312e81; background: #e9edff; }

@media (max-width: 1120px) {
    .patient-profile-identity-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .patient-profile-photo-card { grid-column: 1 / -1; }
    .patient-profile-xray-preview-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 760px) {
    .patient-profile-panel { padding: 11px; }
    .patient-profile-tab { min-height: 38px; padding: 7px 10px; font-size: 9px; }
    .patient-profile-identity-grid,
    .patient-safety-overview-grid,
    .patient-profile-finance-summary { grid-template-columns: 1fr; }
    .patient-profile-photo-card { grid-column: auto; }
    .patient-profile-panel-header { align-items: flex-start; flex-direction: column; }
    .patient-profile-xray-preview-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

/* Medibox 3.13.48 — patient detail overview with latest and previous visits */
.patient-detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 18px 24px;
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid #dce4ef;
    border-radius: 18px;
    background:
        radial-gradient(circle at 96% 0, rgba(79,70,229,.055), transparent 20rem),
        linear-gradient(135deg, #fff 0%, #fbfdff 72%, #f3fbf8 100%);
    box-shadow: 0 18px 42px rgba(39, 50, 112, .09);
}
.patient-detail-hero-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 18px;
}
.patient-detail-avatar {
    width: 86px;
    height: 86px;
    flex: 0 0 86px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 7px solid #f3f6fb;
    border-radius: 50%;
    color: #536fa2;
    background: linear-gradient(145deg, #eef2ff, #e6f8f2);
    box-shadow: 0 0 0 1px #dce5f0, 0 10px 24px rgba(56, 72, 143, .10);
    font-size: 25px;
    font-weight: 900;
}
.patient-detail-avatar img { width: 100%; height: 100%; object-fit: cover; }
.patient-detail-identity { min-width: 0; }
.patient-detail-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px;
}
.patient-detail-name-row h2 {
    margin: 0;
    color: #17223c;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.2;
}
.patient-detail-name-row h2 span { color: #29375a; }
.patient-detail-status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
}
.patient-detail-status.is-active { color: #047857; background: #dcfce7; }
.patient-detail-status.is-inactive { color: #9f1239; background: #ffe4e6; }
.patient-detail-identity > p {
    margin: 8px 0 13px;
    color: #66758d;
    font-size: 12px;
    font-weight: 650;
}
.patient-detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.patient-detail-actions .action-icon-button { width: 34px; height: 34px; }
.patient-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(130px, 1fr));
    gap: 10px;
    align-self: start;
}
.patient-detail-stats article {
    min-width: 130px;
    min-height: 82px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    padding: 12px;
    border: 1px solid #dce4ef;
    border-radius: 13px;
    background: rgba(255,255,255,.88);
    text-align: center;
    box-shadow: 0 7px 18px rgba(39, 52, 110, .045);
}
.patient-detail-stats small {
    color: #516078;
    font-size: 9px;
    font-weight: 850;
}
.patient-detail-stats strong { color: #3f46c8; font-size: 22px; font-weight: 950; }
.patient-detail-stats article:nth-child(2) strong { color: #059669; }
.patient-detail-stats article.is-debt strong { color: #dc2626; }
.patient-detail-stats article.is-clear strong { color: #059669; }
.patient-detail-facts {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.patient-detail-facts article {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 72px;
    padding: 12px 14px;
    border: 1px solid #dce4ef;
    border-radius: 13px;
    background: rgba(255,255,255,.9);
}
.patient-detail-facts article > span {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #4f46e5;
    background: #eef2ff;
}
.patient-detail-facts article:nth-child(2) > span,
.patient-detail-facts article.is-clear > span { color: #059669; background: #e7faf4; }
.patient-detail-facts article.is-alert > span { color: #e11d48; background: #fff0f3; }
.patient-detail-facts article > span .ui-icon { width: 19px; height: 19px; }
.patient-detail-facts div { min-width: 0; }
.patient-detail-facts small {
    display: block;
    margin-bottom: 3px;
    color: #65748c;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.patient-detail-facts strong {
    display: block;
    overflow: hidden;
    color: #1f2e49;
    font-size: 11px;
    font-weight: 850;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.patient-visits-overview { margin-bottom: 22px; }
.patient-visits-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 3px 9px;
}
.patient-visits-heading h2 {
    margin: 0;
    color: #087a5d;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.patient-visits-heading > span {
    color: #4f46e5;
    font-size: 11px;
    font-weight: 900;
}
.patient-last-visit-card {
    position: relative;
    display: grid;
    grid-template-columns: 95px minmax(180px, .85fr) minmax(160px, .75fr) minmax(220px, 1fr) minmax(150px, .65fr) 38px;
    align-items: center;
    gap: 14px;
    overflow: hidden;
    padding: 17px 18px 42px;
    border: 1px solid #dce4ee;
    border-top: 3px solid transparent;
    border-radius: 15px;
    background:
        linear-gradient(#fff,#fff) padding-box,
        linear-gradient(90deg,#4f46e5,#0ea5e9,#10b981) border-box;
    box-shadow: 0 13px 30px rgba(39, 52, 112, .08);
}
.patient-last-visit-card > footer {
    position: absolute;
    right: 14px;
    bottom: 9px;
    display: flex;
    gap: 7px;
}
.patient-last-visit-card > footer span,
.patient-previous-visit-card footer > span:last-child {
    padding: 4px 8px;
    border: 1px solid #dce4ef;
    border-radius: 999px;
    color: #52617a;
    background: #fff;
    font-size: 8px;
    font-weight: 800;
}
.patient-visit-primary { display: grid; gap: 8px; }
.patient-visit-primary > strong { color: #4f46e5; font-size: 12px; font-weight: 950; }
.patient-visit-primary > span,
.patient-previous-visit-card header > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #34455f;
    font-size: 9px;
    font-weight: 850;
}
.patient-visit-primary .ui-icon,
.patient-previous-visit-card header .ui-icon { width: 15px; height: 15px; color: #10a78a; }
.patient-visit-reason,
.patient-visit-diagnosis { min-width: 0; display: grid; gap: 4px; }
.patient-visit-reason strong,
.patient-visit-diagnosis strong { overflow: hidden; color: #20304b; font-size: 10px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.patient-visit-reason small,
.patient-visit-diagnosis small { color: #8290a4; font-size: 8px; line-height: 1.4; }
.patient-visit-diagnosis strong { color: #4f46e5; }
.patient-visit-note { color: #66758d; font-size: 9px; line-height: 1.55; }
.patient-visit-doctor { display: inline-flex; align-items: center; gap: 7px; color: #243550; font-size: 9px; }
.patient-visit-doctor .ui-icon { width: 17px; height: 17px; color: #0aa683; }
.patient-last-visit-card > .action-icon-button { justify-self: end; }
.patient-previous-visits-heading { margin-top: 20px; }
.patient-previous-visits-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child {
    grid-column: 1 / -1;
}
.patient-previous-visit-card {
    overflow: hidden;
    border: 1px solid #dce4ef;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(42, 54, 111, .065);
}
.patient-previous-visit-card > header {
    display: grid;
    grid-template-columns: auto 1fr 34px;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-bottom: 1px solid #e6ebf2;
    background: linear-gradient(100deg, #fbfcff, #f3fbf8);
}
.patient-previous-visit-card > header > strong { color: #4f46e5; font-size: 11px; font-weight: 950; }
.patient-previous-visit-card > header .action-icon-button { width: 34px; height: 34px; }
.patient-previous-visit-card > div { padding: 14px; }
.patient-previous-visit-card > div > strong { color: #263650; font-size: 10px; font-weight: 900; }
.patient-previous-visit-card p { margin: 7px 0 0; color: #697890; font-size: 9px; line-height: 1.55; }
.patient-previous-diagnosis { padding-top: 0 !important; }
.patient-previous-diagnosis strong { color: #4f46e5 !important; font-size: 9px !important; }
.patient-previous-visit-card > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 13px;
    border-top: 1px dashed #e0e6ef;
}
.patient-previous-visit-card footer > span:first-child { display: inline-flex; align-items: center; gap: 6px; color: #283a55; font-size: 8px; font-weight: 850; }
.patient-previous-visit-card footer .ui-icon { width: 15px; height: 15px; color: #0aa683; }
.patient-visit-empty {
    min-height: 100px;
    margin-bottom: 18px;
    border: 1px dashed #dce4ef;
    border-radius: 14px;
    background: rgba(255,255,255,.72);
}
.patient-profile-tabs-shell { margin-top: 4px; }

@media (max-width: 1280px) {
    .patient-detail-hero { grid-template-columns: 1fr; }
    .patient-detail-stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .patient-last-visit-card { grid-template-columns: 82px 1fr 1fr; padding-bottom: 48px; }
    .patient-visit-note,
    .patient-visit-doctor { grid-column: span 1; }
}
@media (max-width: 900px) {
    .patient-detail-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .patient-last-visit-card { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .patient-last-visit-card > .action-icon-button { position: absolute; top: 12px; right: 12px; }
    .patient-previous-visits-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .patient-detail-hero { padding: 15px; border-radius: 15px; }
    .patient-detail-hero-main { align-items: flex-start; gap: 12px; }
    .patient-detail-avatar { width: 62px; height: 62px; flex-basis: 62px; border-width: 5px; font-size: 18px; }
    .patient-detail-name-row h2 { font-size: 16px; }
    .patient-detail-identity > p { font-size: 10px; }
    .patient-detail-stats { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
    .patient-detail-stats article { min-width: 0; min-height: 66px; padding: 8px 5px; }
    .patient-detail-stats small { font-size: 7px; }
    .patient-detail-stats strong { font-size: 16px; }
    .patient-detail-facts { grid-template-columns: 1fr; }
    .patient-last-visit-card { grid-template-columns: 1fr; gap: 10px; padding: 15px 15px 46px; }
    .patient-visit-note,
    .patient-visit-doctor { grid-column: auto; }
    .patient-previous-visit-card > header { grid-template-columns: auto 1fr 34px; }
}

/* Medibox 3.13.49 — simplified professional patient profile */
.patient-profile-page-shell { display: grid; gap: 16px; }
.patient-profile-simple-hero {
    overflow: hidden;
    border: 1px solid #dce4ef;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 13px 32px rgba(39, 50, 112, .075);
}
.patient-profile-simple-main {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px 20px 14px;
}
.patient-profile-simple-avatar { width: 72px; height: 72px; flex-basis: 72px; border-width: 5px; font-size: 20px; }
.patient-profile-simple-identity { min-width: 0; }
.patient-profile-simple-identity .patient-detail-name-row h2 { font-size: 19px; }
.patient-profile-simple-identity > p { margin: 6px 0 8px; color: #6f7d92; font-size: 10px; font-weight: 700; }
.patient-profile-simple-contact { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 14px; }
.patient-profile-simple-contact > span { display: inline-flex; align-items: center; gap: 6px; color: #52627b; font-size: 9px; font-weight: 750; }
.patient-profile-simple-contact .ui-icon { width: 14px; height: 14px; color: #4f46e5; }
.patient-profile-edit-action { align-self: start; }
.patient-profile-simple-hero > .patient-profile-tabs {
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-top: 1px solid #e8edf4;
    border-radius: 0;
    background: #fafbfe;
    box-shadow: none;
}
.patient-profile-simple-hero .patient-profile-tab {
    min-height: 43px;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
}
.patient-profile-simple-hero .patient-profile-tab.is-active {
    color: #4338ca;
    border-bottom-color: #4f46e5;
    background: transparent;
    box-shadow: none;
}
.patient-profile-new-visit-row { display: flex; align-items: center; justify-content: flex-end; margin-top: -2px; }
.patient-profile-new-visit { min-height: 38px; padding: 8px 15px; border-radius: 10px; }
.patient-profile-new-visit .ui-icon { width: 16px; height: 16px; }
.patient-profile-tabs-content-shell { margin-top: 0; }
.patient-profile-tabs-content-shell > .patient-profile-panels { border-radius: 15px; }
.patient-visits-overview { margin-bottom: 0; }
.patient-visits-heading { margin-inline: 1px; }
.patient-last-visit-card {
    border: 1px solid #dce4ef;
    border-top: 1px solid #dce4ef;
    background: #fff;
    box-shadow: 0 9px 23px rgba(39, 52, 112, .065);
}
.patient-previous-visit-card { box-shadow: 0 8px 20px rgba(42, 54, 111, .055); }
.patient-previous-visit-card > header { background: #fafbfe; }

@media (max-width: 760px) {
    .patient-profile-simple-main { grid-template-columns: auto minmax(0,1fr); padding: 14px; }
    .patient-profile-edit-action { position: absolute; right: 14px; }
    .patient-profile-simple-avatar { width: 58px; height: 58px; flex-basis: 58px; }
    .patient-profile-simple-identity .patient-detail-name-row { padding-right: 38px; }
    .patient-profile-simple-identity .patient-detail-name-row h2 { font-size: 15px; }
    .patient-profile-simple-contact { align-items: flex-start; flex-direction: column; gap: 5px; }
    .patient-profile-simple-hero > .patient-profile-tabs { overflow-x: auto; padding-inline: 7px; }
    .patient-profile-simple-hero .patient-profile-tab { flex: 0 0 auto; white-space: nowrap; }
    .patient-profile-new-visit-row { justify-content: stretch; }
    .patient-profile-new-visit { width: 100%; justify-content: center; }
}

/* Medibox 3.13.50 — enhanced five-tab patient dossier */
.patient-profile-v2 { display: grid; gap: 16px; }
.patient-profile-v2-hero {
    overflow: hidden;
    border: 1px solid #dce4ef;
    border-radius: 18px;
    background:
        radial-gradient(circle at 92% 0, rgba(79,70,229,.055), transparent 22rem),
        #fff;
    box-shadow: 0 16px 38px rgba(37, 49, 106, .085);
}
.patient-profile-v2-main {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 20px 22px 16px;
}
.patient-profile-v2-avatar { width: 78px; height: 78px; flex-basis: 78px; border-width: 6px; font-size: 22px; }
.patient-profile-v2-identity { min-width: 0; }
.patient-profile-v2-identity .patient-detail-name-row { justify-content: flex-start; gap: 9px; }
.patient-profile-v2-identity h1 {
    min-width: 0;
    margin: 0;
    color: #16233d;
    font-size: 19px;
    font-weight: 950;
    line-height: 1.25;
}
.patient-profile-v2-identity h1 > span { color: #111827; }
.patient-profile-v2-identity > p { margin: 7px 0 11px; color: #697890; font-size: 10px; font-weight: 700; }
.patient-profile-v2-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.patient-profile-v2-actions .btn { min-height: 38px; padding: 8px 14px; border-radius: 10px; }
.patient-profile-v2-stats { display: grid; grid-template-columns: repeat(3,minmax(128px,1fr)); gap: 10px; }
.patient-profile-v2-stats article {
    min-height: 76px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 5px;
    padding: 12px 16px;
    border: 1px solid #dce4ef;
    border-radius: 13px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 6px 18px rgba(40,53,109,.045);
}
.patient-profile-v2-stats small { color: #52617a; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.patient-profile-v2-stats strong { color: #4f46e5; font-size: 20px; font-weight: 950; }
.patient-profile-v2-stats article.is-clear strong { color: #0f9f72; }
.patient-profile-v2-stats article.has-debt strong { color: #dc2626; }
.patient-profile-v2-facts {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px;
    padding: 0 22px 17px;
}
.patient-profile-v2-facts article {
    min-width: 0;
    min-height: 65px;
    display: grid;
    grid-template-columns: 38px minmax(0,1fr);
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #dce4ef;
    border-radius: 12px;
    background: #fff;
}
.patient-profile-v2-facts article > span {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #4f46e5;
    background: #eef2ff;
}
.patient-profile-v2-facts article:nth-child(2) > span,
.patient-profile-v2-facts article.is-clear > span { color: #0f9f72; background: #e8faf4; }
.patient-profile-v2-facts article.has-alert > span,
.patient-profile-v2-facts article.has-debt > span { color: #dc2626; background: #fff0f2; }
.patient-profile-v2-facts small { display: block; margin-bottom: 4px; color: #66758d; font-size: 7.5px; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
.patient-profile-v2-facts strong { display: block; overflow: hidden; color: #243550; font-size: 10px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.patient-profile-v2-facts article.is-clear strong { color: #087a5d; }
.patient-profile-v2-facts article.has-debt strong { color: #dc2626; }
.patient-profile-v2-tabs {
    display: flex;
    align-items: stretch;
    gap: 2px;
    overflow-x: auto;
    padding: 0 14px;
    border-top: 1px solid #e7ecf3;
    background: #fafbfe;
    scrollbar-width: thin;
}
.patient-profile-v2-tab {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border: 0;
    border-bottom: 3px solid transparent;
    color: #66758d;
    background: transparent;
    font: inherit;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
    cursor: pointer;
    transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.patient-profile-v2-tab .ui-icon { width: 16px; height: 16px; }
.patient-profile-v2-tab > b {
    min-width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    color: #697890;
    background: #edf1f7;
    font-size: 8px;
}
.patient-profile-v2-tab:hover { color: #4338ca; background: #f5f6ff; }
.patient-profile-v2-tab.is-active { color: #3730a3; border-bottom-color: #4f46e5; background: #f6f7ff; }
.patient-profile-v2-tab.is-active > b { color: #3730a3; background: #e8eaff; }
.patient-profile-v2-content {
    overflow: hidden;
    border: 1px solid #dce4ef;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(39,50,112,.07);
}
.patient-profile-v2-panel { padding: 18px; }
.patient-profile-v2-panel[hidden] { display: none !important; }
.patient-profile-v2-panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid #e8edf4;
}
.patient-profile-v2-panel-heading small { color: #8390a4; font-size: 8px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.patient-profile-v2-panel-heading h2 { margin: 2px 0 0; color: #20304b; font-size: 17px; font-weight: 950; }
.patient-profile-v2-panel .patient-visits-heading h3 {
    margin: 0;
    color: #087a5d;
    font-size: 13px;
    font-weight: 950;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.patient-profile-v2-summary-cards {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 11px;
    margin-bottom: 16px;
}
.patient-profile-v2-summary-four { grid-template-columns: repeat(4,minmax(0,1fr)); }
.patient-profile-v2-summary-cards article {
    min-height: 78px;
    display: grid;
    align-content: center;
    gap: 5px;
    padding: 14px 16px;
    border: 1px solid #dde5f0;
    border-radius: 12px;
    background: linear-gradient(145deg,#fff,#f9fbff);
}
.patient-profile-v2-summary-cards small { color: #7d8a9f; font-size: 8px; font-weight: 900; text-transform: uppercase; }
.patient-profile-v2-summary-cards strong { color: #4f46e5; font-size: 18px; font-weight: 950; }
.patient-profile-v2-summary-cards article.is-paid strong,
.patient-profile-v2-summary-cards article.is-clear strong { color: #0f9f72; }
.patient-profile-v2-summary-cards article.has-debt strong { color: #dc2626; }
.patient-appointment-ledger { display: grid; gap: 8px; }
.patient-appointment-ledger-row {
    display: grid;
    grid-template-columns: 112px minmax(150px,1fr) minmax(170px,1fr) 125px 72px 38px;
    align-items: center;
    gap: 13px;
    padding: 12px 13px;
    border: 1px solid #e0e6ef;
    border-radius: 12px;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.patient-appointment-ledger-row:hover { transform: translateY(-1px); border-color: #cfd7f5; box-shadow: 0 8px 20px rgba(45,56,119,.07); }
.patient-appointment-ledger-row > div { min-width: 0; }
.patient-appointment-ledger-row small { display: block; margin-bottom: 4px; color: #8996a9; font-size: 7px; font-weight: 900; text-transform: uppercase; }
.patient-appointment-ledger-row strong { display: block; overflow: hidden; color: #293a55; font-size: 9.5px; font-weight: 900; text-overflow: ellipsis; white-space: nowrap; }
.patient-appointment-ledger-row div > span:not(.badge) { display: block; margin-top: 3px; color: #7b899e; font-size: 8px; }
.patient-appointment-date strong { color: #4f46e5; font-size: 10px; }
.patient-appointment-date > span { color: #0a8f70 !important; font-weight: 900; }
.patient-finance-section + .patient-finance-section { margin-top: 20px; }
.patient-finance-section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 2px 9px; }
.patient-finance-section-title h3 { margin: 0; color: #283954; font-size: 12px; font-weight: 950; }
.patient-finance-section-title span { min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 999px; color: #4338ca; background: #eef2ff; font-size: 8px; font-weight: 900; }
.patient-profile-v2-table { min-width: 780px; }
.patient-profile-v2-table th { padding: 9px 11px; color: #5e6e86; font-size: 8px; }
.patient-profile-v2-table td { padding: 10px 11px; font-size: 9px; }
.patient-xray-professional-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.patient-xray-professional-card { overflow: hidden; border: 1px solid #dfe6ef; border-radius: 13px; background: #fff; box-shadow: 0 7px 18px rgba(41,52,105,.055); }
.patient-xray-professional-card > a { display: block; overflow: hidden; background: #eef2f7; }
.patient-xray-professional-card img { width: 100%; aspect-ratio: 16/10; display: block; object-fit: cover; transition: transform .2s ease; }
.patient-xray-professional-card:hover img { transform: scale(1.025); }
.patient-xray-professional-card > div { display: grid; gap: 3px; padding: 10px 11px; }
.patient-xray-professional-card strong { overflow: hidden; color: #293a55; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.patient-xray-professional-card span,
.patient-xray-professional-card small { color: #8390a4; font-size: 8px; }
.patient-profile-v2-panel .patient-profile-identity-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.patient-profile-v2-panel .patient-profile-photo-card { grid-column: auto; }
.patient-profile-v2-panel .patient-profile-medical-card { grid-column: auto; }
.patient-profile-v2-panel .patient-profile-data-list dd { white-space: normal; line-height: 1.5; }

@media (max-width: 1280px) {
    .patient-profile-v2-main { grid-template-columns: auto minmax(0,1fr); }
    .patient-profile-v2-stats { grid-column: 1 / -1; grid-template-columns: repeat(3,minmax(0,1fr)); }
    .patient-profile-v2-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .patient-appointment-ledger-row { grid-template-columns: 100px 1fr 1fr 110px 38px; }
    .patient-appointment-ledger-row > div:nth-child(5) { display: none; }
    .patient-xray-professional-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
    .patient-profile-v2-summary-four { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .patient-appointment-ledger-row { grid-template-columns: repeat(2,minmax(0,1fr)) 38px; align-items: start; }
    .patient-appointment-ledger-row > .action-icon-button { grid-column: 3; grid-row: 1; }
    .patient-xray-professional-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 700px) {
    .patient-profile-v2-main { grid-template-columns: auto minmax(0,1fr); padding: 15px; gap: 12px; }
    .patient-profile-v2-avatar { width: 60px; height: 60px; flex-basis: 60px; border-width: 5px; font-size: 17px; }
    .patient-profile-v2-identity h1 { font-size: 15px; }
    .patient-profile-v2-actions { grid-column: 1 / -1; }
    .patient-profile-v2-actions .btn { flex: 1; justify-content: center; }
    .patient-profile-v2-stats { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
    .patient-profile-v2-stats article { min-height: 65px; padding: 8px 5px; }
    .patient-profile-v2-stats small { font-size: 6.5px; }
    .patient-profile-v2-stats strong { font-size: 15px; }
    .patient-profile-v2-facts { grid-template-columns: 1fr; padding: 0 15px 14px; }
    .patient-profile-v2-tabs { padding-inline: 6px; }
    .patient-profile-v2-tab { flex: 0 0 auto; min-height: 44px; padding: 8px 11px; font-size: 9px; }
    .patient-profile-v2-panel { padding: 12px; }
    .patient-profile-v2-panel-heading { align-items: flex-start; flex-direction: column; }
    .patient-profile-v2-panel-heading .btn { width: 100%; justify-content: center; }
    .patient-profile-v2-summary-cards,
    .patient-profile-v2-summary-four { grid-template-columns: 1fr 1fr; }
    .patient-appointment-ledger-row { grid-template-columns: 1fr 38px; }
    .patient-appointment-ledger-row > div { grid-column: 1; }
    .patient-appointment-ledger-row > .action-icon-button { grid-column: 2; grid-row: 1; }
    .patient-xray-professional-grid,
    .patient-profile-v2-panel .patient-profile-identity-grid { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
    .patient-profile-v2-summary-cards,
    .patient-profile-v2-summary-four { grid-template-columns: 1fr; }
    .patient-profile-v2-stats { grid-template-columns: 1fr 1fr 1fr; }
    .patient-profile-v2-actions .action-icon-button { flex: 0 0 38px; }
    .patient-xray-professional-grid { grid-template-columns: 1fr; }
}

/* Medibox 3.13.53 — highlighted next/previous appointment cards */
.patient-profile-v2-panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.patient-appointment-highlight-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.patient-appointment-highlight-card {
    overflow: hidden;
    min-height: 222px;
    display: flex;
    flex-direction: column;
    border: 1px solid #dbe3f0;
    border-radius: 16px;
    background: linear-gradient(150deg,#ffffff 0%,#f8faff 100%);
    box-shadow: 0 12px 28px rgba(44,55,119,.075);
    transition: transform .16s ease,border-color .16s ease,box-shadow .16s ease;
}
.patient-appointment-highlight-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5f2;
    box-shadow: 0 16px 34px rgba(44,55,119,.11);
}
.patient-appointment-highlight-card.is-next {
    border-top: 3px solid #4f46e5;
}
.patient-appointment-highlight-card.is-previous {
    border-top: 3px solid #10b981;
}
.patient-appointment-highlight-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 15px 11px;
    border-bottom: 1px solid #e9eef6;
}
.patient-appointment-highlight-title {
    display: flex;
    align-items: center;
    gap: 10px;
}
.patient-appointment-highlight-title > span {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #4f46e5;
    background: #eef2ff;
}
.patient-appointment-highlight-card.is-previous .patient-appointment-highlight-title > span {
    color: #0f8a61;
    background: #e8faf4;
}
.patient-appointment-highlight-title > span .ui-icon { width: 18px; height: 18px; }
.patient-appointment-highlight-title small {
    display: block;
    margin-bottom: 2px;
    color: #8a96a9;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.patient-appointment-highlight-title h3 {
    margin: 0;
    color: #21324e;
    font-size: 13px;
    font-weight: 950;
}
.patient-appointment-highlight-datetime {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 15px 0;
}
.patient-appointment-highlight-datetime > span {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid #dce4f0;
    border-radius: 10px;
    color: #4f46e5;
    background: #fff;
}
.patient-appointment-highlight-card.is-previous .patient-appointment-highlight-datetime > span { color: #0f8a61; }
.patient-appointment-highlight-datetime .ui-icon { width: 14px; height: 14px; }
.patient-appointment-highlight-datetime strong { color: #2a3b58; font-size: 10px; font-weight: 950; }
.patient-appointment-highlight-reason {
    display: grid;
    gap: 4px;
    padding: 12px 15px 0;
}
.patient-appointment-highlight-reason small,
.patient-appointment-highlight-meta small {
    color: #8995a8;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}
.patient-appointment-highlight-reason strong {
    color: #263853;
    font-size: 11px;
    font-weight: 950;
}
.patient-appointment-highlight-meta {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 9px;
    padding: 12px 15px 14px;
}
.patient-appointment-highlight-meta > span {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid #e1e7f0;
    border-radius: 11px;
    background: rgba(255,255,255,.82);
}
.patient-appointment-highlight-meta > span > .ui-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    color: #4f46e5;
}
.patient-appointment-highlight-card.is-previous .patient-appointment-highlight-meta > span > .ui-icon { color: #0f8a61; }
.patient-appointment-highlight-meta > span > span { min-width: 0; }
.patient-appointment-highlight-meta strong {
    display: block;
    overflow: hidden;
    margin-top: 2px;
    color: #33445f;
    font-size: 9px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.patient-appointment-highlight-card > footer {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding: 9px 15px;
    border-top: 1px solid #e8edf5;
    background: rgba(248,250,255,.82);
}
.patient-appointment-highlight-card > footer > span {
    color: #718097;
    font-size: 8px;
    font-weight: 850;
}
.patient-appointment-highlight-empty {
    min-height: 148px;
    display: grid;
    place-items: center;
    padding: 20px;
    color: #8290a5;
    font-size: 10px;
    font-weight: 850;
    text-align: center;
}
.patient-appointment-highlight-card.is-empty {
    min-height: 190px;
    background: linear-gradient(145deg,#fff,#fafbfe);
}

@media (max-width: 900px) {
    .patient-appointment-highlight-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .patient-profile-v2-panel-actions .btn { width: 100%; justify-content: center; }
    .patient-appointment-highlight-meta { grid-template-columns: 1fr; }
    .patient-appointment-highlight-datetime { flex-wrap: wrap; }
}

/* Medibox 3.13.54 — compact patient header and enhanced personal-data cards */
.patient-profile-v2-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
}
.patient-profile-v2-title-line h1 {
    flex: 0 1 auto;
}
.patient-profile-v2-inline-meta {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}
.patient-profile-meta-chip {
    min-height: 29px;
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border: 1px solid #dfe5f0;
    border-radius: 999px;
    color: #52627a;
    background: #f8faff;
    font-size: 9px;
    font-weight: 850;
    white-space: nowrap;
}
.patient-profile-v2-inline-meta .patient-detail-status {
    min-height: 29px;
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    white-space: nowrap;
}
.patient-profile-v2-inline-meta .action-icon-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
}
.patient-profile-schedule-button {
    min-height: 34px !important;
    padding: 6px 12px !important;
    border-color: #cfd7f5 !important;
    color: #4338ca !important;
    background: linear-gradient(180deg,#fff,#f5f6ff) !important;
    box-shadow: 0 5px 13px rgba(79,70,229,.08) !important;
}
.patient-profile-schedule-button:hover {
    border-color: #aebaf0 !important;
    background: #eef1ff !important;
}

.patient-profile-v2-panel .patient-profile-identity-grid {
    gap: 15px;
}
.patient-profile-v2-panel .patient-profile-detail-card {
    position: relative;
    overflow: hidden;
    min-height: 230px;
    padding: 17px;
    border-color: #dbe3ef;
    border-radius: 16px;
    background: linear-gradient(150deg,#fff 0%,#fafbff 100%);
    box-shadow: 0 12px 28px rgba(41,52,105,.07);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.patient-profile-v2-panel .patient-profile-detail-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: linear-gradient(90deg,#4f46e5,#818cf8);
}
.patient-profile-v2-panel .patient-profile-contact-card::before {
    background: linear-gradient(90deg,#10b981,#5eead4);
}
.patient-profile-v2-panel .patient-profile-photo-card::before {
    background: linear-gradient(90deg,#2563eb,#60a5fa);
}
.patient-profile-v2-panel .patient-profile-medical-card::before {
    background: linear-gradient(90deg,#f59e0b,#fcd34d);
}
.patient-profile-v2-panel .patient-profile-detail-card:hover {
    transform: translateY(-2px);
    border-color: #cbd5e7;
    box-shadow: 0 16px 34px rgba(41,52,105,.10);
}
.patient-profile-v2-panel .patient-profile-detail-card > header {
    min-height: 42px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #edf1f6;
}
.patient-profile-v2-panel .patient-profile-detail-card h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.25;
}
.patient-profile-v2-panel .patient-profile-data-list > div {
    padding: 10px 0;
}
.patient-profile-v2-panel .patient-profile-data-list dt {
    color: #7b879b;
    font-size: 8px;
}
.patient-profile-v2-panel .patient-profile-data-list dd {
    color: #253650;
    font-size: 10px;
    font-weight: 850;
}

@media (max-width: 1280px) {
    .patient-profile-v2-title-line { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 700px) {
    .patient-profile-v2-title-line { gap: 8px; }
    .patient-profile-v2-inline-meta { width: 100%; }
    .patient-profile-schedule-button { flex: 1; justify-content: center; }
    .patient-profile-v2-panel .patient-profile-detail-card { min-height: 0; }
}

/* 3.13.59 · Professional service details inspired by the reference review layout */
#serviceDetailsDialog.service-details-dialog {
  width: min(860px, calc(100vw - 34px));
  max-width: 860px;
}

#serviceDetailsDialog .service-details-card {
  overflow: hidden;
  border: 1px solid #dfe5ef;
  border-radius: 22px;
  background: #f8fafc;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .22);
}

#serviceDetailsDialog .service-details-modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, .96);
}

.service-details-modal-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.service-details-modal-heading .eyebrow {
  margin: 0 0 2px;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.service-details-modal-heading h2 {
  margin: 0;
  color: #172033;
  font-size: 20px;
}

.service-details-modal-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  border-radius: 13px;
  background: linear-gradient(145deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 10px 24px rgba(79, 70, 229, .22);
}

.service-details-modal-icon .ui-icon {
  width: 21px;
  height: 21px;
}

#serviceDetailsDialog .service-details-body {
  display: grid;
  gap: 12px;
  padding: 16px 18px 18px;
  background: #f8fafc;
}

.service-detail-hero {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 15px 16px;
  border: 1px solid #dfe4f3;
  border-radius: 17px;
  background: linear-gradient(135deg, #fff, #f7f7ff 67%, #effcf9);
  box-shadow: 0 10px 28px rgba(30, 41, 59, .055);
}

.service-detail-hero-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(145deg, #4f46e5, #6366f1);
  color: #fff;
  box-shadow: 0 12px 26px rgba(79, 70, 229, .24);
}

.service-detail-hero-icon .ui-icon {
  width: 28px;
  height: 28px;
}

.service-detail-hero-copy {
  min-width: 0;
}

.service-detail-hero-copy > span {
  display: inline-flex;
  margin-bottom: 4px;
  padding: 3px 8px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
}

.service-detail-hero-copy h3 {
  margin: 0;
  color: #172033;
  font-size: 19px;
  line-height: 1.25;
}

.service-detail-hero-copy p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 650;
}

.service-detail-price {
  min-width: 145px;
  padding: 11px 13px;
  display: grid;
  gap: 3px;
  border: 1px solid #99f6e4;
  border-radius: 13px;
  background: #ecfdf5;
  text-align: right;
}

.service-detail-price small {
  color: #0f766e;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.service-detail-price strong {
  color: #115e59;
  font-size: 16px;
}

.service-detail-price.is-restricted {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.service-detail-price.is-restricted small,
.service-detail-price.is-restricted strong {
  color: #64748b;
}

.service-detail-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.service-detail-stat-grid article {
  min-width: 0;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(30, 41, 59, .025);
}

.service-detail-stat-grid article > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef2ff;
  color: #4f46e5;
}

.service-detail-stat-grid article > span .ui-icon {
  width: 17px;
  height: 17px;
}

.service-detail-stat-grid small {
  display: block;
  margin-bottom: 2px;
  color: #94a3b8;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.service-detail-stat-grid strong {
  display: block;
  overflow: hidden;
  color: #253047;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-detail-stat-grid article:last-child {
  border-color: #a7f3d0;
  background: #f0fdfa;
}

.service-detail-stat-grid article:last-child > span {
  background: #ccfbf1;
  color: #0f766e;
}

.service-detail-stat-grid article.is-inactive {
  border-color: #fecaca;
  background: #fff7f7;
}

.service-detail-stat-grid article.is-inactive > span {
  background: #fee2e2;
  color: #b91c1c;
}

.service-detail-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  gap: 10px;
}

.service-detail-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(30, 41, 59, .03);
}

.service-detail-card > header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.service-detail-card > header > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eef2ff;
  color: #4f46e5;
}

.service-detail-card > header > span .ui-icon {
  width: 17px;
  height: 17px;
}

.service-detail-card > header small {
  display: block;
  color: #94a3b8;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.service-detail-card > header h4 {
  margin: 2px 0 0;
  color: #334155;
  font-size: 12px;
}

.service-detail-card > p {
  min-height: 74px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-line;
}

.service-detail-availability-card > header > span {
  background: #ccfbf1;
  color: #0f766e;
}

.service-detail-availability {
  min-height: 74px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid #99f6e4;
  border-radius: 11px;
  background: #f0fdfa;
}

.service-detail-availability > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #ccfbf1;
  color: #0f766e;
}

.service-detail-availability > span .ui-icon {
  width: 19px;
  height: 19px;
}

.service-detail-availability strong {
  display: block;
  color: #115e59;
  font-size: 12px;
}

.service-detail-availability small {
  display: block;
  margin-top: 3px;
  color: #0f766e;
  font-size: 10px;
  line-height: 1.35;
}

.service-detail-availability.is-inactive {
  border-color: #fecaca;
  background: #fff7f7;
}

.service-detail-availability.is-inactive > span {
  background: #fee2e2;
  color: #b91c1c;
}

.service-detail-availability.is-inactive strong,
.service-detail-availability.is-inactive small {
  color: #991b1b;
}

#serviceDetailsDialog .service-details-footer {
  padding: 13px 18px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.service-details-action {
  color: #4f46e5;
  background: #eef2ff;
  border-color: #c7d2fe;
}

.service-details-action:hover {
  color: #3730a3;
  background: #e0e7ff;
  border-color: #a5b4fc;
}

@media (max-width: 760px) {
  #serviceDetailsDialog.service-details-dialog {
    width: calc(100vw - 18px);
  }

  .service-detail-hero {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .service-detail-hero-icon {
    width: 48px;
    height: 48px;
  }

  .service-detail-price {
    grid-column: 1 / -1;
    min-width: 0;
    text-align: left;
  }

  .service-detail-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-detail-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 460px) {
  #serviceDetailsDialog .service-details-body {
    padding: 12px;
  }

  .service-detail-stat-grid {
    grid-template-columns: 1fr;
  }

  .service-detail-hero-copy h3 {
    font-size: 16px;
  }
}

/* ========================================================================== 
   3.13.60 · SERVICE DETAILS — EXACT REVIEW RECORD WORKFLOW
   Mirrors the attached project's full-screen "Детали за преглед" structure.
   ========================================================================== */
#serviceDetailsDialog.service-review-dialog[open]{
  position:fixed;
  inset:8px;
  width:calc(100vw - 16px);
  max-width:none;
  height:calc(100vh - 16px);
  max-height:none;
  margin:0;
  padding:0;
  overflow:hidden;
  border:0;
  border-radius:21px;
  background:transparent;
  box-shadow:0 30px 90px rgba(15,23,42,.28);
}
#serviceDetailsDialog.service-review-dialog::backdrop{
  background:rgba(15,23,42,.58);
  backdrop-filter:blur(4px);
}
#serviceDetailsDialog .service-review-record-modal{
  width:100%;
  height:100%;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  overflow:hidden;
  border:1px solid #cfdce7;
  border-radius:21px;
  background:#f4f7fa;
}
#serviceDetailsDialog .service-review-record-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  padding:15px 20px;
  border-bottom:1px solid #d8e3ed;
  background:#fff;
}
#serviceDetailsDialog .service-review-header-copy{
  min-width:0;
  display:flex;
  align-items:center;
  gap:13px;
}
#serviceDetailsDialog .service-review-header-icon{
  width:46px;
  height:46px;
  flex:0 0 auto;
  display:grid;
  place-items:center;
  border:1px solid #cfe7df;
  border-radius:13px;
  background:#eaf9f4;
  color:#08795a;
  box-shadow:0 5px 14px rgba(11,138,100,.08);
}
#serviceDetailsDialog .service-review-header-icon .ui-icon{width:23px;height:23px}
#serviceDetailsDialog .service-review-header-copy>div{min-width:0}
#serviceDetailsDialog .service-review-header-copy .eyebrow{
  margin:0 0 3px;
  color:#0b8a64;
  font-size:9px;
  font-weight:900;
  letter-spacing:.11em;
}
#serviceDetailsDialog .service-review-header-copy h2{
  margin:0;
  overflow:hidden;
  color:#172d4e;
  font-size:20px;
  line-height:1.25;
  text-overflow:ellipsis;
  white-space:nowrap;
}
#serviceDetailsDialog .service-review-header-meta{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:0;
  margin-top:5px;
  color:#718398;
  font-size:10px;
  font-weight:700;
}
#serviceDetailsDialog .service-review-header-meta span{display:inline-flex;align-items:center}
#serviceDetailsDialog .service-review-header-meta span:not(:last-child)::after{
  content:'•';
  margin:0 8px;
  color:#b3c0cc;
}
#serviceDetailsDialog .service-review-record-header>.icon-button{
  width:42px;
  height:42px;
  flex:0 0 auto;
  border-color:#cbd8e6;
  color:#17345f;
}
#serviceDetailsDialog .service-review-body{
  min-height:0;
  overflow:auto;
  padding:15px;
}
#serviceDetailsDialog .service-review-context-bar{
  display:flex;
  align-items:stretch;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
  padding:13px 15px;
  border:1px solid #d8e3ed;
  border-radius:15px;
  background:#fff;
  box-shadow:0 5px 16px rgba(15,23,42,.035);
}
#serviceDetailsDialog .service-review-context-main{
  min-width:0;
  display:flex;
  align-items:center;
  gap:12px;
}
#serviceDetailsDialog .service-review-context-main>div{
  min-width:130px;
  display:flex;
  flex-direction:column;
  gap:3px;
}
#serviceDetailsDialog .service-review-context-main small,
#serviceDetailsDialog .service-review-context-price small{
  color:#7b8b9e;
  font-size:9px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
}
#serviceDetailsDialog .service-review-context-main strong{
  color:#172d4e;
  font-size:12px;
}
#serviceDetailsDialog .service-review-status-badge{
  min-width:118px;
  height:36px;
  padding:0 12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  border:1px solid #bee2d7;
  border-radius:999px;
  background:#eaf9f4;
  color:#08795a;
  font-size:10px;
  font-weight:900;
  letter-spacing:.045em;
  text-transform:uppercase;
}
#serviceDetailsDialog .service-review-status-badge i{
  width:7px;height:7px;border-radius:50%;background:#0b8a64;box-shadow:0 0 0 4px rgba(11,138,100,.10)
}
#serviceDetailsDialog .service-review-status-badge.is-inactive{
  border-color:#dfd5d8;
  background:#f7f3f4;
  color:#806a71;
}
#serviceDetailsDialog .service-review-status-badge.is-inactive i{background:#8d7780;box-shadow:0 0 0 4px rgba(128,106,113,.10)}
#serviceDetailsDialog .service-review-context-price{
  min-width:175px;
  padding:7px 14px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:3px;
  border-left:1px solid #e1e8ef;
}
#serviceDetailsDialog .service-review-context-price strong{
  color:#08795a;
  font-size:18px;
}
#serviceDetailsDialog .service-review-context-price.is-restricted strong{color:#8a6c21;font-size:13px}
#serviceDetailsDialog .service-review-sections{
  display:grid;
  gap:14px;
  padding-bottom:5px;
}
#serviceDetailsDialog .service-review-record-section{
  display:grid;
  grid-template-columns:minmax(215px,250px) minmax(0,1fr);
  align-items:stretch;
  overflow:hidden;
  border:1px solid #d8e3ed;
  border-radius:17px;
  background:#fff;
  box-shadow:0 8px 24px rgba(15,23,42,.045);
  transition:border-color .16s ease,box-shadow .16s ease;
}
#serviceDetailsDialog .service-review-record-section:hover{
  border-color:#c9d9e5;
  box-shadow:0 12px 28px rgba(15,23,42,.065);
}
#serviceDetailsDialog .service-review-record-heading{
  display:grid;
  grid-template-columns:42px minmax(0,1fr);
  align-content:start;
  gap:11px;
  padding:18px;
  border-right:1px solid #e1e9f0;
  background:linear-gradient(145deg,#f7fbfe 0%,#eff8f5 100%);
}
#serviceDetailsDialog .service-review-record-icon{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border:1px solid #cfe7df;
  border-radius:12px;
  background:#fff;
  color:#08795a;
  box-shadow:0 4px 12px rgba(11,138,100,.08);
}
#serviceDetailsDialog .service-review-record-icon .ui-icon{width:21px;height:21px}
#serviceDetailsDialog .service-review-record-heading>div{min-width:0}
#serviceDetailsDialog .service-review-record-heading small{
  display:block;
  margin-bottom:4px;
  color:#0b8a64;
  font-size:9px;
  font-weight:900;
  letter-spacing:.1em;
}
#serviceDetailsDialog .service-review-record-heading h3{
  margin:0;
  color:#172d4e;
  font-size:16px;
  line-height:1.25;
}
#serviceDetailsDialog .service-review-record-content{
  min-width:0;
  padding:18px;
  align-self:stretch;
}
#serviceDetailsDialog .service-review-info-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}
#serviceDetailsDialog .service-review-info-grid article{
  min-height:92px;
  padding:15px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  gap:7px;
  border:1px solid #dce6ee;
  border-radius:13px;
  background:linear-gradient(180deg,#fff,#f7fafc);
}
#serviceDetailsDialog .service-review-info-grid small,
#serviceDetailsDialog .service-review-metrics small{
  color:#718398;
  font-size:10px;
  font-weight:800;
  text-transform:uppercase;
}
#serviceDetailsDialog .service-review-info-grid strong{
  overflow-wrap:anywhere;
  color:#17345f;
  font-size:14px;
  line-height:1.45;
}
#serviceDetailsDialog .service-review-info-grid article.is-inactive{
  border-color:#e3dadd;
  background:#faf7f8;
}
#serviceDetailsDialog .service-review-info-grid article.is-inactive strong{color:#806a71}
#serviceDetailsDialog .service-review-metrics{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px;
}
#serviceDetailsDialog .service-review-metrics article{
  min-height:130px;
  padding:18px;
  display:flex;
  align-items:center;
  gap:16px;
  border:1px solid #dce6ee;
  border-radius:14px;
  background:#fbfcfe;
}
#serviceDetailsDialog .service-review-metrics article>span{
  width:46px;height:46px;flex:0 0 auto;display:grid;place-items:center;border-radius:12px;background:#eaf9f4;color:#08795a
}
#serviceDetailsDialog .service-review-metrics article>span .ui-icon{width:22px;height:22px}
#serviceDetailsDialog .service-review-metrics article>div{display:flex;flex-direction:column;gap:7px}
#serviceDetailsDialog .service-review-metrics strong{color:#17345f;font-size:23px}
#serviceDetailsDialog .service-review-metrics article.is-restricted strong{color:#8a6c21;font-size:14px}
#serviceDetailsDialog .service-review-description{
  min-height:130px;
  padding:18px;
  border:1px solid #dce6ee;
  border-radius:14px;
  background:#fbfcfe;
}
#serviceDetailsDialog .service-review-description p{
  margin:0;
  color:#30465f;
  font-size:13px;
  line-height:1.75;
  white-space:pre-wrap;
}
#serviceDetailsDialog .service-review-availability{
  min-height:120px;
  padding:18px;
  display:flex;
  align-items:center;
  gap:16px;
  border:1px solid #bee2d7;
  border-radius:14px;
  background:#effbf6;
}
#serviceDetailsDialog .service-review-availability>span{
  width:48px;height:48px;flex:0 0 auto;display:grid;place-items:center;border-radius:13px;background:#fff;color:#08795a;box-shadow:0 5px 14px rgba(11,138,100,.08)
}
#serviceDetailsDialog .service-review-availability>span .ui-icon{width:23px;height:23px}
#serviceDetailsDialog .service-review-availability>div{display:flex;flex-direction:column;gap:5px}
#serviceDetailsDialog .service-review-availability strong{color:#08795a;font-size:15px}
#serviceDetailsDialog .service-review-availability small{color:#467363;font-size:11px;line-height:1.5}
#serviceDetailsDialog .service-review-availability.is-inactive{
  border-color:#e3dadd;
  background:#faf7f8;
}
#serviceDetailsDialog .service-review-availability.is-inactive>span{color:#806a71;box-shadow:none}
#serviceDetailsDialog .service-review-availability.is-inactive strong,
#serviceDetailsDialog .service-review-availability.is-inactive small{color:#806a71}
#serviceDetailsDialog .service-review-footer{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  padding:12px 18px;
  border-top:1px solid #d8e3ed;
  background:#fff;
}
#serviceDetailsDialog .service-review-footer .btn{min-width:130px}
@media(max-width:1000px){
  #serviceDetailsDialog .service-review-context-bar{align-items:flex-start;flex-direction:column}
  #serviceDetailsDialog .service-review-context-main{width:100%;flex-wrap:wrap}
  #serviceDetailsDialog .service-review-context-price{width:100%;border-left:0;border-top:1px solid #e1e8ef;padding:10px 0 0}
  #serviceDetailsDialog .service-review-info-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:820px){
  #serviceDetailsDialog .service-review-record-section{grid-template-columns:1fr}
  #serviceDetailsDialog .service-review-record-heading{border-right:0;border-bottom:1px solid #e1e9f0}
}
@media(max-width:620px){
  #serviceDetailsDialog.service-review-dialog[open]{inset:5px;width:calc(100vw - 10px);height:calc(100vh - 10px);border-radius:17px}
  #serviceDetailsDialog .service-review-record-modal{border-radius:17px}
  #serviceDetailsDialog .service-review-record-header{padding:12px 13px}
  #serviceDetailsDialog .service-review-header-icon{display:none}
  #serviceDetailsDialog .service-review-header-copy h2{font-size:16px}
  #serviceDetailsDialog .service-review-header-meta{font-size:9px}
  #serviceDetailsDialog .service-review-body{padding:9px}
  #serviceDetailsDialog .service-review-context-main>div{min-width:calc(50% - 8px)}
  #serviceDetailsDialog .service-review-status-badge{min-width:calc(50% - 8px)}
  #serviceDetailsDialog .service-review-record-heading,
  #serviceDetailsDialog .service-review-record-content{padding:13px}
  #serviceDetailsDialog .service-review-info-grid,
  #serviceDetailsDialog .service-review-metrics{grid-template-columns:1fr}
  #serviceDetailsDialog .service-review-record-heading h3{font-size:14px}
  #serviceDetailsDialog .service-review-metrics article{min-height:105px}
  #serviceDetailsDialog .service-review-footer{padding:10px}
  #serviceDetailsDialog .service-review-footer .btn{flex:1;min-width:0}
}


/* Medibox 3.13.66 — compact patient header, inline facts and image actions */
.patient-profile-v2-main {
    grid-template-columns: auto minmax(0, 1fr);
}
.patient-profile-inline-facts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}
.patient-profile-inline-fact {
    min-width: 0;
    max-width: 320px;
    display: inline-grid;
    grid-template-columns: 18px auto minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    min-height: 31px;
    padding: 6px 10px;
    border: 1px solid #dfe6ef;
    border-radius: 999px;
    color: #4f46e5;
    background: #f8faff;
}
.patient-profile-inline-fact .ui-icon { width: 15px; height: 15px; }
.patient-profile-inline-fact small {
    color: #6f7e94;
    font-size: 7px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.patient-profile-inline-fact strong {
    overflow: hidden;
    color: #273954;
    font-size: 9px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.patient-profile-inline-fact.is-clear { color: #0f9f72; background: #f2fcf8; border-color: #d8f2e8; }
.patient-profile-inline-fact.has-alert,
.patient-profile-inline-fact.has-debt { color: #dc2626; background: #fff7f8; border-color: #ffdce1; }
.patient-profile-inline-fact.is-clear strong { color: #087a5d; }
.patient-profile-inline-fact.has-debt strong { color: #c81e3a; }
.patient-profile-add-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
}
.patient-profile-add-button .ui-icon { width: 17px; height: 17px; }
.patient-xray-professional-meta {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center;
    gap: 10px !important;
}
.patient-xray-professional-copy { min-width: 0; display: grid; gap: 3px; }
.patient-xray-professional-meta form { margin: 0; }
.patient-xray-professional-meta .danger-action { color: #dc2626; background: #fff1f2; border-color: #ffd5dc; }
.patient-xray-professional-meta .danger-action:hover { color: #fff; background: #dc2626; border-color: #dc2626; }

@media (max-width: 700px) {
    .patient-profile-inline-facts { grid-column: 1 / -1; gap: 6px; }
    .patient-profile-inline-fact { max-width: 100%; flex: 1 1 100%; }
}
@media (max-width: 700px) {
    .patient-profile-v2-panel-heading .patient-profile-add-button {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
        padding: 0;
        align-self: flex-end;
    }
}


/* Medibox 3.13.67 — interactive allergy, phone and payment controls in patient header */
.patient-profile-v2-hero { overflow: visible; }
.patient-profile-v2-main {
    grid-template-columns: auto minmax(0, 1fr) auto;
}
.patient-profile-v2-identity { min-width: 0; }
.patient-profile-v2-title-line { display: block; }
.patient-profile-v2-title-line h1 { margin-bottom: 10px; }
.patient-profile-v2-inline-meta {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}
.patient-profile-header-state,
.patient-profile-header-detail > summary,
.patient-profile-header-icon {
    min-height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #dfe6ef;
    border-radius: 999px;
    color: #52627a;
    background: #f8faff;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}
.patient-profile-header-state .ui-icon,
.patient-profile-header-detail > summary .ui-icon,
.patient-profile-header-icon .ui-icon {
    width: 15px;
    height: 15px;
}
.patient-profile-header-state.is-clear {
    color: #087a5d;
    border-color: #caeedf;
    background: #effbf6;
}
.patient-profile-header-detail {
    position: relative;
    z-index: 12;
}
.patient-profile-header-detail > summary {
    cursor: pointer;
    list-style: none;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.patient-profile-header-detail > summary::-webkit-details-marker { display: none; }
.patient-profile-header-detail > summary:hover,
.patient-profile-header-detail[open] > summary {
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(31, 41, 90, .10);
}
.patient-profile-header-detail.has-alert > summary,
.patient-profile-header-detail.has-debt > summary {
    color: #c81e3a;
    border-color: #ffd2d9;
    background: #fff2f4;
}
.patient-profile-header-detail[open] > summary {
    border-color: #f5a8b5;
}
.patient-profile-header-popover {
    position: absolute;
    top: calc(100% + 9px);
    left: 0;
    width: min(310px, 78vw);
    padding: 13px 14px;
    border: 1px solid #e1e7f0;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 18px 44px rgba(28, 39, 83, .18);
    color: #263853;
    z-index: 100;
}
.patient-profile-header-popover::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 18px;
    width: 10px;
    height: 10px;
    transform: rotate(45deg);
    border-top: 1px solid #e1e7f0;
    border-left: 1px solid #e1e7f0;
    background: #fff;
}
.patient-profile-header-popover strong {
    display: block;
    margin-bottom: 6px;
    color: #b91c36;
    font-size: 10px;
    font-weight: 950;
    text-transform: uppercase;
}
.patient-profile-header-popover p {
    margin: 0;
    color: #34445e;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.55;
    white-space: normal;
}
.patient-profile-debt-popover { width: 180px; }
.patient-profile-debt-popover p {
    color: #c81e3a;
    font-size: 16px;
    font-weight: 950;
}
.patient-profile-header-icon {
    position: relative;
    width: 31px;
    min-width: 31px;
    padding: 0;
    color: #4f46e5;
    cursor: help;
}
.patient-profile-phone-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 9px);
    transform: translateX(-50%) translateY(3px);
    min-width: max-content;
    padding: 7px 9px;
    border-radius: 8px;
    background: #172033;
    color: #fff;
    font-size: 9px;
    font-weight: 850;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
    z-index: 110;
}
.patient-profile-phone-tooltip:hover::after,
.patient-profile-phone-tooltip:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.patient-profile-schedule-button {
    align-self: center;
    justify-self: end;
    min-width: 154px;
    justify-content: center;
}
.patient-profile-v2-tabs {
    border-radius: 0 0 18px 18px;
}

@media (max-width: 1100px) {
    .patient-profile-v2-main {
        grid-template-columns: auto minmax(0, 1fr);
    }
    .patient-profile-schedule-button {
        grid-column: 1 / -1;
        width: 100%;
        justify-self: stretch;
    }
}
@media (max-width: 700px) {
    .patient-profile-v2-main {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        gap: 12px;
        padding: 15px;
    }
    .patient-profile-v2-inline-meta { gap: 6px; }
    .patient-profile-header-popover {
        position: fixed;
        inset: auto 14px 18px;
        width: auto;
        max-height: 42vh;
        overflow: auto;
    }
    .patient-profile-header-popover::before { display: none; }
    .patient-profile-schedule-button { margin-top: 2px; }
}

/* 3.13.70: History tab added to the restored compact patient profile. */
.patient-profile-history-panel { min-height: 520px; }
.patient-history-timeline { position: relative; display: grid; gap: 12px; }
.patient-history-timeline::before {
    content: "";
    position: absolute;
    top: 18px;
    bottom: 18px;
    left: 136px;
    width: 2px;
    background: linear-gradient(#d7d8fb, #d8eee8);
}
.patient-history-event {
    position: relative;
    display: grid;
    grid-template-columns: 120px 20px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}
.patient-history-date { text-align: right; padding-right: 5px; }
.patient-history-date small { display: block; margin-bottom: 5px; color: #7b889d; font-size: 8px; font-weight: 850; }
.patient-history-date strong { display: block; color: #455571; font-size: 10px; font-weight: 950; }
.patient-history-date span { display: block; margin-top: 3px; color: #76849a; font-size: 9px; font-weight: 800; }
.patient-history-node {
    position: relative;
    z-index: 2;
    width: 12px;
    height: 12px;
    margin: 0 auto;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #5a50ec;
    box-shadow: 0 0 0 2px #5a50ec;
}
.patient-history-event.tone-mint .patient-history-node { background: #10a77b; box-shadow: 0 0 0 2px #10a77b; }
.patient-history-card {
    min-height: 84px;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 13px;
    padding: 12px 14px;
    border: 1px solid #e3e8f1;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(39, 53, 91, .045);
}
.patient-history-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: #5147e9; background: #efedff; }
.patient-history-event.tone-mint .patient-history-icon { color: #0b9c72; background: #e6f9f3; }
.patient-history-icon .ui-icon { width: 20px; height: 20px; }
.patient-history-copy { min-width: 0; }
.patient-history-copy strong { display: block; overflow: hidden; color: #1b2941; font-size: 11px; font-weight: 950; text-overflow: ellipsis; white-space: nowrap; }
.patient-history-copy p { display: -webkit-box; overflow: hidden; margin: 5px 0 0; color: #627188; font-size: 9px; font-weight: 700; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.patient-history-status { display: inline-flex; align-items: center; justify-content: center; min-height: 25px; padding: 5px 10px; border-radius: 999px; color: #087c5a; background: #e6f9f1; font-size: 8px; font-weight: 950; white-space: nowrap; }
.patient-history-status.is-warning { color: #a06408; background: #fff5dc; }
.patient-history-status.is-danger { color: #bd2442; background: #fff0f3; }
.patient-history-action { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 12px; border: 1px solid #dfe4ed; border-radius: 10px; color: #52617a; background: #fff; font-size: 9px; font-weight: 900; text-decoration: none; white-space: nowrap; }
.patient-history-action:hover { border-color: #bcb7ff; color: #4f46e5; background: #f8f7ff; }
.patient-history-action .ui-icon { width: 13px; height: 13px; }
.patient-history-more { min-height: 38px; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 15px auto 0; padding: 7px 16px; border: 1px solid #dfe4ed; border-radius: 10px; color: #5f6d83; background: #fff; font: inherit; font-size: 9px; font-weight: 900; cursor: pointer; }
.patient-history-more .ui-icon { width: 13px; height: 13px; transition: transform .15s ease; }
.patient-history-more.is-expanded .ui-icon { transform: rotate(180deg); }

@media (max-width: 760px) {
    .patient-history-timeline::before { left: 7px; }
    .patient-history-event { grid-template-columns: 14px minmax(0, 1fr); gap: 9px; padding-top: 30px; }
    .patient-history-date { position: absolute; top: 0; left: 24px; display: flex; align-items: center; gap: 6px; padding: 0; text-align: left; }
    .patient-history-date small { margin: 0; }
    .patient-history-date strong, .patient-history-date span { display: inline; margin: 0; }
    .patient-history-node { grid-column: 1; }
    .patient-history-card { grid-column: 2; grid-template-columns: 40px minmax(0, 1fr); }
    .patient-history-icon { width: 40px; height: 40px; }
    .patient-history-status { grid-column: 2; justify-self: start; }
    .patient-history-action { grid-column: 1 / -1; width: 100%; }
}

/* MEDIBOX 3.13.72 — patient-style search toolbars for services and materials. */
.catalog-inline-filter .catalog-reference-search {
    width: min(420px, 40vw);
    flex: 1 1 280px;
}
.catalog-inline-filter .catalog-reference-select {
    width: 176px;
    min-width: 176px;
}
.catalog-inline-filter .reference-filter-button {
    flex: 0 0 40px;
}
.service-module-tabs + .catalog-table-card .catalog-toolbar-actions-only,
#materialCatalog > .material-catalog-toolbar {
    background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
}
@media (max-width: 840px) {
    .catalog-inline-filter .catalog-reference-search,
    .catalog-inline-filter .catalog-reference-select {
        width: 100%;
        min-width: 0;
    }
    .catalog-inline-filter .reference-filter-button {
        justify-self: end;
    }
}


/* v283 — professional plain + action for Services / Service Groups. */
.service-create-button.catalog-plus-button {
    appearance: none;
    width: 30px;
    min-width: 30px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #34499a;
    font-size: 27px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    flex: 0 0 30px;
    transition: color .16s ease, transform .16s ease;
}
.service-create-button.catalog-plus-button:hover {
    background: transparent;
    color: #24367d;
    transform: translateY(-1px);
}
.service-create-button.catalog-plus-button:focus-visible {
    outline: 2px solid rgba(52, 73, 154, .28);
    outline-offset: 2px;
}
.service-create-button.catalog-plus-button > span {
    display: block;
    transform: translateY(-1px);
}
@media (max-width: 720px) {
    .service-create-button.catalog-plus-button {
        width: 30px;
        min-width: 30px;
        flex-basis: 30px;
    }
}

/* MEDIBOX 3.13.74 — simplified finance and material search toolbars. */
.finance-simple-search-card {
    padding: 14px 16px;
}
.finance-simple-search-form {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}
.finance-simple-search-form .finance-reference-search {
    width: min(520px, 100%);
    flex: 1 1 320px;
}
#materialCatalog .catalog-inline-filter,
#supplierCatalog .catalog-inline-filter {
    flex: 1 1 auto;
}
#supplierCatalog .catalog-reference-search,
#materialCatalog .catalog-reference-search {
    width: min(440px, 42vw);
    flex: 1 1 300px;
}
#invoiceRegister .invoice-register-filter-form {
    grid-template-columns: minmax(260px, 1fr) auto;
}
#invoiceRegister .invoice-register-search {
    width: min(440px, 100%);
}
#invoiceRegister .invoice-register-actions {
    gap: 8px;
}
@media (max-width: 760px) {
    .finance-simple-search-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px 40px;
    }
    .finance-simple-search-form .finance-reference-search {
        width: 100%;
        min-width: 0;
    }
    #materialCatalog .toolbar-actions,
    #supplierCatalog .toolbar-actions {
        align-items: stretch;
    }
    #materialCatalog .catalog-inline-filter,
    #supplierCatalog .catalog-inline-filter {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px 40px;
        width: 100%;
    }
    #materialCatalog .catalog-reference-search,
    #supplierCatalog .catalog-reference-search {
        width: 100%;
        min-width: 0;
    }
    #invoiceRegister .invoice-register-filter-form {
        grid-template-columns: 1fr;
    }
    #invoiceRegister .invoice-register-actions {
        justify-content: flex-start;
    }
}


/* MEDIBOX 3.13.75 — unified material search widths and compact add actions. */
#materialCatalog .catalog-reference-search,
#supplierCatalog .catalog-reference-search,
#invoiceRegister .invoice-register-search {
    width: min(440px, 42vw);
    max-width: 440px;
    min-width: 260px;
    flex: 0 1 440px;
}
#invoiceRegister .invoice-register-filter-form {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}
#invoiceRegister .invoice-register-actions {
    margin-left: 0;
    justify-content: flex-start;
}
.catalog-record-plus-button {
    width: 42px;
    min-width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border-radius: 12px;
    font-size: 25px;
    font-weight: 700;
    line-height: 1;
}
.catalog-record-plus-button > span {
    display: block;
    transform: translateY(-1px);
}
@media (max-width: 760px) {
    #materialCatalog .toolbar-actions,
    #supplierCatalog .toolbar-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 42px;
        gap: 8px;
        width: 100%;
    }
    #materialCatalog .catalog-inline-filter,
    #supplierCatalog .catalog-inline-filter {
        grid-template-columns: minmax(0, 1fr) 40px 40px;
        min-width: 0;
    }
    #materialCatalog .catalog-reference-search,
    #supplierCatalog .catalog-reference-search,
    #invoiceRegister .invoice-register-search {
        width: 100%;
        max-width: none;
        min-width: 0;
        flex: 1 1 auto;
    }
    #invoiceRegister .invoice-register-filter-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
    }
    #invoiceRegister .invoice-register-actions {
        display: grid;
        grid-template-columns: 40px 40px 42px;
        gap: 8px;
        width: auto;
    }
}
@media (max-width: 520px) {
    #materialCatalog .toolbar-actions,
    #supplierCatalog .toolbar-actions {
        grid-template-columns: minmax(0, 1fr) 42px;
    }
    #materialCatalog .catalog-inline-filter,
    #supplierCatalog .catalog-inline-filter {
        grid-template-columns: minmax(0, 1fr) 40px 40px;
    }
    #invoiceRegister .invoice-register-filter-form {
        grid-template-columns: minmax(0, 1fr) auto;
    }
}


/* MEDIBOX 3.13.76 — full-width catalog search and text create buttons. */
#materialCatalog .card-header,
#supplierCatalog .card-header,
#invoiceRegister .card-header {
    width: 100%;
}
#materialCatalog .toolbar-actions,
#supplierCatalog .toolbar-actions {
    width: 100%;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
}
#materialCatalog .catalog-inline-filter,
#supplierCatalog .catalog-inline-filter,
#invoiceRegister .invoice-register-filter-form {
    width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
#materialCatalog .catalog-inline-filter,
#supplierCatalog .catalog-inline-filter {
    flex: 1 1 auto;
}
#materialCatalog .catalog-reference-search,
#supplierCatalog .catalog-reference-search,
#invoiceRegister .invoice-register-search {
    width: auto;
    max-width: none;
    min-width: 0;
    flex: 1 1 auto;
}
#invoiceRegister .invoice-register-actions {
    margin-left: 0;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}
.catalog-record-create-button {
    flex: 0 0 auto;
    min-height: 42px;
    height: 42px;
    padding: 0 17px;
    border-radius: 12px;
    white-space: nowrap;
    font-size: 17px;
    font-weight: 850;
}
.catalog-record-create-button > span {
    display: inline-block;
}
@media (max-width: 760px) {
    #materialCatalog .toolbar-actions,
    #supplierCatalog .toolbar-actions,
    #invoiceRegister .invoice-register-filter-form {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 40px 40px;
        gap: 8px;
        align-items: center;
    }
    #materialCatalog .catalog-inline-filter,
    #supplierCatalog .catalog-inline-filter {
        display: contents;
    }
    #materialCatalog .catalog-reference-search,
    #supplierCatalog .catalog-reference-search,
    #invoiceRegister .invoice-register-search {
        grid-column: 1;
        width: 100%;
    }
    #materialCatalog .catalog-inline-filter > .reference-filter-button,
    #supplierCatalog .catalog-inline-filter > .reference-filter-button {
        grid-column: 2;
    }
    #materialCatalog .catalog-inline-filter > .icon-action:last-child,
    #supplierCatalog .catalog-inline-filter > .icon-action:last-child {
        grid-column: 3;
    }
    #materialCatalog .catalog-record-create-button,
    #supplierCatalog .catalog-record-create-button {
        grid-column: 1 / -1;
        width: 100%;
    }
    #invoiceRegister .invoice-register-actions {
        display: contents;
    }
    #invoiceRegister .invoice-register-actions > .reference-filter-button {
        grid-column: 2;
    }
    #invoiceRegister .invoice-register-actions > .icon-action {
        grid-column: 3;
    }
    #invoiceRegister .catalog-record-create-button {
        grid-column: 1 / -1;
        width: 100%;
    }
}

/* MEDIBOX 3.13.80 — simplified module headings, highlighted tabs and patient UX. */
.module-content-heading {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid #edf1f6;
    background: linear-gradient(180deg,#ffffff 0%,#fbfcff 100%);
}
.module-content-heading > div { min-width: 0; }
.module-content-heading small {
    display: block;
    margin-bottom: 3px;
    color: #8a96a9;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.module-content-heading h2 {
    margin: 0;
    color: #24334d;
    font-size: 17px;
    font-weight: 950;
    line-height: 1.2;
}
.module-content-heading > span {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    color: #596780;
    background: #f0f3f9;
    font-size: 9px;
    font-weight: 900;
}
.settings-content-heading {
    margin-bottom: 14px;
    padding: 4px 2px 10px;
    border-bottom: 0;
    background: transparent;
}
.settings-content-heading h2 { font-size: 19px; }
.finance-overview-heading { border-radius: 16px 16px 0 0; }

/* Patient list: slightly richer but still compact. */
.patient-reference-card { box-shadow: 0 16px 42px rgba(31,43,86,.08); }
.patient-reference-table th {
    height: 42px;
    color: #627089;
    background: #f5f7fb;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.patient-reference-table tbody tr { transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.patient-reference-table tbody tr:hover {
    position: relative;
    z-index: 1;
    background: #fafbff;
    box-shadow: inset 3px 0 0 #6366f1;
}
.patient-reference-table td { padding-block: 13px; }
.patient-reference-table td,
.patient-reference-table .reference-primary-value,
.patient-reference-table .reference-secondary-value,
.patient-reference-table .reference-date-value,
.patient-reference-table .reference-phone-link,
.patient-reference-table .reference-email-link {
    font-weight: 400 !important;
}
.patient-reference-table .reference-email-link {
    color: #4f5f78;
    text-decoration: none;
}
.patient-reference-table .reference-email-link:hover { color: #4f46e5; }
.patient-name-uppercase {
    color: #24334d !important;
    font-size: 10px !important;
    font-weight: 400 !important;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.reference-person-avatar,
.reference-person-photo { box-shadow: 0 6px 16px rgba(79,70,229,.12); }
.reference-row-actions { opacity: .76; transition: opacity .15s ease; }
.patient-reference-table tr:hover .reference-row-actions { opacity: 1; }

/* Modern active state: full pill highlight, never an underline. */
.patient-profile-v2-tabs {
    gap: 6px;
    padding: 7px 10px;
    border-top: 1px solid #edf1f6;
    background: #f6f8fc;
}
.patient-profile-v2-tab {
    min-height: 40px;
    padding: 8px 13px;
    border: 0 !important;
    border-radius: 10px;
    background: transparent;
    transition: color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.patient-profile-v2-tab::before,
.patient-profile-v2-tab::after { display: none !important; }
.patient-profile-v2-tab:hover {
    color: #4338ca;
    background: #eceffd;
}
.patient-profile-v2-tab.is-active,
.patient-profile-v2-tab[aria-selected="true"] {
    color: #fff !important;
    border-bottom-color: transparent !important;
    background: linear-gradient(135deg,#4f46e5,#6366f1) !important;
    box-shadow: 0 7px 18px rgba(79,70,229,.22);
    transform: translateY(-1px);
}
.patient-profile-v2-tab.is-active > b,
.patient-profile-v2-tab[aria-selected="true"] > b {
    color: #4338ca !important;
    background: #fff !important;
}
.patient-profile-v2-tab.is-active .ui-icon,
.patient-profile-v2-tab[aria-selected="true"] .ui-icon { color: currentColor; }

/* Catalog tabs use the same selected treatment and no underline. */
.material-module-tabs { gap: 7px; }
.material-module-tabs a {
    min-height: 44px;
    border: 0 !important;
    border-radius: 11px;
    background: #f4f7fb;
    box-shadow: inset 0 0 0 1px #e5eaf2;
}
.material-module-tabs a::before,
.material-module-tabs a::after { display: none !important; }
.material-module-tabs a.active {
    color: #fff !important;
    border-bottom-color: transparent !important;
    background: linear-gradient(135deg,#4f46e5,#6366f1) !important;
    box-shadow: 0 8px 20px rgba(79,70,229,.20) !important;
}
.material-module-tabs a.active strong { color: #4338ca; background: #fff; }

/* Personal data: neutral, borderless enhanced cards. */
.patient-profile-v2-panel .patient-profile-identity-grid { gap: 14px; }
.patient-profile-v2-panel .patient-profile-detail-card {
    min-height: 0;
    padding: 18px;
    border: 0 !important;
    border-radius: 17px;
    background: linear-gradient(145deg,#fff 0%,#f8faff 100%);
    box-shadow: 0 13px 32px rgba(31,43,86,.08);
}
.patient-profile-v2-panel .patient-profile-detail-card::before { display: none !important; }
.patient-profile-v2-panel .patient-profile-detail-card:hover {
    transform: translateY(-2px);
    border-color: transparent !important;
    box-shadow: 0 18px 38px rgba(31,43,86,.11);
}
.patient-profile-v2-panel .patient-profile-detail-card > header {
    min-height: 40px;
    margin-bottom: 12px;
    padding-bottom: 11px;
    border-bottom: 1px solid #edf1f6;
}
.patient-profile-v2-panel .patient-profile-detail-icon {
    color: #4f46e5 !important;
    background: #eef2ff !important;
}
.patient-profile-v2-panel .patient-profile-data-list > div {
    padding: 9px 0;
    border-bottom-color: #eef2f6;
}

/* Simpler patient create/edit page. */
.patient-edit-page-heading {
    margin-bottom: 12px;
    padding: 2px 2px 8px;
}
.patient-edit-page-heading h1 {
    margin: 0;
    color: #24334d;
    font-size: 20px;
    font-weight: 950;
}
.patient-unified-form .patient-unified-sections { gap: 12px; }
.patient-unified-form .patient-unified-section {
    padding: 16px;
    border: 0;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(31,43,86,.07);
}
.patient-unified-form .patient-unified-section-warning {
    border: 0;
    background: linear-gradient(145deg,#fff 0%,#fffaf5 100%);
}
.patient-simple-section-head {
    min-height: 0 !important;
    margin-bottom: 13px !important;
    padding: 0 0 10px !important;
    border-bottom: 1px solid #edf1f6;
}
.patient-simple-section-head h2 {
    margin: 0;
    color: #2b3a54;
    font-size: 14px;
    font-weight: 950;
}
.patient-simple-form-footer {
    position: sticky;
    bottom: 10px;
    z-index: 20;
    display: flex;
    justify-content: flex-end;
    padding: 11px 14px;
    border: 1px solid rgba(219,226,239,.92);
    border-radius: 14px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 14px 34px rgba(31,43,86,.13);
    backdrop-filter: blur(14px);
}
.patient-simple-form-footer .patient-form-intro-actions { margin-left: auto; }

@media (max-width: 700px) {
    .module-content-heading { min-height: 54px; padding: 12px 13px; }
    .module-content-heading h2 { font-size: 15px; }
    .module-content-heading > span { display: none; }
    .patient-profile-v2-tabs { padding: 6px; }
    .patient-profile-v2-tab { min-height: 38px; padding: 7px 10px; }
    .patient-simple-form-footer { bottom: 6px; }
    .patient-simple-form-footer .patient-form-intro-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
}

/* MEDIBOX 3.13.81 — compact module headings, unified tables and enhanced personal-data cards. */
.module-content-heading.module-content-heading-compact {
    min-height: 44px;
    justify-content: flex-start;
    padding: 10px 14px;
    background: #fff;
}
.module-content-heading.module-content-heading-compact h2 {
    margin: 0;
    color: #2b3952;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -.012em;
}

/* One smaller visual language for Patients, Services, Finance and Materials. */
.module-unified-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-family: inherit;
}
.module-unified-table thead th {
    height: 34px;
    padding: 7px 10px !important;
    border-top: 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid #e2e8f1 !important;
    border-left: 0 !important;
    color: #68758a !important;
    background: #f7f9fc !important;
    font-family: inherit;
    font-size: 8.5px !important;
    font-weight: 900 !important;
    line-height: 1.2;
    letter-spacing: .045em !important;
    text-transform: uppercase;
    white-space: nowrap;
}
.module-unified-table tbody td {
    min-height: 42px;
    padding: 8px 10px !important;
    border-bottom: 1px solid #edf1f6 !important;
    color: #344158 !important;
    background: #fff !important;
    font-family: inherit;
    font-size: 10.5px !important;
    line-height: 1.35;
    vertical-align: middle;
}
.module-unified-table tbody tr:nth-child(even) td { background: #fcfdff !important; }
.module-unified-table tbody tr:hover td { background: #f7f9ff !important; }
.module-unified-table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 #6366f1 !important; }
.module-unified-table tbody tr:last-child td { border-bottom: 0 !important; }
.module-unified-table td strong,
.module-unified-table .reference-primary-value {
    color: #2b3952;
    font-family: inherit;
    font-size: 10.75px;
    font-weight: 850;
}
.module-unified-table .table-subtext,
.module-unified-table .reference-secondary-value,
.module-unified-table small {
    margin-top: 2px;
    color: #8792a4 !important;
    font-family: inherit;
    font-size: 8.75px !important;
    line-height: 1.25;
}
.module-unified-table .badge,
.module-unified-table .code-chip,
.module-unified-table .reference-status-badge {
    min-height: 23px;
    padding: 4px 7px;
    border-radius: 8px;
    font-size: 8.5px;
    line-height: 1;
}
.module-unified-table .icon-action,
.module-unified-table .action-icon-button {
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 9px !important;
}
.module-unified-table .icon-action .ui-icon,
.module-unified-table .action-icon-button .ui-icon { width: 14px; height: 14px; }
.module-unified-table .table-action-group,
.module-unified-table .reference-row-actions { gap: 5px; }
.module-unified-table .reference-person-cell { gap: 8px; }
.module-unified-table .reference-person-photo,
.module-unified-table .reference-person-avatar {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 10px;
}
.module-unified-table .patient-name-uppercase { font-size: 10.75px; letter-spacing: .015em; }
.module-unified-table .reference-date-value strong { font-size: 10.25px; }
.module-unified-table .reference-date-value small { font-size: 8px !important; }

/* Personal data: cleaner layered cards with modern information tiles. */
.patient-profile-v2-panel .patient-profile-identity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.patient-profile-v2-panel .patient-profile-detail-card {
    position: relative;
    overflow: hidden;
    padding: 16px;
    border: 0 !important;
    border-radius: 18px;
    background:
        radial-gradient(circle at 100% 0, rgba(99,102,241,.08), transparent 34%),
        linear-gradient(145deg,#fff 0%,#f8faff 100%);
    box-shadow: 0 10px 26px rgba(31,43,86,.075);
}
.patient-profile-v2-panel .patient-profile-detail-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(31,43,86,.105);
}
.patient-profile-v2-panel .patient-profile-detail-card > header {
    min-height: 38px;
    margin-bottom: 11px;
    padding: 0;
    border-bottom: 0;
}
.patient-profile-v2-panel .patient-profile-detail-card h2 {
    color: #283750;
    font-size: 13px;
    font-weight: 900;
}
.patient-profile-v2-panel .patient-profile-detail-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    border-radius: 12px;
    color: #4f46e5 !important;
    background: linear-gradient(145deg,#eef2ff,#e7eaff) !important;
    box-shadow: 0 7px 16px rgba(79,70,229,.11);
}
.patient-profile-v2-panel .patient-profile-detail-icon.is-mint {
    color: #0f8a61 !important;
    background: linear-gradient(145deg,#e8faf4,#dcf7ee) !important;
    box-shadow: 0 7px 16px rgba(16,185,129,.10);
}
.patient-profile-v2-panel .patient-profile-detail-icon.is-warning {
    color: #b45309 !important;
    background: linear-gradient(145deg,#fff7e6,#ffefd0) !important;
    box-shadow: 0 7px 16px rgba(245,158,11,.10);
}
.patient-profile-v2-panel .patient-profile-detail-card > header .action-icon-button {
    width: 31px;
    min-width: 31px;
    height: 31px;
    min-height: 31px;
    border: 0;
    border-radius: 10px;
    color: #56657c;
    background: rgba(255,255,255,.84);
    box-shadow: 0 5px 14px rgba(31,43,86,.07);
}
.patient-profile-v2-panel .patient-profile-data-list {
    gap: 8px;
}
.patient-profile-v2-panel .patient-profile-data-list > div {
    min-height: 54px;
    padding: 9px 10px;
    border: 0 !important;
    border-radius: 11px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 5px 15px rgba(31,43,86,.045);
}
.patient-profile-v2-panel .patient-profile-data-list dt {
    margin-bottom: 4px;
    color: #8a95a7;
    font-size: 7.5px;
    font-weight: 900;
    letter-spacing: .045em;
}
.patient-profile-v2-panel .patient-profile-data-list dd {
    color: #2d3c55;
    font-size: 10.25px;
    font-weight: 850;
    line-height: 1.35;
}
.patient-profile-v2-panel .patient-profile-photo-preview {
    border: 0;
    box-shadow: 0 12px 28px rgba(79,70,229,.13);
}

@media (max-width: 900px) {
    .patient-profile-v2-panel .patient-profile-identity-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .module-content-heading.module-content-heading-compact { min-height: 40px; padding: 9px 11px; }
    .module-content-heading.module-content-heading-compact h2 { font-size: 13px; }
    .module-unified-table tbody td { font-size: 10px !important; }
}


/* Medibox 3.13.82 — simplified patient register and inline profile cards. */
.patient-profile-v2-title-line {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 9px 12px;
}
.patient-profile-v2-title-line h1 {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 !important;
}
.patient-profile-name-uppercase {
    color: inherit;
    font: inherit;
    font-weight: inherit;
    letter-spacing: .025em;
    text-transform: uppercase;
}
.patient-profile-v2-inline-meta {
    display: inline-flex !important;
    width: auto !important;
    margin: 0;
    flex: 0 1 auto;
}
.patient-profile-meta-chip,
.patient-profile-v2-inline-meta .patient-detail-status,
.patient-profile-header-state,
.patient-profile-header-detail > summary,
.patient-profile-header-icon {
    min-height: 30px;
    box-shadow: 0 5px 13px rgba(31,43,86,.06);
}
.patient-profile-schedule-button {
    min-width: 132px;
}
.patient-appointment-highlight-datetime {
    display: inline-flex;
    width: fit-content;
}
.patient-reference-table .reference-person-copy small {
    display: none !important;
}
@media (max-width: 1100px) {
    .patient-profile-v2-title-line { align-items: flex-start; }
    .patient-profile-v2-inline-meta { flex-basis: 100%; }
}
@media (max-width: 700px) {
    .patient-profile-v2-title-line { gap: 8px; }
    .patient-profile-v2-inline-meta { width: 100% !important; }
}


/* Medibox 3.13.83 — list titles integrated with patient and service search toolbars. */
.module-list-toolbar {
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 12px 14px;
    border-bottom: 1px solid #e4e9f1;
    background: linear-gradient(180deg,#fff 0%,#fbfcff 100%);
}
.module-list-toolbar-heading {
    flex: 0 0 auto;
    min-width: max-content;
}
.module-list-toolbar-heading h2 {
    margin: 0;
    color: #2b3952;
    font-family: inherit;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -.012em;
}
.patient-reference-toolbar .patient-reference-filter {
    flex: 1 1 auto;
    width: auto;
}
.catalog-toolbar-actions-only.module-list-toolbar {
    justify-content: flex-start;
}
.catalog-toolbar-actions-only.module-list-toolbar > .toolbar-actions {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    justify-content: flex-end;
}
.catalog-toolbar-actions-only.module-list-toolbar .catalog-inline-filter {
    flex: 1 1 auto;
    min-width: 0;
}
.catalog-toolbar-actions-only.module-list-toolbar .catalog-reference-search {
    width: 100%;
    max-width: none;
}
@media (max-width: 980px) {
    .module-list-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }
    .module-list-toolbar-heading { min-width: 0; }
    .patient-reference-toolbar .patient-reference-filter,
    .catalog-toolbar-actions-only.module-list-toolbar > .toolbar-actions { width: 100%; }
}
@media (max-width: 700px) {
    .module-list-toolbar { min-height: 0; padding: 10px; }
    .module-list-toolbar-heading h2 { font-size: 13px; }
}

/* Medibox 3.13.84 — unified action footers, compact service details and visit-entry UX. */
.modal-footer,
.form-actions,
.app-action-footer,
.clinical-visit-final-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid #e6eaf1;
    background: #fff;
    box-shadow: none;
}
.modal-footer .btn,
.form-actions .btn,
.app-action-footer .btn,
.clinical-visit-final-footer .btn {
    min-width: 112px;
    min-height: 40px;
    padding: 0 18px;
    border-radius: 10px;
    box-shadow: none !important;
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .01em;
}
.modal-footer .btn .ui-icon,
.form-actions .btn .ui-icon,
.app-action-footer .btn .ui-icon,
.clinical-visit-final-footer .btn .ui-icon {
    display: none !important;
}
.modal-footer .btn-light,
.form-actions .btn-light,
.app-action-footer .btn-light,
.clinical-visit-final-footer .btn-light {
    color: #475569;
    border: 1px solid #d8dee8;
    background: #fff;
}
.modal-footer .btn-primary,
.form-actions .btn-primary,
.app-action-footer .btn-primary,
.clinical-visit-final-footer .btn-primary {
    color: #fff;
    border: 1px solid #4f46e5;
    background: #4f46e5;
}
.modal-footer .btn:hover,
.form-actions .btn:hover,
.app-action-footer .btn:hover,
.clinical-visit-final-footer .btn:hover {
    transform: translateY(-1px);
}

.patient-profile-direct-visit-form {
    margin-left: auto;
}
.patient-profile-direct-visit-form .patient-profile-schedule-button {
    width: 100%;
}

.service-details-compact-dialog {
    width: min(92vw, 620px);
}
.service-details-compact-card {
    width: 100%;
    max-height: min(84vh, 720px);
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(15,23,42,.2);
}
.service-details-compact-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid #edf0f5;
    background: linear-gradient(180deg,#fff 0%,#fafbff 100%);
}
.service-details-compact-header h2 {
    margin: 3px 0 0;
    color: #24324a;
    font-size: 18px;
    line-height: 1.25;
}
.service-details-compact-body {
    display: grid;
    gap: 14px;
    padding: 18px 20px;
    overflow: auto;
}
.service-details-compact-status {
    justify-self: start;
    padding: 6px 10px;
    border-radius: 999px;
    color: #16794d;
    background: #eaf9f1;
    font-size: 11px;
    font-weight: 900;
}
.service-details-compact-status.is-inactive {
    color: #7b8797;
    background: #eef1f5;
}
.service-details-compact-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 10px;
    margin: 0;
}
.service-details-compact-grid > div,
.service-details-compact-description,
.service-details-compact-availability {
    padding: 12px 13px;
    border: 1px solid #e8ebf2;
    border-radius: 12px;
    background: #fff;
}
.service-details-compact-grid dt,
.service-details-compact-description > span {
    margin-bottom: 5px;
    color: #8a94a4;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.service-details-compact-grid dd {
    margin: 0;
    color: #26354d;
    font-size: 12px;
    font-weight: 850;
}
.service-details-compact-description p {
    margin: 0;
    color: #536177;
    font-size: 12px;
    line-height: 1.55;
}
.service-details-compact-availability {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #16794d;
    background: #f5fcf8;
}
.service-details-compact-availability.is-inactive {
    color: #7b8797;
    background: #f7f8fa;
}
.service-details-compact-availability .ui-icon {
    width: 18px;
    height: 18px;
}
.service-details-compact-availability strong,
.service-details-compact-availability small {
    display: block;
}
.service-details-compact-availability strong { font-size: 12px; }
.service-details-compact-availability small { margin-top: 2px; font-size: 10px; color: #7b8797; }

.clinical-visit-entry-board {
    overflow: hidden;
    border: 1px solid #e8ebf2;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 28px rgba(31,43,86,.07);
}
.clinical-visit-entry-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e9edf3;
    background: linear-gradient(180deg,#fff 0%,#fbfcff 100%);
}
.clinical-visit-entry-title small {
    color: #8a94a4;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.clinical-visit-entry-title h2 {
    margin: 2px 0 0;
    color: #26354d;
    font-size: 16px;
}
.clinical-visit-entry-rows {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
}
.clinical-visit-entry-row {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    border-bottom: 1px solid #edf0f4;
}
.clinical-visit-entry-row:nth-child(odd) {
    border-right: 1px solid #edf0f4;
}
.clinical-visit-entry-row > div {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}
.clinical-visit-entry-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #4f46e5;
    background: #f0efff;
}
.clinical-visit-entry-icon .ui-icon { width: 16px; height: 16px; }
.clinical-visit-entry-row h3 {
    margin: 0 0 3px;
    color: #2d3b52;
    font-size: 12px;
    font-weight: 900;
}
.clinical-visit-entry-row p {
    max-width: 460px;
    margin: 0;
    overflow: hidden;
    color: #7a8698;
    font-size: 10px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clinical-section-plus {
    width: 32px;
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #dcdff8;
    border-radius: 9px;
    color: #4f46e5;
    background: #fff;
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    transition: .16s ease;
}
.clinical-section-plus:hover {
    color: #fff;
    border-color: #4f46e5;
    background: #4f46e5;
}
.clinical-section-plus:disabled { opacity: .45; cursor: not-allowed; }
.clinical-section-simple-header {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
}
.clinical-section-simple-header h2 {
    margin: 0;
    color: #2c3a52;
    font-size: 14px;
    font-weight: 900;
}
.clinical-visit-final-footer {
    position: sticky;
    z-index: 12;
    bottom: 0;
    margin-top: 16px;
    border: 1px solid #e4e8ef;
    border-radius: 14px;
    box-shadow: 0 -8px 28px rgba(15,23,42,.08);
}
.clinical-visit-footer-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.clinical-visit-footer-actions form { margin: 0; }
.clinical-visit-data-dialog { width: min(94vw, 680px); }
.clinical-visit-data-dialog .modal-body { max-height: 68vh; overflow: auto; }

@media (max-width: 760px) {
    .modal-footer,
    .form-actions,
    .app-action-footer,
    .clinical-visit-final-footer { padding: 12px; }
    .modal-footer .btn,
    .form-actions .btn,
    .app-action-footer .btn,
    .clinical-visit-final-footer .btn { flex: 1 1 0; min-width: 0; }
    .service-details-compact-grid,
    .clinical-visit-entry-rows { grid-template-columns: 1fr; }
    .clinical-visit-entry-row:nth-child(odd) { border-right: 0; }
    .clinical-visit-entry-row p { white-space: normal; }
    .patient-profile-direct-visit-form { width: 100%; margin-left: 0; }
}

/* 3.13.89 — full-width clinical entry sections + spreadsheet services */
.clinical-entry-single-column {
    overflow: visible;
}
.clinical-entry-full-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
}
.clinical-entry-full-card {
    width: 100%;
    min-width: 0;
    padding: 0;
    border-bottom: 1px solid #edf0f4;
    background: #fff;
}
.clinical-entry-full-card:last-child { border-bottom: 0; }
.clinical-entry-full-head {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
}
.clinical-entry-full-head > div {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 11px;
}
.clinical-entry-full-head h3 {
    margin: 0;
    color: #2d3b52;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .025em;
}
.clinical-entry-full-content,
.clinical-entry-document-list {
    padding: 0 16px 14px 61px;
    color: #59677b;
    font-size: 12px;
    line-height: 1.6;
    white-space: normal;
}
.clinical-entry-document-list p {
    margin: 0;
    padding: 7px 0;
    border-top: 1px solid #f0f2f6;
    color: #4e5c70;
}
.clinical-entry-document-list p:first-child { border-top: 0; padding-top: 0; }
.clinical-inline-editor {
    margin: 0 16px 16px 61px;
    padding: 12px;
    border: 1px solid #e1e6ee;
    border-radius: 12px;
    background: #fbfcfe;
}
.clinical-inline-editor textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    padding: 11px 12px;
    border: 1px solid #dfe4ec;
    border-radius: 10px;
    background: #fff;
    color: #26354d;
    font: inherit;
    line-height: 1.55;
    outline: none;
}
.clinical-inline-editor textarea:focus {
    border-color: #aeb8ee;
    box-shadow: 0 0 0 3px rgba(79,70,229,.08);
}
.clinical-inline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}
.clinical-spreadsheet-wrap {
    width: 100%;
    overflow-x: auto;
    border-top: 1px solid #edf0f4;
}
.clinical-spreadsheet-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    table-layout: auto;
}
.clinical-spreadsheet-table th,
.clinical-spreadsheet-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #eef1f5;
    text-align: left;
    vertical-align: middle;
    color: #536176;
    font-size: 10px;
    font-weight: 400;
}
.clinical-spreadsheet-table th {
    background: #fafbfc;
    color: #7a8697;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.clinical-spreadsheet-table td:first-child { min-width: 210px; }
.clinical-spreadsheet-table td strong {
    display: block;
    color: #2f3c50;
    font-size: 10px;
    font-weight: 600;
}
.clinical-spreadsheet-table td small {
    display: block;
    margin-top: 2px;
    color: #8a94a4;
    font-size: 9px;
}
.clinical-spreadsheet-new-row td { background: #fcfcff; }
.clinical-spreadsheet-new-row input,
.clinical-spreadsheet-new-row select {
    width: 100%;
    min-width: 74px;
    height: 34px;
    padding: 5px 7px;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    background: #fff;
    color: #344258;
    font-size: 10px;
    font-weight: 400;
}
.clinical-spreadsheet-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
}
.clinical-entry-empty {
    margin: 0;
    padding: 10px 16px 14px 61px;
    color: #8a94a4;
    font-size: 10px;
}
@media (max-width: 760px) {
    .clinical-entry-full-content,
    .clinical-entry-document-list,
    .clinical-entry-empty,
    .clinical-inline-editor { margin-left: 0; padding-left: 16px; }
    .clinical-inline-editor { margin-right: 12px; margin-left: 12px; }
    .clinical-entry-full-head { padding-inline: 12px; }
}

/* 3.13.90 — modal-first clinical entry + searchable service/group picker */
.clinical-focused-entry-dialog {
    width: min(620px, calc(100% - 28px));
}
.clinical-focused-entry-dialog .modal-card {
    border-radius: 18px;
    overflow: hidden;
}
.clinical-focused-entry-dialog .modal-body {
    padding: 18px;
    background: #fbfcfe;
}
.clinical-modal-textarea {
    gap: 8px;
}
.clinical-modal-textarea > span {
    color: #344258;
    font-size: 11px;
    font-weight: 700;
}
.clinical-modal-textarea textarea {
    min-height: 210px;
    resize: vertical;
    padding: 14px 15px;
    border: 1px solid #dfe5ee;
    border-radius: 13px;
    background: #fff;
    color: #2c3a50;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.65;
    outline: none;
}
.clinical-modal-textarea textarea:focus {
    border-color: #aeb7ec;
    box-shadow: 0 0 0 3px rgba(79,70,229,.08);
}
.clinical-service-picker-dialog {
    width: min(980px, calc(100% - 28px));
}
.clinical-service-picker-card {
    width: 100%;
    min-height: min(690px, calc(100vh - 40px));
}
.clinical-service-picker-body {
    min-height: 0;
    padding: 0;
    overflow: hidden;
    background: #f7f9fc;
}
.clinical-service-picker-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e7ebf1;
    background: #fff;
}
.clinical-service-picker-search {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #dfe5ed;
    border-radius: 12px;
    background: #f9fafc;
}
.clinical-service-picker-search > span {
    display: inline-flex;
    color: #7a8799;
}
.clinical-service-picker-search .ui-icon {
    width: 16px;
    height: 16px;
}
.clinical-service-picker-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #28364b;
    font: inherit;
    font-size: 12px;
    font-weight: 400;
}
.clinical-service-picker-search:focus-within {
    border-color: #aeb7ec;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(79,70,229,.07);
}
.clinical-service-picker-tabs {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid #e2e7ef;
    border-radius: 11px;
    background: #f5f7fa;
}
.clinical-service-picker-tabs button {
    min-height: 32px;
    padding: 6px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #6c798c;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}
.clinical-service-picker-tabs button.is-active {
    background: #fff;
    color: #4f46e5;
    box-shadow: 0 1px 4px rgba(28,39,61,.11);
}
.clinical-service-picker-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, .55fr);
    min-height: 0;
    height: min(540px, calc(100vh - 190px));
}
.clinical-service-picker-results {
    min-width: 0;
    overflow-y: auto;
    padding: 10px;
    border-right: 1px solid #e7ebf1;
    background: #fff;
}
.clinical-service-choice {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px;
    margin: 0 0 6px;
    border: 1px solid #e7ebf1;
    border-radius: 11px;
    background: #fff;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, transform .15s ease;
}
.clinical-service-choice:hover {
    border-color: #cfd6e3;
    background: #fbfcff;
    transform: translateY(-1px);
}
.clinical-service-choice.is-selected {
    border-color: #aab4eb;
    background: #f6f7ff;
    box-shadow: 0 0 0 2px rgba(79,70,229,.07);
}
.clinical-service-choice-main {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.clinical-service-choice-main small {
    color: #8a95a5;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .02em;
}
.clinical-service-choice-main strong {
    overflow: hidden;
    color: #29374d;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clinical-service-choice-main em {
    overflow: hidden;
    color: #7a8798;
    font-size: 9px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clinical-service-choice-price {
    flex: 0 0 auto;
    color: #39475d;
    font-size: 10px;
    font-weight: 650;
}
.clinical-service-picker-empty {
    padding: 38px 18px;
    color: #8b96a5;
    font-size: 11px;
    text-align: center;
}
.clinical-service-picker-settings {
    min-width: 0;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}
.clinical-service-picker-settings .field {
    margin-top: 12px;
}
.clinical-service-picker-selected {
    display: grid;
    gap: 3px;
    padding: 13px;
    border: 1px solid #e1e6ee;
    border-radius: 12px;
    background: #fff;
}
.clinical-service-picker-selected small {
    color: #8a95a5;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.clinical-service-picker-selected strong {
    color: #2f3d52;
    font-size: 12px;
    line-height: 1.35;
}
.clinical-service-picker-selected span {
    color: #7c899b;
    font-size: 9px;
}
.clinical-service-picker-dialog .modal-footer {
    border-top: 1px solid #e7ebf1;
    background: #fff;
}
.clinical-service-picker-dialog .modal-footer .btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
}
@media (max-width: 820px) {
    .clinical-service-picker-dialog { width: min(720px, calc(100% - 18px)); }
    .clinical-service-picker-card { min-height: calc(100vh - 24px); }
    .clinical-service-picker-topbar { align-items: stretch; flex-direction: column; }
    .clinical-service-picker-tabs { width: 100%; }
    .clinical-service-picker-tabs button { flex: 1 1 0; }
    .clinical-service-picker-layout { grid-template-columns: 1fr; height: auto; max-height: calc(100vh - 220px); overflow-y: auto; }
    .clinical-service-picker-results { max-height: 330px; border-right: 0; border-bottom: 1px solid #e7ebf1; }
    .clinical-service-picker-settings { overflow: visible; }
}
@media (max-width: 560px) {
    .clinical-focused-entry-dialog,
    .clinical-service-picker-dialog { width: calc(100% - 10px); }
    .clinical-service-picker-topbar,
    .clinical-service-picker-settings { padding: 12px; }
    .clinical-service-choice { padding: 10px; }
    .clinical-service-choice-main strong { white-space: normal; }
    .clinical-service-choice-main em { white-space: normal; }
}

/* 3.13.92 — multiple clinical entries in the active review */
.clinical-entry-multi-list {
    display: grid;
    gap: 8px;
}
.clinical-entry-multi-list .clinical-entry-item {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    background: #fbfcfe;
    color: #44556b;
    font-size: 12px;
    line-height: 1.55;
}


/* Medibox 3.13.93 — previous visits use the same content pattern as the latest visit */
.patient-previous-visits-grid .patient-previous-visit-card {
    grid-template-columns: 82px minmax(0, 1fr) 38px;
    align-items: start;
    gap: 10px 12px;
    padding: 15px 16px;
    border: 1px solid #dce4ee;
    border-top: 3px solid transparent;
    border-radius: 15px;
    background:
        linear-gradient(#fff,#fff) padding-box,
        linear-gradient(90deg,#4f46e5,#0ea5e9,#10b981) border-box;
    box-shadow: 0 10px 25px rgba(42, 54, 111, .065);
}
.patient-previous-visits-grid .patient-previous-visit-card > div { padding: 0; }
.patient-previous-visits-grid .patient-previous-visit-card .patient-visit-primary { grid-column: 1; grid-row: 1; }
.patient-previous-visits-grid .patient-previous-visit-card .patient-visit-reason { grid-column: 2; grid-row: 1; }
.patient-previous-visits-grid .patient-previous-visit-card > .action-icon-button { grid-column: 3; grid-row: 1; align-self: center; justify-self: end; }
.patient-previous-visits-grid .patient-previous-visit-card .patient-visit-diagnosis { grid-column: 1 / span 2; grid-row: 2; }
.patient-previous-visits-grid .patient-previous-visit-card .patient-visit-note { grid-column: 1 / -1; grid-row: 3; }
.patient-previous-visits-grid .patient-previous-visit-card .patient-visit-doctor { grid-column: 1 / -1; grid-row: 4; }
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child {
    grid-template-columns: 95px minmax(180px, .85fr) minmax(160px, .75fr) minmax(220px, 1fr) minmax(150px, .65fr) 38px;
    align-items: center;
    gap: 14px;
    padding: 17px 18px;
}
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-primary { grid-column: 1; grid-row: 1; }
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-reason { grid-column: 2; grid-row: 1; }
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-diagnosis { grid-column: 3; grid-row: 1; }
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-note { grid-column: 4; grid-row: 1; }
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-doctor { grid-column: 5; grid-row: 1; }
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child > .action-icon-button { grid-column: 6; grid-row: 1; }
@media (max-width: 1280px) {
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child {
        grid-template-columns: 82px 1fr 1fr 38px;
    }
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-primary { grid-column: 1; }
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-reason { grid-column: 2; }
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-diagnosis { grid-column: 3; }
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child > .action-icon-button { grid-column: 4; }
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-note { grid-column: 2 / span 2; grid-row: 2; }
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-doctor { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 900px) {
    .patient-previous-visits-grid .patient-previous-visit-card,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child {
        grid-template-columns: 78px minmax(0,1fr) 38px;
        padding: 14px;
    }
    .patient-previous-visits-grid .patient-previous-visit-card .patient-visit-primary,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-primary { grid-column: 1; grid-row: 1; }
    .patient-previous-visits-grid .patient-previous-visit-card .patient-visit-reason,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-reason { grid-column: 2; grid-row: 1; }
    .patient-previous-visits-grid .patient-previous-visit-card > .action-icon-button,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child > .action-icon-button { grid-column: 3; grid-row: 1; position: static; }
    .patient-previous-visits-grid .patient-previous-visit-card .patient-visit-diagnosis,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-diagnosis { grid-column: 1 / -1; grid-row: 2; }
    .patient-previous-visits-grid .patient-previous-visit-card .patient-visit-note,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-note { grid-column: 1 / -1; grid-row: 3; }
    .patient-previous-visits-grid .patient-previous-visit-card .patient-visit-doctor,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-doctor { grid-column: 1 / -1; grid-row: 4; }
}


/* Medibox 3.13.94 — clean previous visit cards */
.patient-previous-visits-grid .patient-previous-visit-card {
    border: 0 !important;
    border-top: 0 !important;
    background: #fff !important;
}


/* Medibox 3.13.95 — every previous visit is full-width like the latest visit */
.patient-previous-visits-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
}
.patient-previous-visits-grid > .patient-previous-visit-card,
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child {
    grid-column: auto !important;
    grid-template-columns: 95px minmax(180px, .85fr) minmax(160px, .75fr) minmax(220px, 1fr) minmax(150px, .65fr) 38px;
    align-items: center;
    gap: 14px;
    padding: 17px 18px;
    border: 0 !important;
    border-top: 0 !important;
    background: #fff !important;
    box-shadow: 0 9px 23px rgba(39, 52, 112, .065);
}
.patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-primary,
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-primary { grid-column: 1; grid-row: 1; }
.patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-reason,
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-reason { grid-column: 2; grid-row: 1; }
.patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-diagnosis,
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-diagnosis { grid-column: 3; grid-row: 1; }
.patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-note,
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-note { grid-column: 4; grid-row: 1; }
.patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-doctor,
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child .patient-visit-doctor { grid-column: 5; grid-row: 1; }
.patient-previous-visits-grid > .patient-previous-visit-card > .action-icon-button,
.patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child > .action-icon-button {
    grid-column: 6;
    grid-row: 1;
    position: static;
    align-self: center;
    justify-self: end;
}
@media (max-width: 1280px) {
    .patient-previous-visits-grid > .patient-previous-visit-card,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child {
        grid-template-columns: 82px minmax(0,1fr) minmax(0,1fr) 38px;
    }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-primary { grid-column: 1; grid-row: 1; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-reason { grid-column: 2; grid-row: 1; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-diagnosis { grid-column: 3; grid-row: 1; }
    .patient-previous-visits-grid > .patient-previous-visit-card > .action-icon-button { grid-column: 4; grid-row: 1; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-note { grid-column: 2 / span 2; grid-row: 2; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-doctor { grid-column: 1 / -1; grid-row: 3; }
}
@media (max-width: 900px) {
    .patient-previous-visits-grid > .patient-previous-visit-card,
    .patient-previous-visits-grid.is-odd > .patient-previous-visit-card:first-child {
        grid-template-columns: 78px minmax(0,1fr) 38px;
        padding: 14px;
    }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-primary { grid-column: 1; grid-row: 1; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-reason { grid-column: 2; grid-row: 1; }
    .patient-previous-visits-grid > .patient-previous-visit-card > .action-icon-button { grid-column: 3; grid-row: 1; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-diagnosis { grid-column: 1 / -1; grid-row: 2; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-note { grid-column: 1 / -1; grid-row: 3; }
    .patient-previous-visits-grid > .patient-previous-visit-card .patient-visit-doctor { grid-column: 1 / -1; grid-row: 4; }
}

/* Medibox 3.13.96 — regular typography across dental and general-practice review sections */
.clinical-entry-full-head h3,
.clinical-entry-full-content,
.clinical-entry-document-list,
.clinical-entry-document-list p,
.clinical-entry-multi-list .clinical-entry-item,
.clinical-spreadsheet-table th,
.clinical-spreadsheet-table td,
.clinical-spreadsheet-table td strong {
    font-weight: 400;
}

/* Medibox 3.13.97 — edit/delete controls for every entered clinical record */
.clinical-entry-item-with-actions,
.clinical-entry-document-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.clinical-entry-item-text,
.clinical-entry-document-text {
    min-width: 0;
    flex: 1 1 auto;
    color: #44556b;
    font-weight: 400;
    line-height: 1.55;
}
.clinical-entry-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
}
.clinical-entry-item-actions form { margin: 0; }
.clinical-entry-item-actions .icon-action {
    width: 36px;
    height: 36px;
    min-width: 30px;
    border-radius: 9px;
}
.clinical-entry-single-item {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    background: #fbfcfe;
}
.clinical-entry-document-list {
    display: grid;
    gap: 8px;
}
.clinical-entry-document-item {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    background: #fbfcfe;
}
@media (max-width: 560px) {
    .clinical-entry-item-with-actions,
    .clinical-entry-document-item { gap: 8px; }
    .clinical-entry-item-actions .icon-action { width: 28px; height: 28px; min-width: 28px; }
}


/* Medibox 3.13.98 — group finance records by patient with expandable detail rows */
.payment-patient-summary-row > td {
    background: #fff;
    font-weight: 400;
}
.payment-patient-name {
    color: #1f2f3d;
    font-weight: 400;
}
.payment-patient-toggle {
    width: 34px;
    height: 34px;
    min-width: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe5e3;
    border-radius: 10px;
    background: #fff;
    color: #355b54;
    font: inherit;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.payment-patient-toggle:hover,
.payment-patient-toggle[aria-expanded="true"] {
    background: #f2f7f6;
    border-color: #bfcfcb;
}
.payment-patient-toggle:active { transform: scale(.96); }
.payment-patient-detail-row > td {
    padding: 0 !important;
    background: #f7faf9 !important;
}
.payment-patient-detail-panel {
    padding: 14px 16px 16px 48px;
    border-top: 1px solid #edf2f1;
    border-bottom: 1px solid #edf2f1;
}
.payment-patient-detail-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 10px;
    color: #566a65;
    font-size: .84rem;
    font-weight: 400;
}
.payment-patient-detail-heading small {
    color: #82918d;
    font-size: .76rem;
    font-weight: 400;
}
.payment-patient-nested-wrap {
    border: 1px solid #e5ecea;
    border-radius: 12px;
    background: #fff;
    overflow: auto;
}
.payment-patient-nested-table {
    margin: 0;
    min-width: 920px;
}
.payment-patient-nested-table thead th {
    position: static !important;
    background: #f8fbfa !important;
    font-weight: 400;
    font-size: .76rem;
}
.payment-patient-nested-table td,
.payment-patient-nested-table td span,
.payment-patient-nested-table .payment-service-stack span {
    font-weight: 400;
}
.payment-patient-nested-table tbody tr:last-child td { border-bottom: 0; }
@media (max-width: 760px) {
    .payment-patient-detail-panel { padding: 12px; }
    .payment-patient-detail-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
}

/* Medibox 3.13.99 — regular tables, clean finance borders, compact payment modal */
/* Reviews: regular typography throughout the register. */
.reviews-reference-table thead th,
.reviews-reference-table tbody td,
.reviews-reference-table tbody td strong,
.reviews-reference-table tbody td b,
.reviews-reference-table .reference-primary-value,
.reviews-reference-table .reference-secondary-value,
.reviews-reference-table .reference-service-count,
.reviews-reference-table .reference-service-count strong,
.reviews-reference-table .review-status-badge {
    font-weight: 400 !important;
}

/* Catalog + inventory tables: one regular-weight language across all modules. */
.service-module-tabs + .catalog-table-card .module-unified-table thead th,
.service-module-tabs + .catalog-table-card .module-unified-table tbody td,
.service-module-tabs + .catalog-table-card .module-unified-table tbody td strong,
.service-groups-table thead th,
.service-groups-table tbody td,
.service-groups-table tbody td strong,
.material-catalog-table thead th,
.material-catalog-table tbody td,
.material-catalog-table tbody td strong,
.supplier-full-table thead th,
.supplier-full-table tbody td,
.supplier-full-table tbody td strong,
.invoice-register-table thead th,
.invoice-register-table tbody td,
.invoice-register-table tbody td strong,
#receiptEditDialog .module-unified-table thead th,
#receiptEditDialog .module-unified-table tbody td,
#receiptEditDialog .module-unified-table tbody td strong {
    font-weight: 400 !important;
}
.service-module-tabs + .catalog-table-card .module-unified-table .badge,
.service-module-tabs + .catalog-table-card .module-unified-table .code-chip,
.service-groups-table .badge,
.material-catalog-table .badge,
.supplier-full-table .badge,
.invoice-register-table .badge {
    font-weight: 400 !important;
}

/* Finance: no accent border treatment; patient name is the only emphasized table value. */
.patient-payments-register,
.patient-payments-register.payment-table-card,
.patient-payments-register.catalog-table-card {
    border-color: transparent !important;
    border-width: 0 !important;
}
.patient-payments-register .module-unified-table tbody tr:hover td:first-child {
    box-shadow: none !important;
}
.payment-patient-detail-panel {
    border-top: 0 !important;
    border-bottom: 0 !important;
}
.payment-patient-nested-wrap {
    border: 0 !important;
    box-shadow: none !important;
}
.patient-payments-register .module-unified-table thead th,
.patient-payments-register .module-unified-table tbody td,
.patient-payments-register .module-unified-table tbody td strong,
.patient-payments-register .module-unified-table tbody td span,
.patient-payments-register .module-unified-table .table-subtext,
.patient-payments-register .module-unified-table .badge {
    font-weight: 400 !important;
}
.patient-payments-register .payment-patient-name {
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .015em;
}

/* Smaller, simpler installment evidence modal on desktop. */
@media (min-width: 921px) {
    .payment-installment-dialog {
        width: min(860px, calc(100vw - 40px)) !important;
        max-width: 860px !important;
        height: min(72vh, 650px) !important;
        max-height: calc(100vh - 40px) !important;
        border-radius: 16px !important;
    }
    .payment-installment-dialog .payment-installment-modal-card {
        border-radius: 16px !important;
    }
    .payment-installment-modal-header {
        padding: 12px 16px !important;
    }
    .payment-installment-modal-header h2 {
        font-size: 18px !important;
    }
    .payment-installment-layout {
        grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr) !important;
        gap: 10px !important;
        padding: 10px 16px !important;
    }
    .payment-installment-entry {
        padding: 13px 14px !important;
        border-width: 1px !important;
        border-color: #e2e8e6 !important;
        background: #fff !important;
        box-shadow: none !important;
    }
    .payment-installment-entry::before { display: none !important; }
    .payment-installment-section-heading {
        margin-bottom: 9px !important;
        padding-bottom: 7px !important;
    }
    .payment-installment-section-heading h3 { font-size: 17px !important; }
    .payment-installment-entry .payment-installment-summary {
        gap: 6px !important;
        margin-bottom: 9px !important;
    }
    .payment-installment-entry .payment-installment-summary span {
        min-height: 52px !important;
        padding: 8px 9px !important;
        box-shadow: none !important;
    }
    .payment-installment-entry .payment-installment-summary strong { font-size: 14px !important; }
    .payment-installment-entry .field { margin-bottom: 5px !important; }
    .payment-installment-entry input,
    .payment-installment-entry select {
        min-height: 34px !important;
        font-size: 11px !important;
    }
    .payment-installment-entry textarea {
        min-height: 54px !important;
        height: 54px !important;
        font-size: 11px !important;
    }
    .payment-installment-history-heading { padding: 9px 10px !important; }
    .payment-installment-history-heading h3 { font-size: 13px !important; }
    .payment-installment-history-summary { padding: 7px 8px !important; }
    .payment-installment-modal-footer { padding: 9px 16px !important; }
    .payment-installment-modal-footer [data-installment-submit] {
        min-width: 120px !important;
        min-height: 36px !important;
        box-shadow: none !important;
    }
}

/* Medibox current — payment evidence modal + debtors cleanup */
.payment-installment-dialog {
    width: min(760px, calc(100vw - 24px)) !important;
    height: auto !important;
    max-height: min(90vh, 860px) !important;
    border-radius: 18px !important;
}
.payment-installment-dialog .payment-installment-modal-card {
    max-height: min(90vh, 860px) !important;
    overflow: hidden !important;
    display: grid !important;
    grid-template-rows: auto minmax(0,1fr) auto !important;
}
.payment-installment-modal-header {
    padding: 16px 18px 13px !important;
}
.payment-installment-modal-header h2 {
    margin: 2px 0 3px !important;
    font-size: 20px !important;
    letter-spacing: -.02em;
}
.payment-modal-patient {
    margin: 0 !important;
    color: #365f57 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
}
.payment-evidence-layout {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 12px 16px 14px !important;
}
.payment-evidence-entry {
    overflow: visible !important;
    padding: 14px !important;
    border: 1px solid #dce8e4 !important;
    border-radius: 14px !important;
    background: #fff !important;
    box-shadow: none !important;
}
.payment-evidence-entry::before { display: none !important; }
.payment-evidence-entry .payment-installment-summary {
    gap: 7px !important;
    margin-bottom: 11px !important;
}
.payment-evidence-entry .payment-installment-summary span {
    min-height: 58px !important;
    padding: 9px 10px !important;
    border-color: #e0e9e6 !important;
    border-radius: 11px !important;
    background: #f9fbfa !important;
    box-shadow: none !important;
}
.payment-evidence-entry .payment-installment-summary small { font-size: 8.5px !important; }
.payment-evidence-entry .payment-installment-summary strong { font-size: 14px !important; }
.payment-mode-toggle-card {
    margin: 0 0 12px !important;
    padding: 10px 11px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px !important;
    border: 1px solid #d8e7e2 !important;
    border-radius: 12px !important;
    background: #f7fbf9 !important;
}
.payment-mode-toggle-copy {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}
.payment-mode-toggle-icon,
.payment-installment-mode-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #176b5f;
    background: #e8f5f1;
}
.payment-mode-toggle-icon .ui-icon,
.payment-installment-mode-icon .ui-icon { width: 16px; height: 16px; }
.payment-mode-toggle-copy strong { display: block; color: #234b43; font-size: 12px; }
.payment-mode-toggle-copy small { display: block; margin-top: 2px; color: #71827c; font-size: 9.5px; line-height: 1.35; }
.modern-toggle { position: relative; flex: 0 0 auto; cursor: pointer; }
.modern-toggle input { position: absolute !important; opacity: 0 !important; pointer-events: none !important; }
.modern-toggle-track {
    width: 42px;
    height: 24px;
    display: block;
    padding: 3px;
    border-radius: 999px;
    background: #ccd8d4;
    transition: background .18s ease;
}
.modern-toggle-thumb {
    width: 18px;
    height: 18px;
    display: block;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(35,75,67,.18);
    transition: transform .18s ease;
}
.modern-toggle input:checked + .modern-toggle-track { background: #177468; }
.modern-toggle input:checked + .modern-toggle-track .modern-toggle-thumb { transform: translateX(18px); }
.modern-toggle input:focus-visible + .modern-toggle-track { outline: 3px solid rgba(23,116,104,.18); outline-offset: 2px; }
.payment-installment-mode-panel {
    margin: 0 0 12px;
    padding: 10px 11px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid #bfe0d6;
    border-radius: 12px;
    background: #eef9f5;
}
.payment-installment-mode-panel[hidden] { display: none !important; }
.payment-installment-mode-panel small { display: block; color: #6b827b; font-size: 8px; font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.payment-installment-mode-panel strong { display: block; margin-top: 1px; color: #155f55; font-size: 12px; }
.payment-installment-mode-panel p { margin: 2px 0 0; color: #607970; font-size: 9.5px; line-height: 1.35; }
.payment-entry-heading {
    margin: 0 0 9px !important;
    padding: 0 0 7px !important;
    border-bottom: 1px solid #e6eeeb !important;
}
.payment-entry-heading h3 { font-size: 15px !important; }
.payment-evidence-entry .form-grid { gap: 8px !important; }
.payment-evidence-entry .field { margin-bottom: 5px !important; }
.payment-evidence-entry .field > span { font-size: 10px !important; }
.payment-evidence-entry input,
.payment-evidence-entry select {
    min-height: 35px !important;
    font-size: 11px !important;
}
.payment-evidence-entry textarea {
    min-height: 54px !important;
    height: 54px !important;
    font-size: 11px !important;
}
.payment-installment-history-below {
    min-height: 0 !important;
    max-height: 260px !important;
    display: grid !important;
    grid-template-rows: auto minmax(0,1fr) !important;
    border: 1px solid #dce8e5 !important;
    border-radius: 13px !important;
    box-shadow: none !important;
}
.payment-installment-history-below .payment-installment-history-heading {
    padding: 9px 11px !important;
    background: #f8fbfa !important;
}
.payment-installment-history-below .payment-installment-history-heading h3 { font-size: 13px !important; }
.payment-installment-history-below .payment-installment-history { overflow: auto !important; }
.payment-installment-history-table thead th { position: sticky; top: 0; }
.payment-history-number {
    width: auto !important;
    height: auto !important;
    display: inline-flex !important;
    padding: 4px 7px !important;
    white-space: nowrap !important;
    border-radius: 7px !important;
    font-size: 9px !important;
}
.payment-history-empty { min-height: 110px !important; padding: 18px !important; }
.payment-history-empty strong { font-size: 12px !important; }
.payment-history-empty small { font-size: 9px !important; }
.payment-installment-modal-footer { padding: 10px 16px !important; }
.payment-installment-modal-footer [data-installment-submit] {
    min-width: 132px !important;
    min-height: 36px !important;
    box-shadow: none !important;
}
.debtors-dialog .modal-footer { justify-content: flex-end !important; }

@media (max-width: 700px) {
    .payment-installment-dialog {
        width: calc(100vw - 14px) !important;
        max-width: calc(100vw - 14px) !important;
        height: auto !important;
        max-height: 94dvh !important;
        border-radius: 14px !important;
    }
    .payment-evidence-layout { padding: 10px !important; }
    .payment-evidence-entry .payment-installment-summary { grid-template-columns: 1fr !important; }
    .payment-mode-toggle-card { align-items: flex-start !important; }
    .payment-installment-history-below { max-height: 230px !important; }
}

/* Current project — regular typography in latest / previous visit rows.
   Keep only the visit number visually emphasized. */
.patient-last-visit-card .patient-visit-primary > span,
.patient-last-visit-card .patient-visit-reason > strong,
.patient-last-visit-card .patient-visit-diagnosis > strong,
.patient-last-visit-card .patient-visit-note,
.patient-last-visit-card .patient-visit-doctor > strong {
    font-weight: 400 !important;
}
.patient-last-visit-card .patient-visit-primary > strong {
    font-weight: 900 !important;
}

/* Service picker refinement 2026-08-09: service-first flow, 20% wider desktop modal */
.clinical-service-picker-dialog {
    width: min(1176px, calc(100% - 28px));
}
.clinical-service-picker-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    max-height: min(650px, calc(100vh - 190px));
    overflow-y: auto;
}
.clinical-service-picker-results {
    max-height: 330px;
    border-right: 0;
    border-bottom: 1px solid #e7ebf1;
}
.clinical-service-picker-settings {
    overflow: visible;
    padding: 16px 18px 18px;
    background: #f8fafc;
}
.clinical-service-picker-settings[hidden] { display: none !important; }
.clinical-service-picker-discount-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 260px);
    align-items: end;
    gap: 14px;
    margin-top: 12px;
    padding: 12px 14px;
    border: 1px solid #dfe5f1;
    border-radius: 12px;
    background: #fff;
}
.clinical-service-picker-settings-title {
    display: grid;
    gap: 3px;
    align-self: center;
}
.clinical-service-picker-settings-title small {
    color: #4f46e5;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
}
.clinical-service-picker-settings-title span {
    color: #7b8798;
    font-size: 10px;
    font-weight: 400;
}
.clinical-service-picker-discount-panel .field { margin-top: 0; }
.clinical-service-picker-details-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 4px;
}
.clinical-service-picker-details-grid .field { margin-top: 12px; }
.clinical-service-notes-field { grid-column: span 2; }
@media (max-width: 980px) {
    .clinical-service-picker-dialog { width: min(960px, calc(100% - 18px)); }
    .clinical-service-picker-details-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .clinical-service-picker-discount-panel,
    .clinical-service-picker-details-grid { grid-template-columns: minmax(0, 1fr); }
    .clinical-service-notes-field { grid-column: auto; }
}

/* Current project — service picker table layout + compact post-selection controls (2026-08-09) */
.clinical-service-picker-search {
    border: 0 !important;
    box-shadow: none !important;
    background: #f3f5f9 !important;
}
.clinical-service-picker-search:focus-within {
    border: 0 !important;
    box-shadow: none !important;
    background: #f3f5f9 !important;
}
.clinical-service-picker-search input,
.clinical-service-picker-search input:focus,
.clinical-service-picker-search input:focus-visible {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}
.clinical-service-picker-results {
    padding: 0 16px 10px;
}
.clinical-service-picker-table-head,
.clinical-service-choice {
    display: grid !important;
    grid-template-columns: minmax(100px, .55fr) minmax(260px, 2fr) minmax(110px, .55fr);
    align-items: center;
    gap: 16px;
}
.clinical-service-picker-table-head {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 38px;
    padding: 0 12px;
    border-bottom: 1px solid #dfe5ee;
    background: #f8fafc;
    color: #7b8798;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .035em;
    text-transform: uppercase;
}
.clinical-service-picker-table-head span:last-child {
    text-align: right;
}
.clinical-service-choice {
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 8px 12px;
    border: 0;
    border-bottom: 1px solid #edf0f5;
    border-radius: 0;
    background: #fff;
    text-align: left;
    transform: none !important;
}
.clinical-service-choice:hover {
    border-color: #e4e8ef;
    background: #f8faff;
    box-shadow: none;
}
.clinical-service-choice.is-selected {
    border-color: #dfe3f6;
    background: #f2f4ff;
    box-shadow: inset 3px 0 0 #4f46e5;
}
.clinical-service-choice-code {
    overflow: hidden;
    color: #44516a;
    font-size: 11px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clinical-service-choice-description {
    min-width: 0;
    display: grid;
    gap: 2px;
}
.clinical-service-choice-description strong {
    overflow: hidden;
    color: #26344a;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clinical-service-choice-description small {
    overflow: hidden;
    color: #8792a4;
    font-size: 9px;
    font-weight: 400;
    line-height: 1.3;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clinical-service-choice-price {
    justify-self: end;
    color: #344158;
    font-size: 11px;
    font-weight: 500;
    text-align: right;
}
.clinical-service-picker-settings {
    padding: 14px 18px 18px;
    border-top: 1px solid #e5eaf1;
    background: #f8fafc;
}
.clinical-service-picker-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 0 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.clinical-service-picker-selected small {
    flex: 0 0 auto;
}
.clinical-service-picker-selected strong {
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.clinical-service-picker-selected span {
    margin-left: auto;
    white-space: nowrap;
}
.clinical-service-picker-compact-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e7ef;
    border-radius: 12px;
    background: #fff;
}
.clinical-service-picker-compact-fields .field {
    margin-top: 0 !important;
}
.clinical-service-picker-compact-fields input[readonly] {
    background: #f7f8fb;
    color: #27364d;
    font-weight: 600;
}
@media (max-width: 760px) {
    .clinical-service-picker-table-head,
    .clinical-service-choice {
        grid-template-columns: 80px minmax(150px, 1fr) 90px;
        gap: 8px;
    }
    .clinical-service-picker-results { padding-inline: 8px; }
    .clinical-service-picker-compact-fields { grid-template-columns: 1fr; }
    .clinical-service-picker-selected { align-items: flex-start; flex-direction: column; gap: 3px; }
    .clinical-service-picker-selected span { margin-left: 0; }
}

/* Current project — simple horizontal final visit actions. */
.clinical-visit-final-footer {
    position: static !important;
    margin-top: 12px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
.clinical-visit-footer-actions {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.clinical-visit-footer-actions form {
    flex: 0 0 auto;
    margin: 0;
}
.clinical-visit-final-footer .btn {
    width: auto !important;
    min-width: 92px !important;
    min-height: 36px !important;
    padding: 7px 14px !important;
    border-radius: 7px !important;
    box-shadow: none !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    transform: none !important;
}
.clinical-visit-final-footer .btn:hover {
    transform: none !important;
}
@media (max-width: 760px) {
    .clinical-visit-final-footer {
        padding: 0 !important;
    }
    .clinical-visit-footer-actions {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: flex-end;
    }
    .clinical-visit-final-footer .btn {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 92px !important;
    }
}

/* Current project — patient form actions matching approved reference: horizontal, outlined Cancel + indigo Save. */
.patient-simple-form-footer .patient-form-intro-actions {
    margin-left: auto !important;
    width: auto !important;
    display: grid !important;
    grid-template-columns: repeat(2, 140px) !important;
    gap: 12px !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
}
.patient-simple-form-footer .patient-form-intro-actions .btn {
    width: 140px !important;
    min-width: 140px !important;
    height: 50px !important;
    min-height: 50px !important;
    padding: 0 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    transform: none !important;
}
.patient-simple-form-footer .patient-form-intro-actions .btn.btn-light {
    border: 1px solid #d5deea !important;
    background: #fff !important;
    color: #334155 !important;
}
.patient-simple-form-footer .patient-form-intro-actions .btn.btn-light:hover,
.patient-simple-form-footer .patient-form-intro-actions .btn.btn-light:focus {
    border-color: #c4cfdd !important;
    background: #f8fafc !important;
    color: #334155 !important;
    box-shadow: none !important;
    transform: none !important;
}
.patient-simple-form-footer .patient-form-intro-actions .btn.btn-primary,
.patient-simple-form-footer [data-mobile-patient-save] {
    border: 1px solid #4f3df1 !important;
    background: #4f3df1 !important;
    color: #fff !important;
}
.patient-simple-form-footer .patient-form-intro-actions .btn.btn-primary:hover,
.patient-simple-form-footer .patient-form-intro-actions .btn.btn-primary:focus,
.patient-simple-form-footer [data-mobile-patient-save]:hover,
.patient-simple-form-footer [data-mobile-patient-save]:focus {
    border-color: #4332df !important;
    background: #4332df !important;
    color: #fff !important;
    box-shadow: none !important;
    transform: none !important;
}
.patient-simple-form-footer .patient-form-intro-actions .btn .ui-icon,
.patient-simple-form-footer [data-mobile-patient-save] .ui-icon {
    display: none !important;
}
.patient-simple-form-footer [data-mobile-patient-save] span {
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 700 !important;
}
@media (max-width: 700px) {
    .patient-simple-form-footer .patient-form-intro-actions {
        width: 100% !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }
    .patient-simple-form-footer .patient-form-intro-actions .btn {
        width: 100% !important;
        min-width: 0 !important;
        height: 48px !important;
        min-height: 48px !important;
    }
}

/* Medibox 2026-08-10 — simplified payment entry with automatic partial-payment installments */
.payment-installment-dialog {
    width: min(960px, calc(100vw - 34px)) !important;
    max-width: 960px !important;
}
.payment-installment-dialog .payment-installment-modal-card {
    max-height: min(92vh, 900px) !important;
}
.payment-evidence-entry {
    padding: 16px 17px !important;
}
.payment-entry-row {
    display: grid !important;
    grid-template-columns: minmax(105px,.72fr) minmax(135px,.9fr) minmax(155px,1.05fr) minmax(240px,1.75fr) !important;
    gap: 9px !important;
    align-items: end !important;
}
.payment-entry-row .field {
    min-width: 0 !important;
    margin: 0 !important;
}
.payment-entry-row .field input,
.payment-entry-row .field select {
    width: 100% !important;
    min-height: 36px !important;
    height: 36px !important;
}
.payment-field-amount input,
.payment-field-date input,
.payment-field-method select {
    font-size: 11px !important;
}
.payment-field-notes input {
    font-size: 11px !important;
}
.payment-auto-installment-note {
    margin-top: 10px !important;
    padding: 9px 11px !important;
    display: grid !important;
    grid-template-columns: auto auto 1fr !important;
    align-items: center !important;
    gap: 8px !important;
    border: 1px solid #cfe1dc !important;
    border-radius: 10px !important;
    background: #f5faf8 !important;
}
.payment-auto-installment-note[hidden] { display: none !important; }
.payment-auto-installment-note > span {
    color: #607970 !important;
    font-size: 9px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: .04em !important;
}
.payment-auto-installment-note > strong {
    color: #a83a3a !important;
    font-size: 12px !important;
}
.payment-auto-installment-note > small {
    color: #71827c !important;
    font-size: 9px !important;
}
.payment-installment-history-below {
    border-color: #d4ddd9 !important;
    background: #f6f8f7 !important;
}
.payment-installment-history-below .payment-installment-history-heading {
    padding: 11px 13px !important;
    border-bottom: 1px solid #dfe6e3 !important;
    background: #eef3f1 !important;
}
.payment-installment-history-below .payment-installment-history-heading small {
    display: block !important;
    margin-top: 3px !important;
    color: #71807b !important;
    font-size: 9px !important;
    font-weight: 500 !important;
}
.payment-installment-history-below .payment-installment-history {
    background: #fbfcfc !important;
}
.payment-history-open-row td {
    background: #fff9f6 !important;
}
.payment-history-number.is-open {
    color: #9a4a24 !important;
    border: 1px solid #eed9cb !important;
    background: #fff4ed !important;
}
@media (max-width: 820px) {
    .payment-entry-row {
        grid-template-columns: 1fr 1fr !important;
    }
    .payment-field-notes { grid-column: 1 / -1 !important; }
}
@media (max-width: 560px) {
    .payment-entry-row { grid-template-columns: 1fr !important; }
    .payment-field-notes { grid-column: auto !important; }
    .payment-auto-installment-note { grid-template-columns: 1fr !important; }
}


/* Medibox 2026-08-15 — debt amount is visible only while hovering the payment indicator. */
.patient-profile-debt-hover {
    position: relative;
}
.patient-profile-debt-hover .patient-profile-debt-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 31px;
    padding: 0 10px;
    border: 1px solid #ffd2d9;
    border-radius: 999px;
    background: #fff2f4;
    color: #c81e3a;
    cursor: default;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.patient-profile-debt-hover .patient-profile-debt-trigger .ui-icon {
    width: 15px;
    height: 15px;
}
.patient-profile-debt-hover:hover .patient-profile-debt-trigger {
    transform: translateY(-1px);
    border-color: #f5a8b5;
    box-shadow: 0 7px 16px rgba(31, 41, 90, .10);
}
.patient-profile-debt-hover > .patient-profile-debt-popover {
    display: none !important;
}
.patient-profile-debt-hover:hover > .patient-profile-debt-popover {
    display: block !important;
}


/* v141 · Patient finance: per-service payments and debt ledger */
.patient-finance-tab-debt-count {
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    margin-left: 4px;
    padding: 0 5px;
    border-radius: 999px;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 9px;
    font-style: normal;
    font-weight: 800;
    line-height: 1;
}
.patient-finance-unpaid-alert,
.patient-finance-paid-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid #fecaca;
    border-radius: 11px;
    background: #fff7f7;
}
.patient-finance-unpaid-alert-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #fee2e2;
    color: #b91c1c;
}
.patient-finance-unpaid-alert strong,
.patient-finance-unpaid-alert span { display: block; }
.patient-finance-unpaid-alert strong { color: #991b1b; font-size: 11px; }
.patient-finance-unpaid-alert span { margin-top: 2px; color: #7f1d1d; font-size: 9px; line-height: 1.45; }
.patient-finance-paid-alert {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
    font-size: 10px;
    font-weight: 700;
}
.patient-finance-paid-alert svg { width: 17px; height: 17px; }
.patient-finance-detailed-ledger { min-width: 1120px; }
.patient-finance-payment-history { min-width: 980px; }
.patient-finance-detailed-ledger td strong + small,
.patient-finance-payment-history td strong + small {
    display: block;
    margin-top: 2px;
    color: #8491a4;
    font-size: 8px;
}
.patient-finance-unpaid-row { background: #fffafa; }
.patient-finance-unpaid-row:hover { background: #fff5f5; }
.patient-finance-registration-note {
    display: block;
    margin-top: 4px;
    color: #9a6700;
    font-size: 8px;
    line-height: 1.35;
}
@media (max-width: 900px) {
    .patient-profile-v2-summary-cards.patient-profile-v2-summary-four { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 560px) {
    .patient-profile-v2-summary-cards.patient-profile-v2-summary-four { grid-template-columns: 1fr; }
}

/* v150 · Finance details: + lives inside Paid and Unpaid cards */
.patient-finance-summary-cards { margin-bottom: 0; }
.patient-finance-summary-card-with-action { position: relative; }
.patient-finance-card-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid #d7dfec;
    border-radius: 8px;
    background: #fff;
    color: #4f46e5;
    cursor: pointer;
    font: inherit;
    box-shadow: 0 3px 10px rgba(37,48,96,.05);
    transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.patient-finance-card-toggle span {
    display: block;
    margin-top: -1px;
    font-size: 19px;
    font-weight: 500;
    line-height: 1;
}
.patient-finance-card-toggle:hover,
.patient-finance-card-toggle:focus-visible,
.patient-finance-card-toggle[aria-expanded="true"] {
    border-color: #aebcf2;
    background: #f5f7ff;
    color: #3730a3;
    box-shadow: 0 5px 14px rgba(67,56,202,.11);
}
.patient-finance-summary-card-with-action.has-debt .patient-finance-card-toggle {
    color: #dc2626;
    border-color: #fecaca;
}
.patient-finance-summary-card-with-action.has-debt .patient-finance-card-toggle:hover,
.patient-finance-summary-card-with-action.has-debt .patient-finance-card-toggle:focus-visible,
.patient-finance-summary-card-with-action.has-debt .patient-finance-card-toggle[aria-expanded="true"] {
    background: #fff7f7;
    border-color: #fca5a5;
    color: #b91c1c;
}
.patient-finance-card-toggle:active { transform: translateY(1px); }
.patient-finance-card-toggle:disabled { opacity: .55; cursor: wait; }
.patient-finance-details { display: none; margin-top: 16px; }
.patient-finance-details.is-open { display: block; }

/* v148 · Finance details are loaded only after explicit + click */
.patient-finance-details-loading {
    padding: 18px;
    border: 1px dashed #d7deea;
    border-radius: 12px;
    background: #fafbfc;
    color: #64748b;
    text-align: center;
    font-size: 13px;
}
.patient-finance-details-toggle:disabled {
    cursor: wait;
    opacity: .65;
}

/* v152 · Simplified patient finance: payment and debt only */
.patient-finance-simple-section { margin-top: 14px; }
.patient-finance-simple-table tfoot td { border-top: 1px solid #dfe6f0; background: #fafcff; }
.patient-finance-total-row td { padding-top: 12px; padding-bottom: 12px; }
.patient-finance-pay-button {
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #a7d8c8;
    border-radius: 9px;
    background: #f0fbf6;
    color: #087a5d;
    font: 700 16px/1 inherit;
    cursor: pointer;
    transition: .15s ease;
}
.patient-finance-pay-button:hover,
.patient-finance-pay-button:focus-visible { background: #dcf7ea; border-color: #74c7aa; transform: translateY(-1px); }
.patient-finance-payment-invoice {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid #dde5f0;
    border-radius: 12px;
    background: #fafcff;
}
.patient-finance-payment-invoice small { color: #718096; font-size: 11px; text-transform: uppercase; }
.patient-finance-payment-invoice strong { font-size: 16px; color: #1f2a44; }
.patient-finance-payment-invoice span { color: #64748b; font-size: 12px; }


/* v155 · Patient names in Finance open the patient profile */
body.app-body .payment-patient-profile-link {
    color: #2563eb !important;
    text-decoration: none;
    cursor: pointer;
}
body.app-body .payment-patient-profile-link:hover,
body.app-body .payment-patient-profile-link:focus-visible {
    color: #1d4ed8 !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* v157 · Compact Albanian finance UI */
.payment-kpi-grid-clean { gap: 9px !important; margin-bottom: 10px !important; }
.payment-kpi-grid-clean .payment-kpi-card {
    min-height: 72px !important;
    padding: 10px 12px !important;
    gap: 9px !important;
    border-radius: 13px !important;
    box-shadow: 0 5px 14px rgba(22,73,64,.05) !important;
}
.payment-kpi-grid-clean .payment-kpi-icon {
    width: 32px !important; height: 32px !important; flex-basis: 32px !important; border-radius: 9px !important;
}
.payment-kpi-grid-clean .payment-kpi-icon .ui-icon { width: 16px !important; height: 16px !important; }
.payment-kpi-grid-clean .payment-kpi-card small { font-size: 8px !important; }
.payment-kpi-grid-clean .payment-kpi-card strong { font-size: 17px !important; }
.payment-kpi-grid-clean .payment-kpi-card p { margin-top: 2px !important; font-size: 8.5px !important; line-height: 1.25 !important; }
.payment-kpi-debtors .payment-kpi-arrow .ui-icon { width: 15px !important; height: 15px !important; }

/* Smaller debtors modal */
.debtors-dialog {
    width: min(820px, calc(100vw - 32px)) !important;
    max-width: 820px !important;
    max-height: 72vh !important;
}
.debtors-dialog .modal-card,
.debtors-dialog .modal-card-xlarge {
    width: 100% !important;
    max-width: 820px !important;
    max-height: 72vh !important;
    border-radius: 14px !important;
}
.debtors-dialog .modal-header { padding: 10px 13px !important; }
.debtors-dialog .modal-header h2 { font-size: 16px !important; }
.debtors-dialog .modal-body { padding: 7px 10px !important; }
.debtors-dialog .debtors-table-wrap { max-height: 46vh !important; }
.debtors-dialog .modal-footer { padding: 7px 10px !important; }

/* Smaller register/evidence payment modal */
.payment-installment-dialog {
    width: min(620px, calc(100vw - 28px)) !important;
    max-width: 620px !important;
    height: auto !important;
    max-height: 78vh !important;
    border-radius: 14px !important;
}
.payment-installment-dialog.is-history-only { width: min(500px, calc(100vw - 28px)) !important; max-width: 500px !important; }
.payment-installment-dialog.has-no-payments { width: min(560px, calc(100vw - 28px)) !important; max-width: 560px !important; }
.payment-installment-dialog .payment-installment-modal-card { max-height: 78vh !important; border-radius: 14px !important; }
.payment-installment-modal-header { padding: 10px 13px !important; }
.payment-installment-modal-header h2 { font-size: 16px !important; }
.payment-evidence-layout { gap: 8px !important; padding: 9px 12px 10px !important; }
.payment-evidence-entry { padding: 10px !important; border-radius: 11px !important; }
.payment-evidence-entry .payment-installment-summary span { min-height: 46px !important; padding: 7px 8px !important; }
.payment-evidence-entry .payment-installment-summary strong { font-size: 12px !important; }
.payment-entry-heading h3 { font-size: 13px !important; }
.payment-entry-row { gap: 7px !important; }
.payment-evidence-entry input,
.payment-evidence-entry select { min-height: 32px !important; font-size: 10px !important; }
.payment-installment-modal-footer { padding: 8px 12px !important; }
.payment-installment-modal-footer .btn { min-height: 33px !important; padding: 6px 10px !important; font-size: 10px !important; }

/* Installments are simple informational rows, not a heavy table. */
.payment-installment-history-below { max-height: 180px !important; border-radius: 11px !important; }
.payment-installment-history-below[hidden] { display: none !important; }
.payment-installment-history-below .payment-installment-history-heading { padding: 7px 9px !important; }
.payment-installment-history-below .payment-installment-history-heading h3 { margin: 0 !important; font-size: 12px !important; }
.payment-installment-history-below .payment-installment-history-heading small { font-size: 8.5px !important; }
.payment-installment-simple-list { display: grid; gap: 0; }
.payment-installment-simple-item {
    display: grid;
    grid-template-columns: minmax(90px,1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-top: 1px solid #edf1f0;
    font-size: 10px;
}
.payment-installment-simple-item:first-child { border-top: 0; }
.payment-installment-simple-item span { color: #405b55; }
.payment-installment-simple-item strong { color: #0f766e; font-size: 10.5px; }
.payment-installment-simple-item small { color: #7b8d88; font-size: 8.5px; white-space: nowrap; }
.payment-installment-simple-item.is-open strong { color: #dc2626; }
.payment-history-empty { min-height: 52px !important; padding: 12px !important; }
.payment-history-empty strong { font-size: 10px !important; font-weight: 500 !important; }

/* v158 · Debtors modal fits its table/content, no empty vertical space */
.debtors-dialog {
    width: min(1060px, calc(100vw - 28px)) !important;
    max-width: 1060px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 32px) !important;
    margin: auto !important;
    border-radius: 14px !important;
    overflow: visible !important;
}
.debtors-dialog .modal-card,
.debtors-dialog .modal-card-xlarge {
    width: 100% !important;
    max-width: 1060px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 32px) !important;
    display: grid !important;
    grid-template-rows: auto auto auto !important;
    align-content: start !important;
    overflow: hidden !important;
    border-radius: 14px !important;
}
.debtors-dialog .modal-header {
    padding: 12px 16px 10px !important;
    border-bottom: 1px solid #e5ebe9 !important;
}
.debtors-dialog .modal-header h2 {
    margin: 0 0 3px !important;
    font-size: 17px !important;
}
.debtors-dialog .modal-header .muted {
    margin: 0 !important;
    font-size: 10px !important;
}
.debtors-dialog .modal-body {
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    padding: 10px 14px !important;
}
.debtors-dialog .debtors-table-wrap {
    width: 100% !important;
    height: auto !important;
    max-height: min(55dvh, 520px) !important;
    overflow: auto !important;
    border: 1px solid #dfe7e5 !important;
    border-radius: 10px !important;
}
.debtors-dialog .debtors-table {
    width: 100% !important;
    min-width: 980px !important;
    table-layout: fixed !important;
}
.debtors-dialog .debtors-table thead th {
    padding: 9px 10px !important;
    font-size: 9px !important;
    vertical-align: middle !important;
}
.debtors-dialog .debtors-table tbody td {
    padding: 9px 10px !important;
    font-size: 10px !important;
    vertical-align: middle !important;
}
.debtors-dialog .modal-footer {
    min-height: 0 !important;
    padding: 8px 14px 10px !important;
    border-top: 1px solid #edf1f0 !important;
    justify-content: flex-end !important;
}
.debtors-dialog .modal-footer .btn {
    min-height: 34px !important;
    padding: 6px 16px !important;
}
@media (max-width: 1080px) {
    .debtors-dialog {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
    }
    .debtors-dialog .modal-card,
    .debtors-dialog .modal-card-xlarge { max-width: none !important; }
}


/* Medibox v266 — explicit permanent delete option for inactive patients */
.patient-permanent-delete-form{display:inline-flex;margin:0}
.patient-inactive-delete-button{width:34px;height:34px;padding:0;border:1px solid #fecaca;border-radius:10px;background:#fff5f5;color:#b42318;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;cursor:pointer;transition:background .15s ease,border-color .15s ease,color .15s ease}
.patient-inactive-delete-button svg{width:15px;height:15px}
.patient-inactive-delete-button:hover{background:#fee2e2;border-color:#fca5a5;color:#991b1b}
.patient-profile-header-actions{display:flex;align-items:center;gap:8px;margin-left:auto}
.patient-profile-header-actions .patient-profile-direct-visit-form{margin-left:0}
.patient-profile-delete-form{margin:0}
.patient-profile-delete-button{width:38px;height:38px;min-height:38px;padding:0;border:1px solid #fecaca;background:#fff5f5;color:#b42318;display:inline-flex;align-items:center;justify-content:center;font-weight:700}
.patient-profile-delete-button:hover{background:#fee2e2;border-color:#fca5a5;color:#991b1b}
.patient-profile-delete-button svg{width:16px;height:16px}
@media(max-width:760px){.patient-profile-header-actions{width:100%;margin-left:0;flex-wrap:wrap}.patient-profile-header-actions form{flex:1}.patient-profile-header-actions button{width:100%}}

/* Medibox v285 — larger implantology contextual help, localized by UI language */
.implantology-search-with-help {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.implantology-search-with-help .reference-search-control {
    flex: 1 1 auto;
}
.implantology-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}
.implantology-help-button {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dbe3ef;
    border-radius: 999px;
    background: transparent;
    color: #64748b;
    font: inherit;
    font-size: 13px;
    font-weight: 850;
    line-height: 1;
    cursor: help;
    transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease;
}
.implantology-help:hover .implantology-help-button,
.implantology-help:focus-within .implantology-help-button {
    color: #4f46e5;
    border-color: #c7d2fe;
    background: #f8faff;
    transform: translateY(-1px);
}
.implantology-help-button:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.implantology-help-popover {
    position: absolute;
    z-index: 30;
    top: calc(100% + 10px);
    right: 0;
    width: min(390px, calc(100vw - 44px));
    padding: 13px 14px;
    display: grid;
    gap: 10px;
    border: 1px solid #e1e7f0;
    border-radius: 13px;
    background: #fff;
    color: #334155;
    box-shadow: 0 14px 34px rgba(15,23,42,.14);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}
.implantology-help-popover::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 10px;
    width: 9px;
    height: 9px;
    border-left: 1px solid #e1e7f0;
    border-top: 1px solid #e1e7f0;
    background: #fff;
    transform: rotate(45deg);
}
.implantology-help:hover .implantology-help-popover,
.implantology-help:focus-within .implantology-help-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.implantology-help-copy {
    display: block;
    font-size: 12px;
    line-height: 1.55;
}
@media (max-width: 700px) {
    .implantology-search-with-help { align-items: stretch; }
    .implantology-help { align-self: center; }
    .implantology-help-popover { right: -2px; width: min(330px, calc(100vw - 32px)); }
}



/* Medibox v323 — service warranty field and patient warranty indicator */
.service-warranty-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid #d9e4ee;
    border-radius: 999px;
    background: #f7fafc;
    color: #52627a;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.patient-profile-header-icon.patient-profile-warranty-icon {
    width: 31px;
    min-width: 31px;
    height: 31px;
    min-height: 31px;
    padding: 0;
    cursor: help;
}
.patient-profile-header-icon.patient-profile-warranty-icon.is-active {
    color: #087a5d;
    border-color: #bfe9d8;
    background: #eaf9f3;
    box-shadow: 0 0 0 2px rgba(8, 122, 93, .04);
}
.patient-profile-header-icon.patient-profile-warranty-icon.is-expired {
    color: #7a8798;
    border-color: #dfe6ef;
    background: #f7f9fc;
}
.patient-profile-header-icon.patient-profile-warranty-icon .ui-icon {
    width: 16px;
    height: 16px;
}

/* Medibox v326 — clickable patient warranty indicator and warranty detail modal */
button.patient-profile-header-icon.patient-profile-warranty-icon {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    cursor: pointer;
}
button.patient-profile-header-icon.patient-profile-warranty-icon:hover,
button.patient-profile-header-icon.patient-profile-warranty-icon:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(31, 37, 50, .10);
    outline: none;
}
.patient-warranty-dialog {
    width: min(760px, calc(100vw - 28px));
}
.patient-warranty-modal-card {
    width: 100%;
    max-width: 760px;
}
.patient-warranty-modal-header {
    align-items: center;
}
.patient-warranty-modal-title {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}
.patient-warranty-modal-title h2 {
    margin: 1px 0 0;
}
.patient-warranty-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    border: 1px solid #dfe6ef;
    border-radius: 11px;
    background: #f7f9fc;
    color: #7a8798;
}
.patient-warranty-modal-icon.is-active {
    border-color: #bfe9d8;
    background: #eaf9f3;
    color: #087a5d;
}
.patient-warranty-modal-icon .ui-icon {
    width: 18px;
    height: 18px;
}
.patient-warranty-modal-body {
    padding-top: 12px;
}
.patient-warranty-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #e7ebf1;
    border-radius: 12px;
    background: #fff;
}
.patient-warranty-table {
    width: 100%;
    min-width: 620px;
    border-collapse: collapse;
}
.patient-warranty-table th,
.patient-warranty-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #edf0f4;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}
.patient-warranty-table th {
    background: #f8fafc;
    color: #748095;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.patient-warranty-table td {
    color: #465166;
    font-size: 12px;
    font-weight: 700;
}
.patient-warranty-table td:first-child {
    width: 42%;
    white-space: normal;
}
.patient-warranty-table tbody tr:last-child td {
    border-bottom: 0;
}
.patient-warranty-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 4px 8px;
    border: 1px solid #e0e5ec;
    border-radius: 999px;
    background: #f7f9fc;
    color: #7a8798;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .03em;
}
.patient-warranty-status.is-valid {
    border-color: #bfe9d8;
    background: #eaf9f3;
    color: #087a5d;
}
.patient-warranty-status.is-invalid {
    border-color: #f0d0d4;
    background: #fff1f2;
    color: #b42335;
}
.patient-warranty-modal-footer {
    justify-content: flex-end;
}

@media (max-width: 640px) {
    .patient-warranty-dialog {
        width: calc(100vw - 18px);
    }
    .patient-warranty-modal-card {
        max-width: none;
    }
    .patient-warranty-table th,
    .patient-warranty-table td {
        padding: 9px 10px;
    }
}
