:root {
  --bg: #f6f7fb; --bg2: #ffffff; --ink: #111827; --ink2: #4b5563; --muted: #6b7280; --line: #e5e7eb;
  --brand: #5b5bf7; --brand2: #7c3aed; --brand-ink: #fff;
  --pos: #059669; --neg: #dc2626; --wait: #b45309;
  --okbg: #dcfce7; --okfg: #166534; --waitbg: #fef3c7; --waitfg: #92400e; --badbg: #fee2e2; --badfg: #991b1b;
  --base: #2563eb; --eth: #6366f1; --btc: #f59e0b;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 6px 24px rgba(16,24,40,.06);
  --r: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b0d12; --bg2: #141821; --ink: #f3f4f6; --ink2: #c7cbd4; --muted: #8b93a3; --line: #252b38;
  --okbg: #0f2e1d; --okfg: #6ee7a8; --waitbg: #33270b; --waitfg: #fcd34d; --badbg: #3a1517; --badfg: #fca5a5;
  --pos: #34d399; --neg: #f87171; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.35); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0b0d12; --bg2: #141821; --ink: #f3f4f6; --ink2: #c7cbd4; --muted: #8b93a3; --line: #252b38;
  --okbg: #0f2e1d; --okfg: #6ee7a8; --waitbg: #33270b; --waitfg: #fcd34d; --badbg: #3a1517; --badfg: #fca5a5;
  --pos: #34d399; --neg: #f87171; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 30px rgba(0,0,0,.35); color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; word-break: break-all; }
.muted { color: var(--muted); } .small { font-size: .85rem; }

.top { position: relative; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand2)); font-weight: 800; }
.ghost-btn { background: transparent; border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 7px 12px; cursor: pointer; font: inherit; font-size: .9rem; }
.ghost-btn:hover { background: var(--bg2); }

.hero { text-align: center; padding: 56px 0 24px; transition: padding .25s; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -.03em; line-height: 1.1; margin: 0 0 14px;
  background: linear-gradient(135deg, var(--ink) 30%, var(--brand)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--ink2); max-width: 600px; margin: 0 auto 26px; font-size: 1.08rem; }
body.has-results .hero { padding: 24px 0 8px; }
body.has-results .hero h1, body.has-results .lede { display: none; }
.paste { display: flex; gap: 10px; background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 10px; box-shadow: var(--shadow); max-width: 760px; margin: 0 auto; }
.paste:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent), var(--shadow); }
.paste textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; color: var(--ink); font: 500 1.05rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 10px 8px; min-height: 52px; }
.paste textarea::placeholder { font-family: ui-sans-serif, -apple-system, "Segoe UI", Inter, Arial, sans-serif; color: var(--muted); }
.primary { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: var(--brand-ink); border: 0; border-radius: 14px; padding: 0 22px; font: 600 1rem/1 inherit; font-family: inherit; cursor: pointer; min-height: 48px; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.primary:hover { filter: brightness(1.07); text-decoration: none; }
.primary:disabled { opacity: .7; cursor: default; }
.primary.sm { min-height: 38px; padding: 0 16px; font-size: .92rem; border-radius: 11px; }
.safe { color: var(--muted); font-size: .9rem; margin: 14px 0 0; }

.status { max-width: 760px; margin: 16px auto; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg2); }
.status.error { background: var(--badbg); color: var(--badfg); border-color: transparent; }

#results { padding: 10px 0 40px; }
.loading-card { display: flex; gap: 14px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin: 18px 0; box-shadow: var(--shadow); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--brand) 25%, transparent); border-top-color: var(--brand); animation: spin .8s linear infinite; flex: none; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { height: 72px; border-radius: 14px; margin: 10px 0; background: linear-gradient(90deg, var(--bg2) 0%, var(--line) 50%, var(--bg2) 100%); background-size: 200% 100%; animation: sh 1.3s infinite; opacity: .7; }
@keyframes sh { to { background-position: -200% 0; } }

.addr-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; flex-wrap: wrap; margin: 18px 0 14px; }
.label-sm { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.addr { font-size: 1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chains { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.bal { text-align: right; }
.big { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.big small { font-size: .9rem; color: var(--muted); font-weight: 600; }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.achip { background: color-mix(in srgb, var(--brand) 9%, transparent); border-radius: 999px; padding: 3px 10px; font-size: .92rem; white-space: nowrap; }
.achip i { font-style: normal; color: var(--muted); font-size: .75rem; margin-left: 5px; }
.date { font-weight: 600; font-size: 1.05rem; }
.note { color: var(--muted); font-size: .88rem; margin: 10px 2px 0; }
.hidden-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--waitbg); color: var(--waitfg); border-radius: 14px; padding: 10px 14px; margin-top: 14px; font-size: .94rem; flex-wrap: wrap; }
.hidden-bar .ghost-btn { border-color: currentColor; color: inherit; }
.tzline { margin: 14px 2px 0; }

.month { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 4px 8px; }
.group { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; cursor: pointer; }
.row-main:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.row-main:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.25rem; font-weight: 700; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink2); }
.k-receive .ico, .ico.k-receive, .k-withdraw .ico, .ico.k-withdraw { background: color-mix(in srgb, var(--pos) 14%, transparent); color: var(--pos); }
.k-send .ico, .ico.k-send, .k-deposit .ico, .ico.k-deposit { background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--brand); }
.k-swap .ico, .ico.k-swap { background: color-mix(in srgb, #0ea5e9 15%, transparent); color: #0ea5e9; }
.k-approve .ico, .ico.k-approve { background: color-mix(in srgb, #f59e0b 16%, transparent); }
.k-failed .ico, .ico.k-failed { background: var(--badbg); color: var(--badfg); }
.mid { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hl { font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.amt { text-align: right; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amt small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.amt .muted { font-weight: 500; }
.pos { color: var(--pos); } .neg { color: var(--ink); }
.chip { font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink2); background: var(--bg2); }
.chip.dim { opacity: .55; }
.chain-base { color: var(--base); border-color: color-mix(in srgb, var(--base) 35%, transparent); }
.chain-eth { color: var(--eth); border-color: color-mix(in srgb, var(--eth) 35%, transparent); }
.chain-btc { color: var(--btc); border-color: color-mix(in srgb, var(--btc) 40%, transparent); }
.warnchip { background: var(--badbg); color: var(--badfg); border-color: transparent; vertical-align: 1px; }
.pill { font-size: .74rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.pill.ok { background: var(--okbg); color: var(--okfg); } .pill.wait { background: var(--waitbg); color: var(--waitfg); } .pill.bad { background: var(--badbg); color: var(--badfg); }
.flagged .hl { color: var(--muted); }
.row.open { background: color-mix(in srgb, var(--brand) 3%, transparent); }

.detail { padding: 2px 16px 18px 74px; }
.notes { margin: 0 0 12px; padding-left: 18px; color: var(--ink2); }
.warn { background: var(--badbg); color: var(--badfg); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: .93rem; }
.grid { display: grid; grid-template-columns: 170px 1fr; gap: 8px 16px; margin: 0; font-size: .93rem; }
.grid dt { color: var(--muted); }
.grid dd { margin: 0; min-width: 0; }
.leg + .leg { margin-top: 6px; }
.addrline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 2px; }
.addr-actions { display: inline-flex; gap: 4px; }
.tag { font-size: .78rem; background: color-mix(in srgb, var(--brand) 10%, transparent); color: var(--brand); border-radius: 6px; padding: 1px 6px; }
.mini { font: 600 .74rem/1 inherit; font-family: inherit; padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg2); color: var(--ink2); cursor: pointer; }
.mini:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.wrap.mono, dd.wrap { word-break: break-all; }
.actions { margin-top: 14px; display: flex; gap: 8px; }
.more { text-align: center; margin: 24px 0; }
.end { text-align: center; margin: 24px 0; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.tx-card { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); margin-top: 18px; padding: 8px 0 4px; }
.tx-top { display: flex; gap: 16px; padding: 18px 20px 8px; }
.ico.big { width: 54px; height: 54px; font-size: 1.5rem; flex: none; }
.tx-card h2 { margin: 8px 0 6px; font-size: 1.4rem; letter-spacing: -.02em; line-height: 1.25; }
.tx-card .detail { padding: 8px 20px 18px 90px; }

.foot { color: var(--muted); font-size: .85rem; padding-top: 10px; padding-bottom: 40px; border-top: 1px solid var(--line); margin-top: 30px; }

@media (max-width: 720px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .paste { flex-direction: column; }
  .row-main { grid-template-columns: 38px 1fr; gap: 12px; padding: 12px; }
  .ico { width: 38px; height: 38px; font-size: 1.05rem; border-radius: 11px; }
  .amt { grid-column: 2; text-align: left; }
  .amt small { display: inline; margin-left: 6px; }
  .detail, .tx-card .detail { padding: 2px 12px 16px; }
  .grid { grid-template-columns: 1fr; gap: 2px; }
  .grid dd { margin-bottom: 8px; }
  .bal { text-align: left; }
  .tx-top { padding: 14px; }
}
.btcio + .btcio { margin-top: 6px; }
.flagged .amt .pos, .flagged .amt .neg { color: var(--muted); }
