:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --border: #e2e6ea;
    --text: #1f2933;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    padding-bottom: 16px;
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

main.container {
    padding-top: 28px;
    padding-bottom: 48px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-head h1 {
    margin: 0;
    font-size: 1.6rem;
}

.total-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    text-align: right;
}

.total-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.total-amount {
    font-size: 1.4rem;
    font-weight: 700;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-bar label {
    font-weight: 600;
    font-size: 0.9rem;
}

.expense-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.expense-table th,
.expense-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.expense-table thead th {
    background: #f9fafb;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.expense-table tbody tr:last-child td {
    border-bottom: none;
}

.align-right {
    text-align: right;
}

.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.actions form {
    margin: 0;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: var(--muted);
}

.tag-food { background: #16a34a; }
.tag-transport { background: #2563eb; }
.tag-bills { background: #d97706; }
.tag-other { background: #6b7280; }

.empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    color: var(--muted);
}

.btn {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: #eef1f4;
    line-height: 1.2;
}

.btn-small {
    padding: 6px 10px;
    font-size: 0.8rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-muted {
    background: #eef1f4;
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #b91c1c;
}

.expense-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 520px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.field input,
.field select,
.filter-bar select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: #fff;
}

.filter-bar select {
    width: auto;
    min-width: 180px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.alert-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-error ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.85rem;
}

.site-footer .container {
    padding-top: 16px;
    padding-bottom: 16px;
}
