:root {
  --bg: #f4f6f8; --fg: #0f172a; --muted: #5b6474; --card: #ffffff; --line: #e2e8f0;
  --accent: #0f766e; --accent-fg: #ffffff; --danger: #b91c1c; --warn-bg: #fef3c7; --warn-fg: #7c2d12;
  --ok: #15803d; --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1120; --fg: #e5e7eb; --muted: #9aa4b2; --card: #111827; --line: #1f2937;
    --accent: #14b8a6; --accent-fg: #042f2e; --danger: #f87171; --warn-bg: #422006; --warn-fg: #fde68a; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; padding-bottom: calc(24px + var(--safe-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; flex: 1; }
.brand img { border-radius: 7px; }
main { max-width: 560px; margin: 0 auto; padding: 8px 16px; }
h1 { font-size: 26px; margin: 14px 0 8px; }
h2 { font-size: 17px; margin: 0; }
h3 { font-size: 18px; margin: 8px 0 4px; line-height: 1.3; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.gap { gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.list, .plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 8px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.plain li:last-child { border-bottom: 0; }
label { font-weight: 600; font-size: 14px; }
input, textarea {
  font: inherit; font-size: 16px; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); width: 100%;
}
.btn {
  font: inherit; font-size: 16px; font-weight: 600; min-height: 48px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger-outline { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.icon-btn { background: none; border: 0; color: var(--fg); width: 44px; height: 44px; border-radius: 12px; cursor: pointer; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--line); color: var(--muted); }
.pill[data-state="live"] { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill[data-state="poll"] { background: var(--warn-bg); color: var(--warn-fg); }
.badge { min-width: 30px; text-align: center; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); }
.empty { text-align: center; color: var(--muted); padding: 48px 12px; border: 1px dashed var(--line); border-radius: var(--radius); }
.tag { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.expiry { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.expiry.soon { color: var(--danger); font-weight: 600; }
.amount { font-size: 30px; font-weight: 800; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 14px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.meta a { color: var(--accent); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.actions .btn { min-height: 52px; }
.approval.focus { outline: 3px solid var(--accent); outline-offset: 2px; }
.approval.busy { opacity: .7; }
.warn { background: var(--warn-bg); color: var(--warn-fg); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.error { color: var(--danger); margin: 0; font-size: 14px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + var(--safe-bottom));
  max-width: calc(100% - 32px); background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 12px;
  font-size: 15px; box-shadow: 0 8px 24px rgb(0 0 0 / .25); z-index: 20;
}
.toast[data-kind="error"] { background: var(--danger); color: #fff; }
.toast[data-kind="ok"] { background: var(--ok); color: #fff; }
dialog { border: 0; border-radius: var(--radius); padding: 18px; width: min(92vw, 420px); background: var(--card); color: var(--fg); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
