* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    margin: 0;
    background: #f4f6fa;
    color: #1f2937;
}
a { color: #1d4ed8; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    color: #fff;
    padding: 0.75rem 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.topbar .brand a { color: #fff; font-weight: 700; font-size: 1.05rem; }
.topbar nav { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: #cbd5e1; }
.topbar nav a:hover { color: #fff; text-decoration: none; }
.topbar .user { color: #94a3b8; font-size: 0.9rem; }

.container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

h1, h2, h3 { color: #0f172a; }
h1 { margin-top: 0; }

.card {
    background: #fff;
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: 0 1px 3px rgba(15,23,42,0.06);
    margin-bottom: 1.25rem;
}
.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 720px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.stat { display: flex; flex-direction: column; gap: 0.25rem; }
.stat .label { color: #64748b; font-size: 0.85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; }
.stat.income .value  { color: #15803d; }
.stat.expense .value { color: #b91c1c; }
.stat.balance .value { color: #0f172a; }

table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    font-size: 0.93rem;
}
th { background: #f8fafc; color: #475569; font-weight: 600; }
tr.voided td { color: #94a3b8; text-decoration: line-through; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.badge.income  { background: #dcfce7; color: #166534; }
.badge.expense { background: #fee2e2; color: #991b1b; }
.badge.paid    { background: #dcfce7; color: #166534; }
.badge.unpaid  { background: #fef3c7; color: #92400e; }
.badge.voided  { background: #e2e8f0; color: #475569; }

form label { display: block; margin: 0.5rem 0 0.25rem; color: #334155; font-size: 0.9rem; }
form input[type=text],
form input[type=password],
form input[type=number],
form input[type=date],
form input[type=month],
form input[type=file],
form select,
form textarea {
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    background: #fff;
}
form textarea { min-height: 80px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }

.btn {
    display: inline-block;
    background: #1d4ed8;
    color: #fff;
    padding: 0.55rem 1rem;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
}
.btn:hover { background: #1e40af; text-decoration: none; color: #fff; }
.btn.secondary { background: #475569; }
.btn.danger    { background: #b91c1c; }
.btn.ghost     { background: transparent; color: #1d4ed8; border: 1px solid #1d4ed8; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.flash-info    { background: #dbeafe; color: #1e3a8a; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error   { background: #fee2e2; color: #991b1b; }

.toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.toolbar label { margin: 0; }

.footer {
    text-align: center;
    color: #64748b;
    padding: 1.5rem 1rem 2rem;
    font-size: 0.85rem;
}

.muted { color: #64748b; }
.right { text-align: right; }
.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
