:root {
  --bg: #0a0e14;
  --panel: #111722;
  --line: #233044;
  --txt: #e6edf7;
  --muted: #94a3b8;
  --teal: #2dd4bf;
  --violet: #a78bfa;
  --amber: #fbbf24;
  --red: #fca5a5;
  --green: #4ade80;
}

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
  padding: 24px clamp(14px, 4vw, 56px);
}
main { max-width: 1280px; margin: 0 auto; }
header, footer { max-width: 1280px; margin-left: auto; margin-right: auto; }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 6px; }

header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; letter-spacing: 0.5px; font-size: 13px;
  background: linear-gradient(135deg, var(--teal), var(--violet)); color: #06121a;
}
h1 { font-size: 20px; font-weight: 700; }
.sub { color: var(--muted); font-size: 13px; }
.head-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status { font-size: 13px; color: var(--muted); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; max-width: 60ch; }
.status.ok { color: var(--green); border-color: #4ade8055; }
.status.err { color: var(--red); border-color: #fca5a566; border-radius: 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px;
}
.k-label { font-size: 12px; color: var(--muted); }
.k-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi.warn { border-color: #fbbf2466; }
.kpi.warn .k-value { color: var(--amber); }
.note { color: var(--amber); font-size: 13px; margin: -6px 0 18px; }
.bank-run { margin: -6px 0 18px; }
.bank-run.bad { color: var(--red); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
h2 { font-size: 16px; font-weight: 600; }
h2 small { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: 13px; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); font-size: 13px; }
.bad { color: var(--red); font-size: 13px; }
.pad { padding: 8px 0; }
.strong { font-weight: 700; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

/* money in and out */
.key { display: flex; gap: 18px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.sw.in, .bar.in { background: var(--teal); fill: var(--teal); }
.sw.out, .bar.out { background: var(--violet); fill: var(--violet); }
#flow svg { width: 100%; height: auto; max-height: 320px; display: block; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.axis { fill: var(--muted); font-size: 11px; }
.net { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.net.up { fill: var(--green); }
.net.dn { fill: var(--amber); }
.bar:hover { filter: brightness(1.25); }
details.numbers { margin-top: 8px; }
summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 4px 0; }
summary:hover { color: var(--txt); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; font-weight: 400; }
thead th { color: var(--muted); font-size: 12px; }
td.num, th.num { text-align: right; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }
th.who { font-weight: 600; overflow-wrap: anywhere; }
.amt-warn { color: var(--amber); }

/* approvals */
.pending { border: 1px solid var(--line); border-left: 3px solid var(--amber); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.pending details { margin: 6px 0; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 6px 0 2px; font-size: 13px; }
dt { color: var(--muted); }
dd { overflow-wrap: anywhere; }
pre {
  background: #0a0f16; border-radius: 8px; padding: 8px 10px; overflow: auto;
  font: 12px/1.4 ui-monospace, Consolas, monospace; color: var(--muted); max-height: 220px; white-space: pre-wrap;
}
.row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }

button {
  border: 1px solid transparent; border-radius: 8px; padding: 8px 16px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
button:hover:not(:disabled) { filter: brightness(1.12); }
button:disabled { opacity: 0.5; cursor: default; }
button.approve { background: var(--teal); color: #06121a; }
button.deny, button.quiet { background: transparent; border-color: var(--line); color: var(--txt); }
button.quiet { font-weight: 400; padding: 6px 12px; }

/* activity */
.audit { font-size: 13px; max-height: 360px; overflow: auto; }
.audit .line { display: grid; grid-template-columns: 9.5em 1fr auto; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--line); align-items: baseline; }
.audit .line.failed { grid-template-columns: 9.5em 1fr; }
.audit .line.failed .bad { grid-column: 2; overflow-wrap: anywhere; }
.audit .ts { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit .ok { color: var(--muted); }
.tag { margin-left: 8px; font-size: 11px; color: var(--amber); border: 1px solid #fbbf2455; border-radius: 999px; padding: 0 7px; }

dialog {
  margin: auto; background: var(--panel); color: var(--txt); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; width: min(420px, calc(100vw - 32px));
}
dialog::backdrop { background: #000a; }
dialog form { display: grid; gap: 12px; }
input {
  background: #0a0f16; color: var(--txt); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; width: 100%;
}

footer { color: var(--muted); font-size: 12px; text-align: center; margin-top: 8px; }

@media (prefers-reduced-motion: no-preference) {
  button { transition: filter 0.15s ease; }
}
