:root {
  --paper: #f4f0e6;
  --ink: #1c1915;
  --muted: #6d675f;
  --line: #ddd6c8;
  --card: #fffdf8;
  --covered: #1d6b45;
  --short: #8d2f22;
  --short-bg: #f8ebe4;
  --reserved-bg: #e7f0ea;
  --focus: #1c1915;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Figtree", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body::before {
  content: "";
  display: block;
  height: 6px;
  background: var(--ink);
}

.top, main, footer {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem 0 1rem;
  align-items: end;
}

.kicker {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

h1, h2, .balance, .verdict {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 560;
  letter-spacing: -0.02em;
}

h1 { margin: 0; font-size: 3.2rem; line-height: 0.95; }
h2 { margin: 0; font-size: 1.7rem; }

.deck { max-width: 42rem; color: var(--muted); margin: 0.7rem 0 0; }
.nav { display: flex; gap: 1rem; margin-top: 0.85rem; }
.nav a { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { border-bottom: 1px solid var(--ink); }
.filters label.check { display: flex; flex-direction: row; align-items: center; gap: 0.45rem; color: var(--ink); min-width: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; justify-content: flex-end; }
.synced { margin: 0; color: var(--muted); font-size: 0.92rem; width: 100%; text-align: right; }

button, select, input {
  font: inherit;
  color: inherit;
}

button {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
}

button.secondary { background: transparent; color: var(--ink); }
button:disabled { opacity: 0.55; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

main { display: grid; gap: 2rem; padding-bottom: 3rem; }
section, .statement {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem 1.1rem 1.2rem;
}

.section-head, .filters, .dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
}

.filters { flex-wrap: wrap; margin: 0.8rem 0; align-items: end; }
.filters label, .grow { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.grow { flex: 1; }

input, select {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  min-width: 10rem;
}
input[type="checkbox"] { min-width: 1rem; width: 1rem; height: 1rem; padding: 0; }

.note, .count, footer p { color: var(--muted); }
.note { margin-top: 0.35rem; }
.verdict { font-size: 1.35rem; margin: 0.8rem 0 0.2rem; }
.verdict.short { color: var(--short); }
.verdict.ok { color: var(--covered); }

.accounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 0.8rem; }
.stack { display: contents; }
.card, .empty {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: var(--paper);
}
.card header, .bank {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
.card header img, .bank img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 8px;
  background: white;
}
.balance { font-size: 2rem; margin: 0.7rem 0 0.15rem; }
.balance.negative { color: var(--short); }
.meta { margin: 0.15rem 0; color: var(--muted); font-size: 0.92rem; }
.card .row { display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; margin-top: 0.8rem; }
.warn { color: var(--short); }

.table-wrap { overflow-x: auto; max-width: 100%; }
section, .statement { min-width: 0; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
table.cover { table-layout: fixed; min-width: 880px; }
th, td { padding: 0.65rem 0.45rem; text-align: left; vertical-align: baseline; }
th {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
  font-weight: 650;
  white-space: nowrap;
}
td { border-bottom: 1px solid var(--line); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.short td { background: var(--short-bg); }
tr.reserved td { background: var(--reserved-bg); }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  font-size: 0.78rem;
  border: 1px solid var(--line);
}
.pill.short { color: var(--short); border-color: #e3c2b8; }
.pill.covered, .pill.reserved { color: var(--covered); border-color: #b7d4c4; }
.sub { display: block; color: var(--muted); font-size: 0.85rem; }

.banner {
  width: min(1120px, calc(100% - 2rem));
  margin: 0.5rem auto 0;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: #f8ebe4;
  color: var(--short);
}

.banks { display: grid; gap: 0.35rem; max-height: 320px; overflow: auto; margin-top: 0.4rem; }
.bank {
  width: 100%;
  border-radius: 12px;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: 1px solid transparent;
}
.bank:hover { border-color: var(--line); background: var(--paper); }
.bank small { display: block; color: var(--muted); }
.sandbox { margin-top: 0.8rem; }

dialog {
  width: min(560px, calc(100% - 2rem));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  padding: 1rem;
}
dialog::backdrop { background: rgba(28, 25, 21, 0.45); }
.dialog-head p { color: var(--muted); margin: 0.3rem 0 0; }

.statement summary { cursor: pointer; font-family: "Fraunces", Georgia, serif; font-size: 1.4rem; }
footer { padding-bottom: 2rem; }
footer a { color: var(--ink); }

.login-wrap {
  min-height: calc(100vh - 6px);
  display: grid;
  place-items: center;
  padding: 1.5rem 0 3rem;
}
.login {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem;
  display: grid;
  gap: 0.8rem;
}
.login h1 { font-size: 2.6rem; }
.login label { display: grid; gap: 0.3rem; color: var(--muted); }
.login input { width: 100%; min-width: 0; }
.login .banner { width: auto; margin: 0; }
#otp-step, #password-step { display: grid; gap: 0.7rem; }
#otp-step[hidden], #password-step[hidden] { display: none; }

@media (max-width: 760px) {
  .top { flex-direction: column; align-items: start; }
  .synced { text-align: left; }
  h1 { font-size: 2.5rem; }
  .actions { justify-content: flex-start; }
  .section-head { flex-wrap: wrap; }
  .section-head h2 { width: 100%; }
}
