/* ============================================================
   GnoPulse — Supabase-inspired dark SaaS design system
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
  /* surfaces */
  --bg: #161618;
  --bg-grid: #1c1c1f;
  --surface: #1b1b1e;
  --surface-2: #202024;
  --surface-3: #26262b;
  --border: #2a2a2e;
  --border-strong: #36363c;
  --border-accent: rgba(62, 207, 142, 0.32);

  /* text */
  --text: #ededed;
  --text-2: #b4b4b8;
  --text-muted: #8a8a90;
  --text-dim: #66666c;

  /* accent — Supabase emerald */
  --accent: #3ecf8e;
  --accent-hover: #4ee0a0;
  --accent-dim: rgba(62, 207, 142, 0.12);
  --accent-dim-2: rgba(62, 207, 142, 0.18);
  --accent-text: #3ecf8e;

  /* status */
  --green: #3ecf8e;
  --green-bg: rgba(62, 207, 142, 0.12);
  --red: #f1666a;
  --red-bg: rgba(241, 102, 106, 0.13);
  --amber: #f5b53d;
  --amber-bg: rgba(245, 181, 61, 0.13);
  --gray: #8a8a90;
  --gray-bg: rgba(138, 138, 144, 0.13);
  --violet: #a78bfa;
  --violet-bg: rgba(167, 139, 250, 0.14);
  --blue: #5fa8fb;
  --blue-bg: rgba(95, 168, 251, 0.14);
  --orange: #fb9a4b;
  --orange-bg: rgba(251, 154, 75, 0.14);
  --cyan: #38d4e0;
  --cyan-bg: rgba(56, 212, 224, 0.14);
  --pink: #f47bb6;
  --pink-bg: rgba(244, 123, 182, 0.14);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --sidebar-w: 232px;
  --header-h: 56px;

  --row-h: 38px;
  --row-pad: 9px;

  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', 'Menlo', monospace;
}

/* density: comfortable */
:root[data-density="comfortable"] {
  --row-h: 46px;
  --row-pad: 13px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13.5px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#root { height: 100%; }

/* Tie the app-shell height to the DYNAMIC viewport so the bottom of the page
   isn't trapped under the mobile browser's toolbar (iOS Safari 100% / 100vh
   bug — content gets cut off and unreachable). dvh tracks the visible area. */
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

::selection { background: var(--accent-dim-2); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #303036; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3c3c44; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.mono { font-family: var(--mono); font-feature-settings: "ss01"; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.dim { color: var(--text-muted); }
.dimmer { color: var(--text-dim); }

/* ============================================================
   App shell
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: #161618;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(150deg, var(--accent), #2bb673);
  display: grid; place-items: center;
  color: #0c1f17;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(62,207,142,0.4), 0 4px 12px -4px rgba(62,207,142,0.5);
}
.brand-name { font-weight: 600; font-size: 14.5px; letter-spacing: -0.02em; }
.brand-name b { color: var(--accent); font-weight: 600; }

.sidebar-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 10px 24px; }
.nav-group { margin-bottom: 14px; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 10px 5px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6.5px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 450;
  cursor: pointer;
  position: relative;
  user-select: none;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
}
.nav-item > span:nth-child(2) { flex: 1; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-item.disabled { color: var(--text-dim); cursor: default; }
.nav-item.disabled:hover { background: transparent; color: var(--text-dim); }
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); display: grid; place-items: center; }
.nav-item .soon {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  background: var(--surface-3);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .count { color: var(--accent); }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  white-space: nowrap;
}
.avatar {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--text-2);
}

/* ---------- Main column ---------- */
.main-col { display: flex; flex-direction: column; height: 100%; overflow: hidden; min-width: 0; }

.header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  flex-shrink: 0;
  background: rgba(22,22,24,0.85);
  backdrop-filter: blur(8px);
}
.header-search {
  flex: 1;
  min-width: 0;
  max-width: 460px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  height: 34px;
  color: var(--text-muted);
  transition: border-color 0.12s;
}
.header-search:focus-within { border-color: var(--border-accent); }
.header-search input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text); font-family: inherit; font-size: 13px;
}
.header-search input::placeholder { color: var(--text-dim); }
.header-search .kbd {
  font-size: 10.5px; font-family: var(--mono); color: var(--text-dim);
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 5px;
}
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* Hamburger — desktop hidden, shown only inside the mobile media query below. */
.menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: -4px;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--text-2); cursor: pointer; flex-shrink: 0;
}
.menu-btn:hover { background: var(--surface-2); color: var(--text); }

/* Backdrop behind the off-canvas nav drawer (mobile only). */
.sidebar-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.18s ease;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

.net-select {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 5px 9px; height: 32px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap; flex-shrink: 0;
}
.net-select:hover { border-color: var(--border-strong); }
.net-select.net-static, .net-select.net-static:hover { border-color: var(--border); cursor: default; }
.header-stat {
  display: flex; flex-direction: column; line-height: 1.25; text-align: right;
}
.header-stat .k { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.header-stat .v { font-size: 12.5px; font-weight: 600; font-family: var(--mono); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 26px 64px;
  position: relative;
}
.content-inner { max-width: 1480px; margin: 0 auto; }

/* ---------- Page head ---------- */
.page-head { margin-bottom: 20px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); margin-bottom: 9px; }
.breadcrumb .sep { color: var(--border-strong); }
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.page-sub { color: var(--text-muted); font-size: 13.5px; margin: 6px 0 0; max-width: 720px; line-height: 1.5; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }

/* hero grid backdrop for overview */
.hero {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(62,207,142,0.05), transparent 46%),
    var(--surface);
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(110% 120% at 0% 0%, #000 18%, transparent 60%);
          mask-image: radial-gradient(110% 120% at 0% 0%, #000 18%, transparent 60%);
  opacity: 0.35;
  pointer-events: none;
}
:root[data-herogrid="off"] .hero::before { display: none; }
.hero > * { position: relative; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 500; color: var(--accent);
  background: var(--accent-dim); border: 1px solid var(--border-accent);
  padding: 4px 10px; border-radius: 100px; margin-bottom: 14px;
}
.hero h1 { font-size: 27px; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 8px; }
.hero p { color: var(--text-2); font-size: 14px; margin: 0; max-width: 640px; line-height: 1.55; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  height: 32px; padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px; font-weight: 500;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: #424248; }
.btn.primary {
  background: var(--accent); color: #0c1f17; border-color: transparent; font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 28px; }

/* ============================================================
   Badges
   ============================================================ */
/* No pill/box/outline anywhere — a badge is just colored text plus (optionally) a
   colored dot. The hue carries the meaning; the dot keeps its own colour. */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500;
  padding: 0; border: none; background: transparent;
  white-space: nowrap; line-height: 1.5;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.green  { color: var(--green); }
.badge.red    { color: var(--red); }
.badge.amber  { color: var(--amber); }
.badge.gray   { color: var(--gray); }
.badge.violet { color: var(--violet); }
.badge.blue   { color: var(--blue); }
.badge.orange { color: var(--orange); }
.badge.cyan   { color: var(--cyan); }
.badge.pink   { color: var(--pink); }
.badge.accent { color: var(--accent); }
/* Quiet/muted status: the dot carries the (subtle) signal, text stays neutral. Used
   for the "expected" positive states (Success / Active / Live) that repeat every row —
   so a colour marks the exception, not the norm. */
.badge.quiet  { color: var(--text-2); }
.badge.quiet .dot { background: var(--green); }
.badge.muted  { color: var(--text-dim); }
.badge.muted .dot { background: var(--text-dim); }

/* A realm path that's its OWN click target inside a row (opens the realm drawer, not the
   row's tx/function) reads as a link: faintly accent-tinted at rest, full accent +
   underline on hover, while the rest of the row keeps its normal hover. */
.realm-link { cursor: pointer; color: color-mix(in srgb, var(--accent) 38%, var(--text-2)); transition: color .12s ease; }
.realm-link:hover { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.realm-link:hover .dimmer { color: var(--accent); opacity: .55; }

/* ============================================================
   KPI cards
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}
.kpi-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px 13px;
  transition: border-color 0.12s, background 0.12s;
  min-width: 0;
}
.kpi-card.click { cursor: pointer; }
.kpi-card.click:hover { border-color: var(--border-strong); background: var(--surface-2); }
.kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; min-width: 0; }
.kpi-top .spark { flex-shrink: 0; }
.kpi-ico { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); flex-shrink: 0; }
.kpi-ico.accent { background: var(--accent-dim); border-color: var(--border-accent); color: var(--accent); }
.kpi-label { font-size: 12px; color: var(--text-muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.kpi-value { font-size: 25px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-value .suffix { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.kpi-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 11.5px; color: var(--text-dim); }
.kpi-trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.flat { color: var(--text-muted); }

/* sparkline */
.spark { display: block; }

/* ============================================================
   Panels
   ============================================================ */
.grid-cols { display: grid; gap: 14px; }
.cols-3-2-1 { grid-template-columns: 1.35fr 1fr; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-feed { grid-template-columns: 1.5fr 1fr; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.panel-title .sub { color: var(--text-dim); font-weight: 400; margin-left: 7px; font-size: 12px; }
.panel-head .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 14px 16px; }
.panel-body.flush { padding: 0; }
.panel-foot {
  padding: 9px 16px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-muted);
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(62,207,142,0.5); animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62,207,142,0.45); }
  70% { box-shadow: 0 0 0 6px rgba(62,207,142,0); }
  100% { box-shadow: 0 0 0 0 rgba(62,207,142,0); }
}

/* ============================================================
   Tables
   ============================================================ */
.tbl-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 9px var(--row-pad);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
table.tbl thead th.sortable { cursor: pointer; }
table.tbl thead th.sortable:hover { color: var(--text-2); }
table.tbl thead th.r, table.tbl tbody td.r { text-align: right; }
table.tbl tbody td {
  padding: var(--row-pad) var(--row-pad);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  height: var(--row-h);
  white-space: nowrap;
  vertical-align: middle;
}
table.tbl tbody tr { transition: background 0.1s; }
table.tbl tbody tr.click { cursor: pointer; }
table.tbl tbody tr.click:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td .strong { color: var(--text); font-weight: 500; }
.cell-main { color: var(--text) !important; font-weight: 500; }
.cell-mono { font-family: var(--mono); font-size: 12px; letter-spacing: -0.01em; }
.cell-sub { color: var(--text-dim); font-size: 11.5px; margin-top: 1px; }

/* mono link / hash */
.hashcell { display: inline-flex; align-items: center; gap: 6px; }
.hashcell .h { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.linklike { color: var(--text); cursor: pointer; border-bottom: 1px dotted var(--border-strong); }
.linklike:hover { color: var(--accent); border-color: var(--border-accent); }
.mono-link { font-family: var(--mono); font-size: 12px; color: var(--text-2); cursor: pointer; }
.mono-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.copy-btn {
  width: 20px; height: 20px; border-radius: 5px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent;
  color: var(--text-dim); flex-shrink: 0;
  transition: all 0.12s;
}
.copy-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border); }
.copy-btn.ok { color: var(--green); }

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-search {
  display: flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0 10px; height: 32px; min-width: 220px;
  color: var(--text-muted);
}
.filter-search:focus-within { border-color: var(--border-accent); }
.filter-search input { background: none; border: none; outline: none; color: var(--text); font-family: inherit; font-size: 12.5px; width: 100%; }
.filter-search input::placeholder { color: var(--text-dim); }
.select-wrap { position: relative; }
select.select, .pill-select {
  height: 32px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-2);
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  padding: 0 30px 0 11px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a90' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
select.select:hover { border-color: var(--border-strong); }
.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 2px;
}
.seg button {
  height: 26px; padding: 0 10px; border: none; background: transparent; border-radius: 5px;
  color: var(--text-muted); font-size: 12px; font-weight: 500;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface-3); color: var(--text); }
.filter-spacer { margin-left: auto; }
.result-count { font-size: 12px; color: var(--text-dim); }

/* advanced filter drawer-row */
.adv-filters {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.adv-filters .fld { display: flex; flex-direction: column; gap: 6px; }
.adv-filters .fld > label { font-size: 11px; color: var(--text-dim); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.adv-filters .fld select.select, .adv-filters .fld .filter-search { width: 100%; }

/* toggle switch */
.toggle {
  display: inline-flex; align-items: center; gap: 9px;
  background: none; border: none; padding: 0; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 500;
}
.toggle .knob {
  width: 34px; height: 20px; border-radius: 100px; background: var(--surface-3);
  border: 1px solid var(--border-strong); position: relative; transition: background 0.15s, border-color 0.15s; flex-shrink: 0;
}
.toggle .knob::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-muted); transition: transform 0.15s, background 0.15s;
}
.toggle.on .knob { background: var(--accent-dim-2); border-color: var(--border-accent); }
.toggle.on .knob::after { transform: translateX(14px); background: var(--accent); }

/* toast */
#gp-toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.gp-toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 10px 15px; font-size: 13px; color: var(--text); font-weight: 500;
  box-shadow: 0 14px 40px -12px rgba(0,0,0,0.7);
  opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s;
}
.gp-toast.show { opacity: 1; transform: translateY(0); }
.gp-toast-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.gp-toast.info .gp-toast-dot { background: var(--blue); }
.gp-toast.warn .gp-toast-dot { background: var(--amber); }

/* rule toggle list (alert rules) */
.rule-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rule-item { background: var(--surface); padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.rule-item .grow { flex: 1; min-width: 0; }
.rule-item .rname { font-size: 13px; font-weight: 500; color: var(--text); }
.rule-item .rdesc { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }

/* ============================================================
   Tabs (profile subtabs)
   ============================================================ */
.tabs {
  display: flex; align-items: center; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.tab {
  position: relative;
  padding: 9px 13px 11px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  background: none; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.12s;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .tcount {
  font-size: 11px; font-weight: 600; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 0 6px; border-radius: 5px; font-variant-numeric: tabular-nums;
}
.tab.on .tcount { color: var(--accent); background: var(--accent-dim); border-color: var(--border-accent); }

/* identity header */
.wallet-head {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 16px;
}
.wallet-avatar {
  width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(140deg, var(--accent-dim-2), var(--surface-3));
  border: 1px solid var(--border-accent); display: grid; place-items: center; color: var(--accent);
}
.wallet-addr { font-family: var(--mono); font-size: 15px; font-weight: 500; letter-spacing: -0.01em; display: flex; align-items: center; gap: 7px; }
.wallet-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* pager */
.pager { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--border); }
.pager .pinfo { font-size: 12px; color: var(--text-muted); }
.pager .pspace { margin-left: auto; }
.pg-btns { display: flex; align-items: center; gap: 4px; }
.pg-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums;
  display: inline-grid; place-items: center;
}
.pg-btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-strong); color: var(--text); }
.pg-btn.on { background: var(--accent-dim); border-color: var(--border-accent); color: var(--accent); }
.pg-btn:disabled { opacity: 0.4; cursor: default; }
.pg-ellipsis { color: var(--text-dim); padding: 0 2px; font-size: 12px; }
.pg-size { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); }

/* ============================================================
   Feed
   ============================================================ */
.feed { display: flex; flex-direction: column; }
.feed-item {
  display: flex; gap: 11px; padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--surface-2); }
.feed-ico {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}
.feed-body { min-width: 0; flex: 1; }
.feed-title { font-size: 12.5px; color: var(--text); font-weight: 500; margin-bottom: 2px; line-height: 1.4; }
.feed-meta { font-size: 11.5px; color: var(--text-dim); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.feed-meta .mono { color: var(--text-muted); min-width: 0; overflow-wrap: anywhere; }

/* ============================================================
   Banner
   ============================================================ */
.banner {
  display: flex; gap: 12px; align-items: flex-start;
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 18px;
  font-size: 13px; line-height: 1.5;
}
.banner.amber { background: var(--amber-bg); border: 1px solid rgba(245,181,61,0.25); color: #f5cf8a; }
.banner.accent { background: var(--accent-dim); border: 1px solid var(--border-accent); color: #aef0cf; }
.banner.gray { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); }
.banner .b-ico { flex-shrink: 0; margin-top: 1px; }
.banner b { color: #fff; font-weight: 600; }
.banner.accent b { color: var(--accent); }

/* ============================================================
   Drawer
   ============================================================ */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  opacity: 1;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 61;
  width: 560px; max-width: 94vw;
  background: var(--surface);
  border-left: 1px solid var(--border-strong);
  box-shadow: -24px 0 60px -20px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  transform: translateX(0);
}
.drawer-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px; flex-shrink: 0;
}
.drawer-head .x { margin-left: auto; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.drawer-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 600; margin-bottom: 5px; }
.drawer-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.dsec { margin-bottom: 22px; }
.dsec-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); font-weight: 600; margin-bottom: 10px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kv { background: var(--surface); padding: 10px 12px; }
.kv .k { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.kv .v { font-size: 13px; color: var(--text); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kv .v.mono { font-family: var(--mono); font-size: 12px; }

.mini-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mini-row { background: var(--surface); padding: 9px 12px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.mini-row .grow { flex: 1; min-width: 0; }
.mini-row .mono { font-size: 12px; }

.json-block {
  background: #131315; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.65;
  color: var(--text-2); overflow-x: auto; white-space: pre;
}
.json-block .key { color: var(--blue); }
.json-block .str { color: var(--accent); }
.json-block .num2 { color: var(--amber); }

/* ============================================================
   Progress / bars
   ============================================================ */
.bar { height: 6px; border-radius: 100px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 100px; background: var(--accent); }
.bar.red > span { background: var(--red); }
.bar.amber > span { background: var(--amber); }
.rate { display: flex; align-items: center; gap: 8px; }
.rate .bar { width: 56px; }
.rate .pct { font-variant-numeric: tabular-nums; font-size: 12px; min-width: 38px; }

/* ============================================================
   Empty / coming soon
   ============================================================ */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 70px 20px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface);
}
.empty-ico { width: 52px; height: 52px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text-muted); margin-bottom: 16px; }
.empty h3 { font-size: 16px; font-weight: 600; margin: 0 0 7px; }
.empty p { color: var(--text-muted); font-size: 13px; margin: 0 0 18px; max-width: 380px; line-height: 1.55; }

/* health rows (data quality) */
.health-row { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.health-row:last-child { border-bottom: none; }
.health-name { font-size: 13px; font-weight: 500; color: var(--text); }
.health-desc { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.health-val { font-family: var(--mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* two-col detail layouts */
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* small helpers */
.row { display: flex; align-items: center; gap: 8px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap-gap { display: flex; flex-wrap: wrap; gap: 8px; }
.mt8 { margin-top: 8px; } .mt14 { margin-top: 14px; } .mb14 { margin-bottom: 14px; }
.txt-c { text-align: center; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .cols-3-2-1, .cols-feed, .split, .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  /* Single full-width column; the sidebar leaves grid flow and becomes a drawer. */
  :root { --sidebar-w: 0px; }
  .app-shell { grid-template-columns: 1fr; }

  /* Off-canvas nav drawer: fixed, slides in from the left when .open.
     Left padding clears the notch in landscape (safe-area inset). */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 264px; max-width: 84vw; z-index: 80;
    padding-left: env(safe-area-inset-left);
    transform: translateX(calc(-100% - env(safe-area-inset-left)));
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 24px 0 60px -20px rgba(0,0,0,0.6);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar:focus { outline: none; }            /* it's a focus target, not a focus ring */
  .sidebar-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }

  /* Bigger tap targets in the drawer (≥44px, Apple HIG). */
  .nav-item { padding: 11px 12px; min-height: 44px; font-size: 13.5px; }
  .nav-group-soon { display: none; }           /* hide coming-soon placeholders on mobile */

  .menu-btn { display: flex; }

  /* Condense the header: drop the block stat, divider, and network chip;
     keep the hamburger, search, and live-status pill. Honour notch insets. */
  .header {
    gap: 10px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .header-search { max-width: none; }
  /* Mobile: drop the whole right cluster — block stat, status pill, network chip.
     Header is just the hamburger + search. */
  .header-right { display: none; }

  /* Tighter page gutters; clear the notch + home-indicator. */
  .content {
    padding: 16px max(14px, env(safe-area-inset-right)) calc(56px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }
  /* Tighter hero so the cards surface sooner (smaller gnome + title, less pad). */
  .hero { padding: 18px 16px; margin-bottom: 16px; }
  .hero h1 { font-size: 21px; }
  .hero p { font-size: 12.5px; }
  .hero > div:first-child { gap: 12px !important; margin-bottom: 4px !important; }
  .hero > div:first-child > div:first-child,
  .hero [alt="Gno.land"] { width: 40px !important; height: 40px !important; }

  /* Compact metric cards (Mintscan/GnoScan style): 2-up, text-only — no icon
     or sparkline — with a smaller value, so the stats don't dominate the screen. */
  /* Force 2-up on every stat strip — most pages hard-code repeat(4|5|6,1fr)
     inline, which would otherwise crush the cards and clip the numbers. */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; margin-bottom: 16px; }
  .kpi-card { padding: 11px 12px; }
  .kpi-top { margin-bottom: 5px; gap: 6px; }
  .kpi-ico, .kpi-top .spark { display: none; }
  .kpi-label { font-size: 11.5px; }
  .kpi-value { font-size: 19px; }
  .kpi-value .suffix { font-size: 11px; }
  .kpi-meta { margin-top: 4px; font-size: 11px; }

  /* Background must not scroll behind the open drawer (belt-and-suspenders
     with the full-viewport backdrop). */
  .nav-locked .content { overflow: hidden; }

  /* Detail drawers (tx / realm / block / pool / function) go full-screen on
     phones instead of a 94vw panel with a dead sliver beside it, and honour
     the notch + home-indicator insets. */
  .drawer { width: 100%; max-width: 100%; border-left: none; }
  .drawer-head {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-left: max(20px, env(safe-area-inset-left));
  }
  .drawer-body {
    padding-right: max(20px, env(safe-area-inset-right));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
  /* Key/value pairs stack to one column so values (fees, addresses, gas) aren't
     crushed into ~170px half-cells. */
  .kv-grid { grid-template-columns: 1fr; }
  /* Tables nested inside a drawer keep their own horizontal scroll but must not
     blow out the drawer width. */
  .drawer-body .tbl-wrap { max-width: 100%; }
}

@media (max-width: 520px) {
  /* Keep KPIs 2-up even on the smallest phones (compact rules above); just
     tighten the network pill. */
  .net-select { padding: 5px 7px; }
}

/* Progressive-load skeleton rows (TableLoading) */
.sk-row td { padding-top: 11px; padding-bottom: 11px; }
.sk-bar {
  display: inline-block; height: 11px; min-width: 24px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, rgba(255,255,255,0.07) 37%, var(--surface-2) 63%);
  background-size: 400% 100%; animation: sk-shimmer 1.4s ease infinite;
}
@keyframes sk-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Global search autocomplete dropdown */
.header-search { position: relative; }
.search-dd {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 14px 40px -12px rgba(0,0,0,0.7);
  padding: 5px; max-height: 70vh; overflow-y: auto;
}
.search-dd-head { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); padding: 8px 10px 4px; }
.search-dd-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--text-dim); }
.search-dd-item .ddi-label { font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dd-item .ddi-sub { margin-left: auto; font-size: 11px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; padding-left: 10px; }
.search-dd-item.on { background: var(--surface-3); color: var(--text-2); }
/* Header must sit above the scrolling content so the search dropdown overlays it */
.header { position: relative; z-index: 50; }
