:root {
    --ep-accent: #003469;
    --ep-accent-hover: #00284f;
    --ep-accent-soft: #eef4fa;
    --ep-text: #172333;
    --ep-muted: #6d7c8c;
    --ep-line: #dbe3eb;
    --ep-line-soft: #edf1f5;
    --ep-bg: #ffffff;
    --ep-bg-soft: #f6f8fa;
}

.ep-smart-search {
    position: relative;
    width: 100%;
    font: inherit;
    color: var(--ep-text);
}

.ep-smart-search *,
.ep-search-dialog * {
    box-sizing: border-box;
}

.ep-smart-search [hidden],
.ep-search-dialog[hidden] {
    display: none !important;
}

/* Строка поиска намеренно не переопределяется: используются штатные стили темы. */

/* Выпадающее окно */
.ep-smart-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 10020;
    min-width: 620px;
    background: var(--ep-bg);
    border: 1px solid var(--ep-line);
    border-top: 3px solid var(--ep-accent);
    border-radius: 0 !important;
    box-shadow: 0 18px 46px rgba(0, 52, 105, .13);
    overflow: hidden;
    text-align: left;
}

.ep-smart-results {
    max-height: min(66vh, 650px);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

/* Подсказки сверху */
.ep-smart-hints {
    background: #fff;
    border-bottom: 1px solid var(--ep-line);
}

.ep-smart-hints-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-top: 1px solid var(--ep-line-soft);
}

.ep-smart-hint {
    min-height: 50px;
    border-right: 1px solid var(--ep-line-soft);
}

.ep-smart-hint:nth-child(3n) {
    border-right: 0;
}

.ep-smart-hint:nth-child(n+4) {
    border-top: 1px solid var(--ep-line-soft);
}

/* Основной блок 30/70 */
.ep-smart-content {
    display: grid;
    grid-template-columns: minmax(220px, 30%) minmax(0, 70%);
    align-items: stretch;
    background: #fff;
}

.ep-smart-column {
    min-width: 0;
}

.ep-smart-categories {
    background: var(--ep-bg-soft);
    border-right: 1px solid var(--ep-line);
}

.ep-smart-products {
    background: #fff;
}

.ep-smart-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 42px;
    padding: 0 16px;
    border-bottom: 1px solid var(--ep-line);
    color: var(--ep-accent);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .075em;
    line-height: 1.2;
    text-transform: uppercase;
}

.ep-smart-section-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border: 1px solid #c9d7e4;
    border-radius: 0 !important;
    background: #fff;
    color: var(--ep-accent);
    font-size: 11px;
    letter-spacing: 0;
}

.ep-smart-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 0 !important;
    color: var(--ep-text) !important;
    text-decoration: none !important;
    line-height: 1.35;
    transition: background .12s ease, color .12s ease;
}

.ep-smart-row:hover,
.ep-smart-row:focus,
.ep-smart-row.ep-smart-active {
    background: var(--ep-accent-soft);
    color: var(--ep-accent) !important;
    outline: 0;
}

.ep-smart-row.ep-smart-active {
    box-shadow: inset 3px 0 0 var(--ep-accent);
}

.ep-smart-category-list .ep-smart-row + .ep-smart-row,
.ep-smart-product-list .ep-smart-row + .ep-smart-row {
    border-top: 1px solid var(--ep-line-soft);
}

.ep-smart-category-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    width: 20px;
    color: var(--ep-accent);
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
}

.ep-smart-row-main {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ep-smart-row-name {
    display: block;
    color: inherit;
    font-size: 14px;
    font-weight: 600;
}

.ep-smart-row-path {
    display: block;
    margin-top: 4px;
    color: var(--ep-muted);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.35;
}

.ep-smart-product {
    min-height: 76px;
}

.ep-smart-thumb {
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    object-fit: contain;
    border: 1px solid var(--ep-line-soft);
    border-radius: 0 !important;
    background: #fff;
}

.ep-smart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f5f8;
    color: #9aa6b2;
    font-size: 22px;
}

.ep-smart-price {
    flex: 0 0 auto;
    min-width: 105px;
    padding-left: 12px;
    color: var(--ep-accent);
    white-space: nowrap;
    text-align: right;
    font-size: 14px;
    font-weight: 800;
}

.ep-smart-column-empty {
    padding: 20px 16px;
    color: var(--ep-muted);
    font-size: 13px;
    line-height: 1.45;
}

.ep-smart-message {
    padding: 22px 18px;
    background: #fff;
    color: var(--ep-muted);
    font-size: 13px;
    line-height: 1.55;
}

.ep-smart-all {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 52px;
    padding: 0 18px;
    border-top: 1px solid var(--ep-line);
    border-radius: 0 !important;
    background: var(--ep-accent);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .01em;
}

.ep-smart-all:hover,
.ep-smart-all:focus {
    background: var(--ep-accent-hover);
    color: #fff !important;
}

.ep-smart-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Модальное окно плавающего поиска */
.ep-search-dialog {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 7vh 24px 32px;
    background: rgba(13, 31, 49, .46);
    overflow: auto;
}

.ep-search-dialog-card {
    width: min(1120px, 100%);
    padding: 26px;
    border: 1px solid #d9e2ea;
    border-top: 4px solid var(--ep-accent);
    border-radius: 0 !important;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 31, 63, .22);
    color: var(--ep-text);
    text-align: left;
}

.ep-search-dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    color: var(--ep-accent);
    font-size: 21px;
    font-weight: 800;
}

.ep-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--ep-line);
    border-radius: 0 !important;
    background: #fff;
    color: var(--ep-accent);
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
}

.ep-search-close:hover,
.ep-search-close:focus {
    border-color: var(--ep-accent);
    background: var(--ep-accent);
    color: #fff;
    outline: 0;
}

.ep-search-help {
    margin: 12px 0 0;
    color: #798796;
    font-size: 12px;
    line-height: 1.5;
}

.ep-search-dialog .ep-smart-panel {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    width: 100%;
    min-width: 0;
    margin-top: 12px;
    box-shadow: none;
}

.ep-search-dialog .ep-smart-results {
    max-height: 62vh;
}

/* Без скруглений только у нового интерфейса результатов и модального окна.
   Саму штатную строку поиска не переопределяем. */
.ep-smart-panel,
.ep-smart-section-count,
.ep-smart-thumb,
.ep-smart-all,
.ep-search-dialog-card,
.ep-search-close {
    border-radius: 0 !important;
}

@media (max-width: 900px) {
    .ep-smart-panel {
        min-width: 0;
        width: min(760px, 94vw);
    }

    .ep-smart-hints-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ep-smart-hint:nth-child(3n) {
        border-right: 1px solid var(--ep-line-soft);
    }

    .ep-smart-hint:nth-child(2n) {
        border-right: 0;
    }

    .ep-smart-hint:nth-child(n+3) {
        border-top: 1px solid var(--ep-line-soft);
    }

    .ep-smart-content {
        grid-template-columns: minmax(190px, 34%) minmax(0, 66%);
    }

    .ep-search-dialog {
        padding: 28px 16px;
    }

    .ep-search-dialog-card {
        padding: 20px;
    }
}

@media (max-width: 767px) {
    .ep-search-dialog {
        padding: 0;
        background: #fff;
    }

    .ep-search-dialog-card {
        width: 100%;
        min-height: 100vh;
        padding: 16px 12px 24px;
        border: 0;
        border-top: 4px solid var(--ep-accent);
        box-shadow: none;
    }

    .ep-search-dialog-heading {
        margin-bottom: 14px;
        font-size: 18px;
    }

    .ep-smart-panel,
    .ep-search-dialog .ep-smart-panel {
        position: relative;
        top: auto;
        width: 100%;
        margin-top: 10px;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    .ep-smart-results,
    .ep-search-dialog .ep-smart-results {
        max-height: none;
        overflow: visible;
    }

    .ep-smart-hints-list {
        grid-template-columns: 1fr;
    }

    .ep-smart-hint,
    .ep-smart-hint:nth-child(2n),
    .ep-smart-hint:nth-child(3n) {
        border-right: 0;
        border-top: 1px solid var(--ep-line-soft);
    }

    .ep-smart-content {
        display: block;
    }

    .ep-smart-categories {
        border-right: 0;
        border-bottom: 1px solid var(--ep-line);
    }

    .ep-smart-section-title {
        min-height: 40px;
        padding: 0 12px;
    }

    .ep-smart-row {
        gap: 9px;
        padding: 10px 12px;
    }

    .ep-smart-product {
        min-height: 66px;
    }

    .ep-smart-thumb {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
    }

    .ep-smart-row-name {
        font-size: 13px;
    }

    .ep-smart-price {
        min-width: 0;
        padding-left: 6px;
        font-size: 12px;
    }

    .ep-smart-all {
        min-height: 50px;
        padding: 0 12px;
    }

    .ep-search-help {
        margin-top: 10px;
    }
}



.ep-smart-layout {
    display: grid;
    grid-template-columns: 30% 70%;
    width: 100%;
}

.ep-smart-categories-column {
    min-width: 0;
    border-right: 1px solid #e2e7ec;
}

.ep-smart-products-column {
    min-width: 0;
}

.ep-smart-hints-section {
    width: 100%;
    border-bottom: 1px solid #e2e7ec;
}

.ep-smart-hints-grid {
    display: flex;
    flex-wrap: wrap;
}

@media (max-width: 767px) {
    .ep-smart-layout {
        grid-template-columns: 1fr;
    }

    .ep-smart-categories-column {
        border-right: 0;
        border-bottom: 1px solid #e2e7ec;
    }
}