body {
    font-family: Segoe UI, Arial, sans-serif;
    background: #E8F1F5;
    color: #3A3F47;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 1050px;
}

nav {
    margin-bottom: 20px;
}

nav a {
    margin-right: 15px;
    text-decoration: none;
    color: #3A3F47;
    font-weight: bold;
}

.section {
    background: white;
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 8px;
    border: 1px solid #D3D7DD;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.income { background: #E9F5E9; }
.expenses { background: #F7F3E8; }
.summary { background: #ECEFF7; }

/* Center the Amount column and all values */
td:nth-child(2),
th:nth-child(2) {
    text-align: center;
}

/* left-align the Income Source and Expense Category labels */
td:nth-child(1),
th:nth-child(1) {

    text-align: left;
    padding-left: 10px; 
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid #D3D7DD;
}

input[type="number"] {
    width: 120px;
    padding: 6px;
    border: 1px solid #D3D7DD;
    border-radius: 4px;
    text-align: center; 
}

button {
    padding: 10px 20px;
    margin: 5px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

.save-btn { background: #A8D8D0; }
.csv-btn { background: #C9DDF2; }
.reset-btn { background: #E5D8C5; }

body.dark {
    background: #1F1F22;
    color: #CFCFD4;
}

/* Dark mode clean-up */
body.dark {
    background-color: #1e1e1e;
    color: #f5f5f5;
}

/* Make table text readable */
body.dark table th,
body.dark table td {
    color: #f5f5f5;
}

/* Remove pastel backgrounds in dark mode */
body.dark .section {
    background-color: #2a2a2a;
}

/* Remove cloudy tint from alternating rows */
body.dark table tr:nth-child(even) {
    background-color: #333;
}

body.dark table tr:nth-child(odd) {
    background-color: #2a2a2a;
}

/* Input boxes stay bright and readable */
body.dark input {
    background-color: #ffffff; /* stay white */
    color: #2c2c2c;
    border: 2px solid #8b5e3c; /* same brown outline */
}

body.dark nav a {
    color: white;
}


/* Center the Amount column and all values */
td:nth-child(2),
th:nth-child(2) {
    text-align: center;
}

/* MOBILE VERSION — tighter layout, better spacing, smaller padding */
.mobile-version .section {
    padding: 12px;
    margin-bottom: 18px;
}

/* Make columns closer together */
.mobile-version table td:nth-child(1),
.mobile-version table th:nth-child(1) {
    width: 45%;
    text-align: right;
}

.mobile-version table td:nth-child(2),
.mobile-version table th:nth-child(2) {
    width: 35%;
    text-align: center;
}

/* Smaller input fields for mobile */
.mobile-version input[type="number"] {
    width: 90px;
    padding: 5px;
    font-size: 15px;
    text-align: center;
}

/* Reduce table padding */
.mobile-version th,
.mobile-version td {
    padding: 6px;
}

/* Make buttons mobile-friendly */
.mobile-version button {
    width: 100%;
    margin: 8px 0;
    padding: 12px;
    font-size: 16px;
    border-radius: 8px;
}

@media (max-width: 600px) {
    .mobile-version table td:nth-child(1),
    .mobile-version table th:nth-child(1) {
        width: 50%;
    }

    .mobile-version table td:nth-child(2),
    .mobile-version table th:nth-child(2) {
        width: 50%;
    }

    .mobile-version input[type="number"] {
        width: 100%;
    }

    .mobile-version button {
        font-size: 18px;
    }
}
