.primary-btn {
    background-color: #e994c8;
    /* 主題 */
}

.switch-link {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9em;
}

.switch-link a {
    color: #e994c8;
    text-decoration: underline;
    cursor: pointer;
}

.message {
    text-align: center;
    margin-top: 20px;
    font-weight: bold;
}

.message.success {
    color: #28a745;
}

.message.error {
    color: #dc3545;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f8ebf4;
    color: #333;
    font-family: 'Arial', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;

    .header-icon {
        width: 45px;
        height: auto;
        vertical-align: middle;
        margin-right: 10px;
    }
}

.container {
    background-color: #fff;
    padding: 30px 50px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 70%;
    max-width: 650px;
    /*白色大框框*/
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #000000;
}

/* 餘額 */
.balance-container {
    background-color: #e9ecef;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

#balance {
    font-size: 2em;
    font-weight: bold;
    color: #009d10;
}

.form-control {
    margin-bottom: 15px;
}

.form-control label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control input[type="text"],
.form-control input[type="number"] {
    border: 1px solid #ced4da;
    border-radius: 100px;
    display: block;
    font-size: 16px;
    padding: 10px;
    width: 100%;
}

.btn {
    cursor: pointer;
    background-color: #e994c8;
    color: #fff;
    border: 0;
    display: block;
    font-size: 16px;
    margin: 10px 0 30px;
    padding: 10px;
    width: 100%;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #0056b3;
}

.transaction-list h3 {
    margin-bottom: 10px;
}

#list {
    list-style: none;
    padding: 0;
}

#list li {
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 10px 0;
    border-right: 5px solid;
    border-radius: 4px;
}

.plus {
    border-right-color: #28a745;
    /* 收入-綠色 */
}

.minus {
    border-right-color: #dc3545;
    /* 支出-紅色 */
}

.btn {
    text-decoration: none !important;
}

a {
    text-decoration: none;
}

.btn:focus,
.btn:active,
a:focus,
a:active {
    outline: none !important;
    box-shadow: none !important;
    text-decoration: none !important;
}

.form-control input {
    width: 100%;
    padding: 10px;
    border-radius: 100px;


}

#date {
    width: 100%;
}

.receipt-thumbnail {
    max-width: 60px;
    max-height: 60px;
    height: auto;
    border-radius: 4px;
    border: 1px solid #ccc;
    margin-right: 15px;
    vertical-align: middle;
    object-fit: cover;
}

.hidden-file-input {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.custom-file-label {
    display: inline-block;
    padding: 6px 12px;
    cursor: pointer;
    background-color: #f8f8f8;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
    font-size: 14px;
    transition: background-color 0.2s;
}

.custom-file-label:hover {
    background-color: #e9e9e9;
}

.file-name-display {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #555;
    word-break: break-all;
    white-space: normal;
    max-width: 100%;
}

.controls-group {
    margin-bottom: 20px;
    padding: 25px 35px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: #f7f7f7;
}

.filter-controls,
.sort-controls {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.filter-controls label,
.sort-controls label {
    font-weight: bold;
    margin-right: 10px;
    white-space: nowrap;
}

#date-filter {
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    flex-grow: 1;
    margin-right: 10px;
}

.filter-btn {
    padding: 8px 12px;
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.sort-btn {
    padding: 8px 10px;
    margin-right: 5px;
    background-color: #e994c8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f1f3f5;
    padding: 8px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 14px;
}

.logout-link {
    background: none;
    border: none;
    color: #f33e50;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
}

.logout-link:hover {
    color: #a71d2a;
}

.text-link {
    background: none;
    border: none;
    color: #6d90f2;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
}

.small-btn {
    margin: 5px 0 !important;
    padding: 5px !important;
    font-size: 14px !important;
    width: auto !important;
    display: inline-block !important;
    padding: 5px 15px !important;
}

.message {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    font-weight: bold;
}

.message.success {
    color: #28a745;
}

.message.error {
    color: #dc3545;
}

.type-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 100px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
    outline: none;
}

.type-select:focus {
    border-color: #e994c8;
}

.delete-btn {
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: #ffb3b3;
    font-size: 18px;
    padding: 5px 10px;
    transition: all 0.3s ease;
    border-radius: 50%;
}

.delete-btn:hover {
    color: #ff4d4d;
    background-color: #fff0f0;
    transform: scale(1.1);
}

.delete-btn {
    cursor: pointer;
    background-color: transparent;
    border: none;
    color: #ffb3b3;
    font-size: 18px;
    padding: 5px 10px;
    transition: all 0.3s ease;
    border-radius: 50%;
    margin-left: 10px;
}

.delete-btn:hover {
    color: #ff4d4d;
    background-color: #fff0f0;
    transform: scale(1.2);
}

#list li {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-link {
    background: none;
    border: none;
    color: #6d90f2;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    margin-top: 10px;
}

.text-link:hover {
    color: #4a6fdc;
}

.switch-link {
    text-align: center;
    margin-top: 15px;
}

body {
    background-color: #f8ebf4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 700px;
    text-align: center;
}

.text-link {
    background: none;
    border: none;
    color: #6d90f2;
    text-decoration: underline;
    cursor: pointer;
    font-size: 14px;
    margin-top: 5px;
}

.btn {
    width: 100%;
    padding: 12px;
    border-radius: 100px;
    background-color: #e994c8;
    color: white;
    border: none;
    cursor: pointer;
    margin-top: 15px;
}

.switch-link a {
    text-decoration: none;
    font-size: 14px;
    transition: 0.3s;
}

.switch-link a:hover {
    text-decoration: underline;
}

.filter-btn,
.sort-btn {
    padding: 5px 12px !important;
    font-size: 12px !important;
    width: auto !important;
    min-width: 60px !important;
    height: 32px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 2px !important;
}

.filter-controls {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

#date-filter {
    max-width: 180px !important;
    height: 32px !important;
    padding: 0 10px !important;
}

.controls-group {
    background-color: #f1f3f5 !important;
    padding: 30px 40px !important;
    margin: 20px 0 30px 0 !important;
    border-radius: 15px !important;
    border: 1px solid #e2e8f0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

.controls-group label {
    font-size: 17px !important;
    font-weight: bold !important;
    color: #4a5568 !important;
    margin-right: 15px !important;
    min-width: 80px !important;
    display: inline-block !important;
}

.filter-controls,
.sort-controls {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
}

#date-filter {
    padding: 8px 15px !important;
    height: 40px !important;
    border-radius: 10px !important;
    border: 1px solid #cbd5e0 !important;
}

.controls-group {
    background-color: #f1f3f5 !important;
    padding: 25px !important;
    border-radius: 15px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    margin-bottom: 20px !important;
    text-align: left !important;
}

.filter-controls,
.sort-controls,
.summary-toggle-area {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
}

.controls-group label {
    min-width: 85px !important;
    font-weight: bold !important;
    margin: 0 !important;
}

.filter-btn,
.sort-btn {
    padding: 6px 15px !important;
    font-size: 13px !important;
    width: auto !important;
    margin: 0 !important;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.alert-banner {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.controls-group {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 15px !important;
    padding: 25px !important;
    text-align: left !important;
}

.filter-controls,
.sort-controls {
    display: flex !important;
    width: 100% !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: nowrap !important;
}

#date-filter {
    flex-grow: 0 !important;
    width: 180px !important;
    margin-right: 5px !important;
}

.controls-group label {
    min-width: 85px !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

.filter-btn,
.sort-btn {
    width: auto !important;
    flex-shrink: 0 !important;
}

/* 確定按鈕樣式 */
.btn-confirm {
    background-color: #ffb7ce !important;
    /* 使用粉紅色 */
    color: white !important;
    border: none !important;
    padding: 6px 15px !important;
    border-radius: 10px !important;
    /* 統一圓角 */
    cursor: pointer;
    font-size: 13px !important;
    font-weight: bold !important;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    transition: 0.3s;
}

/* 確定按鈕樣式 */
.btn-confirm {
    background-color: #ffb7ce;
    color: white;
    border: none;
    padding: 6px 15px;
    /* 稍微增加高度增加舒適感 */
    border-radius: 10px;
    /* 統一為 10px 圓角，與控制組風格一致 */
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: 0.3s;
}

/* 復原按鈕樣式 */
.btn-reset {
    background-color: #ffb7ce;
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: 0.3s;
}

/* 統計頁面專屬修正 */
.selection-area {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    margin: 20px 0 !important;
    flex-wrap: nowrap !important;
    /* 🚀 關鍵：強制不換行，解決標籤被擠掉的問題 */
}

/* 統一統計頁面的下拉選單樣式 */
#year-select,
#month-select {
    border: 1px solid #cbd5e0 !important;
    border-radius: 10px !important;
    /* 🚀 關鍵：套用 10px 圓角 */
    padding: 5px 10px !important;
    height: 38px !important;
    width: auto !important;
    min-width: 120px !important;
    /* 給予足夠寬度顯示文字 */
    background-color: white !important;
    cursor: pointer;
    outline: none !important;
}

/* 點選時變主題粉色 */
#year-select:focus,
#month-select:focus {
    border-color: #e994c8 !important;
}

/* 重置按鈕同步樣式 */
#statResetBtn {
    background-color: #ffb7ce !important;
    color: white !important;
    border-radius: 10px !important;
    padding: 6px 15px !important;
    border: none !important;
    font-weight: bold !important;
    height: 38px !important;
}

/* 1. 先設定一個全域的預設值，讓所有 label 預設不換行（這會保護統計和明細頁面） */
label {
    display: inline-block;
    width: auto;
    text-align: left;
    margin-bottom: 0;
}

/* 2. 🚀 專門針對「新增金額頁面」的表單標籤進行靠左與換行設定 */
/* 你的首頁 HTML 裡，這些標籤應該被包在 class="form-control" 的 div 裡 */
.form-control label {
    display: block !important;
    /* 讓標籤獨佔一行 */
    width: 100% !important;
    /* 撐滿寬度 */
    text-align: left !important;
    /* 文字靠左 */
    margin-bottom: 8px !important;
    /* 與下方的輸入框保持距離 */
    padding-left: 10px;
    /* 稍微往右縮一點，對齊圓角輸入框更美觀 */
    font-weight: bold;
}

/* 3. 確保首頁的輸入框與下拉選單也是寬度 100% */
.form-control input,
.form-control select {
    display: block !important;
    width: 100% !important;
    margin: 0 auto !important;
}

/* 4. 保持統計頁面的選單列維持水平置中 */
.selection-area {
    display: flex !important;
    flex-direction: row !important;
    /* 強制橫向並排 */
    justify-content: center !important;
    align-items: center !important;
    gap: 15px !important;
}

.selection-area label {
    display: inline-block !important;
    /* 統計頁面的標籤不換行 */
    width: auto !important;
    margin-right: 5px;
}

.google-btn {
    width: 100%;
    background-color: #e994c8;
    /* Google 藍 */
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    transition: background 0.3s;
}

.google-btn:hover {
    background-color: #0056b3;
}

.google-icon-wrapper {
    background: white;
    border-radius: 50%;
    padding: 3px;
    display: flex;
}

/* 🚀 關鍵的分隔線 */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #888;
    margin: 20px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.divider:not(:empty)::before {
    margin-right: 15px;
}

.divider:not(:empty)::after {
    margin-left: 15px;
}