* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #eef2f3, #dbeafe);
    min-height: 100vh;
    padding: 30px;
}

.container {
    max-width: 1100px;
    margin: auto;
}

h1 {
    text-align: center;
    color: #1e293b;
    font-size: 38px;
}

.subtitle {
    text-align: center;
    color: #64748b;
    margin-bottom: 30px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 30px;
}

.card {
    background: white;
    padding: 22px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.card h3 {
    color: #475569;
    margin-bottom: 10px;
}

.card p {
    font-size: 24px;
    font-weight: bold;
}

.income p {
    color: #16a34a;
}

.expense p {
    color: #dc2626;
}

.balance p {
    color: #2563eb;
}

.form-box, 
.table-box {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.table-box {
    overflow-x: auto;
}

#formInput {
    display: none;
}

h2 {
    margin-bottom: 20px;
    color: #1e293b;
}

label {
    display: block;
    margin-top: 12px;
    margin-bottom: 6px;
    color: #334155;
    font-weight: bold;
}

input, 
select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    outline: none;
}

input:focus, 
select:focus {
    border-color: #2563eb;
}

button {
    margin-top: 20px;
    width: 100%;
    padding: 14px;
    border: none;
    background: #2563eb;
    color: white;
    font-size: 16px;
    border-radius: 10px;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

.toggle-btn {
    display: block;
    width: 220px;
    margin: 0 auto 25px auto;
    padding: 14px;
    border: none;
    background: #16a34a;
    color: white;
    font-size: 16px;
    border-radius: 12px;
    cursor: pointer;
}

.toggle-btn:hover {
    background: #15803d;
}

.alert {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.error {
    background: #fee2e2;
    color: #b91c1c;
}

.success {
    background: #dcfce7;
    color: #166534;
}

table {
    width: 100%;
    min-width: 850px;
    border-collapse: collapse;
}

th {
    background: #2563eb;
    color: white;
    padding: 12px;
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
    white-space: nowrap;
}

/* Kolom keterangan boleh turun baris agar tabel tidak terlalu panjang */
td:nth-child(4) {
    white-space: normal;
    text-align: left;
    min-width: 220px;
}

.badge-income {
    background: #dcfce7;
    color: #166534;
    padding: 6px 10px;
    border-radius: 20px;
}

.badge-expense {
    background: #fee2e2;
    color: #b91c1c;
    padding: 6px 10px;
    border-radius: 20px;
}

@media screen and (max-width: 768px) {
    body {
        padding: 15px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 30px;
    }

    table {
        font-size: 13px;
    }
}