/* TrenchMob design system */
:root {
  --bg: #07080b;
  --bg-2: #0b0d11;
  --surface: #0f1116;
  --surface-2: #151820;
  --surface-3: #1b1f29;
  --border: #1f2430;
  --border-2: #2a3040;
  --text: #f1f3f6;
  --muted: #8f97a6;
  --dim: #5d6574;
  --lime: #b8f53c;
  --lime-2: #9be01f;
  --lime-ink: #0b1400;
  --lime-glow: rgba(184, 245, 60, 0.22);
  --violet: #8b7bff;
  --violet-2: #6d5cf5;
  --red: #ff5d6c;
  --red-bg: rgba(255, 93, 108, 0.12);
  --green: #3fe08b;
  --green-bg: rgba(63, 224, 139, 0.12);
  --amber: #ffb547;
  --amber-bg: rgba(255, 181, 71, 0.12);
  --blue: #5cb8ff;
  --radius: 14px;
  --radius-sm: 9px;
  --radius-xs: 6px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--lime); color: var(--lime-ink); }

.mono { font-family: var(--mono); font-feature-settings: 'tnum'; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.up { color: var(--green); }
.down { color: var(--red); }
.lime { color: var(--lime); }
.amber { color: var(--amber); }
.violet { color: var(--violet); }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text); font-weight: 550; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); border-color: #3a4256; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lime { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); box-shadow: 0 0 0 0 var(--lime-glow); }
.btn-lime:hover { background: #c9ff5a; border-color: #c9ff5a; box-shadow: 0 0 24px var(--lime-glow); }
.btn-violet { background: var(--violet-2); border-color: var(--violet-2); color: #fff; }
.btn-violet:hover { background: var(--violet); border-color: var(--violet); }
.btn-red { background: var(--red); border-color: var(--red); color: #1a0004; }
.btn-red:hover { background: #ff7381; border-color: #ff7381; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 28px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.chip-lime { background: rgba(184, 245, 60, .12); color: var(--lime); }
.chip-red { background: var(--red-bg); color: var(--red); }
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-amber { background: var(--amber-bg); color: var(--amber); }
.chip-violet { background: rgba(139, 123, 255, .14); color: var(--violet); }

.input {
  height: 38px; width: 100%; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2);
  background: var(--bg-2); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(184, 245, 60, .12); }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 70px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--border); }
.seg button {
  height: 28px; padding: 0 11px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); }

.avatar { display: inline-block; vertical-align: middle; border-radius: 50%; flex: none; background: var(--surface-3); overflow: hidden; }
.avatar svg, .avatar img { width: 100%; height: 100%; display: block; }

.tok-img { position: relative; display: block; flex: none; border-radius: 12px; overflow: hidden; background: var(--surface-3); }
.tok-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tok-img .fallback { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--bg); }

.bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(63, 224, 139, .6); animation: pd 1.8s infinite; flex: none; }
.pulse-dot.off { background: var(--red); animation: none; }
@keyframes pd { 70% { box-shadow: 0 0 0 7px rgba(63, 224, 139, 0); } 100% { box-shadow: 0 0 0 0 rgba(63, 224, 139, 0); } }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 56px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 240px; max-width: 360px; padding: 11px 14px; border-radius: 12px; background: var(--surface-2);
  border: 1px solid var(--border-2); box-shadow: var(--shadow); font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
  animation: tin .18s ease-out;
}
.toast.ok { border-color: rgba(63, 224, 139, .4); }
.toast.err { border-color: rgba(255, 93, 108, .45); }
.toast a { color: var(--lime); }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(3, 4, 6, .72); backdrop-filter: blur(6px); z-index: 900; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; box-shadow: var(--shadow); padding: 22px; position: relative; }
.modal h3 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.01em; }
.modal .x { position: absolute; top: 14px; right: 14px; }
@keyframes fade { from { opacity: 0; } }

.scroll-y { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
.scroll-y::-webkit-scrollbar { width: 6px; }
.scroll-y::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }

.empty { padding: 28px 16px; text-align: center; color: var(--dim); font-size: 13px; }

svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i-sm { width: 13px; height: 13px; }
svg.i-lg { width: 20px; height: 20px; }
