*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: system-ui, sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    margin: 0;
    padding: 0;
}

header {
    background: #2c4a1e;
    color: white;
    padding: 1rem 2rem;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

main {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1rem;
    display: grid;
    gap: 1.5rem;
}

/* ── Add Expense form ─────────────────────────────── */
.add-expense {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.add-expense h2 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
}

#expense-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.field label {
    font-size: .85rem;
    font-weight: 600;
    color: #555;
}

.field input,
.field select {
    padding: .5rem .75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}

.field input:focus,
.field select:focus {
    outline: 2px solid #2c4a1e;
    outline-offset: 1px;
}

#expense-form button[type="submit"] {
    grid-column: 1 / -1;
    padding: .65rem 1.5rem;
    background: #2c4a1e;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

#expense-form button[type="submit"]:hover {
    background: #3a6328;
}

/* ── Summary bar ──────────────────────────────────── */
.expense-summary {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .75rem;
}

.totals {
    font-size: 1.1rem;
}

#total-amount {
    font-weight: 700;
    font-size: 1.3rem;
    color: #2c4a1e;
}

.currency-controls,
.filter-controls {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
}

/* ── Expense list ─────────────────────────────────── */
.expense-list {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.expense-list h2 {
    margin: 0 0 .75rem;
    font-size: 1.1rem;
}

#expense-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.expense-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 6px;
}

.expense-main {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.expense-desc {
    font-weight: 500;
}

.badge {
    font-size: .75rem;
    padding: .2rem .5rem;
    background: #e8f0e3;
    color: #2c4a1e;
    border-radius: 999px;
    font-weight: 600;
}

.expense-meta {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.expense-date {
    font-size: .85rem;
    color: #777;
}

.expense-amount {
    font-weight: 600;
    min-width: 4rem;
    text-align: right;
}

.btn-delete {
    border: none;
    background: none;
    color: #c00;
    cursor: pointer;
    font-size: .9rem;
    padding: .25rem;
    border-radius: 4px;
    line-height: 1;
}

.btn-delete:hover {
    background: #fee;
}

.empty-state {
    text-align: center;
    color: #888;
    padding: 2rem 0;
    font-style: italic;
}

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 540px) {
    #expense-form {
        grid-template-columns: 1fr;
    }

    .expense-item {
        flex-direction: column;
        align-items: flex-start;
        gap: .4rem;
    }
}