/* ─── APP — PREMIUM DASHBOARD ──────────────────────────────────────── */

:root {
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;
}

body { background: var(--ink); overflow: hidden; height: 100vh; height: 100dvh; }

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: all var(--t-xs) var(--ease-out);
}
.hamburger:hover { background: var(--surface); color: var(--text); }
.hamburger svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; fill: none; }

/* Drawer overlay for mobile sidebar */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t) var(--ease-out);
  z-index: 400;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

/* ═══ ONBOARDING ═══════════════════════════════════════════════════ */
.onb {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  background: var(--black);
  z-index: 100;
  opacity: 1;
  transition: opacity var(--t-lg) var(--ease-out);
}
.onb.hidden { opacity: 0; pointer-events: none; }

.onb-top {
  padding: var(--s-5) var(--s-7);
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line);
}
.onb-progress {
  display: flex; gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--text-3);
}
.onb-skips {
  display: flex; gap: var(--s-2); align-items: center;
}
.onb-skip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--t-xs) var(--ease-out);
}
.onb-skip:hover {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}
.onb-skip svg { opacity: 0.8; }
@media (max-width: 640px) {
  .onb-skips { flex-direction: column; gap: 6px; align-items: stretch; }
  .onb-skip span { font-size: 0.62rem; }
}
.onb-steps {
  display: flex; gap: var(--s-2);
  margin-left: var(--s-4);
}
.onb-step-dot {
  width: 24px; height: 2px;
  background: var(--line-2);
  border-radius: 1px;
  transition: background var(--t) var(--ease-out);
}
.onb-step-dot.done { background: var(--accent); }
.onb-step-dot.current { background: var(--text); }

.onb-main {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-7);
  overflow-y: auto;
}
.onb-panel {
  width: 100%;
  max-width: 580px;
  opacity: 0;
  transform: translateY(16px);
  animation: onb-in var(--t-lg) var(--ease-out) forwards;
}
.onb-panel.exit { animation: onb-out var(--t) var(--ease-out) forwards; }
@keyframes onb-in { to { opacity: 1; transform: translateY(0); } }
@keyframes onb-out { to { opacity: 0; transform: translateY(-16px); } }

.onb-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: var(--s-4);
}
.onb-title {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  margin-bottom: var(--s-4);
  letter-spacing: -0.035em;
}
.onb-body {
  font-size: 1.02rem;
  color: var(--text-2);
  margin-bottom: var(--s-7);
  max-width: 480px;
  line-height: 1.55;
}

.onb-nav {
  display: flex; justify-content: space-between;
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}

/* Wallet options (legacy grid — kept for back-compat) */
.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-3);
}
.wallet-opt {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--t-sm) var(--ease-out);
  text-align: left;
}
.wallet-opt:hover { background: var(--surface-2); border-color: var(--line-hi); transform: translateY(-1px); }
.wallet-opt.selected { border-color: var(--accent); background: var(--accent-haze); }
.wallet-opt-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}
.wallet-opt-name { font-weight: 500; font-size: 0.95rem; }
.wallet-opt-sub { font-size: 0.78rem; color: var(--text-3); }

/* Connect card — real wallet connection */
.connect-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--t-sm) var(--ease-out), background var(--t-sm) var(--ease-out);
}
.connect-card.connected {
  border-color: rgba(52,211,153,0.3);
  background: linear-gradient(135deg, rgba(52,211,153,0.04), transparent 60%), var(--surface);
}
.connect-card-top {
  display: flex; align-items: center; gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.connect-card-icon {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.connect-card-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.6; fill: none; }
.connect-card-info { flex: 1; min-width: 0; }
.connect-card-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}
.connect-card-addr {
  font-size: 0.95rem;
  color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.connect-card-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--line-2);
  flex-shrink: 0;
  transition: background var(--t-sm) var(--ease-out);
}
.connect-card-dot.on {
  background: var(--alive);
  box-shadow: 0 0 12px rgba(52,211,153,0.5);
}
.connect-card-actions {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.connect-card-actions .btn { flex: 0 1 auto; }
.connect-card-supports {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}
.cc-chip {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-3);
  letter-spacing: 0.04em;
}

/* ENS live-preview inline */
.ens-preview-wrap { min-height: 22px; }
.ens-preview {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.ens-preview svg { width: 13px; height: 13px; stroke: currentColor; stroke-width: 1.8; fill: none; }
.ens-preview.ok { color: var(--alive); }
.ens-preview.err { color: var(--silent); }
.ens-preview.loading { color: var(--text-3); }
.ens-preview.loading::before {
  content: ''; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--text-3);
  border-top-color: transparent;
  animation: ens-spin 0.8s linear infinite;
}
@keyframes ens-spin { to { transform: rotate(360deg); } }

/* Role chips */
.chips {
  display: flex; flex-wrap: wrap;
  gap: var(--s-2);
  padding: var(--s-3);
  min-height: 80px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.chip {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 6px 10px 6px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 0.82rem;
  animation: chip-in var(--t) var(--ease-spring);
}
@keyframes chip-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.chip-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--chip-color, var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 600; color: var(--black);
}
.chip-remove {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--line);
  font-size: 0.7rem;
  color: var(--text-2);
  cursor: pointer;
}
.chip-remove:hover { background: var(--silent); color: var(--text); }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.field {
  width: 100%;
  height: 44px;
  padding: 0 var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.94rem;
  color: var(--text);
  transition: border-color var(--t-xs) var(--ease-out);
}
.field:focus { border-color: var(--accent); background: var(--surface-2); }
.field::placeholder { color: var(--text-3); }
textarea.field { min-height: 140px; padding: var(--s-4); resize: vertical; line-height: 1.6; }
select.field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='rgba(255,255,255,0.4)'%3E%3Cpath d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 36px;
}

/* Sliders */
.slider-wrap { padding: var(--s-5) 0; }
.slider-val {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--accent);
  letter-spacing: -0.03em;
  margin-bottom: var(--s-2);
}
.slider-unit { font-size: 1.2rem; color: var(--text-3); font-family: var(--font-body); margin-left: 8px; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  background: var(--line-2);
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--t-xs) var(--ease-out);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); background: var(--accent); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; background: var(--text); border-radius: 50%; cursor: pointer; border: 0; }

/* ═══ APP SHELL ════════════════════════════════════════════════════ */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh; height: 100dvh;
  background: var(--ink);
}
.shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ═══ SIDEBAR ═══════════════════════════════════════════════════════ */
.sidebar {
  grid-row: 1 / -1;
  border-right: 1px solid var(--line);
  background: var(--black);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: grid-column var(--t) var(--ease-out);
}
.sidebar-top {
  height: var(--topbar-h);
  padding: 0 var(--s-5);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.sb-collapse {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: all var(--t-xs) var(--ease-out);
}
.sb-collapse:hover { background: var(--surface); color: var(--text); }

.sidebar-nav {
  flex: 1;
  padding: var(--s-4) var(--s-3);
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.sb-section {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  color: var(--text-4);
  text-transform: uppercase;
  padding: var(--s-4) var(--s-3) var(--s-2);
  white-space: nowrap;
  overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
}
.sb-section-count {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 3px;
}
.sb-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 9px var(--s-3);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--t-xs) var(--ease-out);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.sb-item:hover { background: var(--surface); color: var(--text); }
.sb-item.active {
  background: var(--surface-2);
  color: var(--text);
}
.sb-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.sb-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sb-item-label { flex: 1; }
.sb-item-badge {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.sb-item-badge.red { background: var(--silent-soft); color: var(--silent); }

.sidebar-foot {
  padding: var(--s-4);
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
}
.user-pill {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-xs) var(--ease-out);
}
.user-pill:hover { background: var(--surface); }
.user-av {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  flex-shrink: 0;
}
.user-info { overflow: hidden; }
.user-name { font-size: 0.85rem; font-weight: 500; color: var(--text); }
.user-addr { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }

/* Collapsed state */
.shell.collapsed .sb-section,
.shell.collapsed .sb-item-label,
.shell.collapsed .sb-item-badge,
.shell.collapsed .user-info,
.shell.collapsed .brand span:not(.brand-mark) { display: none; }
.shell.collapsed .sb-item { justify-content: center; }
.shell.collapsed .brand { justify-content: center; }

/* ═══ TOPBAR ═══════════════════════════════════════════════════════ */
.topbar {
  grid-column: 2 / -1;
  grid-row: 1;
  height: var(--topbar-h);
  padding: 0 var(--s-6);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-5);
  background: var(--black);
}
.topbar-title { display: flex; align-items: center; gap: var(--s-3); }
.topbar-title h1 {
  font-size: 1.1rem;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.topbar-actions { display: flex; align-items: center; gap: var(--s-3); }

.trailer-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 36px;
  padding: 0 var(--s-4);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid rgba(167,139,250,0.22);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: all var(--t-xs) var(--ease-out);
  white-space: nowrap;
}
.trailer-btn:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.trailer-btn svg { color: var(--accent); transition: color var(--t-xs) var(--ease-out); }
.trailer-btn:hover svg { color: #000; }
@media (max-width: 640px) {
  .trailer-btn span { display: none; }
  .trailer-btn { padding: 0; width: 36px; height: 36px; justify-content: center; }
}

.search {
  width: 300px;
  height: 36px;
  padding: 0 var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex; align-items: center; gap: var(--s-3);
  font-size: 0.85rem;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--t-xs) var(--ease-out);
}
.search:hover { border-color: var(--line-hi); }
.search svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.5; fill: none; }
.search kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text-3);
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: all var(--t-xs) var(--ease-out);
  position: relative;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn .badge {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px;
  background: var(--silent);
  border-radius: 50%;
  border: 1.5px solid var(--black);
}

/* ═══ MAIN CONTENT ═══════════════════════════════════════════════════ */
.content {
  grid-column: 2 / -1;
  grid-row: 2;
  overflow-y: auto;
  padding: var(--s-6);
}
.content-inner { max-width: 1200px; margin: 0 auto; }

.page { display: none; }
.page.active { display: block; animation: page-in var(--t) var(--ease-out); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: var(--s-6);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--line);
}
.page-head h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: var(--s-2);
}
.page-head p { font-size: 0.92rem; color: var(--text-2); max-width: 560px; }
.page-head-actions { display: flex; gap: var(--s-2); flex-shrink: 0; }

/* ═══ DASHBOARD ════════════════════════════════════════════════════ */
.hero-score {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: var(--s-6);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: var(--s-7);
  margin-bottom: var(--s-5);
  position: relative;
  overflow: hidden;
}
.hero-score::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 400px; height: 400px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  pointer-events: none;
  opacity: 0.6;
}
@media (max-width: 900px) { .hero-score { grid-template-columns: 1fr; } }

.score-ring-wrap { position: relative; width: 220px; height: 220px; margin: 0 auto; }
.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring-bg { stroke: var(--surface-3); stroke-width: 8; fill: none; }
.score-ring-fill {
  stroke: var(--accent);
  stroke-width: 8;
  fill: none;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--t-xl) var(--ease-out), stroke var(--t-lg) var(--ease-out);
  filter: drop-shadow(0 0 12px var(--accent-soft));
}
.score-ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none;
}
.score-ring-value {
  font-family: var(--font-display); font-weight: 700;
  font-size: 3.5rem; line-height: 1;
  color: var(--text);
  letter-spacing: -0.04em;
  animation: score-breathe 3s var(--ease-out) infinite;
}
@keyframes score-breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.9; } }
.score-ring-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  color: var(--text-3);
  margin-top: var(--s-2);
  text-transform: uppercase;
}

.hero-score-meta {
  display: flex; flex-direction: column;
  justify-content: center;
  gap: var(--s-4);
  position: relative;
  z-index: 1;
}
.hs-head { font-family: var(--font-display); font-size: clamp(1.6rem, 2.4vw, 2.2rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.hs-sub { color: var(--text-2); font-size: 0.95rem; line-height: 1.55; max-width: 440px; }
.hs-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); margin-top: var(--s-3); }
.hs-stat { padding: var(--s-3) var(--s-4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); }
.hs-stat-v { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 500; color: var(--text); line-height: 1; margin-bottom: 4px; }
.hs-stat-l { font-size: 0.7rem; color: var(--text-3); font-family: var(--font-mono); letter-spacing: 0.15em; text-transform: uppercase; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4); margin-bottom: var(--s-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); margin-bottom: var(--s-5); }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s-5);
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--line);
}
.panel-title { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; letter-spacing: -0.015em; }
.panel-action { font-size: 0.82rem; color: var(--text-2); transition: color var(--t-xs) var(--ease-out); }
.panel-action:hover { color: var(--accent); }

/* Role list */
.role-list { display: flex; flex-direction: column; gap: var(--s-2); }
.role-entry {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  transition: background var(--t-xs) var(--ease-out);
}
.role-entry:hover { background: var(--surface-2); }
.re-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--av-color, var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.78rem;
  color: var(--black);
  flex-shrink: 0;
}
.re-info { flex: 1; min-width: 0; }
.re-name { font-size: 0.9rem; font-weight: 500; color: var(--text); }
.re-addr { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-3); }
.re-role {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-2);
  text-transform: uppercase;
}
.re-status {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}
.re-status.pending { background: var(--watch-soft); color: var(--watch); }
.re-status.active { background: var(--alive-soft); color: var(--alive); }
.re-remove {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: all var(--t-xs) var(--ease-out);
  cursor: pointer;
  opacity: 0;
}
.role-entry:hover .re-remove { opacity: 1; }
.re-remove:hover { background: var(--silent-soft); color: var(--silent); }

/* Petitions */
.petition-list { display: flex; flex-direction: column; gap: var(--s-3); }
.petition {
  padding: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: all var(--t-xs) var(--ease-out);
  cursor: pointer;
}
.petition:hover { border-color: var(--line-hi); transform: translateY(-1px); }
.petition-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: var(--s-3);
}
.petition-type { font-weight: 500; font-size: 0.94rem; margin-bottom: 2px; }
.petition-req { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-3); }
.petition-amount { font-family: var(--font-mono); font-size: 0.95rem; font-weight: 500; color: var(--accent); }
.petition-status {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  padding: 3px 8px;
  border-radius: 3px;
  text-transform: uppercase;
}
.ps-commit { background: rgba(167,139,250,0.15); color: var(--accent); }
.ps-reveal { background: rgba(251,191,36,0.15); color: var(--watch); }
.ps-challenge { background: rgba(52,211,153,0.15); color: var(--alive); }
.ps-executed, .ps-cancelled { background: var(--surface-3); color: var(--text-3); }
.ps-vetoed { background: var(--silent-soft); color: var(--silent); }

.petition-progress { display: flex; gap: 2px; margin-top: var(--s-3); }
.pp-step { flex: 1; height: 3px; background: var(--surface-3); border-radius: 2px; }
.pp-step.done { background: var(--accent); }
.pp-step.active { background: var(--accent); box-shadow: 0 0 12px var(--accent-soft); }

/* Empty states */
.empty {
  text-align: center;
  padding: var(--s-7) var(--s-5);
  color: var(--text-3);
}
.empty-title { font-size: 1rem; color: var(--text-2); font-weight: 500; margin-bottom: var(--s-2); }
.empty-desc { font-size: 0.85rem; margin-bottom: var(--s-4); max-width: 320px; margin-left: auto; margin-right: auto; }

/* Silence window modes grid */
.silence-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s-3); margin-bottom: var(--s-4); }
@media (max-width: 700px) { .silence-modes { grid-template-columns: repeat(2, 1fr); } }
.silence-mode {
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--t-xs) var(--ease-out);
  text-align: left;
}
.silence-mode:hover { border-color: var(--line-hi); transform: translateY(-1px); }
.silence-mode.selected { border-color: var(--accent); background: var(--accent-haze); }
.silence-mode svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: var(--s-3); }
.silence-mode-name { font-size: 0.95rem; font-weight: 500; margin-bottom: 4px; }
.silence-mode-desc { font-size: 0.78rem; color: var(--text-3); line-height: 1.4; }

/* Command palette */
.palette-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--t) var(--ease-out);
}
.palette-overlay.open { display: flex; opacity: 1; }
.palette {
  width: min(560px, 92vw);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  transform: translateY(-12px);
  transition: transform var(--t) var(--ease-out);
}
.palette-overlay.open .palette { transform: none; }
.palette-input { width: 100%; height: 56px; padding: 0 var(--s-5); font-size: 1rem; color: var(--text); border-bottom: 1px solid var(--line); }
.palette-input::placeholder { color: var(--text-3); }
.palette-list { max-height: 50vh; overflow-y: auto; padding: var(--s-2); }
.palette-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--text-2);
}
.palette-item:hover, .palette-item.highlighted { background: var(--surface-2); color: var(--text); }
.palette-item svg { width: 16px; height: 16px; color: var(--text-3); }
.palette-item-kbd { margin-left: auto; font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3); }

/* Toasts */
.toasts {
  position: fixed;
  bottom: var(--s-5);
  right: var(--s-5);
  display: flex; flex-direction: column-reverse;
  gap: var(--s-2);
  z-index: 2000;
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4);
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: var(--shadow-2);
  animation: toast-in var(--t) var(--ease-out);
  pointer-events: auto;
  max-width: 320px;
}
.toast.success { border-left-color: var(--alive); }
.toast.error { border-left-color: var(--silent); }
@keyframes toast-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ═══ MODAL ════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: var(--s-5);
}
.modal-overlay.open { display: flex; animation: modal-fade var(--t) var(--ease-out); }
@keyframes modal-fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-scale var(--t) var(--ease-out);
}
@keyframes modal-scale { from { transform: scale(0.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-head {
  padding: var(--s-5);
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.modal-title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.modal-sub { font-size: 0.85rem; color: var(--text-2); margin-top: 4px; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: all var(--t-xs) var(--ease-out);
  margin: -4px;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: var(--s-5); }
.modal-foot {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: var(--s-2);
}

/* Invitation accept card — high-signal */
.invite-card {
  background: linear-gradient(135deg, var(--accent-haze), transparent);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  margin-bottom: var(--s-4);
  position: relative;
  overflow: hidden;
}
.invite-card::before {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  opacity: 0.4;
}
.invite-head {
  display: flex; align-items: center; gap: var(--s-4);
  margin-bottom: var(--s-5);
  position: relative;
  z-index: 1;
}
.invite-av {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--black); font-size: 1.1rem;
}
.invite-info { flex: 1; }
.invite-founder {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}
.invite-addr { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-3); }
.invite-ask {
  font-size: 1.05rem;
  color: var(--text-2);
  margin-bottom: var(--s-5);
  position: relative;
  z-index: 1;
}
.invite-ask strong { color: var(--text); font-weight: 500; }
.invite-role-tag {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 6px 12px;
  background: var(--accent-soft);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
}
.invite-actions { display: flex; gap: var(--s-2); position: relative; z-index: 1; }

/* Founders I serve — card grid */
.founder-card {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: all var(--t-xs) var(--ease-out);
}
.founder-card:hover { border-color: var(--line-hi); transform: translateY(-1px); }
.fc-av { width: 40px; height: 40px; border-radius: 50%; background: var(--av-color, var(--accent)); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--black); }
.fc-info { flex: 1; min-width: 0; }
.fc-name { font-size: 0.95rem; font-weight: 500; }
.fc-meta { font-family: var(--font-mono); font-size: 0.74rem; color: var(--text-3); margin-top: 2px; }
.fc-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.fc-score.silent { color: var(--silent); }
.fc-score.warning { color: var(--watch); }

/* Trust Badge preview */
.badge-preview {
  display: inline-flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--black);
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  box-shadow: 0 0 24px var(--accent-soft);
}
.badge-preview-mark {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent), var(--accent-deep));
  position: relative;
}
.badge-preview-mark::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: brand-pulse 2s infinite;
}
.badge-preview-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
}
.badge-preview-sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.2em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-top: 2px;
}

.code-block {
  background: var(--black);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  overflow-x: auto;
  white-space: pre;
  margin-top: var(--s-3);
}

/* Instructions composer per-trigger blocks */
.trigger-block {
  padding: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: var(--s-3);
}
.trigger-block.active { border-color: var(--accent); background: var(--accent-haze); }
.trigger-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s-3);
}
.trigger-name { font-size: 0.95rem; font-weight: 500; }
.trigger-desc { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 2px; }

/* Fee schedule (Contract page) */
.fee-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.fee-table th, .fee-table td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.fee-table th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--text-3);
  text-transform: uppercase;
  font-weight: 500;
}
.fee-table td.value { font-family: var(--font-mono); color: var(--accent); }
.fee-table tr:hover td { background: var(--surface-2); }

/* Danger zone (NoReleaseFreeze) */
.connect-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr;
  gap: var(--s-4);
}
.connect-grid label { margin-bottom: 4px; display: block; }
@media (max-width: 720px) {
  .connect-grid { grid-template-columns: 1fr; }
}

.tag-accent { background: var(--accent-soft); border-color: rgba(167,139,250,0.25); color: var(--accent); }
.tag-accent .tag-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.danger-zone {
  border: 1px solid var(--silent-soft);
  background: linear-gradient(135deg, var(--silent-soft), transparent 50%);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  margin-top: var(--s-5);
}
.danger-zone .panel-title { color: var(--silent); }

/* ═══ RESPONSIVE BREAKPOINTS ═══════════════════════════════════════ */

/* ── Tablet & below: sidebar becomes a drawer ────────────────────── */
@media (max-width: 960px) {
  body {
    overflow: auto;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .shell {
    display: block;
    grid-template-columns: none;
    grid-template-rows: none;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .shell.collapsed { grid-template-columns: none; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(300px, 88vw);
    z-index: 500;
    transform: translateX(-100%);
    transition: transform var(--t) var(--ease-out);
    box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: translateX(0); }

  /* Collapsed-state overrides don't apply on mobile */
  .shell.collapsed .sb-section,
  .shell.collapsed .sb-item-label,
  .shell.collapsed .sb-item-badge,
  .shell.collapsed .user-info,
  .shell.collapsed .brand span:not(.brand-mark) { display: block; }
  .shell.collapsed .sb-item { justify-content: flex-start; }
  .shell.collapsed .brand { justify-content: flex-start; }
  .sb-collapse { display: none; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    padding: 0 var(--s-4);
    gap: var(--s-3);
  }

  .content {
    padding: var(--s-4);
  }
  .content-inner { max-width: 100%; }

  .hamburger { display: flex; }

  /* Force single-column grids on tablet */
  .hero-score { grid-template-columns: 1fr; padding: var(--s-5); gap: var(--s-5); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hs-stats { grid-template-columns: repeat(3, 1fr); }

  /* Topbar — tighten for tablet */
  .topbar { padding: 0 var(--s-4); gap: var(--s-3); }
  .topbar-title { flex: 1; min-width: 0; }
  .topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* DURESS: icon-only at tablet to save space */
  .duress-btn {
    font-size: 0;
    padding: 0;
    width: 34px;
    height: 34px;
    justify-content: center;
    gap: 0;
  }
  .duress-btn::before { width: 8px; height: 8px; }

  /* Chain picker: hide label on tablet+ mobile */
  .chain-picker-btn .chain-label { display: none; }
  .chain-picker-btn svg:last-child { display: none; }

  /* Balance pill: too wide for tight topbar */
  .balance-pill { display: none !important; }

  /* Search: compact on tablet */
  .search { width: 44px; padding: 0; justify-content: center; }
  .search span, .search kbd { display: none; }

  /* Onboarding */
  .onb-top { padding: var(--s-4); }
  .onb-main { padding: var(--s-4); }
  .wallet-grid { grid-template-columns: 1fr; }
}

/* ── Phone (≤ 640px) ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --topbar-h: 52px; }

  /* ── Topbar ─────────────────────────────────────────────────── */
  .topbar {
    padding: 0 10px;
    gap: 6px;
    overflow: hidden;
  }
  .topbar-title {
    flex: 1;
    min-width: 0;
    gap: 6px;
  }
  .topbar-title h1 {
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .tag { display: none; }
  .topbar-actions { gap: 4px; flex-shrink: 0; }

  /* Duress: dot-only */
  .duress-btn { font-size: 0; padding: 0; width: 32px; height: 32px; justify-content: center; gap: 0; }
  .duress-btn::before { width: 8px; height: 8px; }

  /* Chain picker: dot-only */
  .chain-picker-btn .chain-label,
  .chain-picker-btn svg:last-child { display: none; }
  .chain-picker-btn { padding: 0; width: 32px; height: 32px; justify-content: center; gap: 0; }

  /* Icon buttons */
  .icon-btn { width: 32px; height: 32px; }
  .search { width: 32px; height: 32px; padding: 0; justify-content: center; }
  .search span, .search kbd { display: none; }
  .trailer-btn { display: none; }

  /* ── Content area ───────────────────────────────────────────── */
  .content { padding: var(--s-3); }

  /* ── Hero score ─────────────────────────────────────────────── */
  .hero-score {
    padding: var(--s-4);
    gap: var(--s-4);
    grid-template-columns: 1fr;
  }
  .score-ring-wrap { width: 150px; height: 150px; margin: 0 auto; }
  .score-ring-value { font-size: 2.4rem; }
  .hs-head { font-size: 1.25rem; text-align: center; }
  .hs-sub { font-size: 0.86rem; text-align: center; max-width: 100%; }
  .hs-stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .hs-stat { padding: 8px 6px; text-align: center; }
  .hs-stat-v { font-size: 0.9rem; }
  .hs-stat-l { font-size: 0.58rem; letter-spacing: 0.1em; }

  /* Action buttons stack */
  .hero-score-meta > div[style*="display:flex"] {
    flex-direction: column !important;
    gap: 8px !important;
  }
  .hero-score-meta .btn-sm { width: 100%; justify-content: center; }

  /* ── Panels ─────────────────────────────────────────────────── */
  .panel { padding: var(--s-3); border-radius: var(--r); }
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-bottom: var(--s-2);
  }
  .panel-title { font-size: 0.95rem; }
  .panel-action { font-size: 0.78rem; }

  /* ── Grids ──────────────────────────────────────────────────── */
  .grid-2, .grid-3 { gap: var(--s-3); }
  .silence-modes { grid-template-columns: 1fr 1fr; gap: 8px; }
  .silence-mode { padding: var(--s-3); }
  .silence-mode-name { font-size: 0.88rem; }
  .silence-mode-desc { font-size: 0.72rem; }
  .slider-val { font-size: 2.4rem; }

  /* Invariants single column */
  #page-dashboard div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* ── Page heads ─────────────────────────────────────────────── */
  .page-head { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .page-head-actions { width: 100%; flex-wrap: wrap; }
  .page-head h2 { font-size: 1.3rem; }

  /* ── Roles ──────────────────────────────────────────────────── */
  .role-entry { gap: 6px; padding: 8px 6px; flex-wrap: wrap; }
  .re-info { flex: 1 1 100px; }
  .re-name { font-size: 0.85rem; }
  .re-addr { font-size: 0.68rem; }
  .re-status, .re-role { font-size: 0.58rem; padding: 2px 6px; }

  /* ── Petitions ──────────────────────────────────────────────── */
  .petition { padding: var(--s-3); }
  .petition-head { flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
  .petition-type { font-size: 0.86rem; }
  .petition-amount { font-size: 0.86rem; }

  /* ── Modal → bottom sheet ───────────────────────────────────── */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: 100%; border-radius: 16px 16px 0 0; max-height: 88vh; }
  .modal::before { content: ''; display: block; width: 40px; height: 4px; background: var(--line-2); border-radius: 2px; margin: 8px auto 4px; }

  /* ── Onboarding ─────────────────────────────────────────────── */
  .onb-nav { flex-direction: column-reverse; gap: 8px; }
  .onb-nav .btn { width: 100%; justify-content: center; }

  /* ── Forms ──────────────────────────────────────────────────── */
  .row { grid-template-columns: 1fr; gap: 8px; }
  .row .btn { width: 100%; height: 44px; }
  .field { font-size: 16px; } /* prevent iOS zoom */

  /* ── Misc mobile polish ────────────────────────────────────── */
  .palette-overlay { padding: var(--s-3); padding-top: 8vh; }
  .palette { max-width: 100%; }
  .palette-input { font-size: 16px; }
  .toasts { left: 10px; right: 10px; bottom: 10px; }
  .toast { max-width: 100%; }
  .invite-card { padding: var(--s-3); }
  .invite-head { flex-wrap: wrap; }
  .invite-actions { flex-wrap: wrap; }
  .invite-actions .btn { flex: 1; justify-content: center; min-width: 0; }
  .founder-card { padding: var(--s-3); gap: var(--s-3); }
  .fee-table th, .fee-table td { padding: 6px 8px; font-size: 0.78rem; }
  .fee-table th { font-size: 0.64rem; }
  .code-block { font-size: 0.72rem; padding: var(--s-3); word-break: break-all; white-space: pre-wrap; }
  .btn-sm { height: 40px; padding: 0 var(--s-3); font-size: 0.8rem; }
  .btn { height: 44px; }
  .ens-preview { font-size: 0.76rem; }
  .cc-chip { font-size: 0.64rem; padding: 2px 6px; }
  .danger-zone { padding: var(--s-3); }
  .trigger-block { padding: var(--s-3); }
  .trigger-head { flex-wrap: wrap; gap: 6px; }
  .trigger-name { font-size: 0.88rem; }
}

/* ── Very small phones (≤ 380px) ──────────────────────────────────── */
@media (max-width: 380px) {
  .content { padding: 8px; }
  .hero-score { padding: 10px; }
  .score-ring-wrap { width: 130px; height: 130px; }
  .score-ring-value { font-size: 2rem; }
  .hs-head { font-size: 1.1rem; }
  .hs-stats { grid-template-columns: 1fr; }
  .topbar-title h1 { font-size: 0.85rem; }
  .silence-modes { grid-template-columns: 1fr; }
  .hamburger { width: 32px; height: 32px; }
}

/* ═══ MOBILE POLISH — TABLET + PHONE PATCHES ══════════════════════════ */

@media (max-width: 960px) {
  /* Onboarding top: stack brand above progress+skips on tablet */
  .onb-top { flex-wrap: wrap; gap: var(--s-3); }
  .onb-progress { order: 2; flex-basis: 100%; margin: 0; }
  .onb-steps { margin-left: 0; }
  .onb-skips { flex-wrap: wrap; }
  /* Long addresses truncate */
  .re-addr, .connect-card-addr, .hs-stat-v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .re-remove { opacity: 1; }
}

@media (max-width: 640px) {
  .onb-top { padding: 10px 12px; align-items: flex-start; }
  .onb-progress { font-size: 0.6rem; letter-spacing: 0.12em; }
  .onb-step-dot { width: 14px; }
  .onb-title { font-size: clamp(1.4rem, 6vw, 2rem); }
  .onb-body { font-size: 0.9rem; margin-bottom: var(--s-4); }
  .onb-main { padding: var(--s-3); }
  .connect-card { padding: var(--s-3); }
  .connect-card-top { gap: 8px; margin-bottom: 8px; }
  .connect-card-icon { width: 36px; height: 36px; }
  .connect-card-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* Prevent horizontal scroll on any device */
html, body { overflow-x: hidden; max-width: 100vw; }

/* ═══ CHAIN PICKER ══════════════════════════════════════════════════ */
.chain-picker {
  position: relative;
}
.chain-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--glass, rgba(255,255,255,0.04));
  border: 1px solid var(--line, rgba(255,255,255,0.08));
  color: var(--text-2, #c4c4cf);
  padding: 7px 12px;
  border-radius: 999px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.chain-picker-btn:hover {
  border-color: rgba(255,255,255,0.18);
  color: var(--text, #f5f5f7);
}
.chain-picker-btn .chain-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3, #6b6b74);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.05);
}
.chain-picker.live .chain-picker-btn .chain-dot {
  background: var(--alive, #22c55e);
  box-shadow: 0 0 8px rgba(34,197,94,0.6), 0 0 0 2px rgba(34,197,94,0.18);
}
.chain-picker.wrong-chain .chain-picker-btn .chain-dot {
  background: var(--watch, #f59e0b);
  box-shadow: 0 0 8px rgba(245,158,11,0.6), 0 0 0 2px rgba(245,158,11,0.18);
}
.chain-picker.no-deploy .chain-picker-btn .chain-dot {
  background: var(--silent, #ef4444);
  box-shadow: 0 0 8px rgba(239,68,68,0.4), 0 0 0 2px rgba(239,68,68,0.14);
}
.chain-picker-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 240px;
  background: var(--surface, #0d0d1a);
  border: 1px solid var(--line, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  z-index: 80;
  display: none;
}
.chain-picker.open .chain-picker-menu { display: block; }
.chain-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--text-2, #c4c4cf);
  font-family: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  text-align: left;
}
.chain-option:hover { background: rgba(255,255,255,0.04); color: var(--text, #f5f5f7); }
.chain-option.active { background: rgba(139,92,246,0.12); color: var(--text, #f5f5f7); }
.chain-option .chain-opt-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3, #6b6b74); }
.chain-option.deployed .chain-opt-dot { background: var(--alive, #22c55e); }
.chain-option.active .chain-opt-dot { background: var(--purple, #8b5cf6); }
.chain-option .chain-opt-status {
  margin-left: auto;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--text-3, #6b6b74);
  text-transform: uppercase;
}
.chain-option.deployed .chain-opt-status { color: var(--alive, #22c55e); }

/* ═══ WALLET BALANCE PILL ══════════════════════════════════════════ */
.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--glass, rgba(255,255,255,0.04));
  border: 1px solid var(--line, rgba(255,255,255,0.08));
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-2, #c4c4cf);
  letter-spacing: 0.02em;
}
.balance-pill::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--alive, #22c55e);
  box-shadow: 0 0 6px rgba(34,197,94,0.6);
}

/* ═══ BUTTON LOADING STATE ═════════════════════════════════════════ */
.btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  opacity: 0.85;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
  color: var(--text, #f5f5f7);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn.dirty {
  box-shadow: 0 0 0 2px rgba(139,92,246,0.24);
}

/* ═══ ACTIVITY FEED ════════════════════════════════════════════════ */
.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.activity-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.activity-item:hover { background: rgba(255,255,255,0.02); }
.activity-item + .activity-item { border-top: 1px solid var(--line, rgba(255,255,255,0.04)); }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3, #6b6b74);
}
.activity-item.success .activity-dot { background: var(--alive, #22c55e); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.activity-item.pending .activity-dot { background: var(--watch, #f59e0b); box-shadow: 0 0 6px rgba(245,158,11,0.5); animation: activity-pulse 1.2s ease-in-out infinite; }
.activity-item.error .activity-dot { background: var(--silent, #ef4444); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
@keyframes activity-pulse { 0%, 100% { opacity: 0.8; } 50% { opacity: 0.3; } }
.activity-label { font-size: 0.88rem; color: var(--text, #f5f5f7); font-weight: 500; }
.activity-meta { font-family: var(--font-mono, monospace); font-size: 0.72rem; color: var(--text-3, #6b6b74); }
.activity-time { font-family: var(--font-mono, monospace); font-size: 0.72rem; color: var(--text-3, #6b6b74); }
.activity-link {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--purple, #8b5cf6);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 6px;
  transition: background 0.15s ease;
}
.activity-link:hover { background: rgba(139,92,246,0.12); }

@media (max-width: 700px) {
  .chain-picker-btn { padding: 6px 10px; font-size: 0.68rem; }
  .balance-pill { padding: 6px 10px; font-size: 0.68rem; }
  .activity-item { grid-template-columns: auto 1fr auto; }
  .activity-item .activity-meta { display: none; }
}

/* ═══ SIGNAL BREAKDOWN PANEL ═══════════════════════════════════════ */
.signals-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.signal-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line, rgba(255,255,255,0.06));
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  transition: border-color 0.15s ease;
}
.signal-item:hover { border-color: rgba(255,255,255,0.12); }
.signal-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-3, #6b6b74);
}
.signal-item.green .signal-dot { background: var(--alive, #22c55e); box-shadow: 0 0 8px rgba(34,197,94,0.5); }
.signal-item.amber .signal-dot { background: var(--watch, #f59e0b); box-shadow: 0 0 8px rgba(245,158,11,0.5); }
.signal-item.red   .signal-dot { background: var(--silent, #ef4444); box-shadow: 0 0 8px rgba(239,68,68,0.5); }
.signal-item.muted { opacity: 0.55; }
.signal-info { min-width: 0; }
.signal-label {
  font-size: 0.88rem;
  color: var(--text, #f5f5f7);
  font-weight: 500;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.signal-type {
  font-family: var(--font-mono, monospace);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  color: var(--text-3, #6b6b74);
  background: rgba(255,255,255,0.04);
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}
.signal-meta { font-size: 0.78rem; color: var(--text-3, #6b6b74); line-height: 1.45; }
.signal-contrib {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2, #c4c4cf);
  text-align: right;
  white-space: nowrap;
}
.signal-contrib.pos { color: var(--alive, #22c55e); }
.signal-contrib.neg { color: var(--silent, #ef4444); }

@media (max-width: 860px) {
  .signals-list { grid-template-columns: 1fr; }
}

/* ═══ SAFETY SELF-AUDIT PANEL ═════════════════════════════════════ */
.safety-score-pill {
  display: inline-block;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: rgba(139,92,246,0.12);
  color: #a78bfa;
  border: 1px solid rgba(139,92,246,0.3);
}
.safety-score-pill.good  { background: rgba(34,197,94,0.1);   color: var(--alive, #22c55e); border-color: rgba(34,197,94,0.3); }
.safety-score-pill.okay  { background: rgba(245,158,11,0.1);  color: var(--watch, #f59e0b); border-color: rgba(245,158,11,0.3); }
.safety-score-pill.poor  { background: rgba(239,68,68,0.1);   color: var(--silent, #ef4444); border-color: rgba(239,68,68,0.3); }

.safety-list { display: flex; flex-direction: column; gap: 6px; }
.safety-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(255,255,255,0.015);
  border-left: 2px solid transparent;
}
.safety-item.pass { border-left-color: var(--alive, #22c55e); }
.safety-item.warn { border-left-color: var(--watch, #f59e0b); }
.safety-item.fail { border-left-color: var(--silent, #ef4444); background: rgba(239,68,68,0.04); }
.safety-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.safety-item.pass .safety-check { background: var(--alive, #22c55e); }
.safety-item.warn .safety-check { background: var(--watch, #f59e0b); }
.safety-item.fail .safety-check { background: var(--silent, #ef4444); }
.safety-title { font-size: 0.9rem; color: var(--text, #f5f5f7); font-weight: 500; }
.safety-advice { font-size: 0.78rem; color: var(--text-3, #6b6b74); margin-top: 2px; }
.safety-action {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: #a78bfa;
  padding: 4px 10px;
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease;
}
.safety-action:hover { background: rgba(139,92,246,0.1); }

/* ═══ DURESS BUTTON ═══════════════════════════════════════════════ */
.duress-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid rgba(239,68,68,0.35);
  color: var(--silent, #ef4444);
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.duress-btn:hover { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.6); }
.duress-btn::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--silent, #ef4444);
  box-shadow: 0 0 6px rgba(239,68,68,0.6);
}

/* ═══ TYPE-TO-CONFIRM ═══════════════════════════════════════════════ */
.type-to-confirm {
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px;
  padding: 14px;
  margin: 16px 0;
}
.type-to-confirm label {
  display: block;
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--silent, #ef4444);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.type-to-confirm input {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--text, #f5f5f7);
  font-family: var(--font-mono, monospace);
  font-size: 1rem;
  padding: 10px 14px;
  border-radius: 6px;
  letter-spacing: 0.1em;
}
.type-to-confirm input:focus {
  outline: none;
  border-color: var(--silent, #ef4444);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}

/* SOL chat widget styles live in css/sol.css (shared across pages). */

/* ═══ WALLET ACTIVITY ═══════════════════════════════════════════════ */
.wallet-activity-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wa-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 10px;
  transition: background 0.15s ease;
  cursor: default;
}
.wa-item:hover { background: rgba(255,255,255,0.02); }
.wa-item + .wa-item { border-top: 1px solid var(--line, rgba(255,255,255,0.04)); }
.wa-icon {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.3);
  display: flex; align-items: center; justify-content: center;
  color: var(--alive, #22c55e);
  flex-shrink: 0;
}
.wa-icon svg { width: 14px; height: 14px; }
.wa-item.lazarus .wa-icon { background: rgba(139,92,246,0.12); border-color: rgba(139,92,246,0.3); color: #a78bfa; }
.wa-item.contract .wa-icon { background: rgba(245,158,11,0.10); border-color: rgba(245,158,11,0.28); color: var(--watch, #f59e0b); }
.wa-info { min-width: 0; overflow: hidden; }
.wa-label { font-size: 0.88rem; color: var(--text, #f5f5f7); font-weight: 500; }
.wa-meta {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--text-3, #6b6b74);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-value { font-family: var(--font-mono, monospace); font-size: 0.8rem; color: var(--text-2, #c4c4cf); white-space: nowrap; }
.wa-time { font-family: var(--font-mono, monospace); font-size: 0.72rem; color: var(--text-3, #6b6b74); white-space: nowrap; }
.wa-link {
  font-family: var(--font-mono, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--purple, #8b5cf6);
  text-decoration: none;
  padding: 4px 8px;
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 6px;
  transition: background 0.15s ease;
  margin-left: 6px;
}
.wa-link:hover { background: rgba(139,92,246,0.12); }
.wa-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: var(--text-3, #6b6b74);
  font-size: 0.86rem;
  gap: 8px;
}
.wa-loading::before {
  content: '';
  width: 12px; height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}

@media (max-width: 700px) {
  .wa-item { grid-template-columns: auto 1fr auto auto; }
  .wa-item .wa-meta { display: none; }
  .wa-item .wa-link { display: none; }
  .wa-item .wa-value { font-size: 0.74rem; }
}

/* ═══ HEARTBEAT CRITERIA ═══════════════════════════════════════════ */
.criteria-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
  margin-top: var(--s-3);
}
.criteria-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line, rgba(255,255,255,0.06));
  border-radius: 10px;
  background: rgba(255,255,255,0.015);
}
.criteria-item.yes { border-left: 2px solid var(--alive, #22c55e); }
.criteria-item.no  { border-left: 2px solid var(--silent, #ef4444); }
.criteria-mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
}
.criteria-item.yes .criteria-mark { background: var(--alive, #22c55e); }
.criteria-item.no  .criteria-mark { background: var(--silent, #ef4444); }
.criteria-title { font-size: 0.92rem; color: var(--text, #f5f5f7); font-weight: 500; }
.criteria-desc { font-size: 0.8rem; color: var(--text-3, #6b6b74); margin-top: 3px; line-height: 1.5; }
