/* Medibox 3.13.58 — universal patient search with integrated MKD/ENG keyboard controls */
.universal-global-topbar {
    min-height: 0;
    display: grid;
    grid-template-columns: auto minmax(320px, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 18px 9px;
}
.universal-global-topbar > .mobile-menu,
.universal-global-topbar > .topbar-brand-logo { grid-column: 1; grid-row: 1; }
.universal-global-topbar > .mobile-menu + .topbar-brand-logo { margin-left: 44px; }
.global-patient-search {
    position: relative;
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    height: 46px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 5px 0 13px;
    border: 1px solid #d7e0ee;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 7px 22px rgba(39, 50, 112, .07);
    transition: border-color .16s ease, box-shadow .16s ease;
}
.global-patient-search:focus-within {
    border-color: rgba(79, 70, 229, .55);
    box-shadow: 0 0 0 4px rgba(79,70,229,.10), 0 10px 26px rgba(39,50,112,.09);
}
.global-patient-search > .ui-icon { width: 19px; height: 19px; flex: 0 0 auto; color: #4f46e5; }
.global-patient-search input {
    min-width: 0;
    width: 100%;
    height: 44px;
    padding: 0;
    border: 0;
    outline: 0;
    color: #253451;
    background: transparent;
    font: inherit;
    font-size: 12px;
}
.global-patient-search input::placeholder { color: #8b97a9; }
.global-patient-search kbd {
    flex: 0 0 auto;
    padding: 4px 7px;
    border: 1px solid #dfe5ef;
    border-radius: 7px;
    color: #728098;
    background: #f8faff;
    font: 800 8px/1 inherit;
    white-space: nowrap;
}
.global-patient-search-results {
    position: absolute;
    z-index: 250;
    top: calc(100% + 7px);
    left: 0;
    right: 0;
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid #dce4ef;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 20px 46px rgba(31, 43, 86, .18);
}
.global-search-result {
    width: 100%;
    display: grid;
    grid-template-columns: 36px minmax(0,1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 0;
    border-radius: 10px;
    color: inherit;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.global-search-result:hover,
.global-search-result:focus-visible { background: #f3f5ff; outline: 0; }
.global-search-result-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #4338ca;
    background: linear-gradient(145deg, #eef2ff, #e8faf4);
    font-size: 11px;
    font-weight: 900;
}
.global-search-result-copy { min-width: 0; display: grid; gap: 3px; }
.global-search-result-copy strong { overflow: hidden; color: #24334d; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-copy small { overflow: hidden; color: #7b889c; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.global-search-result-card { color: #4f46e5; font-size: 8px; font-weight: 900; }
.global-search-state { padding: 17px 13px; color: #7b889c; font-size: 10px; font-weight: 750; text-align: center; }

/* MKD / ENG are visually and structurally part of the search field. */
.header-input-method-switch.search-input-method-switch {
    position: relative;
    flex: 0 0 auto;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 4px 0 4px 2px;
    padding: 0 0 0 6px;
    border: 0;
    border-left: 1px solid #dbe3ee;
    border-radius: 0 9px 9px 0;
    background: transparent;
    box-shadow: none;
}
.header-input-method-switch.search-input-method-switch button {
    min-width: 42px;
    height: 36px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    color: #758197;
    background: transparent;
    font: 900 8px/1 inherit;
    letter-spacing: .04em;
    cursor: pointer;
    transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.header-input-method-switch.search-input-method-switch button:hover {
    color: #4f46e5;
    background: #f4f5ff;
}
.header-input-method-switch.search-input-method-switch button.is-active,
.header-input-method-switch.search-input-method-switch button[aria-pressed="true"] {
    color: #4338ca;
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px #d8dcfb;
}
.universal-global-topbar > .top-actions { grid-column: 3; grid-row: 1; }
.universal-global-topbar > .topbar-title-block {
    grid-column: 1 / -1;
    grid-row: 2;
    min-width: 0;
    padding: 0 2px;
}
.universal-global-topbar > .topbar-status-cards {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
}
.universal-global-topbar .module-topbar-title { font-size: 16px !important; }

@media (max-width: 1050px) {
    .universal-global-topbar { grid-template-columns: auto minmax(220px,1fr) auto; gap: 7px 8px; padding-inline: 12px; }
    .global-patient-search kbd { display: none; }
    .header-input-method-switch.search-input-method-switch button { min-width: 36px; padding-inline: 6px; }
}
@media (max-width: 760px) {
    .universal-global-topbar {
        grid-template-columns: auto minmax(0,1fr);
        grid-template-rows: auto auto auto;
        padding: 8px 10px;
    }
    .universal-global-topbar > .mobile-menu { grid-column: 1; grid-row: 1; }
    .universal-global-topbar > .topbar-brand-logo { display: none; }
    .global-patient-search { grid-column: 2; grid-row: 1; height: 42px; gap: 7px; padding-left: 10px; }
    .global-patient-search input { height: 40px; font-size: 10px; }
    .header-input-method-switch.search-input-method-switch { margin-block: 3px; padding-left: 4px; }
    .header-input-method-switch.search-input-method-switch button { min-width: 31px; height: 34px; padding: 0 5px; font-size: 7px; }
    .universal-global-topbar > .top-actions { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
    .universal-global-topbar > .topbar-title-block { grid-column: 1 / -1; grid-row: 3; }
    .global-patient-search-results { position: fixed; top: 62px; left: 10px; right: 10px; max-height: 55vh; }
}

/* Medibox 3.13.57 — MEDIBOX plus active module label */
.medibox-only-topbar {
    display: flex;
    align-items: center;
    min-height: 28px;
}
.topbar-medibox-title {
    margin: 0;
    color: #1f2a44;
    font-size: 18px !important;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: .015em;
    text-transform: none !important;
}
@media (max-width: 760px) {
    .topbar-medibox-title { font-size: 15px !important; }
}

/* Medibox current header 3.16.2 — wide integrated search + click-anywhere practitioner picker */
.universal-global-topbar {
    grid-template-columns: auto minmax(460px, 50vw) minmax(205px, 250px) minmax(165px, 220px) minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 8px 12px;
    padding: 8px 16px 7px;
}

/* The global patient search intentionally owns roughly half of the desktop header. */
.global-patient-search {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    max-width: none;
    height: 44px;
    gap: 9px;
    padding: 0 5px 0 13px;
    border: 1px solid #d7e0ee;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(39, 50, 112, .055);
    transition: box-shadow .16s ease, background .16s ease;
}
.global-patient-search:focus-within {
    border-color: #d7e0ee;
    outline: 0;
    box-shadow: 0 6px 18px rgba(39, 50, 112, .055);
    background: #fff;
}
.global-patient-search > .ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: #4f46e5;
}
.global-patient-search input {
    min-width: 0;
    width: 100%;
    height: 42px;
    padding: 0;
    border: 0;
    outline: 0 !important;
    box-shadow: none !important;
    color: #253451;
    background: transparent;
    font: inherit;
    font-size: 12px;
}
.global-patient-search input:focus,
.global-patient-search input:focus-visible {
    border: 0;
    outline: 0 !important;
    box-shadow: none !important;
}
.global-patient-search input::placeholder { color: #8b97a9; }
.global-patient-search kbd {
    flex: 0 0 auto;
    padding: 4px 7px;
    border: 1px solid #e0e6f0;
    border-radius: 7px;
    color: #748198;
    background: #f8faff;
    font: 800 8px/1 inherit;
    white-space: nowrap;
}
.global-patient-search-results { top: calc(100% + 7px); }

/* MKD / ENG live inside the search field as a compact segmented control. */
.global-patient-search .header-input-method-switch.topbar-language-switch {
    position: relative;
    flex: 0 0 auto;
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 4px 0 4px 2px;
    padding: 0 0 0 7px;
    border: 0;
    border-left: 1px solid #e1e7f0;
    border-radius: 0 10px 10px 0;
    background: transparent;
    box-shadow: none;
}
.global-patient-search .header-input-method-switch.topbar-language-switch button {
    min-width: 43px;
    height: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: 9px;
    color: #76839a;
    background: transparent;
    font: 850 9px/1 inherit;
    letter-spacing: .035em;
    cursor: pointer;
    transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}
.global-patient-search .header-input-method-switch.topbar-language-switch button:hover {
    color: #4338ca;
    background: #f5f6ff;
}
.global-patient-search .header-input-method-switch.topbar-language-switch button.is-active,
.global-patient-search .header-input-method-switch.topbar-language-switch button[aria-pressed="true"] {
    color: #4338ca;
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px #dfe2fb;
}

/* Practitioner context looks like a card, while the native select overlays the whole card. */
.topbar-practitioner-switch,
.topbar-clinic-context {
    min-width: 0;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 11px;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(39,50,112,.05);
}
.topbar-practitioner-switch {
    position: relative;
    grid-column: 3;
    grid-row: 1;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.topbar-practitioner-switch:hover {
    border-color: #cfd8e9;
    box-shadow: 0 9px 22px rgba(39,50,112,.075);
}
.topbar-practitioner-switch:focus-within {
    border-color: #d9e2ec;
    outline: 0;
    box-shadow: 0 6px 18px rgba(39,50,112,.05);
}
.topbar-clinic-context { grid-column: 4; grid-row: 1; }
.topbar-context-icon {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: #4f46e5;
    background: #eef2ff;
}
.topbar-context-icon .ui-icon { width: 15px; height: 15px; }
.topbar-practitioner-copy,
.topbar-clinic-context > div {
    min-width: 0;
    display: grid;
    gap: 1px;
}
.topbar-practitioner-switch small,
.topbar-clinic-context small {
    color: #8a96a8;
    font-size: 7px;
    font-weight: 850;
    line-height: 1;
    letter-spacing: .045em;
    text-transform: uppercase;
}
.topbar-practitioner-copy strong {
    overflow: hidden;
    color: #253451;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-practitioner-switch select {
    position: absolute;
    z-index: 5;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: .001;
    cursor: pointer;
    appearance: auto;
}
.topbar-practitioner-switch select:disabled { cursor: default; }
.topbar-clinic-context strong {
    overflow: hidden;
    color: #253451;
    font-size: 10px;
    font-weight: 850;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.universal-global-topbar > .top-actions { grid-column: 6; grid-row: 1; }
.universal-global-topbar > .topbar-title-block { grid-column: 1 / -1; grid-row: 2; }
.universal-global-topbar > .topbar-status-cards { grid-column: 2 / 5; grid-row: 2; }

@media (max-width: 1320px) {
    .universal-global-topbar {
        grid-template-columns: auto minmax(320px, 1fr) minmax(190px, 225px) minmax(145px, 185px) auto;
    }
    .global-patient-search { grid-column: 2; }
    .topbar-practitioner-switch { grid-column: 3; }
    .topbar-clinic-context { grid-column: 4; }
    .universal-global-topbar > .top-actions { grid-column: 5; }
}

@media (max-width: 980px) {
    .universal-global-topbar {
        grid-template-columns: auto minmax(260px,1fr) auto;
        grid-template-rows: auto auto auto;
        gap: 7px 8px;
        padding-inline: 12px;
    }
    .global-patient-search { grid-column: 2; grid-row: 1; }
    .universal-global-topbar > .top-actions { grid-column: 3; grid-row: 1; }
    .topbar-practitioner-switch { grid-column: 2; grid-row: 2; }
    .topbar-clinic-context { grid-column: 3; grid-row: 2; min-width: 155px; }
    .universal-global-topbar > .topbar-title-block { grid-row: 3; }
    .universal-global-topbar > .topbar-status-cards { grid-column: 2 / 4; grid-row: 3; }
}

@media (max-width: 760px) {
    .universal-global-topbar {
        grid-template-columns: auto minmax(0,1fr) auto;
        grid-template-rows: auto auto auto auto;
        padding: 7px 9px;
    }
    .universal-global-topbar > .mobile-menu { grid-column: 1; grid-row: 1; }
    .universal-global-topbar > .topbar-brand-logo { display: none; }
    .global-patient-search { grid-column: 2 / 4; grid-row: 1; height: 42px; }
    .global-patient-search input { height: 40px; font-size: 10px; }
    .global-patient-search kbd { display: none; }
    .global-patient-search .header-input-method-switch.topbar-language-switch {
        margin-block: 3px;
        padding-left: 4px;
    }
    .global-patient-search .header-input-method-switch.topbar-language-switch button {
        min-width: 33px;
        height: 32px;
        padding-inline: 5px;
        font-size: 7px;
    }
    .topbar-practitioner-switch { grid-column: 1 / 3; grid-row: 2; }
    .topbar-clinic-context { grid-column: 3; grid-row: 2; min-width: 122px; }
    .universal-global-topbar > .top-actions { grid-column: 1 / -1; grid-row: 3; justify-self: end; }
    .universal-global-topbar > .topbar-title-block { grid-column: 1 / -1; grid-row: 4; }
    .universal-global-topbar > .topbar-status-cards { grid-column: 1 / -1; grid-row: 4; }
    .global-patient-search-results { position: fixed; top: 54px; left: 9px; right: 9px; max-height: 55vh; }
}

@media (max-width: 520px) {
    .topbar-clinic-context { min-width: 0; }
    .topbar-clinic-context .topbar-context-icon { display: none; }
    .topbar-clinic-context { padding-inline: 8px; }
    .topbar-practitioner-switch { padding-left: 8px; }
    .topbar-practitioner-copy strong { font-size: 12px; }
}
