/* ========================
   УПРАВЛЕНИЕ БАЛАНСОМ
   ======================== */

.mb-20 {
    margin-bottom: 20px !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

/* Поиск в верхней карточке */
.balance-search-top {
    display: flex;
    align-items: center;
    background: #3B3B46;
    border-radius: 40px;
    padding: 10px 20px;
    width: 280px;
    /* ИСПРАВЛЕНО: Ширина как на макете, а не на 100% */
}

.balance-search-top input {
    background: transparent !important;
    border: none !important;
    color: #FFFFFF !important;
    outline: none !important;
    margin-left: 10px;
    width: 100%;
    font-size: 14px;
    box-shadow: none !important;
}

.balance-search-top input::placeholder {
    color: #A0AAB5;
}

.balance-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 25px -20px 20px -20px;
}

.found-count {
    color: #FFFFFF;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 15px;
}

/* Карточки пользователей */
.user-b-card {
    background: #616165;
    /* ИСПРАВЛЕНО: Точный серый цвет как на макете */
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    color: #FFFFFF;
}

.user-b-card.collapsed {
    padding: 15px 20px;
}

/* Раскрытая карточка: показываем скрытые секции */
.user-b-card.expanded .ub-actions-section,
.user-b-card.expanded .ub-input-group,
.user-b-card.expanded .ub-footer {
    display: block !important;
}

.user-b-card.expanded .ub-header {
    cursor: pointer;
    margin-bottom: 0;
}


.status-msg {
    font-size: 12px;
    color: #E5E7EB;
    margin-bottom: 15px;
}

.ub-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.ub-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ub-name {
    font-size: 13px;
    color: #E5E7EB;
}

.ub-email {
    font-size: 14px;
    font-weight: 700;
    word-break: break-all;
}

.ub-balance-block {
    display: flex;
    flex-direction: column;
    text-align: right;
    gap: 4px;
    flex-shrink: 0;
    white-space: nowrap;
}

.ub-balance-label {
    font-size: 12px;
    color: #E5E7EB;
    white-space: nowrap;
}

.ub-balance-val {
    font-size: 16px;
    font-weight: 700;
}

.ub-actions-section {
    margin-top: 25px;
}

.ub-section-title {
    font-size: 14px;
    font-weight: 700;
    display: block;
    margin-bottom: 10px;
}

/* Кастомные радиокнопки */
.action-radios {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.custom-radio {
    display: none;
}

.radio-pill {
    display: flex;
    align-items: center;
    background: #3B3B46;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: 0.2s;
    color: #FFFFFF;
}

.radio-circle {
    width: 14px;
    height: 14px;
    border: 1.5px solid #FFFFFF;
    border-radius: 50%;
    margin-right: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.custom-radio:checked+.radio-pill .radio-circle::after {
    content: '';
    width: 6px;
    height: 6px;
    background: #FFFFFF;
    border-radius: 50%;
}

/* Поля ввода (Инпуты) */
.ub-input-group {
    margin-bottom: 20px;
}

.ub-input-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ub-input,
.ub-textarea {
    width: 100%;
    background: #C0C0C1;
    /* ИСПРАВЛЕНО: Светло-серый цвет по макету */
    border: none;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 14px;
    color: #181820;
    outline: none;
    font-family: inherit;
}

.ub-input::placeholder,
.ub-textarea::placeholder {
    color: #5A5A64;
}

.ub-textarea {
    resize: vertical;
}

/* Кнопки Сохранить / Отмена */
.ub-footer {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-top: 30px;
}

.btn-save-outline {
    background: transparent;
    border: 1px solid #FFFFFF;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    padding: 12px 30px;
    border-radius: 40px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-save-outline:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-cancel-text {
    background: transparent;
    border: none;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

.btn-cancel-text:hover {
    color: #FF0069;
}

/* ========================
   ИСТОРИЯ ОПЕРАЦИЙ (Нижний блок)
   ======================== */
.history-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-search {
    width: 280px;
    background: #3B3B46;
    border-radius: 40px;
    display: flex;
    align-items: center;
    padding: 10px 20px;
}

.history-search input {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: #FFFFFF !important;
    margin-left: 10px;
    width: 100%;
    font-size: 14px;
    box-shadow: none !important;
    /* ИСПРАВЛЕНО: Убирает дефолтные белые фоны */
}

.history-search input::placeholder {
    color: #A0AAB5;
}

/* Подсказка под поиском */
.history-hint {
    text-align: right;
    font-size: 12px;
    color: #FFFFFF;
    margin-top: 8px;
    margin-bottom: 20px;
}

/* Таблица истории */
.history-table-wrapper {
    background: #181820;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
}

.ht-table {
    display: flex;
    flex-direction: column;
}

.ht-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr 1.5fr 1fr;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: #3B3B46;
    color: #FFFFFF;
    font-size: 12px;
    gap: 10px;
    justify-items: center;
}

.ht-row:last-child {
    border-bottom: none;
}

.ht-head {
    background: transparent;
    font-weight: 700;
    border-bottom: none;
    font-size: 11px;
}

.ht-bold {
    font-weight: 700;
}

.ht-date {
    color: #E5E7EB;
}

.ht-user strong {
    font-weight: 700;
}

/* ========================
   АДАПТИВ (МАКС 900px)
   ======================== */
@media (max-width: 900px) {
    .balance-search-top {
        width: 100%;
        /* На телефоне поиск тянется на всю ширину */
    }

    .history-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .history-search {
        width: 100%;
    }

    .history-hint {
        text-align: left;
        /* Подсказка на телефоне уходит влево */
        margin-top: 10px;
    }

    .ht-row {
        grid-template-columns: 30px 1fr 1.2fr 1.2fr 1fr;
        padding: 10px 5px;
        font-size: 10px;
        gap: 5px;
    }

    .ht-head {
        font-size: 9px;
    }

    .ht-col {
        word-break: break-word;
        line-height: 1.2;
    }
}

@media (max-width: 400px) {
    .ub-header {
        flex-direction: column;
        gap: 10px;
    }

    .ub-balance-block {
        text-align: left;
    }

    .action-radios {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

.ht-user {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

@media (max-width: 600px) {
    .ht-user {
        display: inline-block;

        /* Ширина в символах. 8ch значит, что влезет примерно 8 букв, остальное скроется за ... */
        max-width: 8ch;

        /* Запрещаем тексту переноситься на новую строку */
        white-space: nowrap;

        /* Обрезаем всё, что не влезло */
        overflow: hidden;

        /* Добавляем троеточие в конце */
        text-overflow: ellipsis;

        /* Выравниваем, чтобы не прыгало относительно других элементов */
        vertical-align: middle;
    }
}