/* ===== "Chi phí đầu tư" page (/hoa-don/chi-phi-dau-tu/) =====
   Same layout as the reference page Lịch sử thanh toán: the filter row (.list-filter), the Bảng / Thẻ toolbar,
   the shared table (.list-table) and cards (.list-card) all come from invoice.css; only what is
   particular to costs is here. Builds on .house-mng (static/css/components/house-card.css). */
.cost-page {
    --cost-thu: #15803d;
    --cost-chi: #dc2626;
    --cost-chi-lui: #c2410c;
}

.cost-notice {
    margin-bottom: 0.75rem;
}

/* ----- Totals per money source (sum.by_money_source) ----- */
.cost-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.cost-sources.d-none {
    display: none;
}

.cost-sources__item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.625rem;
    padding: 0.375rem 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-size: 0.8125rem;
}

.cost-sources__name {
    font-weight: 700;
}

.cost-sources__money.is-thu {
    color: var(--cost-thu);
}

.cost-sources__money.is-chi {
    color: var(--cost-chi);
}

.cost-sources__money.is-chi-lui {
    color: var(--cost-chi-lui);
}

.cost-sources__diff {
    font-weight: 600;
}

/* Chênh lệch (Thu − Chi) below zero, in the table footer and the source totals */
.cost-sources__diff.is-negative,
.cost-table__diff.is-negative {
    color: var(--cost-chi);
}

.cost-table__diff {
    font-weight: 700;
    white-space: nowrap;
}

/* ----- Bảng: the shared table + the cost columns ----- */
.cost-table__row {
    cursor: pointer;
}

.cost-table__type {
    min-width: 140px;
}

.cost-table__text {
    min-width: 220px;
    max-width: 320px;
}

.cost-table__remark {
    min-width: 160px;
    max-width: 260px;
}

.cost-table__creator {
    min-width: 150px;
}

.cost-table th.cost-table__money-group {
    border-bottom-width: 1px;
}

.cost-table__money {
    font-weight: 700;
}

/* Thu / Chi / Chi lùi in their colours: amounts in rows, totals, card pills */
.cost-page .cost-table__thu,
.cost-card .is-thu {
    color: var(--cost-thu);
}

.cost-page .cost-table__chi,
.cost-card .is-chi {
    color: var(--cost-chi);
}

.cost-page .cost-table__chi-lui,
.cost-card .is-chi-lui {
    color: var(--cost-chi-lui);
}

.cost-table__actions {
    display: inline-flex;
    gap: 0.375rem;
}

/* Duyệt / Từ chối / Trở về chờ duyệt on a card: the outline action in the tone of the change */
.cost-card .cost-status-action--success {
    border-color: var(--cost-thu);
    color: var(--cost-thu);
}

.cost-card .cost-status-action--warning {
    border-color: var(--cost-chi-lui);
    color: var(--cost-chi-lui);
}

.cost-card .cost-status-action--secondary {
    border-color: #9ca3af;
    color: #4b5563;
}

/* ----- Thẻ ----- */
.cost-card__status {
    margin-top: 0.375rem;
}

/* ----- Modal ----- */
/* Footer left side: Xóa + the status changes, wrapping on narrow screens */
.cost-modal__left-actions,
.cost-modal__status-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cost-modal__grid {
    display: grid;
    grid-template-columns: 1fr;
    column-gap: 1rem;
}

.cost-modal__current-image {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.cost-modal__current-image.d-none {
    display: none;
}

.cost-modal__current-image .list-file-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    font-size: 1.5rem;
}

.cost-modal__current-image .d-none {
    display: none;
}

.cost-modal__current-image img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: #f3f4f6;
}

@media (min-width: 576px) {
    .cost-modal__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cost-modal__wide {
        grid-column: 1 / -1;
    }
}
