/* Sidetrack — warm graphite: charcoal surfaces, parchment text, an amber glow and faint drafting-grid lines. */

:root {
  color-scheme: dark;
  --page: #0f0e0d;
  --graph-bg: #030303;
  --glow: rgba(226, 160, 92, 0.11);
  --gridline: rgba(255, 232, 205, 0.028);
  --surface: #171513;
  --surface-2: #1e1b18;
  --surface-3: #28241f;
  --raise: rgba(255, 238, 215, 0.03);
  --text: #efe9e1;
  --text-2: #b4ab9f;
  --muted: #7b7369;
  --grid: rgba(255, 232, 205, 0.06);
  --baseline: rgba(255, 232, 205, 0.15);
  --border: rgba(255, 232, 205, 0.075);
  --border-2: rgba(255, 232, 205, 0.13);
  --accent: #e2a868;
  --accent-2: #f3d3a6;
  --accent-ink: #1c1309;
  --accent-soft: rgba(226, 168, 104, 0.13);
  --link: #e8b781;
  --up: #8fd19e;
  --down: #ec7b6e;
  --linked: #b9a3ef;
  --probable: #e6d28c;
  --group: #7fbfb2;
  --cotrader: #8a8178;
  --wallet: #86a9d9;
  --danger: #ec7b6e;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --r-xl: 24px;
  --r-lg: 18px;
  --r: 12px;
  --r-sm: 9px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --nav-w: 248px;
  --drawer-w: 460px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f3efe9;
  --graph-bg: #fbf8f3;
  --glow: rgba(196, 130, 60, 0.12);
  --gridline: rgba(60, 40, 20, 0.035);
  --surface: #fffdf9;
  --surface-2: #f7f2eb;
  --surface-3: #eee7dd;
  --raise: rgba(60, 40, 20, 0.02);
  --text: #1d1a16;
  --text-2: #5a5248;
  --muted: #8d8478;
  --grid: rgba(60, 40, 20, 0.07);
  --baseline: rgba(60, 40, 20, 0.18);
  --border: rgba(60, 40, 20, 0.09);
  --border-2: rgba(60, 40, 20, 0.15);
  --accent: #b8742f;
  --accent-2: #d99a55;
  --accent-ink: #fffaf2;
  --accent-soft: rgba(184, 116, 47, 0.12);
  --link: #9a5f22;
  --up: #2f8a4e;
  --down: #c8473b;
  --linked: #7a5fd6;
  --probable: #a8840f;
  --group: #2f8f80;
  --cotrader: #8d8478;
  --wallet: #3d6fb8;
  --shadow: 0 20px 50px rgba(60, 40, 20, 0.14);
}

/* ── base ──────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(760px 620px at 82% -8%, var(--glow), transparent 62%),
    radial-gradient(1100px 700px at 0% 115%, color-mix(in srgb, var(--glow) 60%, transparent), transparent 60%),
    linear-gradient(var(--gridline) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, var(--gridline) 1px, transparent 1px) 0 0 / 64px 64px,
    var(--page);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12px; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; margin: 0; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 11px; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
h4 { font-size: 13px; font-weight: 600; margin: 20px 0 8px; color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.up { color: var(--up); }
.down { color: var(--down); }
[hidden] { display: none !important; }
::selection { background: var(--accent); color: var(--accent-ink); }
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }

/* ── controls ──────────────────────────────────────────── */
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 9px 12px; outline: none;
  transition: border-color .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: var(--surface-3); }
select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
textarea { resize: vertical; min-height: 72px; width: 100%; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 8px 15px; cursor: pointer; font-weight: 500;
  transition: background .15s, border-color .15s, transform .05s, filter .15s;
}
button:hover { background: var(--surface-3); border-color: var(--border-2); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
button.primary:hover { filter: brightness(1.06); background: var(--accent); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-2); color: var(--text); }
button.small { padding: 5px 11px; font-size: 12.5px; }
button.danger { color: var(--danger); }
button:disabled { opacity: .45; cursor: default; }
.file-btn { display: inline-flex; align-items: center; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 8px 15px; cursor: pointer; color: var(--text); font-weight: 500; }
.file-btn:hover { background: var(--surface-3); }
.icon-btn { border: 0; background: none; padding: 5px 7px; color: var(--muted); cursor: pointer; border-radius: 8px; }
.icon-btn:hover { color: var(--text); background: var(--surface-3); }

/* ── shell: nav + main ─────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px 14px;
  border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand:hover { color: var(--text); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.nav-group { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; padding: 16px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r); color: var(--text-2); font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.nav-scroll { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; min-height: 80px; }
.nav-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 6px 0; border-top: 1px solid var(--border); margin-top: 8px; }
.status { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--muted); }
.status span { display: inline-flex; align-items: center; gap: 5px; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status i.on { background: var(--up); box-shadow: 0 0 8px var(--up); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 680px) minmax(140px, 1fr); align-items: center; gap: 20px; padding: 12px 28px; background: color-mix(in srgb, var(--page) 78%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); }
.page-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { display: flex; justify-content: flex-end; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.scan-form { position: relative; width: 100%; display: flex; align-items: center; gap: 8px; }
.scan-form .search { flex: 1; min-width: 0; }
.bulk-btn { display: inline-flex; align-items: center; gap: 7px; flex: none; padding: 10px 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text); font-weight: 600; font-size: 13px; white-space: nowrap; }
.bulk-btn:hover { border-color: var(--accent); color: var(--accent); }
.search { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 16px; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: 999px; color: var(--muted); transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 7px 0; font-size: 13.5px; color: var(--text); }
.search input:focus { background: transparent; }
.search .icon-btn { padding: 7px; border-radius: 999px; }
.search button.primary { padding: 8px 18px; }

#view { padding: 26px 28px 80px; min-width: 0; width: 100%; }
.drawer-open #view { padding-right: calc(var(--drawer-w) + 44px); }

.popover {
  position: absolute; top: 54px; right: 0; z-index: 30; width: 460px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px;
}
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.options-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-2); }
.options-grid input[type="number"], .options-grid select { width: 100%; }
.options-grid .wide { grid-column: 1 / -1; }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: 9px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ── nav: scans list ───────────────────────────────────── */
.report-item, .job-item { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: var(--r); color: var(--text); margin-bottom: 2px; position: relative; }
.report-item:hover, .job-item:hover { background: var(--surface-2); color: var(--text); }
.report-item.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.report-item .body { min-width: 0; flex: 1; }
.report-item .name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 18px; }
.report-item .meta, .job-item .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-item .del { position: absolute; top: 50%; transform: translateY(-50%); right: 4px; opacity: 0; }
.report-item:hover .del { opacity: 1; }
.job-item { display: block; border: 1px solid var(--border); background: var(--surface-2); margin: 0 0 8px; }
.progress { height: 5px; border-radius: 5px; background: var(--surface-3); margin: 8px 0 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 5px; transition: width .4s; }
.job-item .line { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* gradient avatar per address */
.avatar { flex: none; display: inline-block; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, hsl(var(--h1) 48% 72%), hsl(var(--h2) 32% 30%)); box-shadow: inset 0 0 0 1px var(--border-2); }
.avatar.sm { width: 20px; height: 20px; }
.avatar.lg { width: 46px; height: 46px; }

/* ── pills, tags ───────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; padding: 3px 9px 3px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.35;
  color: var(--cotrader); background: color-mix(in srgb, var(--cotrader) 16%, transparent); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.linked { color: var(--linked); background: color-mix(in srgb, var(--linked) 15%, transparent); }
.pill.probable { color: var(--probable); background: color-mix(in srgb, var(--probable) 15%, transparent); }
.pill.group { color: var(--group); background: color-mix(in srgb, var(--group) 15%, transparent); }
.pill.main { color: var(--accent-ink); background: var(--accent); }
.pill.main::before { display: none; }
.pill.wallet { color: var(--wallet); background: color-mix(in srgb, var(--wallet) 15%, transparent); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 2px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.kind { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.kind.wallet { color: var(--text-2); }
.count { font-size: 11.5px; color: var(--muted); }
.count b { color: var(--text); font-weight: 600; }

/* ── cards & tiles ─────────────────────────────────────── */
.card { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 92%, var(--page))); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 20px 22px; margin-bottom: 18px; min-width: 0; }
details.card > summary { cursor: pointer; }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-left: auto; font-size: 13px; color: var(--text-2); }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.toolbar input[type="checkbox"] { accent-color: var(--accent); }
.toolbar input[type="search"] { width: 220px; padding: 7px 14px; border-radius: 999px; }

.report-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 6px; }
.addr-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text-2); }
.addr-line code { overflow-wrap: anywhere; color: var(--text-2); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; }
.tile .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.tile .value { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .value .of { font-size: 13px; font-weight: 500; color: var(--muted); }
.tile .value .pnl b { font-size: 24px; }

/* big numbers with faded decimals: $98,230.02 */
.big { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.big .dec { opacity: .38; }
.big.md { font-size: 24px; }
.big.sm { font-size: 19px; }

/* ── hero (report summary) ─────────────────────────────── */
.hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero .who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.hero .who h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.meta-line { color: var(--muted); font-size: 12.5px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.chip-addr { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 12px; color: var(--text-2); }

/* ── PnL dashboard ─────────────────────────────────────── */
.dash { border: 1px solid var(--border); border-radius: var(--r-xl); background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 90%, var(--page))); overflow: hidden; margin-bottom: 18px; }
.dash-top { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dash-top h2 { margin: 0; font-size: 15px; }
.dash-top .spacer { flex: 1; }
.dash-grid { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(320px, 1.5fr) minmax(260px, 1fr); }
.dash-panel { padding: 18px 20px; min-width: 0; }
.dash-panel + .dash-panel { border-left: 1px solid var(--border); }
.dash-label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dash-panel h3 { margin: 0 0 14px; color: var(--text); font-size: 13.5px; text-transform: none; letter-spacing: 0; }
.dash-stack > div + div { margin-top: 14px; }
.dash-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.funding { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px 5px 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; margin-top: 6px; cursor: pointer; }
.funding:hover { border-color: var(--border-2); }
.perf-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 5px 0; font-size: 13px; }
.perf-row span:first-child { color: var(--text-2); }
.perf-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.buckets { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.bucket { display: flex; align-items: center; gap: 9px; padding: 4px 0; font-size: 12.5px; }
.bucket i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.bucket .lbl { color: var(--text-2); flex: 1; }
.bucket b { font-variant-numeric: tabular-nums; font-weight: 600; }
.bucket.up { color: var(--up); }
.bucket.down { color: var(--down); }
.bucket.up b, .bucket.down b { color: var(--text); }
.bucket.dim { opacity: .55; }
.winbar { display: flex; height: 6px; gap: 3px; margin-top: 10px; }
.winbar i { display: block; border-radius: 6px; min-width: 3px; }
.winbar i.up { background: var(--up); }
.winbar i.down { background: var(--down); }
.pnl-chart { display: block; width: 100%; height: 230px; overflow: visible; }
.pnl-chart .zero { stroke: var(--baseline); stroke-dasharray: 3 4; }
.pnl-chart .ax { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart-empty { height: 230px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; padding: 5px 13px; font-size: 12.5px; color: var(--text-2); border-radius: 999px; font-weight: 600; }
.seg button:hover { color: var(--text); background: var(--surface-3); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.dash-tabs { display: flex; align-items: center; gap: 4px; padding: 12px 20px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.dash-tabs button { border: 0; background: none; border-radius: 0; padding: 8px 4px 12px; margin-right: 18px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; }
.dash-tabs button:hover { color: var(--text); background: none; }
.dash-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.dash-tabs .count { margin-left: 5px; }
.dash-tabs input[type="search"] { margin-left: auto; width: 240px; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; }
.dash-body { padding: 0 8px 10px; }
.dash-body .table-wrap { max-height: 560px; overflow-y: auto; }
.dash-more { display: flex; justify-content: center; padding: 10px 0 4px; }
.fund-from { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fund-from .addr-link { font-size: 12px; }
table.pos td { padding-top: 11px; padding-bottom: 11px; }
table.pos .sub { margin-top: 2px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable.on { color: var(--accent); }
.row-actions { display: inline-flex; gap: 4px; align-items: center; }
.row-actions a { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; }
.row-actions a:hover { background: var(--surface-3); color: var(--text); }
.side { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 3px 10px; border-radius: 999px; }
.side.buy { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.side.sell { color: var(--down); background: color-mix(in srgb, var(--down) 14%, transparent); }
.tok { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tok img, .tok .ph { flex: none; width: 34px; height: 34px; border-radius: 10px; object-fit: cover; background: var(--surface-3); }
.tok .ph { display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text-2); }
.tok b { display: block; font-size: 13.5px; font-weight: 650; }
.sub { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
td .sub { max-width: none; }
.dash-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 6px; }
.dash-mini .cell { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; }
.dash-mini .cell .big { font-size: 18px; }

/* ── graph, legend, tabs ───────────────────────────────── */
#graph {
  height: 640px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle, color-mix(in srgb, var(--text) 16%, transparent) 1px, transparent 1.5px) 0 0 / 22px 22px,
    radial-gradient(900px 480px at 50% 45%, color-mix(in srgb, var(--accent) 5%, transparent), transparent),
    var(--graph-bg);
  cursor: grab;
}
#graph:active { cursor: grabbing; }
.graph-empty { display: grid; place-items: center; height: 100%; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }

.tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); width: fit-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; border-radius: 999px; background: none; padding: 7px 14px; color: var(--text-2); white-space: nowrap; font-weight: 600; font-size: 13px; }
.tabs button:hover { color: var(--text); background: var(--surface-3); }
.tabs button.active { background: var(--accent); color: var(--accent-ink); }
.tabs button.active .count { color: var(--accent-ink); opacity: .7; }
.tabs .count { margin-left: 6px; }

/* ── tables ────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; vertical-align: middle; }
td { border-top: 1px solid var(--grid); }
tbody tr:first-child td { border-top: 0; }
th { color: var(--muted); font-weight: 500; font-size: 11.5px; position: sticky; top: 0; background: var(--surface); z-index: 1; white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--raise); }
tr.clickable:hover td:first-child { border-radius: var(--r) 0 0 var(--r); }
tr.clickable:hover td:last-child { border-radius: 0 var(--r) var(--r) 0; }
tr.dim td { color: var(--muted); }
tr.selected td { background: var(--accent-soft); }
td .why { display: block; min-width: 240px; color: var(--text-2); font-size: 12.5px; }
.wallet-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.wallet-cell .nm { font-weight: 600; }
.wallet-cell code { color: var(--text-2); }
.empty { color: var(--muted); padding: 22px 6px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }
.trail-path { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); overflow-wrap: anywhere; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.chip { border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 5px 12px; font-size: 12px; color: var(--text-2); cursor: pointer; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.subhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 20px 0 8px; }
.subhead h4 { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ── drawer (floating panel) ───────────────────────────── */
.drawer {
  position: fixed; top: 14px; right: 14px; bottom: 14px; width: var(--drawer-w); max-width: calc(100vw - 28px); z-index: 25;
  background: color-mix(in srgb, var(--surface) 96%, transparent); backdrop-filter: blur(18px);
  border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--shadow); overflow-y: auto; padding: 16px 20px 40px;
  animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.drawer-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12.5px; }
.drawer-top .spacer { flex: 1; }
.drawer-id { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.drawer-id > div { min-width: 0; }
.drawer h2 { font-size: 19px; font-weight: 650; margin: 0; overflow-wrap: anywhere; letter-spacing: -0.02em; }
.drawer .full { font-family: var(--mono); font-size: 11px; color: var(--muted); overflow-wrap: anywhere; display: flex; align-items: center; gap: 4px; }
.drawer .badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.drawer h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 22px 0 10px; }
.drawer h4 .small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.label-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; margin: 12px 0 4px; }
.label-form input, .label-form select, .label-form textarea { background: var(--surface); }
.label-form .row { display: flex; gap: 8px; }
.label-form .row > * { flex: 1; min-width: 0; }
.label-form .actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.label-form .actions .status { margin-right: auto; font-size: 12px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.metrics div { background: var(--surface-2); border-radius: var(--r); padding: 10px 12px; }
.metrics b { display: block; font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.metrics span { font-size: 11px; color: var(--muted); }
.evidence { list-style: none; padding: 0; margin: 6px 0; }
.evidence li { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 6px; padding: 9px 0; border-top: 1px solid var(--grid); font-size: 13px; overflow-wrap: anywhere; }
.evidence li:first-child { border-top: 0; }
.evidence .w { display: inline-grid; place-items: center; min-width: 34px; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.addr-link { color: var(--link); cursor: pointer; font-family: var(--mono); font-size: 12px; }
.addr-link:hover { color: var(--accent); }
.addr-link.named { font-family: inherit; font-size: inherit; font-weight: 600; }
.loading { color: var(--muted); padding: 12px 0; }
.loading::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-right: 8px; vertical-align: -1px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.drawer table { font-size: 12.5px; }
.drawer th, .drawer td { padding: 7px 8px; }
.drawer th { background: color-mix(in srgb, var(--surface) 96%, transparent); }
.open-full { width: 100%; margin-top: 10px; }

/* drawer v2: PnL card + tabs */
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.renamable { min-width: 0; }
.renamable h1, .renamable h2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.renamable .nm-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rename-btn { opacity: .4; font-size: 14px; padding: 2px 6px; }
.renamable:hover .rename-btn, .rename-btn:focus-visible { opacity: 1; }
.rename { display: none; margin: 0; }
.rename input { font-size: 17px; font-weight: 650; padding: 5px 10px; width: 100%; min-width: 220px; }
.renamable.renaming .rename { display: block; }
.renamable.renaming h1, .renamable.renaming h2 { display: none; }

.pnl-card { margin: 12px 0 16px; padding: 16px 16px 12px; border-radius: var(--r-lg); border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.pc-head { display: flex; align-items: center; justify-content: space-between; }
.live-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--up); text-transform: uppercase; letter-spacing: .06em; }
.live-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--up) 25%, transparent); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.big.pc-big { font-size: 34px; margin: 4px 0 6px; }
.pnl-chart.pc-chart { height: 84px; margin: 0 -4px 10px; }
.pc-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--border); border-radius: var(--r); overflow: hidden; }
.pc-stats > div { background: var(--surface-2); padding: 9px 10px; display: flex; flex-direction: column; min-width: 0; }
.pc-stats span { font-size: 11px; color: var(--muted); }
.pc-stats b { font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-stats small { font-size: 11px; color: var(--muted); }
.pc-stats em { font-style: normal; }
.pc-stats em.up { color: var(--up); }
.pc-stats em.down { color: var(--down); }
.pc-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pc-foot .funding { margin: 0; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-open { margin-left: auto; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.big-skel { height: 36px; width: 55%; margin: 8px 0 12px; }
.chart-skel { height: 84px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.dtabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 2px; padding: 4px; margin: 0 0 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .6); }
.dtabs button { flex: 1; border: 0; border-radius: 999px; background: none; padding: 7px 6px; color: var(--text-2); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.dtabs button:hover { color: var(--text); background: var(--surface-3); }
.dtabs button.on { background: var(--accent); color: var(--accent-ink); }
.dtabs .count { margin-left: 5px; font-size: 10.5px; opacity: .7; }

.dcard { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; margin-bottom: 12px; }
.dcard-h { font-weight: 650; font-size: 13px; margin-bottom: 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dsec { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin: 18px 0 8px; }
.vc-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.vc-score { flex: 1; }
.vc-score .strength { width: 100%; }
.vc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border-radius: var(--r); overflow: hidden; }
.vc-grid > div { background: var(--surface); padding: 9px 10px; display: flex; flex-direction: column; }
.vc-grid b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.vc-grid span { font-size: 11px; color: var(--muted); }
.vc-note { margin: 10px 0 0; font-size: 12.5px; color: var(--text-2); }
.vc-note b { color: var(--text); }
.flow-stats { margin-bottom: 10px; }
.dcard .funder-row { background: var(--surface); margin: 10px 0 0; }
.dcard-note { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); }
.flow-head { justify-content: space-between; align-items: center; }
.seg.sm { padding: 2px; }
.seg.sm button { padding: 4px 10px; font-size: 11.5px; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.flow-sec + .flow-sec { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.flow-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 650; margin-bottom: 6px; }
.flow-h .muted { font-weight: 500; font-size: 11.5px; }
.flow-none { margin: 4px 0; font-size: 12px; color: var(--muted); }
.dcard .flow-row:hover { background: var(--surface-3); }

.reasons { display: grid; gap: 8px; }
.reason { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.reason .w { display: inline-grid; place-items: center; min-width: 42px; padding: 4px 6px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.reason .w.via { background: color-mix(in srgb, var(--linked) 16%, transparent); color: var(--linked); }
.reason b { font-size: 13.5px; }
.reason p { margin: 3px 0 0; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.reason-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 6px; font-size: 12px; }

.wchips { display: flex; flex-wrap: wrap; gap: 6px; }
.wchip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--text); }
.wchip:hover { border-color: var(--border-2); background: var(--surface-3); }
.wchip .mono { font-family: var(--mono); font-size: 11.5px; }
.wchip .vdot { width: 7px; height: 7px; border-radius: 50%; }
.wchip em { font-style: normal; color: var(--muted); font-size: 11px; }
.seen { display: grid; gap: 4px; }
.seen a { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; color: var(--text); text-decoration: none; }
.seen a:hover { background: var(--surface-3); }
.seen a .pill, .seen a .tag { margin-left: auto; }

.funder-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; margin-bottom: 8px; }
.funder-row:hover { border-color: var(--border-2); }
.funder-row > div { display: flex; flex-direction: column; min-width: 0; }
.funder-row .num { align-items: flex-end; }
.flow-list { display: grid; gap: 2px; }
.flow-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; }
.flow-row:hover { background: var(--surface-2); }
.fr-id { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.fr-id .mono { font-family: var(--mono); font-size: 12px; }
.flow-row .num { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.flow-row .num b { font-size: 13px; }

.label-form .field { display: grid; gap: 5px; }
.label-form .field > span, .label-form .field-h { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pick label { cursor: pointer; }
.tag-pick input { position: absolute; opacity: 0; pointer-events: none; }
.tag-pick span { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-2); font-size: 12.5px; color: var(--text-2); }
.tag-pick input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tag-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.label-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 0 0 16px; }
.label-help > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: grid; gap: 6px; align-content: start; }
.label-help b { font-size: 13.5px; }
.label-help span { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.label-help i { font-style: normal; color: var(--text); font-weight: 600; }

/* ── charts ────────────────────────────────────────────── */
.chart { width: 100%; display: block; overflow: visible; }
.chart .axis text, .chart .row-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .row-label { fill: var(--text-2); }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .zero { stroke: var(--accent); stroke-width: 1; opacity: .7; }
.chart .zero-label { fill: var(--accent); font-size: 11px; font-weight: 600; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .dot { stroke: var(--surface); stroke-width: 2; pointer-events: none; }
/* buy timing (lollipop): amber = bought before main, blue = after */
.tchart { --tc-before: var(--accent); --tc-after: var(--wallet); }
.tchart .tc-zone.before { fill: color-mix(in srgb, var(--tc-before) 7%, transparent); }
.tchart .tc-zone.after { fill: color-mix(in srgb, var(--text) 2%, transparent); }
.tchart .tc-zone-label { fill: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.tchart .tc-zone-label.before { fill: var(--tc-before); opacity: .8; }
.tchart .tc-band { fill: var(--raise); }
.tchart .zero { stroke: var(--text); opacity: .55; stroke-width: 1.5; stroke-dasharray: 3 3; }
.tchart .zero-label { fill: var(--text); }
.tchart .row-label { font-weight: 600; font-size: 11.5px; }
.tchart .tc-stem { stroke-width: 2.5; stroke-linecap: round; opacity: .45; pointer-events: none; }
.tchart .tc-dot { stroke-width: 2; fill: var(--surface); pointer-events: none; }
.tchart .tc-dot.solid { stroke: var(--surface); }
.tchart .tc-glow { opacity: .25; pointer-events: none; }
.tchart .tc-val { font-size: 10.5px; font-weight: 650; font-variant-numeric: tabular-nums; pointer-events: none; }
.tchart .mark.before .tc-stem, .tchart .mark.before .tc-dot { stroke: var(--tc-before); }
.tchart .mark.after .tc-stem, .tchart .mark.after .tc-dot { stroke: var(--tc-after); }
.tchart .mark.before .tc-dot.solid, .tchart .mark.before .tc-glow { fill: var(--tc-before); }
.tchart .mark.after .tc-dot.solid, .tchart .mark.after .tc-glow { fill: var(--tc-after); }
.tchart .mark.before .tc-dot.solid, .tchart .mark.after .tc-dot.solid { stroke: var(--surface); }
.tchart .mark.before .tc-val { fill: var(--tc-before); }
.tchart .mark.after .tc-val { fill: var(--tc-after); }
.tchart .mark:hover .tc-stem { opacity: .9; }
.chart g.mark:hover .dot { filter: brightness(1.2); }
.chart-caption { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 14px; flex-wrap: wrap; }
.chart-caption span { display: inline-flex; align-items: center; gap: 6px; }

.tooltip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 320px;
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-2); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 9px 12px; font-size: 12px;
}
.tooltip .v { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tooltip .l { color: var(--text-2); }
div.vis-tooltip {
  font: 12px/1.45 var(--font) !important; color: var(--text) !important; background: var(--surface-3) !important;
  border: 1px solid var(--border-2) !important; border-radius: var(--r) !important; box-shadow: var(--shadow) !important; padding: 9px 12px !important; max-width: 360px; white-space: normal !important;
}

/* ── modal, toast, log ─────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; }
.modal { width: 760px; max-width: 100%; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 22px 24px; }
.modal h2 { margin-bottom: 4px; font-size: 18px; }
.modal .options-grid { margin: 16px 0 6px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.pick-head { display: flex; align-items: center; gap: 6px; margin: 16px 0 4px; }
.pick-head .muted { margin-right: auto; }
.modal td input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.modal td code { white-space: nowrap; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow); font-size: 13px; }

pre.log { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; font: 12px/1.55 var(--mono); color: var(--text-2); max-height: 62vh; overflow: auto; white-space: pre-wrap; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 16px; }
.steps span { font-size: 12px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.steps span.done { color: var(--text-2); }
.steps span.done::before { content: "✓ "; color: var(--up); }
.steps span.now { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }

/* ── suspects list ─────────────────────────────────────── */
.list-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.list-tools .chip-row { margin: 0; }
.list-tools .spacer { flex: 1; }
.list-tools input[type="search"] { width: 240px; padding: 7px 14px; border-radius: 999px; font-size: 12.5px; }
.list-tools select { padding: 7px 32px 7px 14px; border-radius: 999px; font-size: 12.5px; }
.chip .count { margin-left: 4px; opacity: .7; }
.chip.on .count { color: var(--accent-ink); }
table.sus td { padding-top: 12px; padding-bottom: 12px; }
.sus-who { display: flex; align-items: center; gap: 11px; min-width: 0; }
table.sus th.sel, table.sus td.sel { width: 36px; padding-left: 12px; padding-right: 0; cursor: default; }
table.sus input[type="checkbox"], .modal input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); vertical-align: middle; }
table.sus tr.selected td { background: var(--accent-soft); }
table.sus tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.sel-bar { position: sticky; top: 8px; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 8px 10px 8px 16px; border-radius: 999px; background: var(--surface-2); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border-2)); box-shadow: var(--shadow); }
.sel-bar b { margin-right: 6px; }
.sel-bar .muted { margin-left: auto; padding-right: 8px; }
.ctx-menu { position: fixed; z-index: 60; min-width: 230px; padding: 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: drawer-in .12s ease-out; }
.ctx-menu .ctx-h { padding: 6px 10px 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.ctx-menu button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; border: 0; background: none; text-align: left; padding: 7px 10px; border-radius: 9px; font-size: 13px; color: var(--text); font-weight: 500; }
.ctx-menu button:hover { background: var(--surface-3); }
.ctx-menu button b { font-weight: 650; color: var(--accent); }
.ctx-menu button span { font-size: 11.5px; color: var(--muted); }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.bulk-list { max-height: 300px; overflow: auto; margin-top: 14px; border: 1px solid var(--border); border-radius: var(--r); padding: 4px; }
.bulk-row { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.bulk-row:nth-child(odd) { background: var(--raise); }
.bulk-row code { font-family: var(--mono); font-size: 11.5px; color: var(--text-2); }
.bulk-row .arrow { color: var(--muted); }
.bulk-row b { font-weight: 650; }
.modal .field-h { font-size: 12px; color: var(--text-2); }
.sus-who b { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.sus-who > div > span { display: flex; gap: 6px; align-items: center; }
.strength { display: inline-flex; align-items: center; gap: 10px; min-width: 150px; }
.strength .bar { flex: 1; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; min-width: 90px; }
.strength .bar i { display: block; height: 100%; border-radius: 6px; }
.strength b { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 22px; }
.pips { display: inline-flex; align-items: center; gap: 3px; }
.pips i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.pips i.on { background: var(--accent); }
.pips b { margin-left: 7px; font-size: 12px; color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.why-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.why-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); white-space: nowrap; }
.why-chip b { color: var(--accent); font-weight: 650; }
.why-chip.via { background: transparent; color: var(--text-2); }
.why-chip.warn { color: var(--probable); border-color: color-mix(in srgb, var(--probable) 35%, transparent); }

/* ── home dashboard ────────────────────────────────────── */
.home-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.home-grid > * { margin-bottom: 0; }
.home-col { display: grid; gap: 18px; min-width: 0; }
.kpi-grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.kpi-grid .stat { min-width: 0; }
.kpi-sub { display: flex; gap: 12px; margin-top: 6px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.feed { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 260px); overflow-y: auto; }
.feed li.feed-head, .feed li.feed-wait { display: flex; grid-template-columns: none; }
.feed li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 4px; border-top: 1px solid var(--grid); cursor: pointer; animation: feed-in .3s ease-out; }
.feed li:first-child { border-top: 0; }
.feed li:hover { background: var(--raise); border-radius: var(--r); }
.feed .who { min-width: 0; }
.feed .who b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed .who span { font-size: 11.5px; color: var(--muted); }
.feed .amt { text-align: right; font-variant-numeric: tabular-nums; }
.feed .amt b { display: block; font-size: 13.5px; }
.feed .amt span { font-size: 11.5px; }
@keyframes feed-in { from { opacity: 0; transform: translateY(-6px); background: var(--accent-soft); } to { opacity: 1; transform: none; } }
.feed li.watching { opacity: .82; animation: none; }
.feed li.feed-head, .feed li.feed-wait { cursor: default; }
.feed li.feed-head:hover, .feed li.feed-wait:hover { background: none; }
.feed li.trade { grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; padding: 11px 6px; animation: none; }
.feed li.trade.fresh { animation: feed-in .3s ease-out, trade-glow 2.4s ease-out; }
@keyframes trade-glow { from { background: var(--accent-soft); } to { background: transparent; } }
.tr-main { min-width: 0; display: grid; gap: 5px; }
.tr-who { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tr-who b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-who .side { padding: 1px 8px; font-size: 10.5px; letter-spacing: .04em; }
.tr-time { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-tok { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12.5px; }
.tr-tok b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tok-pic { display: inline-flex; flex: none; }
.tok-pic img, .tok-pic .ph { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.tok-pic .ph { display: inline-grid; place-items: center; background: var(--surface-3); font-size: 8.5px; font-weight: 700; color: var(--text-2); }
.ca { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-family: var(--mono); font-size: 11px; padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.ca:hover { color: var(--text); border-color: var(--border-2); }
.feed li.trade .amt { display: flex; flex-direction: column; align-items: flex-end; }
.feed li.trade .amt span { color: var(--muted); font-size: 11px; }
.feed li.watching .amt span { color: var(--muted); }
.feed-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; padding: 12px 4px 6px; border-top: 1px solid var(--grid); }
.feed-wait { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: 6px; border-radius: var(--r); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; }
.home-side { display: grid; gap: 18px; align-content: start; min-width: 0; position: sticky; top: 90px; }
.home-side .card { margin-bottom: 0; }
.rank { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); font-size: 11.5px; font-weight: 700; }
.rank.top { background: var(--accent); color: var(--accent-ink); }
.set-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.set-main b { display: block; font-size: 13.5px; }
.set-main span { font-size: 11.5px; color: var(--muted); }
.ev-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── home ──────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 90%, var(--page))); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 18px 20px; }
.stat .dash-label { margin-bottom: 8px; }
.stat.accent { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface) 70%); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.how div { background: var(--surface-2); border-radius: var(--r-lg); padding: 14px 16px; font-size: 13px; color: var(--text-2); }
.how b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 12px; margin-bottom: 10px; }
.welcome { max-width: none; }
.banner { border: 1px solid color-mix(in srgb, var(--probable) 45%, transparent); background: color-mix(in srgb, var(--probable) 10%, var(--surface)); border-radius: var(--r-lg); padding: 12px 16px; margin-bottom: 18px; }

/* ── ties, notes, filters, PnL bits ────────────────────── */
.ties { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
td > .ties { flex-wrap: nowrap; }
.tie { font-size: 11px; line-height: 1.6; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tie.money, .tie.tokens { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tie.service { background: color-mix(in srgb, var(--probable) 14%, transparent); color: var(--probable); }
td.trading { color: var(--text-2); white-space: nowrap; }
.note { border-radius: var(--r); padding: 10px 12px; font-size: 12.5px; margin: 10px 0; }
.note.warn { border: 1px solid color-mix(in srgb, var(--probable) 40%, transparent); background: color-mix(in srgb, var(--probable) 9%, transparent); }
.report-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; font-size: 13px; color: var(--text-2); }
.report-filters label { display: inline-flex; align-items: center; gap: 8px; }
.report-filters select { padding: 6px 30px 6px 12px; border-radius: 999px; }

.pnl { font-variant-numeric: tabular-nums; white-space: nowrap; border-radius: 6px; }
.pnl.up b { color: var(--up); }
.pnl.down b { color: var(--down); }
.pnl.none { color: var(--muted); }
.pnl.flash, .big.flash { animation: pnl-flash 1.2s ease-out; border-radius: 8px; }
@keyframes pnl-flash { from { background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); } to { background: transparent; box-shadow: none; } }
.pnl-block { font-size: 14px; margin: 4px 0 8px; }
.pnl-block b { font-size: 18px; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 8px var(--up); vertical-align: middle; margin-right: 3px; animation: live-pulse 1.6s infinite; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ── responsive ────────────────────────────────────────── */
@media (max-width: 1280px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-panel.chart-panel { grid-column: 1 / -1; order: -1; border-left: 0; border-bottom: 1px solid var(--border); }
  .dash-panel + .dash-panel { border-left: 0; }
  .dash-panel.perf { border-left: 1px solid var(--border); }
}
@media (max-width: 1180px) {
  .drawer-open #view { padding-right: 28px; }
  .home-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .topbar { grid-template-columns: auto minmax(0, 1fr); }
  .top-right { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; max-height: 300px; border-right: 0; border-bottom: 1px solid var(--border); }
  .topbar { padding: 12px 16px; grid-template-columns: 1fr; }
  .page-title { display: none; }
  .kpi-grid { grid-template-columns: 1fr; }
  #view { padding: 18px 16px 60px; }
  .drawer { inset: 0; width: 100vw; max-width: none; border-radius: 0; }
  #graph { height: 420px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-panel.perf { border-left: 0; border-top: 1px solid var(--border); }
  .scan-form #options-toggle { padding: 9px 11px; }
}

/* bulk scan */
.nav-group-row { display: flex; align-items: center; justify-content: space-between; }
.nav-add { border: 1px solid var(--border-2); background: none; color: var(--text-2); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; padding: 2px 9px; border-radius: 999px; text-transform: none; }
.nav-add:hover { color: var(--accent); border-color: var(--accent); }
.drop { display: grid; place-items: center; gap: 4px; padding: 22px; margin: 14px 0 10px; border: 1.5px dashed var(--border-2); border-radius: var(--r-lg); background: var(--surface-2); cursor: pointer; text-align: center; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { color: var(--accent); }
.drop span { font-size: 12px; color: var(--muted); }
.modal textarea[name="paste"] { width: 100%; font-family: var(--mono); font-size: 12px; }
.bulk-sum { margin-top: 14px; font-size: 13px; }
.bulk-row.bad { opacity: .6; }
.tag.warn { color: var(--probable); border-color: color-mix(in srgb, var(--probable) 40%, transparent); margin-left: auto; }
.batch-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 6px 0 14px; }
.batch-stats > div { background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; }
.batch-stats b { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.batch-stats span { font-size: 12px; color: var(--muted); }
.big-progress { height: 8px; margin-bottom: 10px; }
.job-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.job-state.running { color: var(--accent); background: var(--accent-soft); }
.job-state.done { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }
.job-state.error { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.job-state.cancelled { opacity: .6; }
table.batch .sub { display: block; font-size: 11px; margin-top: 3px; }
.opt-sep { border-top: 1px solid var(--border); margin: 2px 0; }

/* scan in progress */
.scan-hero { padding: 22px 24px; }
.sh-top { display: flex; align-items: center; gap: 14px; }
.sh-id { min-width: 0; display: grid; gap: 6px; justify-items: start; }
.sh-id h2 { margin: 0; font-size: 20px; }
.sh-status { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sh-time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.sh-bar { height: 8px; margin: 18px 0 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.sh-bar i { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; box-shadow: 0 0 18px var(--accent-soft); }
.sh-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); }
.primary-link { font-weight: 650; }
.scan-grid { display: grid; grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.scan-steps { padding: 10px 14px; }
.ss { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; padding: 12px 4px; position: relative; color: var(--muted); }
.ss:not(:last-child)::after { content: ""; position: absolute; left: 18px; top: 40px; bottom: -8px; width: 2px; background: var(--border); }
.ss.done:not(:last-child)::after { background: color-mix(in srgb, var(--up) 45%, transparent); }
.ss-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border-2); position: relative; z-index: 1; }
.ss b { display: block; font-size: 13.5px; color: var(--text-2); }
.ss > div > span { font-size: 12px; }
.ss.done .ss-dot { background: color-mix(in srgb, var(--up) 18%, var(--surface)); border-color: var(--up); color: var(--up); }
.ss.done b { color: var(--text); }
.ss.now .ss-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 5px var(--accent-soft); animation: pulse 1.6s infinite; }
.ss.now b { color: var(--text); }
.ss.now > div > span { color: var(--accent); }
.ss.fail .ss-dot { background: var(--down); border-color: var(--down); color: var(--page); }
.scan-side { display: grid; gap: 16px; min-width: 0; }
.scan-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.scan-stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; transition: opacity .3s; }
.scan-stats > div.wait { opacity: .45; }
.scan-stats b { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.scan-stats span { font-size: 12px; color: var(--muted); }
.scan-coins h3 { margin: 0; font-size: 14px; }
.coin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-top: 12px; }
.coin { position: relative; overflow: hidden; display: flex; justify-content: space-between; gap: 6px; padding: 8px 10px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; animation: feed-in .3s ease-out; }
.coin .cn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coin .cv { color: var(--text-2); font-variant-numeric: tabular-nums; }
.coin i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); opacity: .8; }
.coin.empty { opacity: .5; }
.coin.empty i { display: none; }
.coin.pending { opacity: .35; animation: none; border-style: dashed; }
.scan-warn { display: grid; gap: 4px; border-color: color-mix(in srgb, var(--probable) 35%, var(--border)); }
.raw-log { margin-top: 16px; }
.raw-log summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.raw-log[open] summary { margin-bottom: 12px; }
@media (max-width: 900px) {
  .scan-grid { grid-template-columns: 1fr; }
  .scan-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sh-top { flex-wrap: wrap; }
}

/* switching timeframe: old numbers stay, dimmed, until the new ones land (no page jump) */
.dash.stale > :not(.dash-top) { opacity: .45; pointer-events: none; transition: opacity .15s; }
.dash.stale .dash-top .seg button.on { animation: pulse 1s infinite; }
.nav-foot .status { flex: 1; min-width: 0; }
@media (max-width: 900px) { .bulk-btn { padding: 10px 12px; font-size: 0; gap: 0; } .bulk-btn svg { width: 17px; height: 17px; } }
