:root {
  --bg: #07080c;
  --sidebar: #0b0d14;
  --card: #10131c;
  --line: #1d2433;
  --text: #e8edf7;
  --muted: #8b95a8;
  --accent: #3d7eff;
  --accent-2: #6d4aff;
  --ok: #1ee3a5;
  --warn: #f5c14a;
  --err: #ff4d6d;
  --eth: #627eea;
  --bsc: #f0b90b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; }
.mob-only { display: none; }
body {
  font-family: Vazirmatn, Tahoma, sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(61,126,255,.12), transparent 50%),
    radial-gradient(800px 400px at -10% 110%, rgba(109,74,255,.1), transparent 45%),
    var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  border-left: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.brand { display: flex; gap: 12px; align-items: center; padding: 2px 4px 4px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.2rem;
  box-shadow: 0 8px 24px rgba(61,126,255,.28);
}
.brand-name { font-weight: 800; letter-spacing: -.02em; }
.brand-sub { color: var(--muted); font-size: .72rem; }

.live-mini {
  width: 100%; text-align: right;
  display: flex; gap: 10px; align-items: flex-start;
  background: #0e111a; border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 12px; color: inherit;
  cursor: pointer; font: inherit;
}
.live-mini:hover, .live-mini.active { border-color: #3558a8; background: #151c2d; }
.live-mini-body { min-width: 0; flex: 1; }
.live-mini-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-size: .78rem; color: var(--muted);
}
.live-pill {
  background: #171c28; border-radius: 999px; padding: 2px 8px; font-size: .68rem;
}
.live-pill.on { background: rgba(30,227,165,.12); color: var(--ok); }
.sc-addr { font-family: Consolas, monospace; font-size: .8rem; margin: 6px 0 3px; word-break: break-all; }
.sc-meta { font-size: .7rem; color: var(--muted); }
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: #555; margin-top: 6px; flex-shrink: 0;
}
.pulse.on { background: var(--ok); box-shadow: 0 0 0 4px rgba(30,227,165,.15); animation: pulse 1.4s infinite; }

.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; min-height: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: right;
  background: transparent; border: 0; color: #c8d0e7;
  padding: 10px 12px; border-radius: 11px;
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.nav-item:hover { background: #151c2d; }
.nav-item.on { background: #1a2a4a; color: #fff; }
.nav-ico {
  width: 22px; text-align: center; color: var(--muted); font-size: .95rem;
}
.nav-item.on .nav-ico { color: var(--accent); }
.nav-badge {
  margin-right: auto;
  min-width: 22px; text-align: center;
  background: #171c28; border-radius: 999px;
  padding: 1px 7px; font-size: .68rem; color: var(--muted);
}
.nav-badge.warn { background: rgba(245,193,74,.12); color: var(--warn); }

.side-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.side-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px;
}
.side-stats div {
  background: #0e111a; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 6px; text-align: center;
}
.side-stats small { display: block; color: var(--muted); font-size: .65rem; margin-bottom: 3px; }
.side-stats b { font-size: .82rem; }

.main { padding: 22px 28px 48px; min-width: 0; }
.page { display: none; }
.page.on { display: block; }

.topbar {
  display: flex; justify-content: space-between; gap: 16px; align-items: flex-start;
  margin-bottom: 16px;
}
.topbar h1 { font-size: 1.4rem; font-weight: 800; }
.topbar p { color: var(--muted); margin-top: 4px; font-size: .88rem; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 14px;
}
.search {
  flex: 1; min-width: 220px;
  background: #10151f; border: 1px solid var(--line);
  color: var(--text); border-radius: 11px;
  padding: 9px 12px; font: inherit;
}
.search:focus { outline: 0; border-color: #3558a8; }

.mode-switch {
  display: flex; background: #121722; border: 1px solid var(--line);
  border-radius: 12px; padding: 3px;
}
.mode-switch button {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 12px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 600;
}
.mode-switch button.on { background: #1d2a4a; color: #fff; }

.btn {
  border: 0; border-radius: 11px; padding: 10px 16px;
  font: inherit; font-weight: 700; cursor: pointer;
}
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 8px 22px rgba(61,126,255,.22);
}
.btn.ghost { background: #171c28; color: #fff; border: 1px solid var(--line); }
.btn.accent { background: linear-gradient(135deg, #16a34a, #059669); color: #fff; box-shadow: 0 8px 22px rgba(22,163,74,.22); }
.btn.sm { padding: 7px 12px; font-size: .82rem; }
.btn.xs { padding: 3px 8px; font-size: .7rem; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.claim-status { font-size: .82rem; font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.claim-status.run { color: var(--warn); }
.claim-status.ok { color: var(--ok); }
.claim-status.err { color: var(--err); }

.status {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 12px;
  background: #10151f; border: 1px solid var(--line); margin-bottom: 14px;
}
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: #666; }
.status.running .dot { background: var(--warn); animation: pulse 1.2s infinite; }
.status.ready .dot, .status.connected .dot { background: var(--ok); }
.status.disconnected .dot { background: var(--warn); }
.status.error .dot { background: var(--err); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 14px;
}
.card > h2 { font-size: 1.05rem; margin-bottom: 6px; }
.connect-card { display: grid; grid-template-columns: 240px 1fr; gap: 20px; }
.qr-box {
  width: 240px; height: 240px; background: #fff; border-radius: 16px;
  display: grid; place-items: center; padding: 10px;
}
.qr-box img { max-width: 100%; max-height: 100%; }
.info label { display: block; color: var(--muted); font-size: .78rem; margin: 0 0 6px; }
.uri-row { display: flex; gap: 8px; }
#uri {
  flex: 1; background: #0b0f16; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical;
}
.addr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.mono { font-family: Consolas, monospace; word-break: break-all; font-size: .9rem; }

.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.section-head h2 { font-size: 1.05rem; }
.inv-tools { display: flex; gap: 8px; align-items: center; }
.usd-sum {
  background: #12261f; color: var(--ok); border: 1px solid #1d4f3f;
  border-radius: 10px; padding: 7px 12px; font-weight: 800;
}
.native-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.native-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #0b0f16; border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 8px 4px 10px; font-size: .8rem;
}
.native-chip img { width: 16px; height: 16px; border-radius: 50%; }
.native-sym { font-weight: 700; color: var(--muted); }
.native-bal { font-weight: 800; }
.btn-native-send {
  border: 0; border-radius: 999px;
  background: rgba(109,74,255,.22); color: #c4aeff;
  padding: 3px 9px; font: inherit; font-size: .72rem; font-weight: 800;
  cursor: pointer; transition: background .15s;
}
.btn-native-send:hover { background: rgba(109,74,255,.4); color: #fff; }
.btn-native-send:disabled { opacity: .5; cursor: not-allowed; }
.btn-native-send.sent { background: rgba(30,227,165,.15); color: var(--ok); }

.table-wrap { overflow-x: auto; margin-bottom: 4px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: right; }
th { color: var(--muted); font-weight: 600; font-size: .75rem; }
.col-check { width: 36px; text-align: center; }
.tok { display: flex; align-items: center; gap: 8px; }
.tok img, .tok-fb {
  width: 26px; height: 26px; border-radius: 50%;
}
.tok-fb {
  display: grid; place-items: center;
  background: #1d2a4a; font-size: .7rem; font-weight: 800;
}
.tok small { display: block; color: var(--muted); font-size: .7rem; font-weight: 400; }
.sign-card {
  background:
    linear-gradient(180deg, rgba(109,74,255,.07), transparent 35%),
    var(--card);
}
.sign-hint { margin-top: 4px; }
.sign-textarea {
  width: 100%; min-height: 96px;
  background: #0b0f16; border: 1px solid var(--line);
  color: var(--text); border-radius: 12px;
  padding: 10px 12px; font: inherit; line-height: 1.6;
  resize: vertical;
}
.sign-textarea:focus { outline: 0; border-color: #3558a8; }
.sign-actions {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-top: 10px;
}
.sign-history { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sign-item {
  background: #0b0f16; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.sign-msg { font-size: .82rem; color: #c5cddb; white-space: pre-wrap; margin: 6px 0; }
.sign-sig { font-size: .72rem; color: var(--muted); word-break: break-all; margin-bottom: 4px; }
.sign-item small { color: var(--muted); font-size: .7rem; }
.set-row-col { flex-direction: column; align-items: stretch; }
.set-row-col textarea { margin-top: 8px; }

.custom-badge {
  display: inline-block; margin-right: 5px;
  font-size: .6rem; font-weight: 800; letter-spacing: .04em;
  background: rgba(109,74,255,.22); color: #c4aeff;
  border: 1px solid #6d4aff55; border-radius: 4px; padding: 1px 5px;
  vertical-align: middle;
}
.chain-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 3px 8px; font-size: .75rem; font-weight: 700;
}
.chain-pill.eth { background: rgba(98,126,234,.15); color: #9db0ff; }
.chain-pill.bsc { background: rgba(240,185,11,.12); color: #f0b90b; }
.chain-pill img { width: 14px; height: 14px; }

.empty { text-align: center; color: var(--muted); padding: 28px !important; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.claim-bar { margin-bottom: 12px; }
.sel-count { color: var(--muted); font-size: .82rem; }
.hint { color: var(--muted); font-size: .82rem; margin-top: 10px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: .75rem; }
.badge.pending { background: #1a2030; color: var(--muted); }
.badge.ok { background: #12261f; color: var(--ok); }
.badge.err { background: #2a1218; color: var(--err); }
.badge.run { background: #2a2412; color: var(--warn); }
.btn-one {
  padding: 5px 9px; font-size: .72rem; border-radius: 8px;
  background: #1d2a4a; color: #fff; border: 1px solid #3558a8;
  cursor: pointer; font-weight: 700;
}
.btn-sign-appr {
  padding: 5px 9px; font-size: .68rem; border-radius: 8px;
  background: rgba(109,74,255,.25); color: #d4c4ff;
  border: 1px solid #6d4aff55; cursor: pointer; font-weight: 800;
  margin-inline-end: 4px;
}
.btn-sign-appr:hover { background: rgba(109,74,255,.4); color: #fff; }
.btn-one:disabled { opacity: .4; cursor: not-allowed; }
.claim-one {
  padding: 5px 11px; font-size: .8rem; border-radius: 8px;
  background: #12261f; color: var(--ok); border: 1px solid #16a34a40;
  cursor: pointer; font-weight: 700;
}
.claim-one:disabled { opacity: .35; cursor: not-allowed; }
a { color: #7eb0ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
  padding: 5px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: #171c28; color: var(--muted); font: inherit; font-size: .8rem;
  font-weight: 600; cursor: pointer;
}
.filter-btn.on { background: #1a2a4a; border-color: var(--accent); color: var(--accent); }
.filter-btn:hover { background: #1e2639; color: #fff; }

.net-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.net-row {
  display: flex; align-items: center; gap: 10px;
  background: #121722; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.net-row img { width: 26px; height: 26px; }
.net-row .nm { font-weight: 700; font-size: .85rem; }
.net-row .sm { color: var(--muted); font-size: .7rem; }
.net-row.off { opacity: .45; }
.switch {
  margin-right: auto;
  width: 38px; height: 22px; border-radius: 999px; border: 0;
  background: #2a3140; position: relative; cursor: pointer;
}
.switch::after {
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 16px; height: 16px; border-radius: 50%; background: #c5cddb;
}
.switch.on { background: #1d4f3f; }
.switch.on::after { background: var(--ok); left: 3px; right: auto; }

.settings-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px;
}
.set-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-num {
  display: flex; align-items: center; gap: 6px;
  background: #0b0f16; border: 1px solid var(--line);
  border-radius: 10px; padding: 4px 10px;
}
.set-num input {
  width: 80px; background: transparent; border: 0; color: var(--text);
  font: inherit; font-weight: 700; text-align: left;
}
.set-num span { color: var(--muted); font-size: .75rem; }

.claim-live-bar {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.live-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #10151f; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 600;
}
.live-chip button {
  border: 0; background: #1d2a4a; color: #fff; border-radius: 999px;
  padding: 3px 8px; font: inherit; font-size: .72rem; font-weight: 700; cursor: pointer;
}

.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
}
.activity-card .ac-top {
  display: flex; justify-content: space-between; gap: 10px;
  margin-bottom: 8px; font-size: .82rem; color: var(--muted);
}
.activity-card .ac-title { font-weight: 800; color: var(--text); }
.activity-card .ac-body {
  color: #c5cddb; font-size: .84rem; line-height: 1.7;
  white-space: pre-wrap; word-break: break-word;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* ── Live page ── */
.live-page { position: relative; }
.live-hero {
  display: flex; justify-content: space-between; gap: 20px; align-items: flex-end;
  margin-bottom: 16px; padding: 22px 22px 18px;
  border: 1px solid var(--line); border-radius: 22px;
  background:
    radial-gradient(520px 180px at 100% 0%, rgba(61,126,255,.16), transparent 55%),
    radial-gradient(380px 160px at 0% 120%, rgba(109,74,255,.12), transparent 50%),
    #0d111b;
}
.live-kicker {
  font-size: .68rem; letter-spacing: .18em; text-transform: uppercase;
  color: #7ea2ff; font-weight: 800; margin-bottom: 6px;
}
.live-hero h1 { font-size: 1.7rem; font-weight: 800; }
.live-hero p { color: var(--muted); margin-top: 6px; font-size: .9rem; max-width: 520px; }
.live-hero-actions { flex-shrink: 0; }
.live-stages {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px;
}
.live-stages span {
  padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700;
  background: #151b28; color: var(--muted); border: 1px solid var(--line);
}
.live-stages span.on {
  background: rgba(61,126,255,.16); color: #c9d8ff; border-color: #3558a8;
}
.live-stages span.done {
  background: rgba(30,227,165,.1); color: var(--ok); border-color: #1d4f3f;
}

.live-metrics {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px;
}
.metric {
  background: #10131c; border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 14px;
}
.metric small { display: block; color: var(--muted); font-size: .7rem; margin-bottom: 4px; }
.metric b { font-size: 1.02rem; }

.live-status { border-radius: 14px; }

.live-empty {
  display: flex; align-items: center; gap: 18px;
  min-height: 220px; padding: 28px;
  border: 1px dashed #2a3348; border-radius: 22px;
  background: #0c1018; margin-bottom: 14px;
}
.live-empty[hidden] { display: none; }
.live-empty-orb {
  width: 86px; height: 86px; border-radius: 50%; flex-shrink: 0;
  background:
    radial-gradient(circle at 30% 30%, #7ea2ff, transparent 42%),
    radial-gradient(circle at 70% 70%, #6d4aff, transparent 45%),
    #12182a;
  box-shadow: 0 0 40px rgba(61,126,255,.2);
  animation: pulse 2.4s infinite;
}
.live-empty-copy h3 { font-size: 1.15rem; margin-bottom: 6px; }
.live-empty-copy p { color: var(--muted); max-width: 460px; line-height: 1.7; }

.live-connect {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(61,126,255,.06), transparent 40%),
    var(--card);
}
.qr-wrap { position: relative; width: 240px; }
.qr-glow {
  position: absolute; inset: -18px; border-radius: 28px;
  background: radial-gradient(circle, rgba(61,126,255,.22), transparent 68%);
  pointer-events: none;
}
.qr-caption {
  text-align: center; margin-top: 10px; color: var(--muted);
  font-size: .75rem; font-weight: 700; letter-spacing: .04em;
}
.info-tile {
  background: #0b0f16; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.info-tile label { margin-bottom: 4px; }

.live-inv {
  background:
    linear-gradient(180deg, rgba(30,227,165,.05), transparent 28%),
    var(--card);
}

/* ── Add-token form ── */
.add-token-form {
  margin-bottom: 14px;
  border: 1px solid #2a3a5a;
  border-radius: 14px;
  background: #0b1020;
  overflow: hidden;
}
.add-token-form[hidden] { display: none; }
.add-token-inner { padding: 12px 14px; }
.atf-title {
  font-size: .78rem; font-weight: 800; color: #7ea2ff;
  text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px;
}
.atf-row {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
}
.atf-select {
  background: #10151f; border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 8px 10px;
  font: inherit; font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.atf-input {
  flex: 1; min-width: 220px;
  background: #10151f; border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 8px 12px;
  font: inherit; font-family: Consolas, monospace; font-size: .85rem;
}
.atf-input:focus, .atf-select:focus { outline: 0; border-color: #3558a8; }
.atf-msg {
  margin-top: 8px; font-size: .82rem; font-weight: 700;
  padding: 6px 10px; border-radius: 8px;
}
.atf-msg[hidden] { display: none; }
.atf-msg.ok  { background: rgba(30,227,165,.1); color: var(--ok); }
.atf-msg.err { background: rgba(255,77,109,.1);  color: var(--err); }
.atf-msg.run { background: rgba(245,193,74,.1);  color: var(--warn); }
.live-actions {
  padding-top: 6px;
}

.mob-bar, .scrim { display: none; }
.all-lab {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: .8rem; font-weight: 700; cursor: pointer;
}
.row-act { white-space: nowrap; }
.row-act .btn, .row-act .btn-one, .row-act .claim-one { margin-inline-start: 4px; }

/* ── Tablet ── */
@media (max-width: 1100px) {
  .settings-grid { grid-template-columns: 1fr; }
  .main { padding: 18px 18px 40px; }
  .live-hero h1 { font-size: 1.45rem; }
}

/* ── Phone / small tablet ── */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .main {
    padding: 14px 14px calc(28px + env(safe-area-inset-bottom));
    min-width: 0;
  }

  .mob-bar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 60;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    background: rgba(11, 13, 20, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }
  .mob-menu {
    width: 42px; height: 42px; border: 1px solid var(--line);
    border-radius: 12px; background: #151c2d; color: #fff;
    font-size: 1.15rem; cursor: pointer; flex-shrink: 0;
  }
  .mob-title-wrap { min-width: 0; flex: 1; }
  .mob-brand { font-size: .68rem; color: var(--muted); font-weight: 700; }
  .mob-page { font-weight: 800; font-size: .98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mob-bar .live-pill { flex-shrink: 0; }

  .scrim {
    display: none; position: fixed; inset: 0; z-index: 70;
    background: rgba(0, 0, 0, .55);
  }
  body.nav-open .scrim { display: block; }
  body.nav-open { overflow: hidden; }

  .sidebar {
    position: fixed; top: 0; right: 0; z-index: 80;
    width: min(320px, 88vw); height: 100vh; height: 100dvh;
    transform: translateX(110%);
    transition: transform .22s ease;
    border-left: 1px solid var(--line);
    border-bottom: 0;
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    overflow: auto;
  }
  body.nav-open .sidebar { transform: none; }
  .nav-item { min-height: 44px; }

  .topbar, .live-hero { flex-direction: column; align-items: stretch; }
  .topbar h1 { font-size: 1.22rem; }
  .top-actions { width: 100%; }
  .top-actions .btn { min-height: 42px; }

  .connect-card, .addr-grid, .settings-grid, .live-metrics { grid-template-columns: 1fr; }
  .live-metrics { grid-template-columns: 1fr 1fr; }
  .connect-card { justify-items: center; }
  .qr-wrap { width: min(240px, 72vw); }
  .qr-box { width: 100%; height: auto; aspect-ratio: 1; }
  .uri-row { flex-direction: column; }
  .uri-row .btn { min-height: 42px; width: 100%; }

  .live-hero { padding: 16px; border-radius: 18px; }
  .live-hero-actions { width: 100%; }
  .live-hero-actions .mode-switch,
  .live-hero-actions .btn { width: 100%; }
  .mode-switch button { flex: 1; min-height: 40px; }

  .live-empty { flex-direction: column; text-align: center; min-height: 0; padding: 22px 16px; }
  .live-empty-copy p { max-width: none; }
  .section-head, .inv-tools { flex-wrap: wrap; }
  .mob-only { display: inline-flex; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .search { min-width: 0; width: 100%; }
  .filter-group {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }
  .filter-btn { flex-shrink: 0; min-height: 36px; }

  .set-row { flex-wrap: wrap; align-items: flex-start; }
  .set-row .mode-switch { width: 100%; }
  .set-num { margin-right: auto; }

  .activity-card .ac-top { flex-direction: column; }
  .live-chip { width: 100%; justify-content: space-between; border-radius: 12px; }

  input, textarea, select { font-size: 16px; }
  .mono, .sc-addr { overflow-wrap: anywhere; }
  .actions-row .btn { min-height: 44px; }
  .live-actions, .claim-bar {
    position: sticky; bottom: 0; z-index: 20;
    background: linear-gradient(180deg, transparent, #0b0d14 12px);
    padding: 12px 0 calc(10px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 860px) {
  .table-wrap { overflow: visible; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap th, .table-wrap td, .table-wrap tr {
    display: block; width: 100%;
  }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    background: #0c1018;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  .table-wrap td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border-bottom: 1px dashed #1a2232;
    padding: 8px 0; text-align: left;
  }
  .table-wrap td:last-child { border-bottom: 0; }
  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
    text-align: right;
  }
  .table-wrap td.col-check { justify-content: flex-start; }
  .table-wrap td.row-act {
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
    padding-top: 10px;
  }
  .table-wrap td.row-act::before { display: none; }
  .table-wrap td.row-act .btn,
  .table-wrap td.row-act .btn-one,
  .table-wrap td.row-act .claim-one {
    min-height: 38px; margin: 0;
  }
  .table-wrap tr.empty-row {
    background: transparent; border: 0; padding: 0;
  }
  .table-wrap tr.empty-row td {
    display: block; text-align: center; border: 0;
  }
  .table-wrap tr.empty-row td::before { content: none; }
  .row-act { white-space: normal; }
}

@media (max-width: 520px) {
  .live-metrics { gap: 8px; }
  .metric { padding: 10px; }
  .metric b { font-size: .92rem; }
  .card { padding: 14px; border-radius: 16px; }
  .btn, .btn.sm { width: 100%; }
  .top-actions { flex-direction: column; align-items: stretch; }
  .claim-bar .all-lab { width: 100%; }
}

/* ── NFT Grid ───────────────────────── */
.nft-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin-top: 10px;
}
.nft-card {
  background: var(--card2, #1e293b); border-radius: 14px;
  overflow: hidden; border: 1px solid var(--border, #334155);
  transition: box-shadow .2s;
}
.nft-card:hover { box-shadow: 0 4px 18px rgba(99,102,241,.2); }
.nft-card .nft-img {
  width: 100%; aspect-ratio: 1; object-fit: cover; background: #0f172a;
  display: block;
}
.nft-card .nft-body { padding: 10px 12px; }
.nft-card .nft-col-name { font-weight: 600; font-size: .85rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nft-card .nft-info { font-size: .75rem; opacity: .65; }
.nft-card .nft-chain { font-size: .65rem; text-transform: uppercase; opacity: .5; }
.nft-card .nft-actions { padding: 6px 12px 10px; display: flex; gap: 6px; }
.nft-card .nft-actions .btn { flex: 1; font-size: .72rem; }
.row-act { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.row-act .btn-one { font-size: .68rem; padding: 4px 7px; min-height: 28px; }
.cap-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cap-pill { font-size: .62rem; padding: 1px 6px; border-radius: 999px; background: #1a2233; color: var(--muted); }
.cap-pill.on { background: rgba(30,227,165,.12); color: var(--ok); }
.cap-pill.best { background: rgba(61,126,255,.18); color: #9ec1ff; }
.routes-best { margin: 8px 0 12px; padding: 12px 14px; border-radius: 12px; background: rgba(61,126,255,.1); border: 1px solid rgba(61,126,255,.25); }
.routes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.route-card { background: #0b0e16; border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.route-card b { font-size: .92rem; }
.route-card small { color: var(--muted); line-height: 1.45; }
.route-card .route-count { font-size: .75rem; color: var(--ok); }
.routes-blocked { margin-top: 12px; font-size: .78rem; color: var(--muted); }
