/* 財務 → 收支記錄、設定 → 財務 → 收支分類 */

/* 視覺上隱藏、但螢幕閱讀器仍然讀得到的文字（輸入框的標籤）。 */
.cash-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* 月份切換列 */
.cash-month-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 12px;
}

.cash-month-bar strong {
    min-width: 110px;
    text-align: center;
    font-size: 16px;
    color: #111827;
}

.cash-month-bar button {
    padding: 6px 12px;
    font-size: 14px;
}

#cashThisMonth {
    margin-left: 4px;
}

/* 「支出依分類」：只有一張卡，不要像儀表板那樣排兩欄；橫條用「支出」的橘色（和財務儀表板的「付」同色）。 */
.cash-chart-wrap {
    grid-template-columns: minmax(0, 1fr);
    margin: 16px 0;
}

.cash-rank-fill {
    background: var(--fin-series-out);
}

/* 標題和第一條橫條之間留一點空間 */
.cash-ranks {
    margin-top: 16px;
}

/* 類型標籤、金額 */
.cash-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.5;
    white-space: nowrap;
}

.cash-chip-income {
    background: #dbeafe;
    color: #1e40af;
}

.cash-chip-expense {
    background: #ffedd5;
    color: #9a3412;
}

.cash-chip-off {
    background: #f3f4f6;
    color: #6b7280;
}

/* 費用報銷核准後自動記進來的收支 */
.cash-chip-auto {
    background: #ede9fe;
    color: #5b21b6;
}

.cash-locked-note {
    color: #6b7280;
    font-size: 12px;
    white-space: nowrap;
}

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

.cash-amount-income strong {
    color: #1e40af;
}

.cash-amount-expense strong {
    color: #9a3412;
}

.deleteCashEntry {
    background: white;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.cash-entry-modal .modal-footer,
.cash-receipts-modal .modal-footer {
    margin-top: 16px;
}

/* 收支記錄列表的「收據」欄 */
.cash-receipt-cell {
    white-space: nowrap;
}

/* 和同一列的「修改」「刪除」一樣大 */
.openReceipts {
    padding: 6px 10px;
    font-size: 13px;
}

.cash-receipt-none {
    color: #6b7280;
    font-size: 12px;
}

/* 收據視窗：檔案清單、上傳 */
.cash-receipts-modal .cash-receipt-message {
    min-height: 20px;
}

.cash-receipts-modal .cash-receipt-message.cash-cat-error {
    color: #b91c1c;
}

.cash-receipt-list {
    list-style: none;
    margin: 8px 0;
    padding: 0;
}

.cash-receipt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #eef0f3;
}

.cash-receipt-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cash-receipt-name strong {
    overflow-wrap: anywhere;
}

.cash-receipt-actions {
    display: flex;
    gap: 6px;
    flex: none;
}

.deleteReceipt {
    background: white;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.cash-receipt-upload {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.cash-receipt-upload input[type="file"] {
    max-width: 100%;
}

/* 窄螢幕：表格比畫面寬時，在表格自己的範圍內左右捲動，不要把頁面撐開或切掉。 */
.cash-table-scroll {
    overflow-x: auto;
}

#cashTable .crm-table {
    min-width: 720px;
}

.page-header > #addCashEntry {
    flex: none;
    white-space: nowrap;
    align-self: flex-start;
}

.cash-note {
    max-width: 260px;
    color: #6b7280;
    overflow-wrap: anywhere;
}

#cashNoCategories button {
    margin: 6px 6px 6px 0;
}

/* 設定 → 財務 → 收支分類 */
.cash-categories-config .field-hint {
    margin: 8px 0;
}

.cash-categories-config .cash-cat-error {
    color: #b91c1c;
}

.cash-categories-config #catMessage {
    min-height: 20px;
}

.cash-categories-config h3 {
    margin: 24px 0 8px;
}

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

.cash-categories-config .lead-field-form button {
    flex: none;
    width: auto;
}

.cash-cat-quick {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 8px 0 4px;
}

.cash-cat-quick button {
    flex: none;
    width: auto;
}

.cash-cat-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cash-cat-name {
    flex: 1;
    min-width: 0;
}

.cash-cat-name input {
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
}

.cash-cat-item button {
    flex: none;
    width: auto;
    padding: 6px 12px;
    font-size: 13px;
}

.cash-cat-item .deleteCat {
    background: white;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

@media (max-width: 640px) {
    .cash-cat-item {
        flex-wrap: wrap;
    }

    .cash-note {
        max-width: none;
    }
}
