* { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f4f1ea;
    color: #2f2a20;
    margin: 0;
    padding: 0;
}

header {
    background: #4a5c3d;
    color: #fff;
    padding: 18px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

header h1 {
    margin: 0;
    font-size: 1.4em;
}

header h1::before {
    content: "🐑 ";
}

nav a {
    color: #f4f1ea;
    text-decoration: none;
    margin-left: 20px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

nav a:hover, nav a.active {
    background: rgba(255,255,255,0.18);
}

.container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 20px 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.summary-box {
    padding: 18px;
    border-radius: 10px;
    color: #fff;
    text-align: center;
}

.summary-box .label {
    font-size: 0.85em;
    opacity: 0.9;
    margin-bottom: 6px;
}

.summary-box .value {
    font-size: 1.5em;
    font-weight: bold;
}

.bg-income { background: #4a7c3d; }
.bg-expense { background: #a13d3d; }
.bg-balance-pos { background: #3d6a7c; }
.bg-balance-neg { background: #8a5a2b; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e0d5;
}

th {
    background: #ece7d9;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

tr:hover { background: #faf9f4; }

.amount-income { color: #2e6b1f; font-weight: 600; }
.amount-expense { color: #a13d3d; font-weight: 600; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    color: #fff;
}

.badge-income { background: #4a7c3d; }
.badge-expense { background: #a13d3d; }

form label {
    display: block;
    margin-top: 14px;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.92em;
}

form input[type=text],
form input[type=number],
form input[type=date],
form select,
form textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #ccc4b0;
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
}

.type-toggle {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.type-toggle label {
    flex: 1;
    text-align: center;
    padding: 12px;
    border: 2px solid #ccc4b0;
    border-radius: 8px;
    cursor: pointer;
    margin: 0;
    font-weight: 600;
}

.type-toggle input { display: none; }

.type-toggle input:checked + span,
.type-toggle label:has(input:checked) {
    border-color: transparent;
}

.type-toggle label.income-label:has(input:checked) {
    background: #e3f0dd; border-color: #4a7c3d; color: #2e6b1f;
}
.type-toggle label.expense-label:has(input:checked) {
    background: #f5e3e3; border-color: #a13d3d; color: #a13d3d;
}

button, .btn {
    display: inline-block;
    margin-top: 20px;
    background: #4a5c3d;
    color: #fff;
    border: none;
    padding: 11px 22px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

button:hover, .btn:hover { background: #3a4a30; }

.btn-danger { background: #a13d3d; }
.btn-danger:hover { background: #832f2f; }

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: end;
    margin-bottom: 15px;
}

.filters > div { display: flex; flex-direction: column; }
.filters label { font-size: 0.85em; font-weight: 600; margin-bottom: 4px; }
.filters select { padding: 7px 9px; border-radius: 6px; border: 1px solid #ccc4b0; }

.empty-state {
    text-align: center;
    padding: 30px;
    color: #8a8471;
}

.flash {
    background: #e3f0dd;
    color: #2e6b1f;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.action-link {
    color: #a13d3d;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
}
.action-link:hover { text-decoration: underline; }

.year-select {
    padding: 7px 10px;
    border-radius: 6px;
    border: 1px solid #ccc4b0;
}
