/* RAAC Chain Watch — forensic ops dashboard
   Operate mode: scanable density, IBM Plex, sky accent, stacked overview */
:root {
  --bg: #070a10;
  --bg-elev: #0b1018;
  --surface: #0f1520;
  --surface2: #151c2a;
  --surface3: #1c2536;
  --border: rgba(148, 163, 184, 0.1);
  --border2: rgba(148, 163, 184, 0.18);
  --text: #e8eef7;
  --muted: #94a3b8;
  --dim: #64748b;
  --sky: #38bdf8;
  --sky-dim: #0ea5e9;
  --sky-soft: rgba(56, 189, 248, 0.12);
  --sky-ring: rgba(56, 189, 248, 0.28);
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --pink: #f472b6;
  --purple: #a78bfa;
  --orange: #fb923c;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 16px;
  --nav-h: 58px;
  --max: 1280px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 12px 40px rgba(0,0,0,0.28);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background:
    radial-gradient(900px 420px at 8% -12%, rgba(56, 189, 248, 0.07), transparent 55%),
    radial-gradient(700px 380px at 96% 4%, rgba(251, 113, 133, 0.04), transparent 50%),
    linear-gradient(180deg, #080c14 0%, var(--bg) 40%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  font-size: 14.5px;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(56, 189, 248, 0.28); color: #fff; }

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.15em; }

/* ── top bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  background: rgba(7, 10, 16, 0.86);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
  min-height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 0.92rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand span { color: var(--sky); }
.nav {
  display: flex;
  gap: 0.2rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav button {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-weight: 500;
  font-size: 0.82rem;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.nav button:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav button.active {
  color: #031018;
  background: var(--sky);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(56,189,248,0.35), 0 6px 18px rgba(14,165,233,0.18);
}
.top-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.22);
}
.live-dot.err {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(251,113,133,0.22);
}

/* ── layout ── */
.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3.5rem;
}
.panel { display: none; animation: fadeIn 0.28s var(--ease); }
.panel.active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .panel { animation: none; }
  * { transition: none !important; }
}

/* ── intro note ── */
.note {
  font-size: 0.84rem;
  color: var(--muted);
  background: linear-gradient(135deg, rgba(56,189,248,0.07), rgba(56,189,248,0.02));
  border: 1px solid var(--sky-ring);
  border-radius: var(--r);
  padding: 0.85rem 1rem;
  margin-bottom: 1.15rem;
  line-height: 1.55;
}
.note strong { color: var(--text); font-weight: 600; }

/* ── KPIs ── */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--border2);
  border-radius: 3px 0 0 3px;
}
.kpi.sky::before { background: var(--sky); }
.kpi.green::before { background: var(--green); }
.kpi.red::before { background: var(--red); }
.kpi.amber::before { background: var(--amber); }
.kpi .lbl {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.3rem;
  font-weight: 500;
}
.kpi .val {
  font-size: 1.28rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.kpi .sub {
  font-size: 0.72rem;
  color: var(--dim);
  margin-top: 0.28rem;
  line-height: 1.35;
}
.kpi.green .val { color: var(--green); }
.kpi.red .val { color: var(--red); }
.kpi.amber .val { color: var(--amber); }
.kpi.sky .val { color: var(--sky); }

/* ── cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.15rem 1.2rem 1.25rem;
  margin-bottom: 0.95rem;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 1.02rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}
.card .hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.95rem;
  line-height: 1.45;
  max-width: 72ch;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.15rem;
}
.card-head h2 { margin: 0; }
.card-head .hint { margin: 0.2rem 0 0; }

/* Overview: stacked full-width, not cramped 2-col */
.ov-stack {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}
.ov-stack > .card { margin-bottom: 0; }

.signals-panel {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.55rem;
}
.signal-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.75rem 0.85rem;
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  transition: border-color 0.15s var(--ease);
}
.signal-card:hover { border-color: var(--border2); }
.signal-ico {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--mono);
  flex-shrink: 0;
  background: var(--surface3);
  border: 1px solid var(--border);
  color: var(--muted);
}
.signal-ico.cex { color: var(--purple); border-color: rgba(167,139,250,0.35); background: rgba(167,139,250,0.1); }
.signal-ico.desk { color: var(--orange); border-color: rgba(251,146,60,0.35); background: rgba(251,146,60,0.1); }
.signal-ico.unlabeled { color: var(--amber); border-color: rgba(251,191,36,0.35); background: var(--amber-soft); }
.signal-ico.internal { color: var(--sky); border-color: var(--sky-ring); background: var(--sky-soft); }
.signal-ico.mintburn { color: var(--red); border-color: rgba(251,113,133,0.35); background: var(--red-soft); }
.signal-body { min-width: 0; flex: 1; }
.signal-body strong { font-size: 0.86rem; font-weight: 600; }
.signal-body .muted { margin-top: 0.15rem; font-size: 0.78rem; }

/* ── toolbar / chips ── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.9rem;
}
.chip, .select, input[type=search], button.btn {
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  border-radius: 999px;
  padding: 0.38rem 0.8rem;
  font: inherit;
  font-size: 0.8rem;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
}
.chip { cursor: pointer; color: var(--muted); }
.chip:hover { color: var(--text); border-color: rgba(148,163,184,0.3); }
.chip.on {
  background: var(--sky-soft);
  border-color: var(--sky-ring);
  color: var(--sky);
  font-weight: 600;
}
.select, input[type=search] {
  border-radius: var(--r-sm);
  outline: none;
  min-width: 120px;
}
.select:focus, input[type=search]:focus {
  border-color: var(--sky-ring);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.12);
}
input[type=search] { min-width: 200px; flex: 1; }
button.btn {
  cursor: pointer;
  border-radius: var(--r-sm);
  font-weight: 500;
}
button.btn:hover {
  border-color: var(--sky-ring);
  color: var(--sky);
  background: var(--sky-soft);
}
button.btn:active { transform: scale(0.98); }

/* ── tables ── */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r);
  max-height: min(62vh, 720px);
  background: var(--bg-elev);
}
.table-wrap.table-tall { max-height: min(70vh, 820px); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
th, td {
  padding: 0.58rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.42);
  position: sticky;
  top: 0;
  z-index: 1;
  backdrop-filter: blur(8px);
}
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 255, 255, 0.025); }
.mono { font-family: var(--mono); font-size: 0.76rem; }
.right { text-align: right; font-variant-numeric: tabular-nums; }

/* ── badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.66rem;
  font-weight: 650;
  padding: 0.16rem 0.48rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.b-buy { background: var(--green-soft); color: var(--green); border: 1px solid rgba(52,211,153,0.3); }
.b-sell { background: var(--red-soft); color: var(--red); border: 1px solid rgba(251,113,133,0.3); }
.b-int { background: var(--sky-soft); color: var(--sky); border: 1px solid var(--sky-ring); }
.b-ext { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(251,191,36,0.3); }
.b-cex { background: rgba(167,139,250,0.12); color: var(--purple); border: 1px solid rgba(167,139,250,0.3); }
.b-unk { background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid var(--border); }
.b-team { background: rgba(244,114,182,0.12); color: var(--pink); border: 1px solid rgba(244,114,182,0.3); }
.b-desk { background: rgba(251,146,60,0.12); color: var(--orange); border: 1px solid rgba(251,146,60,0.3); }

.bar-wrap {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 99px;
  overflow: hidden;
  min-width: 72px;
}
.bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #f472b6, var(--sky));
}

.addr-link {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.76rem;
}
.addr-link:hover { color: var(--sky); }
.tag-name { font-weight: 600; color: var(--text); font-size: 0.86rem; }
.tag-cat { font-size: 0.68rem; color: var(--dim); display: block; margin-top: 0.1rem; }

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.status-line {
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.legend span {
  font-size: 0.72rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* holder position cards */
.pos-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem;
}
.pos-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.85rem 0.9rem;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.pos-card:hover {
  border-color: var(--border2);
  transform: translateY(-1px);
}
.pos-card .rank { font-size: 0.68rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.04em; }
.pos-card .amt { font-weight: 700; margin-top: 0.25rem; font-variant-numeric: tabular-nums; font-size: 0.95rem; }

.cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}
.cat-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.55rem 0.85rem;
  min-width: 100px;
}
.cat-pill .n { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cat-pill .l {
  font-size: 0.66rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.1rem;
}

.empty {
  padding: 2.25rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.foot {
  margin-top: 1.75rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  color: var(--dim);
  font-size: 0.74rem;
  line-height: 1.5;
}

/* legacy alert-row (if any leftover) */
.alert-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}
.alert-row:last-child { border: 0; }
.alert-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
}

/* mobile nav */
@media (max-width: 900px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 0.65rem 1rem; gap: 0.55rem; }
  .nav { order: 3; width: 100%; padding-bottom: 0.15rem; }
  .top-meta { margin-left: 0; }
  .wrap { padding: 1rem 0.9rem 2.5rem; }
}
