:root {
  --ink: #17252b; --soft: #5d6f76; --line: #dde4e3; --bg: #f4f6f5; --card: #fff;
  --brand: #0f5c55; --side: #102f33; --in: #137a45; --out: #b3382c;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
[hidden] { display: none !important; }
h1 { font-size: 1.5rem; margin: 0; } h2 { font-size: 1rem; margin: 0 0 .75rem; } h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
a { color: var(--brand); }
small { display: block; color: var(--soft); font-size: .8rem; }
.boot { padding: 2rem; }

button, .button, input, select { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: .45rem .75rem; background: var(--card); color: inherit; }
button, .button { cursor: pointer; text-decoration: none; font-weight: 500; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.link { border: 0; background: none; padding: 0; color: var(--brand); text-decoration: underline; }
.danger { color: var(--out); }
:focus-visible { outline: 2px solid #d99a1c; outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .75rem; min-width: 0; }
.field > span { font-size: .82rem; color: var(--soft); font-weight: 500; }
.field input, .field select { width: 100%; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .75rem; align-items: start; }
.check { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.form-error { color: var(--out); margin: .5rem 0 0; } .form-error:empty { display: none; }
.note { background: #fbf3dd; border-radius: 6px; padding: .6rem .8rem; overflow-wrap: anywhere; } .note:empty { display: none; }

.auth { max-width: 23rem; margin: 8vh auto; padding: 2rem; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.auth h1 { margin-bottom: 1.25rem; font-size: 1.3rem; }
.auth .primary { width: 100%; } .auth > .link { margin-top: 1rem; }
.brand { font: 700 1.35rem Georgia, serif; margin-bottom: 1rem; color: var(--brand); }

.shell { display: grid; grid-template-columns: 14rem minmax(0, 1fr); min-height: 100vh; }
aside { background: var(--side); color: #e4eeec; padding: 1.25rem 1rem; display: flex; flex-direction: column; gap: .5rem; position: sticky; top: 0; height: 100vh; }
aside .brand { color: #fff; }
aside select { width: 100%; background: #1c4247; border-color: #2f5a5f; color: #fff; }
nav { display: flex; flex-direction: column; gap: 2px; margin-top: .75rem; }
nav a { color: #c5d8d5; text-decoration: none; padding: .45rem .7rem; border-radius: 6px; }
nav a.active, nav a:hover { background: #1c4247; color: #fff; }
.who { margin-top: auto; } .who small { color: #a9c2be; text-transform: capitalize; } .who .link { color: #c5e5df; }
.shell > main { padding: 1.5rem 2rem 3rem; min-width: 0; }

.page-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.actions, .filters, .pager, .row-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters { align-items: flex-end; } .filters .field { margin: 0; }
.totals { color: var(--soft); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.narrow { max-width: 30rem; }
.stats, .accounts-strip, .grid3 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.grid3 { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.stat span, .account span { color: var(--soft); font-size: .85rem; }
.stat strong { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.account { text-decoration: none; color: inherit; border-left: 4px solid var(--brand); }
.account strong { display: block; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.bar-row { display: grid; grid-template-columns: 1fr auto; margin-bottom: .5rem; font-size: .9rem; }
.bar { grid-column: 1 / -1; height: 5px; background: #e8eeed; border-radius: 3px; } .bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .8rem; color: var(--soft); font-weight: 600; border-bottom: 1px solid var(--line); padding: .4rem .6rem; }
td { padding: .55rem .6rem; border-bottom: 1px solid #edf1f0; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { opacity: .55; }
.row-actions { flex-wrap: nowrap; justify-content: flex-end; }
.amount.income { color: var(--in); } .amount.expense { color: var(--out); }
.tag { font-size: .78rem; padding: .1rem .5rem; border-radius: 99px; background: #e9eef0; }
.tag.income { background: #e0f2e8; color: var(--in); } .tag.expense { background: #fae6e3; color: var(--out); }
.empty { color: var(--soft); margin: .5rem 0; }

dialog { width: min(34rem, calc(100vw - 2rem)); border: 0; border-radius: 12px; padding: 1.25rem; color: var(--ink); }
dialog::backdrop { background: rgb(10 30 33 / .55); }
dialog header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.toast { position: fixed; right: 1rem; bottom: 1rem; background: var(--side); color: #fff; padding: .7rem 1rem; border-radius: 8px; max-width: 22rem; z-index: 10; }
.toast.error { background: var(--out); }

@media (max-width: 760px) {
  .shell { display: block; }
  aside { position: static; height: auto; }
  nav { flex-direction: row; flex-wrap: wrap; }
  aside { padding: .75rem 1rem; }
  aside .brand { margin: 0; }
  nav { margin-top: 0; }
  .who { margin-top: 0; display: flex; gap: .6rem; align-items: baseline; }
  .shell > main { padding: 1rem; }
  .cols { grid-template-columns: 1fr; }
  thead { display: none; }
  table, tbody, tr, td { display: block; }
  tr { border-bottom: 1px solid var(--line); padding: .4rem 0; }
  td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .15rem 0; text-align: right; }
  td::before { content: attr(data-label); color: var(--soft); font-size: .8rem; text-align: left; }
  .num { white-space: normal; }
}
