.crm-global-search-hidden {
    display: none !important;
}

.crm-global-search-shell {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: grid;
    place-items: start center;
    padding: 8vh 20px 24px;
    box-sizing: border-box;
}

.crm-global-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
}

.crm-global-search-dialog {
    position: relative;
    width: min(820px, 100%);
    max-height: min(760px, 86vh);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    color: #111827;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.crm-global-search-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.crm-global-search-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}

.crm-global-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    width: 18px;
    height: 18px;
    color: #64748b;
    pointer-events: none;
}

.crm-global-search-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 1.8;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.crm-global-search-input {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 12px 0 38px;
    outline: none;
    color: #111827;
    background: #ffffff;
    font: inherit;
}

.crm-global-search-input:focus {
    border-color: #5ab774;
    box-shadow: 0 0 0 3px rgba(90, 183, 116, 0.18);
}

.crm-global-search-close,
.crm-global-search-action {
    min-height: 36px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 12px;
    background: #ffffff;
    color: #334155;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.crm-global-search-close:hover,
.crm-global-search-action:hover {
    background: #f1f5f9;
}

.crm-global-search-status {
    padding: 10px 14px;
    color: #64748b;
    font-size: 12px;
    border-bottom: 1px solid #eef2f7;
}

.crm-global-search-results {
    overflow: auto;
    min-height: 160px;
    padding: 10px;
}

.crm-global-search-group + .crm-global-search-group {
    margin-top: 12px;
}

.crm-global-search-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.crm-global-search-result {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}

.crm-global-search-result:hover,
.crm-global-search-result:focus {
    background: #f8fafc;
    border-color: #dbe3ee;
    outline: none;
}

.crm-global-search-result-icon {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: #e8f5ed;
    color: #28623c;
    font-size: 13px;
    font-weight: 800;
}

.crm-global-search-result-icon[data-entity="companies"] {
    background: #eaf1ff;
    color: #1d4ed8;
}

.crm-global-search-result-icon[data-entity="deals"] {
    background: #fff7e6;
    color: #9a5b00;
}

.crm-global-search-result-icon[data-entity="signals"] {
    background: #f1f5f9;
    color: #475569;
}

.crm-global-search-result-main {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.crm-global-search-result-main strong,
.crm-global-search-result-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-global-search-result-main strong {
    color: #111827;
    font-size: 14px;
}

.crm-global-search-result-main span {
    color: #64748b;
    font-size: 12px;
}

.crm-global-search-result-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
    max-width: 250px;
}

.crm-global-search-badge {
    border: 1px solid #dbe3ee;
    border-radius: 999px;
    padding: 3px 7px;
    color: #475569;
    background: #ffffff;
    font-size: 11px;
    white-space: nowrap;
}

.crm-global-search-empty,
.crm-global-search-loading {
    min-height: 140px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: #64748b;
    text-align: center;
    padding: 28px;
}

.crm-global-search-empty strong {
    color: #111827;
}

.crm-global-search-empty-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.crm-global-search-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #dbe3ee;
    border-top-color: #5ab774;
    border-radius: 999px;
    animation: crmGlobalSearchSpin 0.8s linear infinite;
}

@keyframes crmGlobalSearchSpin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    .crm-global-search-shell {
        padding: 10px;
        place-items: start center;
    }

    .crm-global-search-dialog {
        max-height: calc(100vh - 20px);
    }

    .crm-global-search-head,
    .crm-global-search-result {
        align-items: stretch;
    }

    .crm-global-search-result {
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .crm-global-search-result-side {
        grid-column: 2;
        justify-content: flex-start;
        max-width: 100%;
    }
}
