/* =========================================================
   SatNet — Member Dashboard (extends brand.css)
   Webapp layout: sidebar (desktop) + bottom-tabs (mobile)
   Mobile-first. RTL-aware.
   ========================================================= */

/* ---------- Full-screen logo loader (first paint) ---------- */
#app-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-0, #05070d);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  transition: opacity 0.45s ease;
}
#app-loader.hide { opacity: 0; pointer-events: none; }
#app-loader .al-logo {
  animation: al-pulse 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 18px rgba(107, 227, 214, 0.55));
}
#app-loader .al-logo svg { display: block; width: 60px; height: 60px; }
#app-loader .al-dots { display: flex; gap: 7px; }
#app-loader .al-dots i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent, #6BE3D6);
  animation: al-dot 1.2s ease-in-out infinite;
}
#app-loader .al-dots i:nth-child(2) { animation-delay: 0.18s; }
#app-loader .al-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes al-pulse { 0%, 100% { transform: scale(0.9); opacity: 0.55; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes al-dot { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-6px); opacity: 1; } }

/* ---------- Connect gate (no wallet → block dashboard) ---------- */
#connect-gate {
  position: fixed; inset: 0; z-index: 9998;
  background: var(--bg-0, #05070d);
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 28px; text-align: center;
}
#connect-gate.show { display: flex; }
#connect-gate .al-logo { animation: al-pulse 2s ease-in-out infinite; filter: drop-shadow(0 0 18px rgba(107, 227, 214, 0.45)); margin-bottom: 6px; }
#connect-gate .al-logo svg { width: 54px; height: 54px; display: block; }
.cg-h { font-family: var(--f-display); font-size: 22px; font-weight: 700; margin: 0; color: var(--ink); }
.cg-p { color: var(--ink-soft); font-size: 14px; line-height: 1.55; margin: 0 0 10px; max-width: 340px; }
#connect-gate .btn { min-width: 220px; }
.cg-mint { color: var(--accent); font-size: 13.5px; text-decoration: none; margin-top: 2px; }
.cg-mint:hover { text-decoration: underline; }
.cg-home { color: var(--ink-mute); font-size: 12.5px; text-decoration: none; margin-top: 4px; }
.cg-home:hover { color: var(--ink-soft); }

:root {
  --sidebar-w: 248px;
  --topbar-h: 60px;
  --actionbar-h: 56px;
  --tabbar-h: 64px;
}

html { scroll-behavior: smooth; scroll-padding-top: 70px; }
/* Use overflow-x:clip (not hidden): `hidden` on html/body turns them into
   scroll containers, which makes position:fixed descendants (e.g. .action-bar)
   resolve against the body box and scroll with the page instead of pinning to
   the viewport. `clip` still hides horizontal overflow but creates no scroll
   container, so fixed bars stay docked to the viewport on iOS Safari/Android. */
html, body { background: var(--bg-0); overflow-x: clip; max-width: 100%; }
body::before, body::after { display: none; } /* drop the cosmic backdrop — dashboards stay calm */

/* Global overflow guards (iPhone-safe) */
*, *::before, *::after { box-sizing: border-box; }
img, svg, video, iframe { max-width: 100%; }
.dc, .feed-row, .feed-inner, main.feed { max-width: 100%; min-width: 0; }
input, textarea, select { max-width: 100%; }
/* Any flex/grid child must allow shrink — otherwise text overflows container */
.dc > *, .feed-row > *, .prelaunch-banner > *, .nft-card > *, .ref-grid > * { min-width: 0; }

/* ============================
   App shell
   ============================ */
.app {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: var(--topbar-h) 1fr auto;
  grid-template-areas:
    "topbar"
    "main"
    "tabbar";
  min-height: 100vh;
}
.app.desktop {
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
}

/* ---------- Top bar ---------- */
.appbar {
  grid-area: topbar;
  background: rgba(5, 7, 13, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 40;
}
.appbar-left { display: flex; align-items: center; gap: 12px; }
.appbar-brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: 16px; letter-spacing: -0.015em; }
.appbar-brand svg { width: 28px; height: 28px; }
.app.desktop .appbar-brand { display: none; } /* shown in sidebar instead */
.app.desktop .appbar-burger { display: none; }
.appbar-burger { background: none; border: 0; width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-soft); cursor: pointer; }
.appbar-burger:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
.appbar-title { font-family: var(--f-display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; color: var(--ink-soft); display: none; }
.app.desktop .appbar-title { display: block; }
.appbar-right { display: flex; align-items: center; gap: 6px; }
.appbar-btn { background: none; border: 0; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-soft); cursor: pointer; position: relative; }
.appbar-btn:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
.appbar-btn .badge { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--bg-0); }
.appbar-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 700; font-size: 13px; color: #04221F;
  cursor: pointer;
}
.appbar-avatar:hover { box-shadow: 0 0 0 2px rgba(107, 227, 214, 0.4); }

/* Referral card */
#referral-card .ref-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-top: 6px; }
@media (max-width: 880px) { #referral-card .ref-grid { grid-template-columns: 1fr; } }
.ref-link-label, .ref-leg-label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; display: block; }
.ref-link-row { display: flex; gap: 8px; align-items: center; }
.ref-link-row input {
  flex: 1; min-width: 0;
  padding: 10px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  color: var(--ink); font-family: var(--f-mono); font-size: 13px;
}
.ref-link-row .btn { padding: 10px 14px; font-size: 12px; }
.btn-ghost { background: rgba(255,255,255,0.04); color: var(--ink-soft); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; padding: 10px 14px; font-family: var(--f-display); font-size: 12px; }
.btn-ghost:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
.ref-leg-row { margin-top: 14px; }
.ref-leg-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ref-leg-pills button {
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--ink-soft);
  padding: 7px 12px; border-radius: 999px; cursor: pointer;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
}
.ref-leg-pills button[aria-pressed="true"] { background: rgba(107,227,214,0.12); border-color: var(--accent); color: var(--accent); }
.ref-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.ref-stat { background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.ref-stat .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.ref-stat .v { font-family: var(--f-display); font-size: 22px; font-weight: 600; color: var(--ink); margin-top: 4px; }
.ref-share { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.ref-share-label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.ref-share-btn {
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--ink-soft);
  padding: 7px 11px; border-radius: 8px; cursor: pointer; text-decoration: none;
  font-family: var(--f-display); font-size: 12px;
}
.ref-share-btn:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
.ref-qr-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 200; align-items: center; justify-content: center; padding: 20px; }
.ref-qr-modal.open { display: flex; }
.ref-qr-card { background: var(--bg-1); border: 1px solid var(--line-strong); border-radius: 16px; padding: 24px; max-width: 320px; width: 100%; position: relative; text-align: center; }
.ref-qr-close { position: absolute; top: 10px; right: 14px; background: none; border: 0; color: var(--ink-mute); font-size: 26px; cursor: pointer; line-height: 1; }
.ref-qr-cap { font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); margin-top: 12px; word-break: break-all; }

/* Open Sponsor card (Diamond+) */
.os-card h3 .tag { background: rgba(255,255,255,0.06); color: var(--ink-mute); padding: 4px 10px; border-radius: 999px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; }
.os-card h3 .tag.on { background: rgba(107,227,214,0.14); color: var(--accent); }
.os-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 4px; }
@media (max-width: 760px) { .os-toggles { grid-template-columns: 1fr; } }
.os-toggle {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 14px; border-radius: 14px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.os-toggle:has(input:checked) { border-color: rgba(107,227,214,0.45); background: rgba(107,227,214,0.05); }
.os-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.os-sw {
  flex-shrink: 0;
  width: 38px; height: 22px; border-radius: 999px;
  background: rgba(255,255,255,0.10);
  position: relative; transition: background 0.18s ease;
  margin-top: 2px;
}
.os-sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); transition: transform 0.18s ease;
}
.os-toggle input:checked + .os-sw { background: var(--accent); }
.os-toggle input:checked + .os-sw::after { transform: translateX(16px); background: #04221F; }
.os-meta { display: flex; flex-direction: column; gap: 3px; }
.os-meta-t { font-family: var(--f-display); font-weight: 600; font-size: 14px; color: var(--ink); }
.os-meta-d { color: var(--ink-soft); font-size: 12.5px; line-height: 1.4; }

.os-fieldset { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.os-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.os-field label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.os-field label small { font-family: var(--f-body); text-transform: none; letter-spacing: 0.02em; color: var(--ink-mute); font-size: 11px; margin-left: 6px; }
.os-field textarea, .os-field select, .settings-field select {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); padding: 10px 12px;
  font-family: var(--f-body); font-size: 13px; resize: vertical;
}
.os-field textarea { min-height: 70px; }
.os-field-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
@media (max-width: 720px) { .os-field-row { grid-template-columns: 1fr; } }
.os-bio-count { text-align: right; font-family: var(--f-mono); font-size: 10px; color: var(--ink-mute); }
.os-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.os-tags button {
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); color: var(--ink-soft);
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em;
}
.os-tags button[aria-pressed="true"] { background: rgba(107,227,214,0.12); border-color: var(--accent); color: var(--accent); }
.os-tags button[disabled] { opacity: 0.4; cursor: not-allowed; }
.os-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.os-stat { background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px; text-align: center; }
.os-stat .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.os-stat .v { font-family: var(--f-display); font-size: 20px; font-weight: 600; color: var(--ink); margin-top: 4px; }
.os-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.os-save-msg, .set-save-msg { font-family: var(--f-mono); font-size: 11px; color: var(--accent); opacity: 0; transition: opacity 0.2s ease; }
.os-save-msg.visible, .set-save-msg.visible { opacity: 1; }

/* Settings · Consent & Privacy */
.settings-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 4px; }
@media (max-width: 880px) { .settings-row { grid-template-columns: 1fr; } }
.settings-field { display: flex; flex-direction: column; gap: 6px; }
.settings-field label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.settings-field small { color: var(--ink-mute); font-size: 11.5px; margin-top: 2px; }
.settings-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; }

/* Post-mint profile prompt */
.profile-prompt {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 16px 22px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(107,227,214,0.10), rgba(140,108,255,0.10));
  border: 1px solid rgba(107,227,214,0.30);
}
.profile-prompt .pp-text { display: flex; flex-direction: column; gap: 4px; flex: 1 1 280px; min-width: 0; }
.profile-prompt .pp-text strong { color: var(--ink); font-family: var(--f-display); font-weight: 600; font-size: 15px; }
.profile-prompt .pp-text span { color: var(--ink-soft); font-size: 13px; }
.profile-prompt .pp-actions { display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 640px) {
  .profile-prompt .pp-actions { width: 100%; }
  .profile-prompt .pp-actions .btn { flex: 1; }
}

/* Settings profile subsection */
.settings-profile { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.settings-notifs { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.settings-sub-h { font-family: var(--f-display); font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 4px; }
.settings-sub-d { color: var(--ink-soft); font-size: 12.5px; margin-bottom: 14px; }
.notif-opts { display: grid; gap: 10px; }
.notif-opt { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--ink-soft); }
.notif-opt input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.notif-opt:hover { color: var(--ink); }
.settings-field input[type="email"], .settings-field input[type="text"] {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  color: var(--ink); font-family: var(--f-body); font-size: 13px;
}
.settings-field input::placeholder { color: var(--ink-mute); }

/* Empty-state hero (no NFT yet) */
.empty-hero { text-align: center; padding: 38px 28px; background: linear-gradient(180deg, rgba(107,227,214,0.06), rgba(255,255,255,0.02)); }
.empty-hero .eh-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(22px, 4vw, 30px); color: var(--ink); margin-bottom: 8px; }
.empty-hero .eh-sub { color: var(--ink-soft); font-size: 14px; max-width: 480px; margin: 0 auto 20px; line-height: 1.5; }
.empty-hero .eh-steps { display: grid; gap: 8px; max-width: 460px; margin: 0 auto; padding: 0; list-style: none; text-align: left; }
.empty-hero .eh-steps li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.empty-hero .eh-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(107,227,214,0.10); color: var(--accent); font-family: var(--f-mono); font-size: 11px; font-weight: 700; flex-shrink: 0; }
@media (max-width: 759px) {
  .empty-hero { padding: 26px 16px; }
  .empty-hero .eh-steps li { font-size: 12px; padding: 9px 12px; }
}

/* Mint card */
.mint-card { margin-bottom: 18px; }
.mint-card h3 { margin-bottom: 6px; }
.mint-step { padding: 16px 0; border-top: 1px solid var(--line); }
.mint-step:first-of-type { border-top: 0; padding-top: 8px; }
.mint-step-h {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-display); font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 6px;
}
.mint-step-n {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(107,227,214,0.10); color: var(--accent);
  font-family: var(--f-mono); font-size: 11px; font-weight: 700;
}
.mint-step-d { color: var(--ink-soft); font-size: 12.5px; margin-bottom: 10px; }
.mint-step-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.mint-balance { color: var(--ink-soft); font-family: var(--f-mono); font-size: 12px; }
.mint-balance b { color: var(--ink); font-weight: 700; }
.mint-tier-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 720px) { .mint-tier-grid { grid-template-columns: repeat(2, 1fr); } }
.mint-tier {
  background: rgba(255,255,255,0.03); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 6px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; align-items: center;
  color: var(--ink-soft); transition: 0.15s;
}
.mint-tier:hover { background: rgba(255,255,255,0.05); color: var(--ink); }
.mint-tier.active {
  background: rgba(107,227,214,0.06); border-color: var(--accent); color: var(--accent);
}
.mint-tier .t-name { font-family: var(--f-display); font-weight: 600; font-size: 14px; }
.mint-tier .t-price { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em; }
.mint-sponsor-row { display: flex; flex-direction: column; gap: 6px; }
.mint-info-line { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.mint-info-line .k { color: var(--ink-mute); font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; }
.mint-info-line .v { color: var(--ink); font-family: var(--f-mono); font-weight: 700; }
.mint-info-line .hint { color: var(--ink-soft); font-size: 12px; }
.mint-action-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mint-msg { margin-top: 12px; font-family: var(--f-mono); font-size: 12px; color: var(--ink-soft); min-height: 18px; }
.mint-msg.ok { color: var(--accent); }
.mint-msg.err { color: var(--danger); }

/* Pre-launch banner */
.prelaunch-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 18px 22px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(107,227,214,0.10), rgba(140,108,255,0.10));
  border: 1px solid rgba(107,227,214,0.30);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.prelaunch-banner .pl-left { display: flex; gap: 16px; align-items: center; flex: 1 1 320px; min-width: 0; }
.prelaunch-banner .pl-pill {
  display: inline-block; padding: 5px 11px; border-radius: 999px;
  background: var(--accent); color: #04221F;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; font-weight: 700;
  flex-shrink: 0;
}
.prelaunch-banner .pl-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 auto; }
.prelaunch-banner .pl-text strong { color: var(--ink); font-family: var(--f-display); font-size: 15px; font-weight: 600; word-wrap: break-word; overflow-wrap: break-word; min-width: 0; }
.prelaunch-banner .pl-text span { color: var(--ink-soft); font-size: 13px; word-wrap: break-word; overflow-wrap: break-word; min-width: 0; }
.prelaunch-banner .pl-right { display: flex; gap: 16px; align-items: center; flex-shrink: 0; }
.prelaunch-banner .pl-countdown { display: flex; gap: 8px; }
.prelaunch-banner .pl-status-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px;
  background: rgba(255,255,255,0.05); border: 1px solid var(--line-strong);
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.16em; color: var(--ink-soft);
}
.prelaunch-banner .pl-status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(107,227,214,0.7); animation: pl-pulse 2.2s infinite;
}
@keyframes pl-pulse {
  0% { box-shadow: 0 0 0 0 rgba(107,227,214,0.7); }
  70% { box-shadow: 0 0 0 8px rgba(107,227,214,0); }
  100% { box-shadow: 0 0 0 0 rgba(107,227,214,0); }
}
.prelaunch-banner .pl-cd-grp { display: flex; flex-direction: column; align-items: center; min-width: 36px; }
.prelaunch-banner .pl-cd-grp b { font-family: var(--f-mono); font-size: 18px; color: var(--accent); font-weight: 700; line-height: 1; }
.prelaunch-banner .pl-cd-grp i { font-family: var(--f-mono); font-size: 9px; color: var(--ink-mute); font-style: normal; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 3px; }
.prelaunch-banner .pl-cta {
  text-decoration: none; padding: 9px 14px; border-radius: 999px;
  background: var(--accent); color: #04221F;
  font-family: var(--f-display); font-weight: 600; font-size: 13px;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.prelaunch-banner .pl-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(107,227,214,0.30); }
@media (max-width: 720px) {
  .prelaunch-banner { flex-direction: column; align-items: stretch; }
  .prelaunch-banner .pl-right { justify-content: space-between; }
}

/* Connect wallet button */
.appbar-connect {
  display: inline-flex; align-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04221F; border: 0; cursor: pointer;
  padding: 8px 14px; border-radius: 999px;
  font-family: var(--f-display); font-weight: 600; font-size: 12px; letter-spacing: 0.02em;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}
.appbar-connect:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(107, 227, 214, 0.25); }
.appbar-connect.connected {
  background: rgba(107,227,214,0.08); color: var(--accent); border: 1px solid rgba(107,227,214,0.35);
  font-family: var(--f-mono); letter-spacing: 0.06em;
}
.appbar-connect.connected:hover { background: rgba(107,227,214,0.12); }

/* tier-switch demo */
.tier-switch { position: relative; }
.tier-switch summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,0.04); border: 1px solid var(--line-strong); font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.tier-switch summary::-webkit-details-marker { display: none; }
.tier-switch summary:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
.tier-switch[open] summary { color: var(--accent); border-color: rgba(107, 227, 214, 0.3); }
.tier-switch summary .ring-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.tier-switch summary .lbl-prefix { color: var(--ink-mute); font-weight: 500; }
.tier-switch-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 6px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5); z-index: 60;
}
.tier-switch-menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 9px 12px; background: transparent; border: 0; color: var(--ink-soft); font-family: var(--f-body); font-size: 13px; text-align: left; cursor: pointer; border-radius: 8px; }
.tier-switch-menu button:hover { background: rgba(255,255,255,0.04); color: var(--ink); }
.tier-switch-menu button[aria-pressed="true"] { color: var(--accent); }
.tier-switch-menu button .dot { width: 10px; height: 10px; border-radius: 50%; }
.tier-switch-menu .row { display: flex; align-items: center; gap: 10px; }

/* ---------- Sidebar (desktop only) ---------- */
.sidebar {
  grid-area: sidebar;
  background: #04060B;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: none;
  flex-direction: column;
  gap: 4px;
}
.app.desktop .sidebar { display: flex; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 8px 12px 24px; font-family: var(--f-display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.sidebar-brand svg { width: 32px; height: 32px; }
.sidebar-section { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); padding: 16px 12px 8px; }
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink-soft); font-size: 14px; font-weight: 500; cursor: pointer; transition: 0.12s; position: relative; }
.sidebar-link:hover { background: rgba(255,255,255,0.04); color: var(--ink); }
.sidebar-link.active { background: linear-gradient(90deg, rgba(107,227,214,0.10), rgba(110,124,255,0.04)); color: var(--ink); }
.sidebar-link.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; background: var(--accent); border-radius: 0 3px 3px 0; }
.sidebar-link svg { width: 18px; height: 18px; color: var(--ink-mute); }
.sidebar-link.active svg { color: var(--accent); }
.sidebar-link.locked { color: var(--ink-dim); }
.sidebar-link.locked .lock { margin-left: auto; opacity: 0.6; }
.sidebar-foot { margin-top: auto; padding: 16px 12px; border-top: 1px solid var(--line); }
.sidebar-foot small { color: var(--ink-dim); font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.1em; }

/* ---------- Mobile bottom tab bar ---------- */
.tabbar {
  grid-area: tabbar;
  background: rgba(5, 7, 13, 0.95);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  position: sticky; bottom: 0; z-index: 35;
}
.app.desktop .tabbar { display: none; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink-mute); background: none; border: 0; cursor: pointer; font-size: 10px; font-weight: 500; letter-spacing: 0.02em;
  font-family: var(--f-body);
  padding: 8px 4px;
  transition: 0.12s;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--accent); }
.tab.active svg { filter: drop-shadow(0 0 8px rgba(107, 227, 214, 0.5)); }
.tab.center { position: relative; }
.tab.center::before {
  content: ""; position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
  opacity: 0; transition: 0.2s;
}
.tab.center.active::before { opacity: 1; }

/* ---------- Main scroll area ---------- */
main.feed {
  grid-area: main;
  padding: 20px 16px 24px;
  overflow-x: hidden;
  max-width: 100%;
}
.app.desktop main.feed { padding: 28px 32px 64px; }
.feed-inner { max-width: 1280px; margin: 0 auto; display: grid; gap: 18px; }

/* ============================
   Card system
   ============================ */
.dc {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
}
.dc.flush { padding: 0; }
.dc h3 { font-family: var(--f-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.dc h3 .tag { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-mute); padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; margin-left: auto; }
.dc h3 .tag.live { color: var(--success); border-color: rgba(63, 209, 139, 0.3); background: rgba(63, 209, 139, 0.06); }
.dc h3 .tag.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); margin-right: 5px; animation: live-pulse 1.6s ease-in-out infinite; vertical-align: middle; }
@keyframes live-pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63, 209, 139, 0.6); } 50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(63, 209, 139, 0); } }
.dc .info-i {
  display: inline-grid; place-items: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255,255,255,0.06); color: var(--ink-mute);
  font-family: var(--f-mono); font-size: 9px; font-weight: 700;
  cursor: help; margin-left: 4px; vertical-align: 1px;
  position: relative;
}
.dc .info-i:hover { background: var(--accent); color: #04221F; }

/* tooltip */
.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 10px 12px;
  width: 240px;
  font-size: 12px; color: var(--ink-soft); line-height: 1.45;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  z-index: 50;
  opacity: 0; visibility: hidden;
  transition: 0.12s;
  pointer-events: none;
}
.tooltip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--bg-3); }
.tooltip .ttl { font-family: var(--f-display); font-weight: 600; font-size: 12px; color: var(--ink); margin-bottom: 4px; }
.tooltip .calc { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.04em; color: var(--accent); margin: 6px 0 4px; }
.tooltip a { color: var(--accent); font-size: 11px; }
.info-i:hover .tooltip,
.info-i:focus .tooltip { opacity: 1; visibility: visible; }

/* ============================
   1) NFT Identity Card
   ============================ */
.nft-card {
  position: relative;
  overflow: hidden;
  padding: 28px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  align-items: center;
}
.nft-card-bg {
  position: absolute; inset: 0; opacity: 0.6; pointer-events: none;
}
.nft-card-bg::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(380px 200px at 25% 30%, var(--tier-glow, rgba(248,215,127,0.18)), transparent 65%);
}
.nft-card.bronze   { --tier-glow: rgba(226, 154, 108, 0.20); border-color: rgba(226, 154, 108, 0.22); }
.nft-card.silver   { --tier-glow: rgba(232, 238, 245, 0.16); border-color: rgba(232, 238, 245, 0.20); }
.nft-card.gold     { --tier-glow: rgba(248, 215, 127, 0.22); border-color: rgba(248, 215, 127, 0.22); }
.nft-card.diamond  { --tier-glow: rgba(184, 241, 255, 0.22); border-color: rgba(184, 241, 255, 0.22); }
.nft-card.crown    { --tier-glow: rgba(216, 184, 255, 0.28); border-color: rgba(216, 184, 255, 0.30); box-shadow: 0 0 0 1px rgba(216, 184, 255, 0.18), 0 24px 64px rgba(90, 61, 204, 0.18); }
.nft-badge-wrap { position: relative; aspect-ratio: 1; }
.nft-badge-wrap svg { width: 100%; height: 100%; }
.nft-rank-pin { position: absolute; bottom: -6px; right: -6px; padding: 4px 10px; border-radius: 999px; font-family: var(--f-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; background: var(--bg-3); border: 1px solid var(--line-strong); color: var(--accent); }
.nft-meta { position: relative; }
.nft-meta .tier-line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.nft-meta .tier-name { font-family: var(--f-display); font-weight: 700; font-size: 28px; letter-spacing: -0.02em; }
.nft-meta .mint { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em; color: var(--ink-mute); }
.nft-meta .position { font-family: var(--f-mono); font-size: 12px; color: var(--ink-soft); margin-bottom: 14px; letter-spacing: 0.04em; }
.nft-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.nft-stat { min-width: 0; overflow: hidden; }
.nft-stat .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nft-stat .v { font-family: var(--f-display); font-weight: 600; font-size: 17px; color: var(--ink); margin-top: 4px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nft-stat .v small { font-family: var(--f-mono); font-size: 11px; color: var(--success); font-weight: 500; margin-left: 4px; letter-spacing: 0.04em; }

/* ============================
   2) Earnings Summary
   ============================ */
.earn-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.earn-total { flex: 1; }
.earn-total .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-mute); }
.earn-total .v { font-family: var(--f-display); font-weight: 700; font-size: clamp(34px, 5vw, 44px); letter-spacing: -0.025em; line-height: 1.05; margin-top: 6px; font-variant-numeric: tabular-nums; }
.earn-total .v small { font-family: var(--f-mono); font-size: 16px; color: var(--ink-mute); font-weight: 500; letter-spacing: 0.04em; margin-left: 4px; }
.earn-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.earn-pill { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-strong); font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.12em; }
.earn-pill .v { color: var(--ink); font-weight: 600; }
.earn-pill .k { color: var(--ink-mute); margin-right: 6px; }
.earn-pill.up { color: var(--success); border-color: rgba(63, 209, 139, 0.3); background: rgba(63, 209, 139, 0.06); }
.earn-pill.pending { color: var(--warning); border-color: rgba(242, 181, 68, 0.3); background: rgba(242, 181, 68, 0.06); }

.earn-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.earn-card-mini { padding: 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: var(--r-md); }
.earn-card-mini .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.earn-card-mini .v { font-family: var(--f-display); font-weight: 600; font-size: 22px; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.015em; }
.earn-card-mini.withdraw .v { color: var(--success); }
.earn-card-mini.action { display: flex; flex-direction: column; gap: 6px; }
.earn-card-mini .btn { margin-top: 8px; padding: 10px 14px; font-size: 13px; font-weight: 600; }

.earn-breakdown { margin-top: 22px; }
.earn-breakdown .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.earn-breakdown .label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); }
.earn-breakdown .total { font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); }
.bar { display: flex; height: 10px; background: rgba(255,255,255,0.04); border-radius: 999px; overflow: hidden; gap: 1px; }
.bar > span { height: 100%; }
.bar .b-direct  { background: var(--accent); }
.bar .b-match   { background: var(--accent-2); }
.bar .b-pair    { background: #A878FF; }
.bar .b-pool    { background: var(--warning); }
.bar .b-fast    { background: var(--success); }
.legend { display: flex; flex-wrap: wrap; gap: 12px 18px; margin-top: 12px; }
.legend .item { display: flex; align-items: center; gap: 8px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--ink-soft); }
.legend .item .dot { width: 8px; height: 8px; border-radius: 50%; }
.legend .item .v { color: var(--ink-mute); margin-left: 6px; }

/* ============================
   3) Network Health Score
   ============================ */
.health-card { text-align: center; }
.health-gauge { position: relative; width: 200px; height: 200px; margin: 6px auto 16px; }
.health-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.health-gauge .label {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.health-gauge .v { font-family: var(--f-display); font-weight: 700; font-size: 44px; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.health-gauge .v small { font-family: var(--f-mono); font-size: 14px; color: var(--ink-mute); margin-left: 2px; letter-spacing: 0.04em; }
.health-gauge .lvl { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; margin-top: 4px; color: var(--success); }
.health-sub { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; text-align: left; margin-top: 18px; }
.health-sub .row { display: flex; justify-content: space-between; font-size: 12px; padding: 6px 0; border-top: 1px dashed var(--line); }
.health-sub .row .k { color: var(--ink-mute); }
.health-sub .row .v { font-family: var(--f-mono); color: var(--ink); font-weight: 500; }

/* ============================
   4) BV Pools
   ============================ */
.bv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bv-leg {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
}
.bv-leg .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bv-leg .head .lbl { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-mute); }
.bv-leg .head .arrow { width: 22px; height: 22px; border-radius: 6px; background: rgba(107,227,214,0.06); display: grid; place-items: center; color: var(--accent); }
.bv-leg .v { font-family: var(--f-display); font-weight: 700; font-size: 32px; letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.bv-leg .v small { font-family: var(--f-mono); font-size: 14px; color: var(--ink-mute); margin-left: 4px; letter-spacing: 0.04em; }
.bv-leg .members { font-family: var(--f-mono); font-size: 11px; color: var(--ink-soft); margin-top: 8px; letter-spacing: 0.04em; }
.bv-leg.weaker .v { color: var(--warning); }

.bv-projected {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, rgba(107,227,214,0.08), rgba(110,124,255,0.04));
  border: 1px solid rgba(107, 227, 214, 0.18);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.bv-projected .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.bv-projected .v { font-family: var(--f-display); font-weight: 700; font-size: 24px; letter-spacing: -0.02em; color: var(--accent); margin-top: 4px; font-variant-numeric: tabular-nums; }

.bv-cap { margin-top: 18px; }
.bv-cap .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.bv-cap .head .v { color: var(--ink); font-weight: 600; }
.bv-cap-bar { height: 8px; background: rgba(255,255,255,0.04); border-radius: 999px; overflow: hidden; }
.bv-cap-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width 0.6s ease; }

.bv-balance { margin-top: 16px; padding: 12px; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: var(--r-md); }
.bv-balance .row { display: flex; justify-content: space-between; align-items: center; }
.bv-balance .lbl { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.bv-balance .v { font-family: var(--f-mono); font-size: 13px; color: var(--ink); font-weight: 600; }
.bv-balance .ratio-bar { margin-top: 10px; height: 4px; background: linear-gradient(90deg, var(--warning) 0% 30%, var(--success) 30% 70%, var(--warning) 70% 100%); border-radius: 999px; position: relative; }
.bv-balance .ratio-bar::after { content: ""; position: absolute; top: -3px; bottom: -3px; left: var(--ratio-pos, 50%); width: 2px; background: var(--ink); border-radius: 999px; transform: translateX(-50%); transition: left 0.6s ease; }

.bv-clocks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.bv-clock { padding: 12px 14px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: var(--r-md); }
.bv-clock .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); }
.bv-clock .v { font-family: var(--f-mono); font-size: 17px; color: var(--accent); margin-top: 6px; font-weight: 600; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

/* ============================
   5) Mini downline tree
   ============================ */
.tree-sub { display: flex; justify-content: space-between; align-items: center; font-family: var(--f-mono); font-size: 11px; color: var(--ink-mute); margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.tree-sub b { color: var(--ink-soft); font-weight: 600; }
.tree-sub .legend { display: flex; gap: 12px; align-items: center; }
.tree-sub .legend .swatch { display: inline-flex; align-items: center; gap: 6px; }
.tree-sub .legend .dot { width: 8px; height: 8px; border-radius: 50%; }
.tree-sub .legend .dot.active { background: var(--accent); box-shadow: 0 0 6px rgba(107,227,214,0.6); }
.tree-sub .legend .dot.inactive { background: transparent; border: 1.5px dashed var(--ink-dim); }

.tree-canvas {
  width: 100%; aspect-ratio: 2/1; min-height: 240px;
  position: relative; overflow: visible;
  background:
    radial-gradient(400px 220px at 50% 0%, rgba(107,227,214,0.05), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
/* Tree card: override the .dc overflow:hidden so popovers can escape */
.dc:has(.tree-canvas) { overflow: visible; }
.tn-stage { position: relative; width: 100%; height: 100%; }
.tn-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tn-branch-label {
  position: absolute;
  font-family: var(--f-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.18em; color: var(--accent);
  padding: 2px 7px; border-radius: 999px;
  background: rgba(5, 7, 13, 0.85);
  border: 1px solid rgba(107, 227, 214, 0.25);
  pointer-events: none;
  z-index: 1; /* below popovers (z=50) */
  transform: translateX(-50%);
}

/* Node */
.tn {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  z-index: 2;
  outline: none;
}
.tn-badge {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 2px solid var(--tier-c, var(--ink-mute));
  display: grid; place-items: center;
  font-family: var(--f-display);
  font-weight: 700; font-size: 11px;
  color: var(--ink);
  letter-spacing: -0.01em;
  transition: 0.18s cubic-bezier(0.2, 0.7, 0.3, 1);
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.tn:hover .tn-badge,
.tn:focus-visible .tn-badge { transform: scale(1.18); box-shadow: 0 0 0 4px rgba(107, 227, 214, 0.16), 0 8px 24px rgba(0,0,0,0.4); }
.tn.you .tn-badge {
  width: 44px; height: 44px; font-size: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04221F;
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 24px rgba(107, 227, 214, 0.55), 0 4px 12px rgba(0,0,0,0.3);
}
.tn.inactive .tn-badge {
  opacity: 0.4;
  border-style: dashed;
  border-color: var(--ink-dim);
  background: transparent;
}
.tn.inactive:hover .tn-badge { opacity: 0.8; }
/* tier color rings */
.tn.tier-bronze   { --tier-c: var(--bronze-a); }
.tn.tier-silver   { --tier-c: var(--silver-a); }
.tn.tier-gold     { --tier-c: var(--gold-a); }
.tn.tier-diamond  { --tier-c: var(--diamond-a); }
.tn.tier-crown    { --tier-c: var(--crown-a); }
.tn.tier-crown .tn-badge::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid rgba(216, 184, 255, 0.4);
  animation: crown-pulse 2.4s ease-in-out infinite;
}
@keyframes crown-pulse { 0%,100% { opacity: 0.6; transform: scale(1); } 50% { opacity: 0; transform: scale(1.25); } }
.tn.tier-diamond .tn-badge::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid rgba(184, 241, 255, 0.4);
}

/* node mini-glyph (small L/R indicator under badge) */
.tn-leg {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 4px;
  font-family: var(--f-mono); font-size: 8px; letter-spacing: 0.16em;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* Popover */
.tn-popover {
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%; transform: translateX(-50%);
  width: 240px;
  background: var(--bg-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 14px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.55);
  opacity: 0; visibility: hidden;
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  pointer-events: none;
  z-index: 50;
  text-align: left;
}
.tn-popover::after {
  content: ""; position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--bg-3);
}
.tn:hover .tn-popover,
.tn:focus .tn-popover,
.tn:focus-within .tn-popover {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}
/* flip popover when too close to top */
.tn.flip .tn-popover { bottom: auto; top: calc(100% + 14px); }
.tn.flip .tn-popover::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--bg-3); }
/* edge nudges so popover doesn't clip out */
.tn.edge-l .tn-popover { left: 0; transform: translateX(0); }
.tn.edge-l .tn-popover::after { left: 18px; transform: none; }
.tn.edge-r .tn-popover { left: auto; right: 0; transform: translateX(0); }
.tn.edge-r .tn-popover::after { left: auto; right: 18px; transform: none; }

.tn-pop-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.tn-pop-name { font-family: var(--f-display); font-weight: 600; font-size: 13px; color: var(--ink); line-height: 1.2; }
.tn-pop-name .wallet { display: block; font-family: var(--f-mono); font-size: 9px; color: var(--ink-mute); letter-spacing: 0.04em; font-weight: 400; margin-top: 2px; }
.tn-pop-tier {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  flex-shrink: 0;
}
.tn-pop-tier.bronze   { background: rgba(226,154,108,0.14); color: var(--bronze-a); border: 1px solid rgba(226,154,108,0.32); }
.tn-pop-tier.silver   { background: rgba(232,238,245,0.10); color: var(--silver-a); border: 1px solid rgba(232,238,245,0.22); }
.tn-pop-tier.gold     { background: rgba(248,215,127,0.14); color: var(--gold-a); border: 1px solid rgba(248,215,127,0.32); }
.tn-pop-tier.diamond  { background: rgba(184,241,255,0.14); color: var(--diamond-a); border: 1px solid rgba(184,241,255,0.32); }
.tn-pop-tier.crown    { background: rgba(216,184,255,0.16); color: var(--crown-a); border: 1px solid rgba(216,184,255,0.36); }

.tn-pop-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px;
  padding-top: 10px; border-top: 1px dashed var(--line);
}
.tn-pop-stats > div { display: flex; flex-direction: column; gap: 2px; }
.tn-pop-stats span {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-mute);
}
.tn-pop-stats b {
  font-family: var(--f-display); font-weight: 600; font-size: 13px;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.005em;
}
.tn-pop-stats b.dim { color: var(--ink-mute); font-weight: 400; }
.tn-pop-stats b.up { color: var(--success); }

.tn-pop-foot {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.12em;
  color: var(--ink-mute); text-transform: uppercase;
}
.tn-pop-foot a {
  color: var(--accent); cursor: pointer;
  font-weight: 600;
}

/* Tree controls */
.tree-controls { display: flex; gap: 6px; }
.tree-controls button {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  width: 28px; height: 28px;
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: 0.12s;
}
.tree-controls button:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
.tree-controls button:disabled { opacity: 0.4; cursor: not-allowed; }

.tree-expand-btn { width: 100%; margin-top: 14px; padding: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); border-radius: var(--r-md); font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); cursor: pointer; transition: 0.12s; }
.tree-expand-btn:hover { background: rgba(255,255,255,0.08); color: var(--ink); border-color: var(--line-strong); }

/* Modal tree — bigger badges, larger canvas */
.modal-body .tree-canvas { aspect-ratio: auto; min-height: 480px; }
.modal-body .tn-badge { width: 40px; height: 40px; font-size: 12px; }
.modal-body .tn.you .tn-badge { width: 52px; height: 52px; font-size: 13px; }

/* Mobile: reduce node size slightly, fit popover */
@media (max-width: 759px) {
  .tn-badge { width: 30px; height: 30px; font-size: 10px; }
  .tn.you .tn-badge { width: 36px; height: 36px; font-size: 11px; }
  .tn-popover { width: 200px; padding: 12px; }
  .tn-pop-stats b { font-size: 12px; }
  .tree-canvas { aspect-ratio: 1.3/1; min-height: 320px; }
}

[dir="rtl"] .tn-popover { text-align: right; }

/* ============================
   6) Tier upgrade card
   ============================ */
.upgrade-card { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.upgrade-side { padding: 18px; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: var(--r-md); position: relative; }
.upgrade-side.next { border-color: rgba(107, 227, 214, 0.22); background: linear-gradient(180deg, rgba(107,227,214,0.05), transparent); }
.upgrade-side .lbl { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 12px; }
.upgrade-side.next .lbl { color: var(--accent); }
.upgrade-side .name { font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: -0.015em; }
.upgrade-side .price { font-family: var(--f-mono); font-size: 12px; color: var(--ink-mute); margin: 4px 0 12px; letter-spacing: 0.06em; }
.upgrade-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.upgrade-side ul li { font-size: 12px; color: var(--ink-soft); padding: 6px 0; border-top: 1px dashed var(--line); display: flex; gap: 6px; }
.upgrade-side ul li::before { content: "—"; color: var(--ink-mute); }
.upgrade-side.next ul li::before { content: "+"; color: var(--accent); font-weight: 700; }
.upgrade-cta { grid-column: 1 / -1; margin-top: 8px; padding: 16px 18px; background: linear-gradient(135deg, rgba(107,227,214,0.10), rgba(110,124,255,0.08)); border: 1px solid rgba(107, 227, 214, 0.25); border-radius: var(--r-md); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.upgrade-cta .est { font-family: var(--f-mono); font-size: 12px; color: var(--ink-soft); }
.upgrade-cta .est b { color: var(--accent); font-weight: 600; }
.upgrade-max { padding: 32px 18px; text-align: center; }
.upgrade-max .badge { display: inline-block; padding: 6px 14px; border-radius: 999px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; background: linear-gradient(135deg, var(--crown-a), var(--crown-b)); color: #FFFFFF; font-weight: 700; }
.upgrade-max h4 { font-family: var(--f-display); font-weight: 700; font-size: 22px; margin: 18px 0 6px; letter-spacing: -0.015em; }
.upgrade-max p { color: var(--ink-soft); font-size: 13px; margin: 0; }

/* ============================
   7) Partner Deals carousel
   ============================ */
.deals-scroller { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; margin: 0 -22px; padding-left: 22px; padding-right: 22px; }
.deals-scroller::-webkit-scrollbar { display: none; }
.deal-card { flex: 0 0 320px; scroll-snap-align: start; padding: 18px; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 10px; position: relative; }
.deal-card.urgent { border-color: rgba(255, 90, 106, 0.3); background: linear-gradient(180deg, rgba(255,90,106,0.04), transparent); }
.deal-card.locked { opacity: 0.6; filter: grayscale(0.4); }
.deal-card.locked::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(135deg, transparent 0 20px, rgba(0,0,0,0.05) 20px 21px); pointer-events: none; border-radius: var(--r-md); }
.deal-head { display: flex; justify-content: space-between; align-items: center; }
.deal-logo { width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; font-family: var(--f-display); font-weight: 700; font-size: 14px; color: #04221F; }
.deal-status { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); }
.deal-status.live { color: var(--success); border-color: rgba(63, 209, 139, 0.3); background: rgba(63,209,139,0.06); }
.deal-status.upcoming { color: var(--warning); border-color: rgba(242, 181, 68, 0.3); background: rgba(242,181,68,0.06); }
.deal-status.future { color: var(--ink-mute); }
.deal-card h4 { font-family: var(--f-display); font-weight: 600; font-size: 16px; margin: 0; letter-spacing: -0.01em; }
.deal-card .desc { font-size: 12px; color: var(--ink-mute); line-height: 1.4; margin: 0; }
.deal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.deal-grid .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-mute); }
.deal-grid .v { font-family: var(--f-display); font-weight: 600; font-size: 13px; color: var(--ink); margin-top: 2px; font-variant-numeric: tabular-nums; }
.deal-card .cta { margin-top: auto; padding: 10px 14px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; border-radius: 999px; background: var(--accent); color: #04221F; border: 0; cursor: pointer; font-weight: 700; }
.deal-card.locked .cta { background: rgba(255,255,255,0.04); color: var(--ink-mute); border: 1px solid var(--line); cursor: not-allowed; font-weight: 500; }

/* ============================
   6) Tier upgrade card — compact banner
   ============================ */
.upgrade-compact {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(107,227,214,0.06), rgba(110,124,255,0.04));
  border: 1px solid rgba(107, 227, 214, 0.22);
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
}
.upgrade-compact::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(360px 160px at 0% 50%, var(--tier-glow-up, rgba(107,227,214,0.14)), transparent 65%);
  pointer-events: none;
}
.upgrade-compact.tier-silver  { --tier-glow-up: rgba(232, 238, 245, 0.16); border-color: rgba(232, 238, 245, 0.22); }
.upgrade-compact.tier-gold    { --tier-glow-up: rgba(248, 215, 127, 0.18); border-color: rgba(248, 215, 127, 0.25); }
.upgrade-compact.tier-diamond { --tier-glow-up: rgba(184, 241, 255, 0.20); border-color: rgba(184, 241, 255, 0.26); }
.upgrade-compact.tier-crown   { --tier-glow-up: rgba(216, 184, 255, 0.24); border-color: rgba(216, 184, 255, 0.30); }

.upgrade-compact .badge { position: relative; aspect-ratio: 1; display: grid; place-items: center; }
.upgrade-compact .badge svg { width: 100%; height: 100%; }
.upgrade-compact .info { position: relative; min-width: 0; }
.upgrade-compact .lbl {
  font-family: var(--f-mono); font-size: 9px;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--accent);
}
.upgrade-compact .name {
  font-family: var(--f-display); font-weight: 700;
  font-size: 20px; letter-spacing: -0.015em;
  line-height: 1.05; margin-top: 4px;
  display: flex; align-items: baseline; gap: 8px;
}
.upgrade-compact .name .from {
  font-family: var(--f-mono); font-size: 11px;
  font-weight: 500; color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.upgrade-compact .deltas-inline {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: 10px;
  font-family: var(--f-mono); font-size: 11px;
  color: var(--ink-soft);
}
.upgrade-compact .deltas-inline span {
  display: inline-flex; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  letter-spacing: 0.04em;
}
.upgrade-compact .deltas-inline span .k {
  color: var(--ink-mute); text-transform: uppercase;
  font-size: 9px; letter-spacing: 0.14em;
}
.upgrade-compact .deltas-inline span b {
  color: var(--accent); font-weight: 700;
}
.upgrade-compact .deltas-inline span del {
  color: var(--ink-mute); text-decoration: line-through;
  font-weight: 400;
}
.upgrade-compact .price-cta {
  position: relative;
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 8px;
}
.upgrade-compact .price-cta .price {
  font-family: var(--f-mono); font-size: 11px;
  color: var(--ink-soft); letter-spacing: 0.04em;
}
.upgrade-compact .price-cta .price b {
  color: var(--ink); font-weight: 700;
  font-family: var(--f-display);
  font-size: 16px; letter-spacing: -0.005em;
  margin-right: 2px;
}
.upgrade-compact .price-cta .btn {
  padding: 10px 18px; font-size: 12px;
  white-space: nowrap;
}
.upgrade-compact .est {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--accent); letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Crown — "MAX TIER" compact version */
.upgrade-compact.max {
  background: linear-gradient(135deg, rgba(216,184,255,0.08), rgba(90, 61, 204, 0.04));
}
.upgrade-compact.max .max-badge {
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.2em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
  background: linear-gradient(135deg, var(--crown-a), var(--crown-b));
  color: #FFFFFF; font-weight: 700;
}
.upgrade-compact.max .sub {
  font-size: 12px; color: var(--ink-soft);
  margin-top: 6px; line-height: 1.45;
}

@media (max-width: 759px) {
  .upgrade-compact { grid-template-columns: 48px 1fr; padding: 14px 16px; gap: 12px; }
  .upgrade-compact .name { font-size: 17px; }
  .upgrade-compact .deltas-inline { margin-top: 8px; gap: 6px; }
  .upgrade-compact .deltas-inline span { padding: 3px 8px; font-size: 10px; }
  .upgrade-compact .price-cta {
    grid-column: 1 / -1;
    flex-direction: row; justify-content: space-between;
    align-items: center;
    padding-top: 14px; margin-top: 4px;
    border-top: 1px dashed var(--line);
  }
}

[dir="rtl"] .upgrade-compact .price-cta { align-items: flex-start; }

/* ============================
   8) Smart Recommendations
   ============================ */
.recs { display: grid; gap: 10px; }
.rec { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--r-md); }
.rec .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 14px; flex-shrink: 0; }
.rec h4 { font-family: var(--f-display); font-weight: 600; font-size: 14px; margin: 0 0 4px; letter-spacing: -0.005em; }
.rec p { color: var(--ink-soft); font-size: 12px; line-height: 1.45; margin: 0; }
.rec .act { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-top: 6px; display: inline-block; cursor: pointer; }
.rec.urgent { border-left-color: var(--danger); }
.rec.urgent .ic { background: rgba(255, 90, 106, 0.12); color: var(--danger); }
.rec.info { border-left-color: var(--accent-2); }
.rec.info .ic { background: rgba(110, 124, 255, 0.12); color: var(--accent-2); }
.rec.opportunity { border-left-color: var(--warning); }
.rec.opportunity .ic { background: rgba(242, 181, 68, 0.12); color: var(--warning); }
.rec.success { border-left-color: var(--success); }
.rec.success .ic { background: rgba(63, 209, 139, 0.12); color: var(--success); }
.rec.upgrade { border-left-color: var(--accent); }
.rec.upgrade .ic { background: rgba(107, 227, 214, 0.12); color: var(--accent); }

/* ============================
   6) Tier upgrade card — redesigned
   ============================ */
.upgrade-current-ref {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 14px;
  font-family: var(--f-mono); font-size: 11px;
  color: var(--ink-mute); letter-spacing: 0.06em;
  flex-wrap: wrap;
}
.upgrade-current-ref .lbl { text-transform: uppercase; letter-spacing: 0.18em; }
.upgrade-current-ref b { color: var(--ink); font-weight: 600; font-family: var(--f-display); font-size: 13px; letter-spacing: -0.005em; }
.upgrade-current-ref .sep { color: var(--ink-dim); }

.upgrade-hero {
  position: relative;
  padding: 24px;
  background: linear-gradient(135deg, rgba(107,227,214,0.08), rgba(110,124,255,0.06));
  border: 1px solid rgba(107, 227, 214, 0.22);
  border-radius: var(--r-lg);
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  align-items: center;
  overflow: hidden;
  margin-bottom: 14px;
}
.upgrade-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(400px 200px at 25% 0%, var(--tier-glow-up, rgba(107,227,214,0.18)), transparent 65%);
  pointer-events: none;
}
.upgrade-hero.tier-silver  { --tier-glow-up: rgba(232, 238, 245, 0.18); border-color: rgba(232, 238, 245, 0.22); }
.upgrade-hero.tier-gold    { --tier-glow-up: rgba(248, 215, 127, 0.20); border-color: rgba(248, 215, 127, 0.25); }
.upgrade-hero.tier-diamond { --tier-glow-up: rgba(184, 241, 255, 0.22); border-color: rgba(184, 241, 255, 0.28); }
.upgrade-hero.tier-crown   { --tier-glow-up: rgba(216, 184, 255, 0.26); border-color: rgba(216, 184, 255, 0.32); }
.upgrade-hero-badge { position: relative; aspect-ratio: 1; display: grid; place-items: center; }
.upgrade-hero-badge svg { width: 100%; height: 100%; }
.upgrade-hero-meta { position: relative; min-width: 0; }
.upgrade-hero .tag {
  display: inline-block;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--accent);
  padding: 3px 10px; border: 1px solid rgba(107, 227, 214, 0.3);
  background: rgba(107, 227, 214, 0.06); border-radius: 999px;
  margin-bottom: 12px;
}
.upgrade-hero .name {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: -0.025em; line-height: 1;
}
.upgrade-hero .price-diff {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-strong);
  font-family: var(--f-mono); font-size: 12px;
  color: var(--ink-soft); letter-spacing: 0.04em;
}
.upgrade-hero .price-diff .plus {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #04221F;
  display: grid; place-items: center; font-weight: 700;
}
.upgrade-hero .price-diff b { color: var(--ink); font-weight: 700; letter-spacing: 0.02em; }

.upgrade-deltas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.upgrade-delta {
  padding: 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.upgrade-delta .k {
  font-family: var(--f-mono); font-size: 9px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-mute); margin-bottom: 8px;
}
.upgrade-delta .v {
  display: flex; align-items: baseline; gap: 6px;
  font-family: var(--f-display); font-weight: 600;
  font-size: 15px; letter-spacing: -0.01em;
}
.upgrade-delta .v .old {
  color: var(--ink-mute); text-decoration: line-through;
  font-size: 12px; font-weight: 500;
}
.upgrade-delta .v .arrow {
  color: var(--ink-dim); font-family: var(--f-mono);
  font-weight: 400;
}
.upgrade-delta .v .new {
  color: var(--accent); font-weight: 700;
}

.upgrade-cta-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap;
  padding: 18px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.upgrade-cta-row .est {
  font-family: var(--f-mono); font-size: 12px;
  color: var(--ink-soft); letter-spacing: 0.04em;
}
.upgrade-cta-row .est b {
  color: var(--accent); font-weight: 700;
  font-family: var(--f-display); font-size: 14px;
  letter-spacing: -0.005em; margin: 0 4px;
}
.upgrade-cta-row .btn { padding: 12px 22px; font-size: 13px; }

.upgrade-max { padding: 32px 18px; text-align: center; }
.upgrade-max .badge { display: inline-block; padding: 6px 14px; border-radius: 999px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; background: linear-gradient(135deg, var(--crown-a), var(--crown-b)); color: #FFFFFF; font-weight: 700; }
.upgrade-max h4 { font-family: var(--f-display); font-weight: 700; font-size: 22px; margin: 18px 0 6px; letter-spacing: -0.015em; }
.upgrade-max p { color: var(--ink-soft); font-size: 13px; margin: 0; }

/* ============ Platform Pulse (gauge) ============ */
.plat-pulse {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px 22px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}
.plat-pulse::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(360px 180px at 0% 50%, rgba(63, 209, 139, 0.06), transparent 60%);
  pointer-events: none;
}
.plat-pulse-gauge { position: relative; width: 130px; height: 130px; }
.plat-pulse-gauge svg { width: 100%; height: 100%; }
.plat-pulse-gauge .center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.plat-pulse-gauge .center .v {
  font-family: var(--f-display); font-weight: 700;
  font-size: 28px; line-height: 1; letter-spacing: -0.02em;
}
.plat-pulse-gauge .center .v small { font-family: var(--f-mono); font-size: 11px; color: var(--ink-mute); margin-left: 2px; }
.plat-pulse-meta { position: relative; min-width: 0; }
.plat-pulse-meta .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-mute); }
.plat-pulse-meta .h { font-family: var(--f-display); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; margin-top: 4px; }
.plat-pulse-meta .lvl {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--success); margin-top: 8px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(63, 209, 139, 0.06);
  border: 1px solid rgba(63, 209, 139, 0.25);
}
.plat-pulse-meta .lvl .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(63,209,139,0.6); animation: live-pulse 2s ease-in-out infinite; }
.plat-pulse-meta .sub { font-family: var(--f-mono); font-size: 10px; color: var(--ink-mute); margin-top: 12px; letter-spacing: 0.06em; }

@media (max-width: 759px) {
  .plat-pulse { grid-template-columns: 110px 1fr; padding: 16px; }
  .plat-pulse-gauge { width: 110px; height: 110px; }
  .plat-pulse-gauge .center .v { font-size: 24px; }
  .upgrade-hero { grid-template-columns: 90px 1fr; padding: 18px; }
  .upgrade-hero .name { font-size: 26px; }
}

/* ============================
   9) Platform Health
   ============================ */
.plat-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.plat-pill.healthy { color: var(--success); border: 1px solid rgba(63, 209, 139, 0.3); background: rgba(63,209,139,0.06); }
.plat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.plat-grid .stat { padding: 12px 14px; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: var(--r-md); }
.plat-grid .stat .k { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-mute); }
.plat-grid .stat .v { font-family: var(--f-display); font-weight: 600; font-size: 18px; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.plat-grid .stat .v small { font-family: var(--f-mono); font-size: 11px; color: var(--success); font-weight: 500; margin-left: 4px; }
.plat-grid .stat .spark { margin-top: 8px; height: 28px; }
.plat-grid .stat .spark svg { width: 100%; height: 100%; }
.plat-locked { padding: 14px; background: rgba(255,255,255,0.02); border: 1px dashed var(--line-strong); border-radius: var(--r-md); display: flex; gap: 14px; align-items: center; }
.plat-locked .lk-ic { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,0.04); display: grid; place-items: center; color: var(--ink-mute); flex-shrink: 0; }
.plat-locked h4 { font-family: var(--f-display); font-weight: 600; font-size: 14px; margin: 0; }
.plat-locked p { font-size: 12px; color: var(--ink-mute); margin: 4px 0 0; }

/* 30-day chart */
.chart-30 { margin-top: 14px; height: 140px; padding: 14px; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: var(--r-md); }
.chart-30 svg { width: 100%; height: 100%; }

/* ============================
   10) Activity log
   ============================ */
.log { display: grid; gap: 0; }
.log-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; padding: 12px 0; border-top: 1px dashed var(--line); align-items: center; }
.log-row:first-child { border-top: 0; }
.log-row .ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,0.04); color: var(--ink-soft); }
.log-row .ic svg { width: 16px; height: 16px; }
.log-row .ttl { font-size: 13px; color: var(--ink); }
.log-row .meta { font-family: var(--f-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: 0.04em; }
.log-row .amt { font-family: var(--f-display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.log-row.commission .ic { background: rgba(63, 209, 139, 0.10); color: var(--success); }
.log-row.commission .amt { color: var(--success); }
.log-row.withdrawal .ic { background: rgba(110, 124, 255, 0.10); color: var(--accent-2); }
.log-row.withdrawal .amt { color: var(--ink); }
.log-row.upgrade .ic { background: rgba(216, 184, 255, 0.10); color: var(--crown-a); }
.log-row.deal .ic { background: rgba(107, 227, 214, 0.10); color: var(--accent); }
.log-row.cycle .ic { background: rgba(242, 181, 68, 0.10); color: var(--warning); }

/* ============================
   11) Tier-locked panels
   ============================ */
.vote-card .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.vote-card .stats { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--f-mono); font-size: 11px; color: var(--ink-mute); letter-spacing: 0.04em; }
.vote-card .stats b { color: var(--ink-soft); font-weight: 600; }
.vote-row { padding: 16px; background: rgba(255,255,255,0.02); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 10px; }
.vote-row .top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.vote-row .top h4 { font-family: var(--f-display); font-weight: 600; font-size: 15px; margin: 0; }
.vote-row .top .clock { font-family: var(--f-mono); font-size: 11px; color: var(--warning); letter-spacing: 0.06em; }
.vote-row .desc { font-size: 12px; color: var(--ink-soft); line-height: 1.5; margin: 0 0 12px; }
.vote-row .progress { display: flex; gap: 4px; margin-bottom: 10px; }
.vote-row .progress > span { height: 4px; flex: 1; background: rgba(255,255,255,0.04); border-radius: 999px; position: relative; }
.vote-row .progress > span::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; }
.vote-row .progress .approve::after { width: var(--p-approve, 0%); background: var(--success); }
.vote-row .progress .reject::after { width: var(--p-reject, 0%); background: var(--danger); }
.vote-row .progress .abstain::after { width: var(--p-abstain, 0%); background: var(--ink-mute); }
.vote-row .progress-labels { display: flex; gap: 12px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--ink-mute); margin-bottom: 14px; }
.vote-row .progress-labels b { color: var(--ink); font-weight: 600; }
.vote-row .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vote-row .actions button { flex: 1; min-width: 80px; padding: 9px 12px; border-radius: 999px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; font-weight: 600; border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--ink-soft); }
.vote-row .actions button.approve { background: rgba(63,209,139,0.10); color: var(--success); border-color: rgba(63,209,139,0.3); }
.vote-row .actions button.reject { background: rgba(255,90,106,0.10); color: var(--danger); border-color: rgba(255,90,106,0.3); }
.vote-row .actions button:hover { transform: translateY(-1px); }

/* Crown revenue share */
.rev-share .v { font-family: var(--f-display); font-weight: 700; font-size: 38px; letter-spacing: -0.025em; color: var(--ink); font-variant-numeric: tabular-nums; }
.rev-share .v small { font-family: var(--f-mono); font-size: 14px; color: var(--ink-mute); font-weight: 500; letter-spacing: 0.04em; margin-left: 4px; }
.rev-share .breakdown { margin-top: 16px; display: grid; gap: 8px; }
.rev-share .breakdown .row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px dashed var(--line); }
.rev-share .breakdown .src { font-size: 13px; color: var(--ink-soft); }
.rev-share .breakdown .pct { font-family: var(--f-mono); font-size: 11px; color: var(--accent); margin-right: 12px; }
.rev-share .breakdown .amt { font-family: var(--f-display); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }

/* ============================
   Sticky bottom action bar (mobile)
   ============================ */
.action-bar {
  /* tabbar height already excludes the safe-area inset, so add it here too,
     otherwise on notched phones the bar overlaps the top of the tabbar. */
  position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); z-index: 30;
  background: rgba(5, 7, 13, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  display: flex; gap: 10px;
}
.app.desktop .action-bar { display: none; }
.action-bar button { flex: 1; padding: 12px 14px; border-radius: 12px; font-family: var(--f-display); font-size: 13px; font-weight: 600; letter-spacing: -0.005em; cursor: pointer; border: 1px solid transparent; display: flex; align-items: center; justify-content: center; gap: 6px; }
.action-bar .primary { background: var(--accent); color: #04221F; }
.action-bar .secondary { background: rgba(255,255,255,0.04); color: var(--ink); border-color: var(--line-strong); }

/* ============================
   Tree modal (fullscreen)
   ============================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(5, 7, 13, 0.85);
  backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  width: 100%; max-width: 920px; max-height: 90vh;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 18px; letter-spacing: -0.01em; }
.modal-head .close { background: none; border: 0; color: var(--ink-soft); cursor: pointer; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.modal-head .close:hover { background: rgba(255,255,255,0.06); color: var(--ink); }
.modal-body { padding: 22px; overflow: auto; flex: 1; }
.modal-body .canvas { background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r-md); aspect-ratio: 16/10; overflow: hidden; }
.modal-body .canvas svg { width: 100%; height: 100%; }

/* ============================
   Responsive grid for sections
   ============================ */
.feed-row { display: grid; gap: 18px; }
.feed-row.r-3 { grid-template-columns: 1fr; }
.feed-row.r-2-1 { grid-template-columns: 1fr; }
.feed-row.r-1-1 { grid-template-columns: 1fr; }

@media (min-width: 760px) {
  .feed-row.r-3 { grid-template-columns: 1.1fr 1fr; }
  .feed-row.r-3 > .nft-card { grid-column: span 1; }
}

@media (min-width: 1024px) {
  .feed-row.r-3 { grid-template-columns: 1.2fr 1fr 0.9fr; }
  .feed-row.r-3 > .nft-card { grid-column: span 1; }
  .feed-row.r-2-1 { grid-template-columns: 2fr 1fr; }
  .feed-row.r-1-1 { grid-template-columns: 1fr 1fr; }
}

/* Tablet refinements */
@media (max-width: 759px) {
  .nft-card { grid-template-columns: 90px 1fr; padding: 16px; }
  .nft-meta .tier-name { font-size: 22px; }
  .nft-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .nft-stat .k { font-size: 8px; letter-spacing: 0.10em; }
  .nft-stat .v { font-size: 14px; }
  .bv-grid { grid-template-columns: 1fr; }
  .upgrade-card { grid-template-columns: 1fr; }
  .health-gauge { width: 160px; height: 160px; }
  .health-gauge .v { font-size: 36px; }
  .dc { padding: 16px; }
  .earn-total .v { font-size: 28px; }
  .earn-quick { grid-template-columns: 1fr; }
  .feed-inner { gap: 14px; }
  main.feed { padding: 12px 10px calc(var(--actionbar-h) + 16px); }
  .deal-card { flex: 0 0 86%; }
  .plat-grid { grid-template-columns: 1fr; }

  /* Appbar — tighter on phones */
  .appbar { padding: 0 10px; }
  .appbar-right { gap: 4px; }
  .appbar-brand { font-size: 14px; gap: 8px; }
  .appbar-brand svg { width: 24px; height: 24px; }
  .appbar-connect { padding: 7px 10px; font-size: 11px; }
  .appbar-connect.connected { letter-spacing: 0.04em; font-size: 10.5px; padding: 7px 9px; }
  .appbar-btn { width: 32px; height: 32px; }
  .appbar-avatar { width: 32px; height: 32px; font-size: 11px; }
  .lang-switch summary, details.tier-switch summary { padding: 6px 9px; font-size: 9.5px; }

  /* Mint card — tighter on mobile to never overflow */
  #mint-card { padding: 14px; }
  .mint-tier { padding: 10px 4px; }
  .mint-tier .t-name { font-size: 13px; }
  .mint-tier .t-price { font-size: 10px; }
  .mint-step-h { font-size: 13px; }
  .mint-step-d { font-size: 12px; }
  .mint-action-row { flex-direction: column; align-items: stretch; }
  .mint-action-row .btn { width: 100%; }
  .mint-step-row { flex-direction: column; align-items: stretch; }
  .mint-step-row .btn { width: 100%; }

  /* Pre-launch banner — stack the two halves */
  .prelaunch-banner { padding: 14px 16px; }
  .prelaunch-banner .pl-text strong { font-size: 14px; }
  .prelaunch-banner .pl-text span { font-size: 12px; }
}

/* tier-aware tabs (mobile BV) */
.bv-tabs { display: none; gap: 4px; padding: 4px; background: rgba(255,255,255,0.04); border-radius: 999px; margin-bottom: 12px; }
.bv-tabs button { flex: 1; background: transparent; border: 0; padding: 8px 12px; border-radius: 999px; color: var(--ink-mute); font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; cursor: pointer; }
.bv-tabs button[aria-pressed="true"] { background: var(--accent); color: #04221F; }
@media (max-width: 759px) {
  .bv-tabs { display: flex; }
  .bv-grid .bv-leg:not(.shown) { display: none; }
}

/* RTL */
[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .sidebar-link.active::before { left: auto; right: 0; border-radius: 3px 0 0 3px; }
[dir="rtl"] .tier-switch-menu { right: auto; left: 0; }
[dir="rtl"] .nft-rank-pin { right: auto; left: -6px; }
[dir="rtl"] .app.desktop { grid-template-columns: 1fr var(--sidebar-w); grid-template-areas: "topbar sidebar" "main sidebar"; }
[dir="rtl"] [lang="fa"] body { font-family: var(--f-fa); }
[dir="rtl"] [lang="ar"] body { font-family: var(--f-ar); }
[dir="rtl"] .nft-stat .v small,
[dir="rtl"] .earn-total .v small,
[dir="rtl"] .mono,
[dir="rtl"] .bv-leg .v,
[dir="rtl"] .bv-clock .v { direction: ltr; display: inline-block; }
[dir="rtl"] .bar > span { /* keep bar order LTR for consistent reading */ }

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

/* ---------- Transactions modal + copy buttons ---------- */
.tx-chip { padding:6px 12px; border-radius:999px; border:1px solid var(--line); background:rgba(255,255,255,0.03); color:var(--ink-soft); font-size:12px; cursor:pointer; white-space:nowrap; }
.tx-chip.active { border-color:var(--accent); color:var(--accent); background:rgba(107,227,214,0.08); }
.tx-row { display:flex; align-items:center; gap:12px; padding:12px 6px; border-bottom:1px solid var(--line); }
.tx-row .tx-ic { width:30px; height:30px; border-radius:8px; display:grid; place-items:center; flex-shrink:0; font-size:14px; background:rgba(255,255,255,0.04); }
.tx-row .tx-main { flex:1; min-width:0; }
.tx-row .tx-ttl { font-weight:600; font-size:13px; color:var(--ink); }
.tx-row .tx-meta { font-size:11px; color:var(--ink-mute); font-family:var(--f-mono); display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-top:2px; }
.tx-row .tx-amt { font-family:var(--f-mono); font-weight:700; font-size:13px; white-space:nowrap; }
.tx-row .tx-amt.pos { color:var(--success); } .tx-row .tx-amt.neg { color:var(--ink-soft); }
.copy-btn { display:inline-flex; align-items:center; gap:3px; cursor:pointer; border:0; background:rgba(255,255,255,0.05); color:var(--ink-mute); border-radius:5px; padding:2px 6px; font-family:var(--f-mono); font-size:10px; }
.copy-btn:hover { background:rgba(107,227,214,0.12); color:var(--accent); }
.copy-btn.copied { color:var(--success); }
