* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f3f4f6;
    color: #222;
}

header {
    background: #202938;
    color: white;
    padding: 18px 5%;
    display: flex;
    align-items: center;
    gap: 20px;
}

header h1 {
    margin: 0;
}

header span {
    margin-left: auto;
}

main {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 15px;
}

.card {
    background: white;
    padding: 22px;
    margin-bottom: 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.auth-forms {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

input, select, button {
    padding: 11px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 14px;
}

input, select {
    width: 100%;
    margin-bottom: 10px;
}

button {
    cursor: pointer;
    background: #2563eb;
    color: white;
    border: none;
}

button:hover {
    background: #1d4ed8;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

form {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.stats > div {
    background: #f3f4f6;
    padding: 15px;
    border-radius: 6px;
}

.stats h2 {
    font-size: 22px;
    overflow-wrap: anywhere;
}

small {
    color: #666;
}

.controls {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.controls input,
.controls select {
    flex: 1;
    min-width: 120px;
}

#custom-dates {
    display: flex;
    gap: 10px;
}

.expense-item,
.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid #eee;
}

.expense-item button,
.category-item button {
    background: #dc2626;
}

.expense-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.expense-amount {
    font-weight: bold;
}

.category-stat {
    margin: 12px 0;
}

.progress {
    height: 9px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background: #2563eb;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

#message {
    padding: 12px;
    margin: 15px 0;
    border-radius: 5px;
}

#message:empty {
    display: none;
}

#message.success {
    background: #dcfce7;
    color: #166534;
}

#message.error {
    background: #fee2e2;
    color: #991b1b;
}

footer {
    text-align: center;
    padding: 25px;
    color: #777;
}

[hidden] {
    display: none !important;
}

@media (max-width: 650px) {
    .auth-forms {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    header {
        flex-wrap: wrap;
    }

    #custom-dates {
        flex-direction: column;
    }
}