/*
 * Arc Track dashboard, built on TypeUI "Pure".
 *
 * Pure's signature, held throughout: a near-black #141314 surface with a fine
 * static grain, raised #141414 panels outlined by a #262626 hairline, peach
 * #F79F79 as the one accent, hard-cornered controls beside 6px panels,
 * Instrument Sans for reading and Chivo Mono uppercase for labels and buttons.
 * This is an application surface, so headings stay flat (no gradient) and
 * widgets sit on a 16px grid.
 */

:root {
  /* Surfaces */
  --neutral-secondary-soft: #141314; /* page */
  --neutral-primary: #141414; /* raised panel */
  --neutral-primary-soft: #141414; /* modal panel */
  --neutral-tertiary: #262626; /* field fill */
  --hover: rgba(255, 255, 255, 0.04); /* the one hover tint, everywhere */

  /* Borders */
  --default: #262626;
  --default-medium: #333333;

  /* Text */
  --heading: #ffffff;
  --body: #b3aca6;
  --muted: #7d7773;

  /* Brand */
  --brand: #f79f79;
  --brand-medium: #f9b394;
  --brand-strong: #da8a63;
  --fg-brand: #f9b394;
  --fg-brand-strong: #fbc3a6;
  --on-brand: #141314;
  --brand-ring: rgba(247, 159, 121, 0.28);
  --brand-tint: rgba(247, 159, 121, 0.1);

  /* State, for real state only */
  --success: #6fd3a0;
  --success-tint: rgba(111, 211, 160, 0.12);
  --danger: #f2766f;
  --danger-tint: rgba(242, 118, 111, 0.12);
  --warning: #f2c46b;
  --warning-tint: rgba(242, 196, 107, 0.12);
  --info: #8ab4f8;
  --info-tint: rgba(138, 180, 248, 0.12);

  /* Type */
  --font-sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Chivo Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --line-height-heading: 1.3;

  /* Spacing */
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 20px;
  --spacing-6: 24px;
  --spacing-8: 32px;
  --spacing-10: 40px;
  --spacing-12: 48px;
  --spacing-16: 64px;

  /* Radius: sharp controls, 6px panels, round only where round is the point */
  --radius-none: 0;
  --radius-md: 6px;
  --radius-full: 999px;

  /* Floating overlays are the one place a real shadow is allowed */
  --elevation-3: 0 12px 32px rgba(0, 0, 0, 0.45);
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--neutral-secondary-soft);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

a {
  color: var(--fg-brand);
  text-decoration: none;
}

a:hover {
  color: var(--fg-brand-strong);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--fg-brand-strong);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Fine, static, monochrome film grain across the whole content surface. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.login,
.app,
.toasts,
.scrim {
  position: relative;
  z-index: 1;
}

.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--spacing-6);
}

/* Icons: Lucide, outline, sized by context and never above 16px in a table. */
[data-lucide],
svg.lucide {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
  flex: none;
}

/* ---------- Brand mark ---------- */

.brandmark {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-3);
  color: var(--heading);
}

.brandmark:hover {
  color: var(--heading);
}

.brandmark__glyph {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--brand);
  color: var(--on-brand);
}

.brandmark__glyph svg {
  width: 18px;
  height: 18px;
}

.brandmark__word {
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- Buttons ---------- */

.btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px 26px;
  border: 2px solid transparent;
  border-radius: var(--radius-none);
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.btn svg {
  margin-block: -4px;
}

.btn--sm {
  padding: 12px 18px;
  font-size: var(--font-size-sm);
}

.btn--block {
  width: 100%;
}

/* Primary: a solid peach block, near-black label, bloom-up hover. The bloom is
   a lighter step of the same peach, so the dark label stays legible mid-way. */
.btn--primary {
  background: var(--brand);
  color: var(--on-brand);
  border-color: var(--brand);
}

.btn--primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand-medium);
  transform: translateY(101%);
  transition: transform 260ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.btn--primary:hover::before,
.btn--primary:focus-visible::before {
  transform: translateY(0);
}

.btn--outline {
  background: transparent;
  color: var(--heading);
  border-color: var(--default-medium);
}

.btn--outline:hover {
  background: var(--hover);
  border-color: var(--muted);
}

.btn--danger {
  background: var(--danger);
  color: var(--on-brand);
  border-color: var(--danger);
}

.btn--danger:hover {
  background: #f58b85;
  border-color: #f58b85;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:disabled::before {
  display: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-none);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.icon-btn:hover {
  background: var(--hover);
  color: var(--heading);
}

.icon-btn--danger:hover {
  color: var(--danger);
  background: var(--danger-tint);
}

/* ---------- Chips, badges, dots ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: 7px 12px;
  border: 1px solid var(--default);
  border-radius: var(--radius-none);
  background: var(--neutral-primary);
  color: var(--body);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--muted);
  flex: none;
}

.dot--live {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-tint);
}

.dot--warn {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-tint);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  width: auto;
  padding: 3px 8px;
  border-radius: var(--radius-none);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--hover);
  color: var(--body);
  border: 1px solid var(--default);
}

.badge svg {
  width: 12px;
  height: 12px;
}

.badge--usdc {
  color: var(--success);
  background: var(--success-tint);
  border-color: transparent;
}

.badge--token {
  color: var(--info);
  background: var(--info-tint);
  border-color: transparent;
}

.badge--swap,
.badge--liquidity {
  color: var(--fg-brand-strong);
  background: var(--brand-tint);
  border-color: transparent;
}

.badge--contract {
  color: var(--warning);
  background: var(--warning-tint);
  border-color: transparent;
}

.badge--out {
  color: var(--danger);
  background: var(--danger-tint);
  border-color: transparent;
}

/* ---------- Navbar ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--default);
  background: rgba(20, 19, 20, 0.78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav {
    background: var(--neutral-secondary-soft);
  }
}

.nav__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
  min-height: 64px;
}

.nav__status {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

/* ---------- Page ---------- */

.page {
  display: grid;
  gap: var(--spacing-4);
  padding-block: var(--spacing-10) var(--spacing-16);
}

.page__head {
  margin-bottom: var(--spacing-4);
}

.eyebrow {
  margin-bottom: var(--spacing-3);
  color: var(--fg-brand);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.page__title {
  color: var(--heading);
  font-size: 40px;
  font-weight: 700;
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
}

.page__lead {
  margin-top: var(--spacing-2);
  max-width: 640px;
  font-size: var(--font-size-base);
}

/* ---------- Cards ---------- */

.card {
  border: 1px solid var(--default);
  border-radius: var(--radius-md);
  background: var(--neutral-primary);
}

/* ---------- Stat widgets ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--spacing-4);
}

.stat {
  padding: var(--spacing-5);
}

.stat__label {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat__value {
  margin-top: var(--spacing-3);
  color: var(--heading);
  font-size: 28px;
  font-weight: 700;
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat__meta {
  margin-top: var(--spacing-1);
  color: var(--muted);
  font-size: var(--font-size-sm);
}

/* ---------- Panels ---------- */

.panel {
  overflow: hidden;
}

.panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
  padding: var(--spacing-5) var(--spacing-6);
  border-bottom: 1px solid var(--default);
}

.panel__title {
  color: var(--heading);
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: var(--line-height-heading);
}

.panel__lead {
  margin-top: 2px;
  color: var(--muted);
  font-size: var(--font-size-sm);
}

.toolbar {
  display: flex;
  align-items: stretch;
  gap: var(--spacing-3);
}

/* In a toolbar the field sits beside a small button, so it takes the small
   button's height exactly: 10px + 20px line + 10px + 2px border = 42px, the
   same as 12px + 14px + 12px + a 2px border on each side of the button. */
.toolbar .field__shell input {
  padding-block: 10px;
  line-height: 20px;
}

/* ---------- Fields ---------- */

.field {
  display: grid;
  gap: var(--spacing-2);
}

.field__label {
  color: var(--heading);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field__hint {
  color: var(--muted);
  font-size: var(--font-size-xs);
}

.field__shell {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding-inline: var(--spacing-3);
  border: 1px solid var(--default);
  border-radius: var(--radius-none);
  background: var(--neutral-tertiary);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field__shell:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.field__shell input {
  flex: 1;
  min-width: 0;
  padding-block: 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--heading);
  font: inherit;
  font-size: var(--font-size-sm);
}

.field__shell input::placeholder {
  color: var(--muted);
}

.field__icon {
  color: var(--muted);
}

.field__shell--search {
  width: min(320px, 100%);
}

.field--invalid .field__shell {
  border-color: var(--danger);
}

.form-error {
  padding: var(--spacing-3);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--danger-tint);
  color: var(--danger);
  font-size: var(--font-size-sm);
}

/* ---------- Table ---------- */

/* Relative so it is the containing block for anything absolutely positioned
   inside the table. Without it the visually-hidden "Actions" header anchors to
   the page at the table's far edge and widens the whole document on mobile,
   which then zooms out to fit. */
.table-wrap {
  position: relative;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table th {
  padding: var(--spacing-3) var(--spacing-6);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--default);
}

.table td {
  padding: var(--spacing-4) var(--spacing-6);
  border-bottom: 1px solid var(--default);
  vertical-align: middle;
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  cursor: pointer;
  transition: background-color 120ms ease;
}

.table tbody tr:hover,
.table tbody tr.is-selected {
  background: var(--hover);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.actions-col {
  width: 1%;
}

.cell-name {
  color: var(--heading);
  font-weight: 600;
}

.addr {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  color: var(--body);
}

.addr a {
  color: var(--body);
}

.addr a:hover {
  color: var(--fg-brand);
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-1);
}

/* Last activity: kind and time in one badge, split by a hairline. The time
   keeps the badge's colour at lower strength, and stays lowercase. */
.badge__time {
  margin-left: 4px;
  padding-left: 7px;
  border-left: 1px solid currentColor;
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

/* Status column: a switch, the table's one round control, because a switch
   is read by its shape. Off rows dim so the live ones stand out. */
.status-col {
  width: 1%;
}

.table tbody tr.is-off td:not(.status-col) {
  opacity: 0.5;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--default-medium);
  border-radius: var(--radius-full);
  background: var(--neutral-tertiary);
  cursor: pointer;
  vertical-align: middle;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.switch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: var(--muted);
  transition: transform 180ms cubic-bezier(0.2, 0.7, 0.2, 1), background-color 160ms ease;
}

.switch[aria-checked="true"] {
  border-color: var(--brand);
  background: var(--brand);
}

.switch[aria-checked="true"] .switch__knob {
  transform: translateX(16px);
  background: var(--on-brand);
}

.switch:hover {
  border-color: var(--muted);
}

.switch[aria-checked="true"]:hover {
  border-color: var(--brand-medium);
  background: var(--brand-medium);
}

/* ---------- Groups ---------- */

.group-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
  padding: var(--spacing-3) var(--spacing-6);
  border-bottom: 1px solid var(--default);
}

.group-bar__chips {
  display: flex;
  gap: var(--spacing-2);
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.gchip {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: 7px 12px;
  border: 1px solid var(--default);
  background: transparent;
  color: var(--body);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.gchip:hover {
  background: var(--hover);
  color: var(--heading);
}

.gchip[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--fg-brand-strong);
}

.gchip__count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.gchip[aria-pressed="true"] .gchip__count {
  color: var(--fg-brand);
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-6);
  border-bottom: 1px solid var(--default);
  background: var(--brand-tint);
}

.bulk-bar__count {
  color: var(--fg-brand-strong);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bulk-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--spacing-2);
}

.field__shell select {
  flex: 1;
  min-width: 0;
  padding-block: 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--heading);
  font: inherit;
  font-size: var(--font-size-sm);
  cursor: pointer;
}

.field__shell select option {
  background: var(--neutral-primary);
  color: var(--heading);
}

.bulk-bar .field__shell select {
  padding-block: 10px;
  line-height: 20px;
}

.bulk-bar .field__shell--select {
  min-width: 180px;
}

.select-col {
  width: 1%;
  padding-right: 0 !important;
}

.check.check--bare {
  display: inline-flex;
  padding: 4px;
  border: 0;
}

.check.check--bare:hover {
  background: transparent;
}

.table tbody tr.is-checked {
  background: var(--brand-tint);
}

.empty-row td {
  padding-block: var(--spacing-8);
  color: var(--muted);
  text-align: center;
  white-space: normal;
  cursor: default;
}

.group-new {
  display: flex;
  gap: var(--spacing-2);
}

.group-new .field__shell {
  flex: 1;
}

.group-new .field__shell input {
  padding-block: 10px;
  line-height: 20px;
}

.group-list {
  display: grid;
  gap: var(--spacing-2);
}

.group-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 64px;
  align-items: center;
  gap: var(--spacing-3);
}

.group-row .field__shell input {
  padding-block: 8px;
}

.group-row .field__shell input:disabled {
  color: var(--body);
  cursor: default;
}

.group-row__count {
  color: var(--muted);
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.group-row__fixed {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.group-row .icon-btn {
  justify-self: center;
}

.icon-btn.is-armed {
  border-color: var(--danger);
  background: var(--danger-tint);
  color: var(--danger);
}

/* Notify column: Telegram's own blue when a wallet's alerts go to the chat,
   grey when it is dashboard-only. */
.notify-col {
  width: 1%;
  text-align: center !important;
}

.notify {
  --notify-plane: #ffffff;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: #4b4746;
  cursor: pointer;
  vertical-align: middle;
  transition: color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.notify svg {
  width: 22px;
  height: 22px;
}

.notify[aria-pressed="false"] {
  --notify-plane: #8f8884;
}

.notify[aria-pressed="true"] {
  color: #2aabee;
}

.notify:hover {
  background: var(--hover);
}

.notify:active {
  transform: scale(0.92);
}

/* Events column: how much of a wallet is being listened to. */
.events {
  display: inline-block;
  min-width: 44px;
  padding: 3px 8px;
  border: 1px solid var(--default);
  color: var(--body);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.events--all {
  border-color: transparent;
  background: var(--success-tint);
  color: var(--success);
}

.events--off {
  color: var(--muted);
}

/* ---------- Tabs ---------- */

.tabs {
  display: flex;
  gap: var(--spacing-6);
  padding-inline: var(--spacing-6);
  border-bottom: 1px solid var(--default);
  /* Horizontal scroll for narrow screens only. Without clamping the vertical
     axis, the active underline's overhang turns on a vertical scrollbar. */
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.tab {
  position: relative;
  padding: var(--spacing-4) 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.tab:hover {
  color: var(--heading);
}

.tab[aria-selected="true"] {
  color: var(--heading);
}

.tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--brand);
}

/* ---------- Feed ---------- */

/* One alert, one row: time | kind | wallet | what happened | tx. The summary
   takes whatever width is left and ellipsises; the full sentence is in its
   title. Columns are fixed so the eye can run straight down each one. */
.feed > li {
  display: grid;
  grid-template-columns: 76px 128px minmax(0, 140px) minmax(0, 1fr) auto;
  gap: var(--spacing-4);
  align-items: center;
  min-height: 44px;
  padding: 6px var(--spacing-6);
  border-bottom: 1px solid var(--default);
  font-size: var(--font-size-sm);
  transition: background-color 120ms ease;
}

.feed > li:hover {
  background: var(--hover);
}

.feed > li:last-child {
  border-bottom: 0;
}

.feed > li.is-new {
  animation: row-new 2.4s ease-out;
}

@keyframes row-new {
  from {
    background: var(--brand-tint);
    box-shadow: inset 2px 0 0 var(--brand);
  }
}

.feed__time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.feed__kind {
  display: flex;
  min-width: 0;
}

.feed__wallet {
  overflow: hidden;
  color: var(--heading);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.feed__summary {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.feed__summary strong {
  color: var(--heading);
  font-weight: 600;
}

.feed__summary .sep {
  margin-inline: var(--spacing-3);
  color: var(--muted);
}

.dim {
  color: var(--muted);
}

.warn {
  color: var(--warning);
}

.feed__more {
  display: flex;
  justify-content: center;
  padding: var(--spacing-4);
  border-top: 1px solid var(--default);
}

.live-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: var(--spacing-2);
  padding: 2px 8px;
  border: 1px solid var(--default);
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
}

.live-tag .dot {
  width: 6px;
  height: 6px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.amt {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.amt--in {
  color: var(--success);
}

.amt--out {
  color: var(--danger);
}

.feed__link {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--muted);
}

.feed__link:hover {
  color: var(--fg-brand);
}

.feed__link svg {
  width: 14px;
  height: 14px;
}

/* ---------- Empty states ---------- */

.empty {
  display: grid;
  justify-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-12) var(--spacing-6);
  text-align: center;
}

.empty > svg {
  width: 24px;
  height: 24px;
  color: var(--muted);
  margin-bottom: var(--spacing-2);
}

.empty__title {
  color: var(--heading);
  font-weight: 600;
}

.empty__text {
  color: var(--muted);
  font-size: var(--font-size-sm);
}

/* ---------- Modal ---------- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: var(--spacing-4);
  background: rgba(0, 0, 0, 0.62);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(480px, 100%);
  border: 1px solid var(--default-medium);
  border-radius: var(--radius-md);
  background: var(--neutral-primary-soft);
  box-shadow: var(--elevation-3);
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-4);
  padding: var(--spacing-5) var(--spacing-6);
  border-bottom: 1px solid var(--default);
}

.modal__title {
  color: var(--heading);
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: var(--line-height-heading);
}

.modal__body {
  display: grid;
  gap: var(--spacing-5);
  padding: var(--spacing-6);
}

.modal__text {
  font-size: var(--font-size-base);
}

.modal__text strong {
  color: var(--heading);
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-3);
  padding: var(--spacing-4) var(--spacing-6);
  border-top: 1px solid var(--default);
}

.modal__foot--split {
  justify-content: space-between;
}

.modal__foot-group {
  display: flex;
  gap: var(--spacing-3);
}

.modal--wide {
  width: min(640px, 100%);
}

/* Tall modals scroll inside themselves; the page behind stays put. */
.modal {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
}

.modal__body {
  overflow-y: auto;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-4);
}

.field__area {
  width: 100%;
  min-height: 200px;
  padding: var(--spacing-3);
  border: 1px solid var(--default);
  border-radius: var(--radius-none);
  outline: 0;
  background: var(--neutral-tertiary);
  color: var(--heading);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field__area:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.field__area::placeholder {
  color: var(--muted);
}

.custom-tag {
  margin-left: 6px;
  padding: 1px 6px;
  background: var(--brand-tint);
  color: var(--fg-brand);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.config-stats {
  color: var(--body);
  font-size: var(--font-size-sm);
}

.config-stats strong {
  color: var(--heading);
  font-variant-numeric: tabular-nums;
}

.batch-result {
  display: grid;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-4);
  border: 1px solid var(--default);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.batch-result strong {
  color: var(--heading);
}

.batch-result ul {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: var(--font-size-xs);
}

.batch-result code {
  overflow-wrap: anywhere;
}

/* Event checkboxes, two to a row. */
.checks {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.checks__legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: var(--spacing-2);
  padding: 0;
}

.checks__quick {
  display: flex;
  gap: var(--spacing-3);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg-brand);
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.link-btn:hover {
  color: var(--fg-brand-strong);
}

.checks__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--spacing-2);
}

.check {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: 9px var(--spacing-3);
  border: 1px solid var(--default);
  color: var(--body);
  font-size: var(--font-size-sm);
  cursor: pointer;
  user-select: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.check:hover {
  background: var(--hover);
}

.check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.check__box {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border: 1px solid var(--default-medium);
  background: var(--neutral-tertiary);
  color: transparent;
  flex: none;
}

.check__box svg {
  width: 12px;
  height: 12px;
  stroke-width: 3;
}

.check:has(input:checked) {
  border-color: var(--brand-ring);
  color: var(--heading);
}

.check input:checked + .check__box {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}

/* Some but not all rows ticked: a dash, the usual convention. */
.check input:indeterminate + .check__box {
  border-color: var(--brand);
  background: var(--brand-tint);
}

.check input:indeterminate + .check__box::after {
  content: "";
  grid-area: 1 / 1;
  width: 8px;
  height: 2px;
  background: var(--brand);
}

.check__box > svg {
  grid-area: 1 / 1;
}

.check input:focus-visible + .check__box {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- Login ---------- */

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: var(--spacing-6);
}

.login__card {
  display: grid;
  gap: var(--spacing-5);
  width: min(420px, 100%);
  padding: var(--spacing-8);
}

.login__title {
  margin-top: var(--spacing-4);
  color: var(--heading);
  font-size: 28px;
  font-weight: 700;
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
}

.login__lead {
  margin-top: calc(var(--spacing-3) * -1);
  color: var(--muted);
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  right: var(--spacing-4);
  bottom: var(--spacing-4);
  z-index: 60;
  display: grid;
  gap: var(--spacing-2);
  width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  padding: var(--spacing-3) var(--spacing-4);
  border: 1px solid var(--default-medium);
  border-radius: var(--radius-md);
  background: var(--neutral-primary);
  box-shadow: var(--elevation-3);
  color: var(--heading);
  font-size: var(--font-size-sm);
  animation: toast-in 180ms ease;
}

.toast svg {
  margin-top: 2px;
}

.toast--ok svg {
  color: var(--success);
}

.toast--err svg {
  color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------- Responsive ---------- */

/* The nav holds a status chip of changing width ("Catching up 1892"); below
   900px the Telegram chip and button labels give way so it never overflows. */
@media (max-width: 900px) {
  .chip--hide-sm,
  .nav .hide-sm {
    display: none;
  }
}

@media (max-width: 1024px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feed > li {
    grid-template-columns: 64px 120px minmax(0, 110px) minmax(0, 1fr);
  }

  .feed__link {
    display: none;
  }
}

@media (max-width: 640px) {
  .container {
    padding-inline: var(--spacing-4);
  }

  .stats {
    grid-template-columns: minmax(0, 1fr);
  }

  .chip--hide-sm,
  .hide-sm {
    display: none;
  }

  .field-row,
  .checks__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .page__title {
    font-size: 32px;
  }

  .panel__head,
  .group-bar,
  .bulk-bar,
  .table th,
  .table td,
  .feed > li {
    padding-inline: var(--spacing-4);
  }

  .bulk-bar__actions {
    width: 100%;
  }

  .bulk-bar .field__shell--select {
    flex: 1;
    min-width: 0;
  }

  .tabs {
    padding-inline: var(--spacing-4);
  }

  /* The field and button stack rather than squeeze: a label is never cut
     or hidden to make a row fit. */
  .toolbar {
    flex-direction: column;
    width: 100%;
  }

  .field__shell--search,
  .toolbar .btn {
    width: 100%;
  }

  /* On a phone the row keeps time, kind and wallet on one line and lets the
     summary take a second — still two lines, not the old four. */
  .feed > li {
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 4px var(--spacing-3);
    padding-block: var(--spacing-2);
  }

  .feed__summary {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
