/* ERP 對帳・應收／應付 */

.recon-card-alert {
    border-color: #fecaca;
    background: #fff7f7;
}

.recon-card-alert h2 {
    color: #b91c1c;
}

#reconTabs {
    margin: 20px 0 12px;
}

/* 篩選列：橫的一排，從左邊開始排（leads-filter-bar 預設是直的）。 */
.recon-filter-bar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 12px;
}

.recon-filter-bar label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #6b7280;
}

.recon-filter-bar input[type="text"] {
    min-width: 220px;
}

.recon-table td {
    vertical-align: top;
}

.recon-amount {
    white-space: nowrap;
}

.recon-amount strong {
    display: block;
}

.recon-amount small {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #6b7280;
}

.recon-custom-due {
    font-size: 11px;
    color: #6b7280;
}

.recon-actions {
    white-space: nowrap;
}

.recon-actions button {
    padding: 6px 10px;
    font-size: 13px;
    margin-right: 4px;
}

.overdue-chip,
.aging-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
}

.overdue-chip {
    margin-top: 4px;
    background: #fee2e2;
    color: #b91c1c;
    font-weight: 600;
}

.aging-chip {
    background: #f3f4f6;
    color: #374151;
}

.aging-31-60 {
    background: #fef3c7;
    color: #92400e;
}

.aging-61-90 {
    background: #ffedd5;
    color: #9a3412;
}

.aging-90plus {
    background: #fee2e2;
    color: #b91c1c;
}

/* 付款／修改到期日的視窗 */
.reconciliation-modal .reconciliation-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 8px 0 14px;
    font-size: 14px;
    color: #374151;
}

.reconciliation-payment-row {
    display: grid;
    grid-template-columns: 100px 100px 90px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.deletePayment {
    padding: 4px 10px;
    font-size: 12px;
    background: white;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.reconciliation-payment-note {
    color: #6b7280;
    overflow-wrap: anywhere;
}

.manufacturer-terms {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 12px;
    font-size: 13px;
    color: #6b7280;
}

.manufacturer-terms input {
    width: 80px;
}

/* 設定 → 財務 → 付款期限 */
.payment-terms-field {
    display: inline-flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
    color: #6b7280;
}

.payment-terms-field input {
    width: 140px;
}

.payment-terms-config .field-hint {
    margin: 8px 0;
}

.payment-terms-config .payment-terms-error {
    color: #b91c1c;
}

@media (max-width: 640px) {
    .reconciliation-payment-row {
        grid-template-columns: 1fr 1fr;
    }

    .recon-filter-bar input[type="text"] {
        min-width: 0;
        width: 100%;
    }
}

.payment-terms-config .lead-field-form {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: flex-end;
    gap: 12px;
    margin: 12px 0 4px;
}

.payment-terms-config .lead-field-form button {
    flex: none;
    width: auto;
}

.payment-terms-config h3 {
    margin: 24px 0 8px;
}

.payment-terms-config #termsMessage {
    min-height: 20px;
}
