/* Контроль расходов — рамочный адаптивный список транзакций */

.trx-modal {
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    overflow-x: hidden;
    overflow-y: auto !important;
    padding: 0 !important;
    z-index: 1050;
}

.trx-modal__dialog {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.trx-modal__content {
    min-height: 100vh;
    border-radius: 0;
    border: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.45;
    color: #222;
}

.trx-modal__header {
    padding: 0.75rem 1rem;
    align-items: center;
    flex-shrink: 0;
    border-bottom: 1px solid #eee;
}

.trx-modal__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0;
    padding-right: 1.5rem;
}

.trx-modal__body {
    flex: 1 1 auto;
    padding: 0.75rem 1rem 1.25rem;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.trx-form,
.trx-form * {
    box-sizing: border-box;
}

.trx-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.85rem;
}

.trx-toolbar__search {
    flex: 1 1 200px;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trx-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.trx-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    align-items: end;
    margin-bottom: 1rem;
    padding: 0.85rem;
    background: #f7f8fa;
    border: 1px solid rgba(15, 62, 86, 0.12);
    border-radius: 8px;
}

.trx-filter--action {
    min-width: 140px;
}

.trx-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 0.3rem;
}

.trx-label--spacer {
    visibility: hidden;
}

.trx-input,
.trx-form .form-control {
    font-size: 0.95rem !important;
    height: 40px;
    border-radius: 8px;
    border: 1px solid #d5d7db;
    width: 100%;
    max-width: 100%;
}

.trx-btn {
    font-size: 0.95rem !important;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    height: 40px;
    line-height: 1.2;
    white-space: nowrap;
}

.trx-btn--primary {
    background: #0f3e56;
    border: 2px solid #0f3e56;
    color: #fff;
}

.trx-btn--primary:hover,
.trx-btn--primary:focus {
    background: #0a2d3f;
    border-color: #0a2d3f;
    color: #fff;
}

.trx-btn--accent {
    background: #FF5900;
    border: 2px solid #FF5900;
    color: #fff;
}

.trx-btn--accent:hover,
.trx-btn--accent:focus {
    background: #e04a00;
    border-color: #e04a00;
    color: #fff;
}

/* Оранжевая обводка — как «Показать все» */
.trx-btn--outline {
    background: #fff !important;
    border: 2px solid #FF5900 !important;
    color: #FF5900 !important;
}

.trx-btn--outline:hover,
.trx-btn--outline:focus {
    background: #fff3eb !important;
    border-color: #e04a00 !important;
    color: #e04a00 !important;
}

.trx-counter {
    font-size: 0.95rem;
    color: #666;
    white-space: nowrap;
}

.trx-results {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.body-transactions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.trx-show-all-wrap {
    margin-bottom: 0.25rem;
}

.trx-group {
    border: 1px solid rgba(15, 62, 86, 0.12);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.trx-group.is-hidden {
    display: none !important;
}

.trx-group__head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    text-align: left;
    background: #f3f5f7;
    border: 0;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: #222;
    cursor: pointer;
}

.trx-group__head:hover {
    background: #ebeff2;
}

.trx-group__card {
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-all;
}

.trx-group__meta {
    font-weight: 500;
    color: #666;
    font-size: 0.95rem;
}

.trx-group__body {
    padding: 0.75rem;
    border-top: 1px solid #eceff2;
    background: #eef1f4;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* Карточка транзакции по образцу */
.trx-card {
    background: #fff;
    border: 1px solid #e4e7eb;
    border-radius: 12px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.trx-card__main {
    display: grid;
    grid-template-columns: auto minmax(0, 1.4fr) minmax(0, 1fr) auto;
    gap: 0.85rem 1.25rem;
    align-items: start;
}

.trx-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f4f7;
    color: #667085;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.trx-card--return .trx-card__icon {
    background: #ecfdf3;
    color: #12b76a;
}

.trx-card__place {
    min-width: 0;
}

.trx-card__date {
    font-size: 0.98rem;
    font-weight: 700;
    color: #101828;
    margin-bottom: 0.2rem;
}

.trx-card__station {
    font-size: 0.95rem;
    font-weight: 700;
    color: #101828;
    line-height: 1.35;
    word-break: break-word;
}

.trx-card__address {
    margin-top: 0.2rem;
    font-size: 0.82rem;
    line-height: 1.35;
    color: #98a2b3;
    word-break: break-word;
}

.trx-card__op {
    margin-top: 0.45rem;
    font-size: 0.82rem;
    color: #98a2b3;
}

.trx-card__meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-top: 0.1rem;
}

.trx-card__meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.trx-card__meta-icon {
    width: 1.1rem;
    text-align: center;
    color: #98a2b3;
    flex-shrink: 0;
}

.trx-card__meta-icon--card {
    position: relative;
    color: #667085;
}

.trx-card__meta-icon--card::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #12b76a;
    border: 1.5px solid #fff;
}

.trx-card__meta-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: #344054;
    word-break: break-word;
}

.trx-card__meta-text--muted {
    font-weight: 500;
    color: #98a2b3;
}

.trx-card__money {
    text-align: right;
    min-width: 7.5rem;
    justify-self: end;
}

.trx-card__amount {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.trx-card__amount--minus {
    color: #101828;
}

.trx-card__amount--plus {
    color: #12b76a;
}

.trx-card__fuel {
    margin-top: 0.15rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #98a2b3;
}

.trx-card__rate {
    margin-top: 0.45rem;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    font-size: 0.82rem;
}

.trx-card__price {
    font-weight: 700;
    color: #344054;
    font-variant-numeric: tabular-nums;
}

.trx-card__volume {
    color: #98a2b3;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.trx-subtotal {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    padding: 0.55rem 0.75rem;
    background: #eef8ee;
    border-radius: 8px;
    font-size: 0.95rem;
}

.trx-subtotal__label {
    flex: 1 1 auto;
    font-weight: 700;
    min-width: 0;
}

.trx-subtotal__count,
.trx-subtotal__sum {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.trx-totals {
    margin-top: 0.5rem;
    border: 1px solid rgba(15, 62, 86, 0.18);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    background: #f0f7fb;
}

.trx-totals__title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.55rem;
}

.trx-totals__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.45rem 0;
    border-top: 1px solid rgba(15, 62, 86, 0.1);
    font-size: 0.95rem;
}

.trx-totals__service {
    flex: 1 1 120px;
    font-weight: 600;
    min-width: 0;
    word-break: break-word;
}

.trx-totals__nums {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    align-items: baseline;
    justify-content: flex-end;
    margin-left: auto;
}

.trx-totals__count,
.trx-totals__sum {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.trx-totals__sum {
    min-width: 6.5rem;
    text-align: right;
}

.trx-totals__row--grand {
    border-top: 2px solid rgba(15, 62, 86, 0.2);
    margin-top: 0.25rem;
    padding-top: 0.55rem;
    font-weight: 700;
}

.trx-totals__row--grand .trx-totals__sum {
    font-size: 1.05rem;
}

.trx-empty {
    text-align: center;
    padding: 1.5rem 0.75rem;
    color: #666;
    font-size: 0.95rem;
}

@media (min-width: 768px) {
    .trx-modal__body {
        padding: 1rem 1.25rem 1.5rem;
    }

    .trx-group__body {
        padding: 0.85rem;
    }
}

@media (max-width: 900px) {
    .trx-card__main {
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "icon place money"
            "icon meta money";
    }

    .trx-card__icon { grid-area: icon; }
    .trx-card__place { grid-area: place; }
    .trx-card__meta { grid-area: meta; }
    .trx-card__money { grid-area: money; }
}

@media (max-width: 575.98px) {
    .trx-modal__header {
        padding: 0.7rem 0.85rem;
    }

    .trx-modal__title {
        font-size: 1rem;
    }

    .trx-modal__body {
        padding: 0.65rem 0.7rem 1.1rem;
    }

    .trx-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.55rem;
    }

    .trx-toolbar__search {
        flex: none;
        width: 100%;
    }

    .trx-toolbar__actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .trx-toolbar__actions .trx-btn {
        width: 100%;
        height: auto;
        min-height: 42px;
        white-space: normal;
        padding: 0.55rem 0.75rem;
        line-height: 1.25;
    }

    .trx-filters {
        grid-template-columns: 1fr;
        padding: 0.7rem;
        gap: 0.65rem;
    }

    .trx-filter--action .trx-label--spacer {
        display: none;
    }

    .trx-filter--action .trx-btn {
        height: auto;
        min-height: 42px;
    }

    .trx-label--spacer {
        display: none;
    }

    .trx-group__head {
        padding: 0.75rem 0.85rem;
        gap: 0.4rem 0.55rem;
    }

    .trx-group__card {
        flex: 1 1 100%;
        font-size: 0.92rem;
    }

    .trx-group__meta {
        font-size: 0.85rem;
    }

    .trx-group__body {
        padding: 0.55rem;
        gap: 0.55rem;
    }

    .trx-card {
        padding: 0.8rem 0.85rem;
        border-radius: 10px;
    }

    /* Мобильная карточка: вертикальный читаемый стек */
    .trx-card__main {
        display: flex;
        flex-direction: column;
        gap: 0.7rem;
    }

    .trx-card__icon {
        display: none;
    }

    .trx-card__place {
        order: 1;
    }

    .trx-card__money {
        order: 2;
        text-align: left;
        justify-self: stretch;
        min-width: 0;
        width: 100%;
        padding-top: 0.55rem;
        border-top: 1px solid #eef0f3;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "amount amount"
            "fuel rate";
        gap: 0.2rem 0.75rem;
        align-items: baseline;
    }

    .trx-card__amount {
        grid-area: amount;
        font-size: 1.2rem;
        white-space: normal;
        margin-bottom: 0.15rem;
    }

    .trx-card__fuel {
        grid-area: fuel;
        margin-top: 0;
        font-size: 0.9rem;
    }

    .trx-card__rate {
        grid-area: rate;
        margin-top: 0;
        justify-content: flex-end;
        font-size: 0.88rem;
    }

    .trx-card__meta {
        order: 3;
        padding-top: 0.55rem;
        border-top: 1px solid #eef0f3;
        gap: 0.45rem;
    }

    .trx-card__date {
        font-size: 1rem;
    }

    .trx-card__station {
        font-size: 0.98rem;
    }

    .trx-card__address {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .trx-card__op {
        margin-top: 0.35rem;
        font-size: 0.85rem;
    }

    .trx-card__meta-text {
        font-size: 0.92rem;
    }

    .trx-subtotal {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 0.65rem 0.75rem;
    }

    .trx-subtotal__count,
    .trx-subtotal__sum {
        font-size: 0.95rem;
    }

    .trx-totals {
        padding: 0.75rem 0.85rem;
    }

    .trx-totals__row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3rem;
        padding: 0.55rem 0;
    }

    .trx-totals__nums {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
        gap: 0.5rem;
    }

    .trx-totals__sum {
        min-width: 0;
        font-size: 1.02rem;
    }

    .trx-totals__row--grand .trx-totals__sum {
        font-size: 1.12rem;
    }

    .trx-show-all-wrap .trx-btn {
        width: 100%;
        height: auto;
        min-height: 42px;
    }
}
