:root {
  --bg: #f4f5f7; --card: #fff; --ink: #1c2530; --muted: #6b7683;
  --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --line: #e5e8ec; --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 76px;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 12px; }
h1 { font-size: 20px; margin: 8px 0 2px; }
h2 { font-size: 16px; margin: 18px 0 8px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 1px 3px rgba(20,30,50,.07); margin-bottom: 10px;
}
.hero { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .stat { flex: 1 1 150px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--muted); }
.v.ok { color: var(--ok); } .v.warn { color: var(--warn); } .v.bad { color: var(--bad); }

.cat { padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.cat:last-child { border-bottom: 0; }
.cat .row1 { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.cat .nums { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat .nums b { color: var(--ink); }
.bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); }
.cat .note { font-size: 12px; color: var(--muted); margin-top: 4px; display: none; }
.cat.open .note { display: block; }

.tx { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tx:last-child { border-bottom: 0; }
.tx .amt { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tx .meta { color: var(--muted); font-size: 12px; }
.tx.pending { opacity: .6; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 9px; background: var(--line); color: var(--muted); }
.badge.urgent { background: #fee2e2; color: var(--bad); }
.badge.approval { background: #fef3c7; color: var(--warn); }
.badge.approved { background: #dcfce7; color: var(--ok); }
.badge.rejected { background: #fee2e2; color: var(--bad); }

button, .btn {
  font: inherit; border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer;
  background: var(--accent); color: #fff; font-size: 14px;
}
button.ghost { background: transparent; color: var(--accent); padding: 6px 8px; }
button.small { padding: 5px 10px; font-size: 13px; }
button.danger { background: transparent; color: var(--bad); }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; margin-bottom: 8px;
}
.formrow { display: flex; gap: 8px; } .formrow > * { flex: 1; }

.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; display: flex;
  background: var(--card); border-top: 1px solid var(--line); z-index: 5;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button { flex: 1; background: none; color: var(--muted); border-radius: 0; padding: 10px 2px 12px; font-size: 12px; }
.tabs button.active { color: var(--accent); font-weight: 600; }
.tabs .ico { display: block; font-size: 20px; }

.fab {
  position: fixed; right: 18px; bottom: 76px; width: 56px; height: 56px; border-radius: 50%;
  font-size: 28px; line-height: 0; box-shadow: 0 4px 12px rgba(37,99,235,.4); z-index: 6;
}
.page { display: none; } .page.active { display: block; }
dialog {
  border: 0; border-radius: var(--radius); padding: 16px; width: min(94vw, 420px);
  box-shadow: 0 8px 30px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(15,23,42,.45); }
.comment { border-left: 3px solid var(--line); margin: 6px 0 0 4px; padding: 4px 8px; font-size: 13px; }
.comment .agent { color: var(--accent); margin-top: 3px; }
.muted { color: var(--muted); font-size: 13px; }
.spark { width: 100%; height: 130px; }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 130px;
  background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 10px;
  font-size: 14px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 9;
}
#toast.show { opacity: .95; }
@media (min-width: 700px) {
  body { padding-bottom: 20px; }
  .tabs { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
  .fab { bottom: 24px; }
}
.login-box { max-width: 340px; margin: 18vh auto; }
