:root {
    --branches-blue: #0b5da7;
    --branches-blue-light: #0f76d6;
    --branches-text: #173f73;
    --branches-muted: #7e93b3;
    --branches-border: #dce5f0;
    --branches-background: #f7f9fc;
}

.branches-directory,
.branches-directory * {
    box-sizing: border-box;
}

.branches-directory {
    width: min(1135px, calc(100% - 48px));
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 0 30px;
    color: var(--branches-text);
}

.branches-toolbar {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        minmax(180px, 220px)
        minmax(205px, 235px);
    gap: 14px;
    width: 100%;
    margin-bottom: 17px;
}

.branches-control {
    width: 100%;
    min-width: 0;
    height: 42px;
    background: #ffffff;
    border: 1px solid var(--branches-border);
    border-radius: 8px;
}

.branches-search {
    position: relative;
    display: flex;
    align-items: center;
}

.branches-search__icon {
    position: absolute;
    left: 15px;
    display: flex;
    color: #6685ad;
    pointer-events: none;
}

.branches-search input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 14px 0 44px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #294e80;
    font: inherit;
    font-size: 13px;
}

.branches-search input::placeholder {
    color: #8297b5;
}

.branches-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}

.branches-select-wrap__icon {
    position: absolute;
    left: 14px;
    z-index: 1;
    display: flex;
    color: #1b5ea8;
    pointer-events: none;
}

.branches-select-wrap select {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 34px 0 42px;
    border: 0;
    outline: 0;
    background: transparent;
    color: #244d83;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-overflow: ellipsis;
}

.branches-list {
    width: 100%;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--branches-border);
    border-radius: 9px;
}

.branch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 43px;
    padding: 0 21px 0 24px;
    border-bottom: 1px solid #e2e9f1;
    background: #ffffff;
}

.branch-row:last-child {
    border-bottom: 0;
}

.branch-row:hover {
    background: #fbfdff;
}

.branch-row__left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1 1 auto;
}

.branch-row__icon {
    display: flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eaf5ff;
    color: #1677d2;
}

.branch-row__icon svg {
    width: 17px;
    height: 17px;
}

.branch-row__title {
    min-width: 0;
    overflow: hidden;
    color: #194c86;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.branch-row__title:hover {
    color: #0a69c7;
    text-decoration: none;
}

.branch-row__more {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    color: #087bea;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.branch-row__more:hover {
    color: #005fbd;
    text-decoration: none;
}

.branch-row__more svg {
    width: 16px;
    height: 16px;
}

.branches-empty {
    padding: 34px;
    background: #ffffff;
    border: 1px solid var(--branches-border);
    border-radius: 9px;
    text-align: center;
    color: var(--branches-muted);
    font-size: 13px;
}

.branches-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 27px;
}

.branches-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.branches-pagination button {
    min-width: 36px;
    height: 36px;
    padding: 0 11px;
    border: 1px solid var(--branches-border);
    border-radius: 7px;
    background: #ffffff;
    color: #3670ad;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.branches-pagination button:hover:not(:disabled):not(.is-active) {
    border-color: #a9c5e3;
    color: #0b67ba;
}

.branches-pagination button.is-active {
    background: #0879d9;
    border-color: #0879d9;
    color: #ffffff;
}

.branches-pagination button:disabled {
    opacity: 0.45;
    cursor: default;
}

.branches-counter {
    flex: 0 0 auto;
    color: #8296b4;
    font-size: 12px;
    white-space: nowrap;
}

/* Tablet: search on first row, both selects on second row */
@media (max-width: 1100px) {
    .branches-directory {
        width: calc(100% - 32px);
    }

    .branches-toolbar {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .branches-search {
        grid-column: 1 / -1;
    }
}

/* Mobile: all controls full width */
@media (max-width: 640px) {
    .branches-directory {
        width: calc(100% - 24px);
        padding-top: 16px;
    }

    .branches-toolbar {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .branches-search {
        grid-column: auto;
    }

    .branches-control {
        height: 44px;
    }

    .branches-select-wrap select {
        padding-right: 40px;
    }

    .branch-row {
        gap: 10px;
        min-height: 52px;
        padding: 8px 12px;
    }

    .branch-row__left {
        gap: 10px;
    }

    .branch-row__icon {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
        border-radius: 7px;
    }

    .branch-row__title {
        font-size: 12.5px;
    }

    .branch-row__more {
        gap: 0;
    }

    .branch-row__more span {
        display: none;
    }

    .branches-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
        margin-top: 20px;
    }
}
