:root {
  --bg: #06080c;
  --panel: #0c1117;
  --panel-2: #10161f;
  --border: #1a232f;
  --border-2: #283544;
  --text: #e9eef5;
  --muted: #8a97a8;
  --dim: #586676;
  --accent: #4fe3c1;
  --accent-2: #5fe0ac;
  --term2: #7c9cff;
  --warn: #f0a868;
  --bad: #f06a6a;
  --good: #5fe0ac;
  --radius: 13px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1000px 560px at 85% -10%, rgba(79,227,193,0.08), transparent 60%),
    radial-gradient(760px 480px at 4% 0%, rgba(124,156,255,0.06), transparent 55%);
}
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
h3 { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--text); }

/* ---------- token gate ---------- */
.gate { position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; background: var(--bg); }
.gate-card {
  width: min(760px, calc(100vw - 24px));
  background: var(--panel); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 28px 80px rgba(0,0,0,.35);
}
.eyebrow { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); }
.gate-copy h1 {
  margin: 10px 0 8px; font-size: clamp(28px, 4vw, 42px); line-height: 1.04; letter-spacing: -0.04em;
}
.gate-copy p { margin: 0; max-width: 62ch; color: var(--muted); line-height: 1.55; font-size: 14px; }
.gate-points {
  list-style: none; padding: 0; margin: 4px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
}
.gate-points li {
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 10px; padding: 12px 12px 11px;
  color: var(--muted); font-size: 12px; line-height: 1.45;
}
.gate-points strong { display: block; color: var(--text); font-size: 13px; margin-bottom: 4px; }
.gate-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.gate-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-top: 6px; }
.gate-input {
  background: #04060a; border: 1px solid var(--border-2); color: var(--text);
  border-radius: 9px; padding: 11px 12px; font-size: 13px; font-family: var(--mono);
}
.gate-input:focus { outline: none; border-color: var(--accent); }
.gate-note { font-size: 12px; color: var(--dim); font-family: var(--mono); }
.gate-error { color: var(--bad); font-size: 12px; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 11px; position: relative; z-index: 1; }
.logo { font-size: 19px; color: var(--accent); }
.brand-name { font-family: var(--mono); font-weight: 500; letter-spacing: -0.01em; font-size: 15px; }
.brand-tag {
  font-family: var(--mono); font-size: 10px; color: var(--accent); border: 1px solid #1f3a36; background: #0b1714;
  border-radius: 5px; padding: 1px 6px; vertical-align: middle; margin-left: 6px; letter-spacing: 0.12em;
}
.brand-sub { font-family: var(--mono); font-size: 12px; color: var(--dim); }

/* ---------- layout ---------- */
.app { display: flex; flex-direction: column; min-height: 100vh; position: relative; z-index: 1; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: rgba(8,11,17,.82); backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--border);
}
.controls { display: flex; align-items: center; gap: 12px; }
.main { padding: 22px; display: flex; flex-direction: column; gap: 18px; max-width: 1500px; width: 100%; margin: 0 auto; }

.select {
  background: var(--panel-2); border: 1px solid var(--border-2); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 12px; font-family: var(--mono);
}
.btn { background: var(--accent); color: #032019; border: none; border-radius: 9px; padding: 11px; font-size: 13px; font-weight: 500; font-family: var(--mono); cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn-secondary { display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; background: transparent; color: var(--text); border: 1px solid var(--border-2); border-radius: 9px; padding: 11px 14px; font-size: 13px; font-weight: 500; font-family: var(--mono); }
.btn-secondary:hover { color: var(--accent); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 11px; font-size: 12px; font-family: var(--mono); cursor: pointer; }
.btn-ghost:hover { color: var(--accent); border-color: var(--accent); }
.btn-mini { background: var(--panel-2); color: var(--text); border: 1px solid var(--border-2); border-radius: 6px; padding: 3px 8px; font-size: 11px; font-family: var(--mono); cursor: pointer; }
.btn-mini:hover { border-color: var(--accent); }

/* segmented control */
.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; border: none; color: var(--muted); padding: 6px 11px; font-size: 12px; font-family: var(--mono); cursor: pointer; }
.seg button.active { background: var(--accent); color: #032019; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(95,224,172,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(95,224,172,.5);} 70%{ box-shadow: 0 0 0 7px rgba(95,224,172,0);} 100%{box-shadow:0 0 0 0 rgba(95,224,172,0);} }

/* ---------- chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 7px 14px; font-size: 12px; font-family: var(--mono); }
.chip b { font-weight: 500; color: var(--text); }
.chip.good { border-color: rgba(95,224,172,.5); }
.chip.warn { border-color: rgba(240,168,104,.5); }
.chip.bad { border-color: rgba(240,106,106,.55); }
.chip .led { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip.good .led { background: var(--good); }
.chip.warn .led { background: var(--warn); }
.chip.bad .led { background: var(--bad); }

/* ---------- KPI cards ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .label { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.kpi .value { font-family: var(--mono); font-size: 24px; font-weight: 500; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--dim); margin-top: 4px; font-family: var(--mono); }
.kpi .value.pos { color: var(--good); }
.kpi .value.accent { color: var(--accent); }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-sub { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.cards-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .cards-2 { grid-template-columns: 1fr; } }
@media (max-width: 840px) {
  .gate-points { grid-template-columns: 1fr; }
}
.chart { width: 100%; height: 150px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 320px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-family: var(--mono); }
th, td { text-align: right; padding: 7px 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--panel); color: var(--dim); font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; border-bottom: 1px solid var(--border); z-index: 1; }
tbody tr { border-bottom: 1px solid rgba(26,35,47,.6); }
tbody tr:hover { background: var(--panel-2); }
td.pos { color: var(--good); }
td.neg { color: var(--bad); }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--border-2); color: var(--muted); }
.tag.pin { color: var(--accent); border-color: rgba(79,227,193,.4); }
.tag.settled { color: var(--good); border-color: rgba(95,224,172,.4); }
.tag.failed, .tag.frozen { color: var(--bad); border-color: rgba(240,106,106,.4); }
.tag.pending { color: var(--warn); border-color: rgba(240,168,104,.4); }
.empty { color: var(--dim); font-size: 12px; padding: 16px 4px; font-family: var(--mono); }

/* routing mini-stats */
.statline { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 12px; font-size: 12px; font-family: var(--mono); }
.statline div b { font-size: 15px; font-weight: 500; margin-right: 5px; color: var(--text); }
.bar { height: 6px; border-radius: 3px; background: var(--accent); }
.bar-track { background: var(--panel-2); border-radius: 3px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; }

/* treasury */
.treas { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 14px; }
.treas .t { background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 12px; font-size: 12px; font-family: var(--mono); }
.treas .t .b { font-size: 17px; font-weight: 500; }
