/* Definisi Variabel CSS (Mode Terang Default) */
:root {
    --bg-body: #f4f4f4;
    --bg-container: #fff;
    --bg-section: #fdfdfd;
    --bg-header-table: #f2f2f2;
    --bg-table-even: #f9f9f9;
    --bg-table-hover: #f1f1f1;
    --bg-category-item: #e9ecef;
    --bg-stat-card: #f8f9fa;
    --bg-recent-expense-item: #f0f0f0;
    --bg-sidebar: #fff; /* Warna background sidebar */
    --bg-sidebar-hover: #e2e6ea; /* Warna hover item sidebar */
    --bg-sidebar-active: #007bff; /* Warna aktif item sidebar */

    --text-color-primary: #333;
    --text-color-secondary: #444;
    --text-color-label: #666;
    --text-color-small: #888;
    --text-color-info: #777;
    --text-color-category-item: #495057;
    --text-color-stat-value: #007bff;
    --text-color-sidebar-item: #555; /* Warna teks item sidebar */
    --text-color-sidebar-active: #fff; /* Warna teks aktif item sidebar */
    --text-color-hamburger: #333; /* Warna ikon hamburger */

    --border-color-light: #eee;
    --border-color-medium: #ddd;
    --border-color-dark: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-table-header: rgba(0, 0, 0, 0.2);
    --shadow-stat-card: rgba(0, 0, 0, 0.08);
    --shadow-sidebar: rgba(0, 0, 0, 0.2); /* Bayangan sidebar */
    --overlay-color: rgba(0, 0, 0, 0.5); /* Warna overlay */


    --button-add-bg: #28a745;
    --button-add-hover-bg: #218838;
    --button-secondary-bg: #6c757d;
    --button-secondary-hover-bg: #5a6268;
    --button-edit-bg: #007bff;
    --button-edit-hover-bg: #0056b3;
    --button-delete-bg: #ff0000;
    --button-delete-hover-bg: #c82333;

    /* Toggle Switch Colors (Light Mode) */
    --toggle-slider-bg-off: #ccc;
    --toggle-slider-bg-on: #2196F3; /* Warna biru standar untuk toggle on */
    --toggle-slider-circle: white;

    /* Warna untuk efek validasi input */
    --input-invalid-border: #dc3545;
    --input-invalid-shadow: rgba(220, 53, 69, 0.25);
}

/* Gaya Dark Mode */
body.dark-mode {
    --bg-body: #2c2c2c;
    --bg-container: #3a3a3a;
    --bg-section: #424242;
    --bg-header-table: #505050;
    --bg-table-even: #4a4a4a;
    --bg-table-hover: #555555;
    --bg-category-item: #505050;
    --bg-stat-card: #4a4a4a;
    --bg-recent-expense-item: #505050;
    --bg-sidebar: #3a3a3a;
    --bg-sidebar-hover: #4a4a4a;
    --bg-sidebar-active: #0056b3;

    --text-color-primary: #f0f0f0;
    --text-color-secondary: #e0e0e0;
    --text-color-label: #cccccc;
    --text-color-small: #aaaaaa;
    --text-color-info: #bbbbbb;
    --text-color-category-item: #e0e0e0;
    --text-color-stat-value: #87ceeb;
    --text-color-sidebar-item: #e0e0e0;
    --text-color-sidebar-active: #fff;
    --text-color-hamburger: #f0f0f0;

    --border-color-light: #555;
    --border-color-medium: #666;
    --border-color-dark: #777;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-table-header: rgba(0, 0, 0, 0.5);
    --shadow-stat-card: rgba(0, 0, 0, 0.2);
    --shadow-sidebar: rgba(0, 0, 0, 0.5);
    --overlay-color: rgba(0, 0, 0, 0.7);

    --button-add-bg: #218838;
    --button-add-hover-bg: #1a742c;
    --button-secondary-bg: #5a6268;
    --button-secondary-hover-bg: #4a5054;
    --button-edit-bg: #0056b3;
    --button-edit-hover-bg: #003d82;
    --button-delete-bg: #ffc000;
    --button-delete-hover-bg: #a01c27;

    --toggle-slider-bg-off: #777;
    --toggle-slider-bg-on: #4CAF50;
    --toggle-slider-circle: #f0f0f0;

    /* Warna untuk efek validasi input (Dark Mode) */
    --input-invalid-border: #ef5350; /* Merah yang sedikit terang */
    --input-invalid-shadow: rgba(239, 83, 80, 0.35);
}


/* Styling Dasar Menggunakan Variabel */
body {
    font-family: Arial, sans-serif; /* Default font */
    background-color: var(--bg-body);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    margin: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease;
    color: var(--text-color-primary);
}

.container {
    background-color: var(--bg-container);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px var(--shadow-color);
    width: 100%;
    max-width: 800px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Header Aplikasi */
.app-header {
    display: flex;
    align-items: center;
    margin-bottom: 30px;
}

.app-header h1 {
    flex-grow: 1;
    margin: 0;
    text-align: center;
    font-size: 2em; /* Adjusted font size */
    color: var(--text-color-primary);
}

/* Tombol Hamburger */
.hamburger-btn {
    background: none;
    border: none;
    font-size: 1.8em;
    color: var(--text-color-hamburger);
    cursor: pointer;
    padding: 0 10px 0 0;
    transition: color 0.3s;
    line-height: 1;
}

.hamburger-btn:hover {
    color: var(--button-nav-active-bg);
}

/* Navigasi Sidebar */
.sidebar {
    height: 100%;
    width: 250px;
    position: fixed;
    z-index: 1001;
    top: 0;
    left: 0;
    background-color: var(--bg-sidebar);
    box-shadow: 2px 0 10px var(--shadow-sidebar);
    overflow-x: hidden;
    transition: transform 0.3s ease-out;
    transform: translateX(-100%);
    padding-top: 20px;
    display: flex; /* Gunakan flexbox untuk menata elemen di dalam sidebar */
    flex-direction: column; /* Tata elemen secara vertikal */
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    text-align: center;
    padding: 10px 0 20px;
    border-bottom: 1px solid var(--border-color-light);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 1.5em; /* Adjusted font size */
    color: var(--text-color-secondary);
    margin: 0;
}

/* Gaya untuk grup menu atas */
.sidebar-menu-group-top {
    flex-grow: 1; /* Biarkan grup atas mengisi sebagian besar ruang yang tersedia */
}

/* Gaya untuk grup menu bawah (pengaturan) */
.sidebar-menu-group-bottom {
    margin-top: auto; /* Ini yang akan mendorongnya ke bagian paling bawah */
    padding-bottom: 20px; /* Padding di bagian bawah sidebar */
    border-top: 1px solid var(--border-color-light); /* Garis pemisah opsional */
    padding-top: 10px; /* Padding atas untuk grup bawah */
}

.sidebar-menu { /* Aturan untuk ul di dalam grup */
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-nav-btn {
    display: block;
    width: 100%;
    padding: 12px 20px;
    text-align: left;
    background: none;
    border: none;
    font-size: 1.05em; /* Adjusted font size */
    color: var(--text-color-sidebar-item);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.sidebar-nav-btn:hover {
    background-color: var(--bg-sidebar-hover);
    color: var(--text-color-sidebar-item);
}

.sidebar-nav-btn.active {
    background-color: var(--bg-sidebar-active);
    color: var(--text-color-sidebar-active);
    font-weight: bold;
}

/* Tombol Tutup Sidebar */
.close-sidebar-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--text-color-label);
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
    line-height: 1;
    padding: 0 5px;
    transition: color 0.3s;
}

.close-sidebar-btn:hover {
    color: var(--button-delete-bg);
}


/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-color);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.overlay.visible {
    opacity: 1;
    visibility: visible;
}


/* Bagian Konten (Section) */
.section {
    margin-bottom: 30px;
    padding: 20px;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    background-color: var(--bg-section);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.section.hidden {
    display: none;
}


/* Form Group */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-color-label);
    font-size: 0.95em; /* Adjusted font size */
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="month"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color-medium);
    border-radius: 4px;
    font-size: 1rem; /* Adjusted font size */
    box-sizing: border-box;
    background-color: var(--bg-container);
    color: var(--text-color-primary);
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.form-group small {
    color: var(--text-color-small);
    font-size: 0.85em;
    margin-top: 5px;
    display: block;
}

/* Gaya input tidak valid (feedback visual) */
.form-group input.invalid, .form-group select.invalid {
    border-color: var(--input-invalid-border);
    box-shadow: 0 0 0 0.2rem var(--input-invalid-shadow);
}


/* Tombol Tambah/Edit */
.btn-add {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--button-add-bg);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem; /* Adjusted font size */
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 20px;
}

.btn-add:hover {
    background-color: var(--button-add-hover-bg);
}


/* Gaya untuk tombol Batal Edit dan Reset Filter (btn-secondary) */
.btn-secondary {
    display: block;
    width: 100%;
    padding: 12px;
    background-color: var(--button-secondary-bg);
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem; /* Adjusted font size */
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 10px;
}

.btn-secondary:hover {
    background-color: var(--button-secondary-hover-bg);
}


/* Tabel Pengeluaran - Gaya Desktop Default */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    display: table;
}

thead {
    display: table-header-group;
}

tbody {
    display: table-row-group;
    max-height: 350px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

th, td {
    border: 1px solid var(--border-color-medium);
    padding: 10px;
    text-align: left;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Lebar Kolom untuk Desktop */
th:nth-child(1), td:nth-child(1) { width: 20%; } /* Tanggal */
th:nth-child(2), td:nth-child(2) { width: 35%; } /* Jenis Pengeluaran */
th:nth-child(3), td:nth-child(3) { width: 25%; } /* Jumlah (Rp) */
th:nth-child(4), td:nth-child(4) { width: 20%; } /* Aksi */


th {
    background-color: var(--bg-header-table);
    color: var(--text-color-secondary);
}

table tr:nth-child(even) {
    background-color: var(--bg-table-even);
}

table tr:hover {
    background-color: var(--bg-table-hover);
}


/* Styling Dasar Menggunakan Variabel */
/* ... styling dasar yang sudah ada ... */

/* START: Gaya Modal Konfirmasi Kustom */
.modal {
    display: none; /* Sembunyikan secara default */
    position: fixed; /* Tetap di layar */
    z-index: 1002; /* Lebih tinggi dari overlay dan sidebar */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; /* Aktifkan scroll jika kontennya terlalu besar */
    background-color: rgba(0,0,0,0.4); /* Background gelap */
    padding-top: 60px; /* Jarak dari atas */
}

.modal-content {
    background-color: var(--bg-container); /* Warna latar belakang modal */
    margin: 10% auto; /* 10% dari atas dan tengah secara horizontal */
    padding: 20px;
    border: 1px solid var(--border-color-medium);
    border-radius: 8px;
    width: 80%; /* Lebar modal */
    max-width: 400px; /* Batasi lebar maksimum */
    box-shadow: 0 4px 12px var(--shadow-color);
    position: relative; /* Untuk posisi tombol close */
    text-align: center;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.modal-content p {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: var(--text-color-primary);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 20px; /* Jarak antar tombol */
}

.modal-buttons button { /* Ini adalah satu-satunya bagian yang perlu Anda atur */
    padding: 12x 25px; /* Sesuaikan nilai padding ini untuk ukuran yang Anda inginkan */
    font-size: 1em;     /* Sesuaikan ukuran font ini */
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}


/* Tombol close */
.close-button {
    color: var(--text-color-label);
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: var(--button-delete-bg);
    text-decoration: none;
    cursor: pointer;
}

/* Media Query untuk modal di layar kecil */
@media (max-width: 600px) {
    .modal-content {
        width: 90%;
        margin: 20% auto;
        padding: 20px;
    }
    .modal-buttons {
        flex-direction: column; /* Tombol bertumpuk di layar kecil */
    }
    .modal-buttons button {
        width: 100%; /* Tombol memenuhi lebar */
        margin-bottom: 10px; /* Jarak antar tombol vertikal */
		padding: 12px 20px; /* Pertahankan padding yang baik untuk sentuhan di mobile */
        font-size: 1em;
	}
}

/* END: Gaya Modal Konfirmasi Kustom */

/* Tombol Hapus & Edit di Tabel */
.btn-delete {
    background-color: var(--button-delete-bg);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em; /* Adjusted font size */
    transition: background-color 0.3s;
}

.btn-delete:hover {
    background-color: var(--button-delete-hover-bg);
}

.btn-edit {
    background-color: var(--button-edit-bg);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em; /* Adjusted font size */
    transition: background-color 0.3s;
    margin-right: 5px;
}

.btn-edit:hover {
    background-color: var(--button-edit-hover-bg);
}


/* Pesan Tidak Ada Data */
#no-expense-message, #no-chart-data-message, #no-category-message, #no-report-data-message {
    text-align: center;
    margin-top: 20px;
    color: var(--text-color-info);
    font-style: italic;
}

/* Gaya untuk List Ringkasan Kategori */
#category-summary {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

#category-summary li {
    background-color: var(--bg-category-item);
    padding: 8px 15px;
    margin-bottom: 5px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em; /* Adjusted font size */
    color: var(--text-color-category-item);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

#total-expenses {
    font-weight: bold;
    color: var(--button-edit-bg);
    font-size: 1.1em; /* Adjusted font size */
}

/* Gaya untuk Checkbox dan Groupnya */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 15px;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-bottom: 0;
    transform: scale(1.2);
}

.checkbox-group label {
    margin-bottom: 0;
    font-weight: normal;
}

/* Gaya untuk Filter Group */
.filter-group {
    border: 1px solid var(--border-color-medium);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    background-color: var(--bg-section);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.filter-group .form-group {
    flex: 1;
    min-width: 150px;
    margin-bottom: 0;
}

.filter-group .btn-secondary {
    width: auto;
    flex-grow: 1;
    min-width: 120px;
    margin-top: 5px;
}


/* Gaya untuk Daftar Kategori di Kelola Kategori */
.category-list-management {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

.category-list-management li {
    background-color: var(--bg-category-item);
    border: 1px solid var(--border-color-dark);
    border-radius: 5px;
    padding: 10px 15px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1em; /* Adjusted font size */
    color: var(--text-color-category-item);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.category-list-management li button {
    background-color: var(--button-delete-bg);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em; /* Adjusted font size */
    transition: background-color 0.3s;
}

.category-list-management li button:hover {
    background-color: var(--button-delete-hover-bg);
}

/* Gaya untuk opsi di dalam Settings Section */
.settings-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    margin-bottom: 20px;
}

.settings-options .settings-btn-item {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem; /* Adjusted font size */
    text-align: center;
}

/* Gaya Toggle Switch (untuk Dark Mode) */
.toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color-light);
}

/* Kontainer slider */
.switch {
    position: relative;
    display: inline-block;
    width: 45px;
    height: 25px;
}

/* Sembunyikan checkbox HTML default */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Slider itu sendiri */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--toggle-slider-bg-off);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 25px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 19px;
    width: 19px;
    left: 3px;
    bottom: 3px;
    background-color: var(--toggle-slider-circle);
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

/* Gaya saat checkbox dicentang (toggle on) */
input:checked + .slider {
    background-color: var(--toggle-slider-bg-on);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--toggle-slider-bg-on);
}

input:checked + .slider:before {
    -webkit-transform: translateX(20px);
    -ms-transform: translateX(20px);
    transform: translateX(20px);
}


/* Gaya Dashboard */
.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    flex: 1;
    min-width: 180px;
    background-color: var(--bg-stat-card);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px var(--shadow-stat-card);
    text-align: center;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Add max-width for stat cards on larger screens to prevent excessive stretching */
@media (min-width: 769px) {
    .stat-card {
        /*
        The 30% width along with flex-wrap and gap will ensure 3 cards per row.
        If you want exactly 3 cards and no more stretching, you can calculate flex-basis:
        calc(33.33% - (2 * gap / 3)) for three items.
        For simplicity and good responsiveness, flex: 1 combined with max-width is usually effective.
        */
        max-width: 30%; /* Set a max-width to prevent cards from becoming too wide */
    }
}


.stat-card h3 {
    margin-top: 0;
    font-size: 1.1em; /* Adjusted font size */
    color: var(--text-color-secondary);
}

.stat-card p {
    font-size: 1.2em; /* Adjusted font size */
    font-weight: bold;
    color: var(--text-color-stat-value);
    margin-bottom: 0.5;
    transition: color 0.3s ease;
}

.recent-expense-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

.recent-expense-list li {
    background-color: var(--bg-recent-expense-item);
    padding: 10px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em; /* Adjusted font size */
    color: var(--text-color-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.recent-expense-list li span:last-child {
    font-weight: bold;
    color: var(--button-delete-bg);
}


/* Media Queries untuk Responsivitas */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        margin: 10px;
    }

    .app-header h1 {
        font-size: 1.5em;
    }

    /* Sidebar di mobile: mungkin sedikit lebih lebar atau adaptif */
    .sidebar {
        width: 70%;
        max-width: 280px;
    }

    .hamburger-btn {
        font-size: 1.5em;
    }

    .form-group label {
        font-size: 0.9em;
    }

    .form-group input,
    .form-group select {
        padding: 8px;
        font-size: 0.9em;
    }

    .btn-add, .btn-secondary { /* Apply to both add and secondary buttons */
        padding: 10px;
        font-size: 1em;
    }

    /* Penyesuaian Tabel untuk Mobile - Tetap Tabel dengan Scroll Vertikal */
    table {
        display: block;
        overflow-x: auto; /* Make table horizontally scrollable */
        -webkit-overflow-scrolling: touch;
        white-space: nowrap; /* Keep content on one line for horizontal scroll */
    }

    thead {
        display: table-header-group; /* Keep thead as table-header-group */
    }

    tbody {
        display: table-row-group; /* Keep tbody as table-row-group */
        /* max-height and overflow-y are handled by the table itself if no individual row display is forced */
    }

    tr {
        display: table-row; /* Keep rows as table-row */
        border: none; /* Remove individual row borders */
        margin-bottom: 0; /* Remove margin between rows */
    }

    th, td {
        display: table-cell; /* Treat cells as table-cells */
        box-sizing: border-box;
        text-align: left;
        padding: 8px 10px;
        font-size: 0.85em;
        white-space: nowrap; /* Keep text on one line */
        overflow: hidden;
        text-overflow: ellipsis;
        border: 1px solid var(--border-color-medium); /* Add borders back for traditional table look on scroll */
    }

    /* Specific width adjustments for mobile table columns */
    th:nth-child(1), td:nth-child(1) { width: 90px; min-width: 90px; } /* Tanggal */
    th:nth-child(2), td:nth-child(2) { width: 120px; min-width: 120px; } /* Jenis Pengeluaran */
    th:nth-child(3), td:nth-child(3) { width: 100px; min-width: 100px; } /* Jumlah (Rp) */
    th:nth-child(4), td:nth-child(4) { width: 100px; min-width: 100px; text-align: center; } /* Aksi */


    .btn-delete, .btn-edit { /* Combine button styles for mobile */
        padding: 6px 12px; /* Slightly larger touch targets */
        font-size: 0.85em;
        margin-top: 0; /* No top margin as they are side-by-side */
        display: inline-block; /* Allow them to sit side-by-side if space allows */
    }
    .btn-edit {
        margin-right: 5px; /* Standard space between edit and delete */
    }


    /* Penyesuaian khusus untuk grafik */
    #monthly-expense-chart, #reports-chart {
        max-height: 300px;
        width: 100% !important;
        height: auto !important;
    }

    /* Filter Group di mobile */
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        padding: 10px; /* Reduce padding for mobile */
    }
    .filter-group .form-group {
        width: 100%;
        min-width: unset; /* Remove min-width constraint */
    }
    .filter-group .btn-secondary {
        width: 100%;
        margin-top: 10px; /* More spacing for buttons */
    }

    /* Gaya untuk Daftar Kategori di Kelola Kategori (mobile) */
    .category-list-management li {
        padding: 8px 12px;
        font-size: 0.9em;
        /* Revert to single line with space-between for better readability */
        flex-direction: row;
        align-items: center;
    }
    .category-list-management li button {
        padding: 6px 12px; /* Consistent button size */
        font-size: 0.8em;
        margin-top: 0; /* No top margin */
        width: auto; /* Allow button to size naturally */
        align-self: auto; /* Revert align-self */
    }

    /* Dashboard Stats di Mobile */
    .dashboard-stats {
        flex-direction: column;
        gap: 10px;
    }
    .stat-card {
        min-width: unset;
        width: 100%; /* Ensure each card takes full width */
        padding: 3px; /* Reduce padding */
    }
    .stat-card h3 {
        font-size: 1em; /* Smaller font for titles */
    }
    .stat-card p {
        font-size: 1.4em; /* Smaller font for values */
    }

    .recent-expense-list li {
        flex-direction: row; /* Keep on one row */
        align-items: center;
        padding: 8px 12px;
    }
    .recent-expense-list li span:last-child {
        font-weight: bold;
        color: var(--button-delete-bg);
        margin-top: 0; /* No top margin */
        align-self: auto; /* Revert align-self */
    }

    .settings-options .settings-btn-item {
        padding: 10px;
        font-size: 1em;
    }
}

/* Media Query untuk layar yang sangat kecil (misalnya di bawah 480px) */
@media (max-width: 480px) {
    body {
        padding: 10px; /* Reduce overall body padding */
    }
    .container {
        padding: 15px; /* Adjust container padding */
    }

    h1 {
        font-size: 1.4em; /* Smaller main title */
    }

    h2 {
        font-size: 1.1em; /* Smaller section titles */
    }

    .form-group label {
        font-size: 0.85em; /* Smaller label font */
    }

    .form-group input,
    .form-group select,
    .btn-add, .btn-secondary {
        font-size: 0.9em; /* Consistent input/button font size */
        padding: 10px; /* Ensure sufficient padding for touch */
    }

    /* Table adjustments for very small screens */
    th, td {
        padding: 6px 8px; /* Even smaller padding */
        font-size: 0.8em; /* Smaller font in table cells */
    }

    /* Action buttons in table */
    .btn-delete, .btn-edit {
        padding: 4px 8px;
        font-size: 0.75em;
    }

    #category-summary li {
        font-size: 0.85em;
        padding: 5px 10px;
    }

    .stat-card p {
        font-size: 1.2em; /* Even smaller font for stat values */
    }

    .category-list-management li {
        font-size: 0.85em;
        padding: 6px 10px;
    }
    .category-list-management li button {
        font-size: 0.75em;
        padding: 4px 8px;
    }
}