  :root { --bg:#f6f7f8; --card:#fff; --text:#16191d; --muted:#5f6977; --line:#e3e6ea;
          --accent:#0f766e; --on-accent:#fff; --ok:#15803d; --bad:#b91c1c; --warn:#b45309;
          --warn-bg:#fff4e0; --bad-bg:#fdecec; --ok-bg:#e6f5ea; --rule-bg:#e8eef9; --rule:#3556a8;
          --on-bad:#fff; }
  @media (prefers-color-scheme: dark) {
    :root { --bg:#0e1113; --card:#171b1f; --text:#e8ebee; --muted:#9aa4b0; --line:#262c32;
            --accent:#2dd4bf; --on-accent:#06201c; --ok:#4ade80; --bad:#f87171; --warn:#fbbf24;
            --warn-bg:#2a2111; --bad-bg:#2b1618; --ok-bg:#12261a; --rule-bg:#17203a; --rule:#8fb0ff;
            --on-bad:#2b0a0a; color-scheme: dark; }
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  body { margin:0; background:var(--bg); color:var(--text);
         font:16px/1.4 -apple-system, system-ui, sans-serif;
         padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
         overscroll-behavior-y: contain; overflow-x: clip; touch-action: pan-y pinch-zoom; }
  main { padding:16px; max-width:640px; margin:0 auto; }
  h1 { font-size:22px; margin:8px 0 16px; }
  .card { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:14px; margin-bottom:12px; }
  .card.fail { border-left:4px solid var(--bad); }
  .cardbtn { cursor:pointer; }
  .row { display:flex; justify-content:space-between; align-items:center; gap:12px; }
  .row > * { min-width:0; }
  .muted { color:var(--muted); font-size:14px; }
  .fine { font-size:12px; }
  .sec { font-size:13px; color:var(--muted); margin:16px 0 6px; }
  .hint { margin-top:6px; }
  .amount { font-variant-numeric: tabular-nums; white-space:nowrap; }
  .amount.in { color:var(--ok); }
  button, input { font:inherit; touch-action: manipulation; }
  button:focus-visible, input:focus-visible, [role="button"]:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
  .act { min-height:44px; padding:8px 14px; border-radius:12px; border:1px solid var(--line); background:var(--card);
         color:var(--text); cursor:pointer; display:flex; align-items:center; justify-content:center;
         text-align:center; width:100%; line-height:1.25; }
  .act.main { background:var(--accent); color:var(--on-accent); border:0; font-weight:600; font-size:18px; min-height:52px; }
  .act.fill { background:var(--accent); color:var(--on-accent); border:0; font-weight:600; }
  .act.ghost { background:none; }
  .act.text { border:0; background:none; color:var(--muted); }
  .act.danger { color:var(--bad); border-color:var(--bad); background:none; }
  .act.compact { width:auto; min-height:36px; padding:4px 12px; }
  .act:disabled { opacity:.6; cursor:default; }
  .actions { display:flex; flex-direction:column; gap:8px; margin-top:10px; }
  .pill { display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:999px; font-size:12px; font-weight:600; white-space:nowrap; }
  .p-ok { background:var(--ok-bg); color:var(--ok); }
  .p-bad { background:var(--bad-bg); color:var(--bad); }
  .p-warn { background:var(--warn-bg); color:var(--warn); }
  .p-rule { background:var(--rule-bg); color:var(--rule); }
  .note { border-radius:10px; padding:10px 12px; font-size:14px; margin:8px 0; border-left:3px solid transparent; }
  .n-warn { background:var(--warn-bg); border-left-color:var(--warn); }
  .n-bad { background:var(--bad-bg); border-left-color:var(--bad); }
  .n-ok { background:var(--ok-bg); border-left-color:var(--ok); }
  .linkbtn { background:none; border:0; color:var(--accent); font-weight:600; padding:8px 0 8px 8px; min-height:44px; cursor:pointer; }
  pre { white-space:pre-wrap; word-break:break-word; font-size:12px; margin:8px 0 0; padding:8px; background:var(--bg); border-radius:8px; max-height:50vh; overflow:auto; }
  label { display:block; margin-top:8px; }
  input { width:100%; padding:12px; border-radius:10px; border:1px solid var(--line); background:var(--card); color:var(--text); margin:6px 0 12px; }
  .picker { margin-top:10px; }
  .picker input { margin-bottom:4px; }
  .pick-list { max-height:50vh; overflow:auto; overscroll-behavior:contain; }
  .pick { justify-content:flex-start; text-align:left; border:0; }
  .pick-list .sec { margin:10px 0 0; }
  .done { color:var(--muted); font-size:14px; padding:6px 2px; }
  nav { position:fixed; bottom:0; left:0; right:0; display:flex; background:var(--card); border-top:1px solid var(--line);
        padding-bottom:env(safe-area-inset-bottom); }
  nav button { flex:1; position:relative; display:flex; flex-direction:column; align-items:center; gap:2px; padding:8px 0 6px;
               min-height:52px; border:0; background:none; color:var(--muted); font-size:11px; cursor:pointer; }
  nav button[aria-current="page"] { color:var(--accent); font-weight:600; }
  nav svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
  .badge { position:absolute; top:2px; left:calc(50% + 6px); min-width:16px; height:16px; padding:0 4px; border-radius:8px;
           background:var(--bad); color:var(--on-bad); font-size:10px; font-weight:700; display:flex; align-items:center; justify-content:center; }
  select { width:100%; padding:12px; border-radius:10px; border:1px solid var(--line); background:var(--card); color:var(--text); margin:6px 0 12px; font:inherit; }
  .chips { display:flex; gap:8px; margin-bottom:8px; }
  .chip { min-height:36px; padding:4px 14px; border-radius:999px; border:1px solid var(--line); background:var(--card); color:var(--text); cursor:pointer; }
  .chip[aria-pressed="true"] { background:var(--accent); color:var(--on-accent); border-color:transparent; font-weight:600; }
  .skeleton .bar { height:12px; border-radius:6px; background:var(--line); margin:10px 0; animation:pulse 1.2s ease-in-out infinite; }
  .skeleton .bar.short { width:40%; }
  @keyframes pulse { 50% { opacity:.45; } }
  @media (prefers-reduced-motion: reduce) { .skeleton .bar { animation:none; } }
  .stale { opacity:.55; }
  .ptr { position:fixed; top:calc(env(safe-area-inset-top) + 8px); left:50%; transform:translate(-50%, -80px); padding:6px 14px; border-radius:999px;
         background:var(--card); border:1px solid var(--line); font-size:13px; color:var(--muted); pointer-events:none; z-index:5; }
  .ptr.ready { color:var(--accent); font-weight:600; }
  .status-line, .spaced { margin-top:8px; }
  .summary { display:flex; justify-content:space-between; align-items:center; gap:8px; position:sticky; top:0; z-index:3;
             background:var(--bg); padding:8px 0; font-size:14px; color:var(--muted); }
  details { margin:12px 0; }
  summary { cursor:pointer; min-height:44px; display:flex; align-items:center; color:var(--muted); }
  .snackbar { position:fixed; left:16px; right:16px; bottom:calc(64px + env(safe-area-inset-bottom)); max-width:608px; margin:0 auto; z-index:6;
              display:flex; justify-content:space-between; align-items:center; gap:12px; padding:6px 8px 6px 16px;
              border-radius:12px; background:var(--text); color:var(--bg); box-shadow:0 6px 20px rgba(0,0,0,.25); }
  .snack-btn { background:none; border:0; color:inherit; font-weight:700; min-height:44px; padding:0 12px; cursor:pointer; }
  [hidden] { display:none !important; }
