@font-face {
  font-family: "Montserrat";
  src: url("/assets/montserrat-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #06080d;
  --surface: #0c111a;
  --surface-2: #111824;
  --surface-3: #151e2c;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(216, 181, 69, 0.25);
  --text: #f4f5f8;
  --muted: #8f98a8;
  --muted-2: #657083;
  --gold: #d8b545;
  --gold-light: #f3d976;
  --blue: #70a8ff;
  --green: #61d7a1;
  --violet: #a889f7;
  --danger: #ff7a7a;
  --sidebar: 268px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 88% 8%, rgba(112, 168, 255, 0.1), transparent 28rem),
    radial-gradient(circle at 12% 90%, rgba(216, 181, 69, 0.075), transparent 34rem),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: 0.035;
  background-image: url("/assets/primex-theme-bg.png");
  background-position: center;
  background-size: cover;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
}

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
}

.brand-word {
  color: #f7f7fb;
  font-size: 1.32rem;
  font-weight: 500;
  letter-spacing: 0.19em;
  line-height: 1;
}

.brand-word span {
  color: var(--gold);
  font-weight: 800;
}

.brand em {
  padding: 0.27rem 0.42rem;
  border: 1px solid rgba(216, 181, 69, 0.38);
  border-radius: 999px;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.08);
  font-size: 0.48rem;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.15em;
}

.brand-large .brand-word {
  font-size: 1.7rem;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 0.62rem;
  padding: 0.74rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.primary-button {
  color: #111;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 10px 30px rgba(216, 181, 69, 0.16);
}

.secondary-button {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.secondary-button:hover {
  border-color: rgba(216, 181, 69, 0.3);
  background: rgba(216, 181, 69, 0.06);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--gold-light);
  font-size: 0.72rem;
  font-weight: 700;
}

.text-link svg,
.invite-footer a svg,
.rank-panel a svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* Login */

.login-body {
  overflow-x: hidden;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(460px, 1.06fr) minmax(420px, 0.94fr);
}

.login-story {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(2rem, 4.8vw, 4.8rem);
  border-right: 1px solid var(--line);
  isolation: isolate;
}

.login-story::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  background:
    linear-gradient(110deg, rgba(4, 7, 12, 0.93), rgba(6, 9, 15, 0.62)),
    url("/assets/primex-theme-bg.png") center / cover;
}

.login-story::after {
  position: absolute;
  top: 18%;
  right: -18%;
  z-index: -1;
  width: 36rem;
  height: 36rem;
  border: 1px solid rgba(216, 181, 69, 0.14);
  border-radius: 50%;
  content: "";
  box-shadow:
    0 0 0 5rem rgba(216, 181, 69, 0.018),
    0 0 0 10rem rgba(112, 168, 255, 0.012);
}

.story-copy {
  width: min(100%, 620px);
  margin-top: auto;
  margin-bottom: 3.5rem;
}

.story-copy h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(3.2rem, 6vw, 6.5rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.93;
}

.story-copy h1 span {
  color: var(--gold-light);
}

.story-copy > p:last-child {
  max-width: 540px;
  margin: 1.7rem 0 0;
  color: #aab1bf;
  font-size: 0.94rem;
  line-height: 1.8;
}

.story-note {
  margin: 0;
  color: var(--muted-2);
  font-size: 0.66rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.story-network {
  position: absolute;
  top: 18%;
  right: 9%;
  width: 18rem;
  height: 16rem;
  opacity: 0.7;
}

.network-core,
.network-node {
  position: absolute;
  z-index: 2;
  display: grid;
  border: 1px solid rgba(216, 181, 69, 0.35);
  border-radius: 50%;
  place-items: center;
  color: var(--gold-light);
  background: rgba(8, 12, 19, 0.94);
  box-shadow: 0 0 28px rgba(216, 181, 69, 0.08);
  font-size: 0.58rem;
  font-weight: 800;
}

.network-core {
  top: 0;
  left: calc(50% - 1.7rem);
  width: 3.4rem;
  height: 3.4rem;
}

.network-node {
  width: 2.5rem;
  height: 2.5rem;
  border-color: rgba(112, 168, 255, 0.3);
  color: #b8d2ff;
}

.node-one { top: 6.7rem; left: 2.1rem; }
.node-two { top: 6.7rem; right: 2.1rem; }
.node-three { bottom: 0; left: 0; }
.node-four { right: 0; bottom: 0; }

.story-network i {
  position: absolute;
  z-index: 1;
  width: 1px;
  height: 6.7rem;
  background: linear-gradient(var(--gold), rgba(112, 168, 255, 0.2));
  transform-origin: top;
}

.line-one { top: 2.9rem; left: 8.4rem; transform: rotate(38deg); }
.line-two { top: 2.9rem; right: 8.4rem; transform: rotate(-38deg); }
.line-three { top: 8.7rem; left: 3.3rem; transform: rotate(24deg); }
.line-four { top: 8.7rem; right: 3.3rem; transform: rotate(-24deg); }

.login-panel {
  display: grid;
  min-height: 100vh;
  padding: clamp(1.5rem, 5vw, 5rem);
  background:
    radial-gradient(circle at 90% 0, rgba(112, 168, 255, 0.07), transparent 25rem),
    #080b11;
  place-items: center;
}

.login-card {
  width: min(100%, 440px);
}

.mobile-brand {
  display: none;
}

.team-install-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.9rem;
  border: 1px solid rgba(216, 181, 69, 0.32);
  border-radius: 999px;
  cursor: pointer;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.06);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.team-install-button[hidden] {
  display: none;
}

.team-install-button:hover {
  border-color: rgba(216, 181, 69, 0.58);
  background: rgba(216, 181, 69, 0.11);
  transform: translateY(-1px);
}

.team-install-button svg {
  width: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.team-install-help {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  padding: 1.2rem;
  background: rgba(2, 4, 8, 0.82);
  backdrop-filter: blur(10px);
  place-items: center;
}

.team-install-help[hidden] {
  display: none;
}

.team-install-help > div {
  position: relative;
  width: min(100%, 390px);
  padding: 2.2rem;
  border: 1px solid rgba(216, 181, 69, 0.24);
  border-radius: 18px;
  background: #0c1018;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.team-install-close {
  position: absolute;
  top: 0.65rem;
  right: 0.7rem;
  width: 2.2rem;
  height: 2.2rem;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-size: 1.6rem;
}

.team-install-mark {
  display: grid;
  width: 3.4rem;
  height: 3.4rem;
  margin: 0 auto 1.2rem;
  border: 1px solid rgba(216, 181, 69, 0.38);
  border-radius: 50%;
  place-items: center;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.07);
  font-size: 0.78rem;
  font-weight: 850;
}

.team-install-help h2 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 550;
  letter-spacing: -0.035em;
}

.team-install-help p {
  margin: 0.9rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.65;
}

.team-install-confirm {
  width: 100%;
  min-height: 46px;
  border: 0;
}

.login-card h2 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.25rem);
  font-weight: 550;
  letter-spacing: -0.055em;
}

.login-intro {
  margin: 0.8rem 0 2.25rem;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.6;
}

.form-alert {
  margin: -0.6rem 0 1.15rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(255, 122, 122, 0.2);
  border-radius: 10px;
  color: #ffb0b0;
  background: rgba(255, 122, 122, 0.06);
  font-size: 0.73rem;
  line-height: 1.5;
}

.login-form {
  display: grid;
  gap: 1.05rem;
}

.login-form label > span:first-child {
  display: block;
  margin: 0 0 0.48rem;
  color: #c7cbd3;
  font-size: 0.68rem;
  font-weight: 700;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  min-height: 50px;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.82rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-form input:focus {
  border-color: rgba(216, 181, 69, 0.55);
  box-shadow: 0 0 0 3px rgba(216, 181, 69, 0.07);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 4.4rem !important;
}

.password-field button {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  padding: 0 0.95rem;
  border: 0;
  cursor: pointer;
  color: var(--gold-light);
  background: transparent;
  font-size: 0.66rem;
  font-weight: 750;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
}

.remember-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--gold);
}

.remember-row span {
  margin: 0 !important;
  color: var(--muted) !important;
  font-size: 0.68rem !important;
  font-weight: 550 !important;
}

.login-button {
  width: 100%;
  min-height: 52px;
  margin-top: 0.25rem;
  border: 0;
}

.login-button svg {
  width: 1rem;
}

.login-support {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1.6rem;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.login-support a {
  color: var(--gold-light);
  font-weight: 700;
}

.join-shell {
  display: grid;
  min-height: 100vh;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at 50% 0, rgba(216, 181, 69, 0.12), transparent 28rem),
    linear-gradient(rgba(6, 8, 13, 0.9), rgba(6, 8, 13, 0.98)),
    url("/assets/primex-theme-bg.png") center / cover;
  place-items: center;
}

.join-card {
  width: min(100%, 560px);
  padding: clamp(1.4rem, 4vw, 2.6rem);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(10, 14, 21, 0.94);
  box-shadow: var(--shadow);
}

.join-mark {
  position: relative;
  display: grid;
  width: 5rem;
  height: 5rem;
  margin: 3.2rem 0 1.6rem;
  border: 1px solid rgba(216, 181, 69, 0.3);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.08);
  font-size: 1rem;
  font-weight: 800;
  place-items: center;
}

.join-mark i {
  position: absolute;
  right: 0.2rem;
  bottom: 0.2rem;
  width: 0.85rem;
  height: 0.85rem;
  border: 3px solid #0a0e15;
  border-radius: 50%;
  background: var(--green);
}

.join-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 550;
  letter-spacing: -0.055em;
  line-height: 1.05;
}

.join-intro {
  margin: 1rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.7;
}

.join-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.join-details > div {
  min-width: 0;
  padding: 0.85rem;
  border-right: 1px solid var(--line);
}

.join-details > div:last-child {
  border-right: 0;
}

.join-details small,
.join-details strong {
  display: block;
}

.join-details small {
  color: var(--muted-2);
  font-size: 0.5rem;
}

.join-details strong {
  overflow: hidden;
  margin-top: 0.35rem;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.join-continue {
  width: 100%;
  margin-top: 0.65rem;
}

.join-note {
  margin: 1rem 0 0;
  color: var(--muted-2);
  font-size: 0.53rem;
  line-height: 1.6;
  text-align: center;
}

.join-note strong {
  color: #c7ccd5;
}

.error-mark {
  color: var(--danger);
  border-color: rgba(255, 122, 122, 0.25);
  background: rgba(255, 122, 122, 0.06);
}

.error-login-link {
  display: flex;
  justify-content: center;
  margin-top: 1.1rem;
}

/* Application shell */

.app-frame {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  padding: 1.55rem 1.05rem 1rem;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(8, 12, 18, 0.96), rgba(8, 12, 18, 0.98)),
    url("/assets/primex-theme-bg.png") center / cover;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.2rem 0.65rem 1.7rem;
}

.sidebar-close {
  display: none;
}

.side-nav {
  display: grid;
  gap: 0.35rem;
}

.side-nav > a {
  position: relative;
  display: grid;
  min-height: 62px;
  grid-template-columns: 2.15rem 1fr 1rem;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #7e899b;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.side-nav > a > span {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.028);
  place-items: center;
}

.side-nav > a p {
  margin: 0;
}

.side-nav > a strong,
.side-nav > a small {
  display: block;
}

.side-nav > a strong {
  color: #c8ced9;
  font-size: 0.73rem;
  font-weight: 700;
}

.side-nav > a small {
  margin-top: 0.18rem;
  color: var(--muted-2);
  font-size: 0.56rem;
  font-weight: 500;
}

.side-nav > a > i {
  opacity: 0;
}

.side-nav > a > i svg {
  width: 0.85rem;
}

.side-nav > a:hover,
.side-nav > a.active {
  border-color: rgba(216, 181, 69, 0.13);
  color: var(--gold);
  background: linear-gradient(90deg, rgba(216, 181, 69, 0.09), rgba(216, 181, 69, 0.02));
}

.side-nav > a.active::before {
  position: absolute;
  top: 13px;
  bottom: 13px;
  left: -1.08rem;
  width: 3px;
  border-radius: 0 4px 4px 0;
  content: "";
  background: var(--gold);
  box-shadow: 0 0 12px rgba(216, 181, 69, 0.45);
}

.side-nav > a.active > span {
  background: rgba(216, 181, 69, 0.1);
}

.side-nav > a.active strong {
  color: var(--text);
}

.side-nav > a.active > i {
  opacity: 1;
}

.sidebar-growth {
  position: relative;
  margin-top: auto;
  overflow: hidden;
  padding: 1.05rem;
  border: 1px solid rgba(216, 181, 69, 0.17);
  border-radius: 14px;
  background:
    radial-gradient(circle at 100% 0, rgba(216, 181, 69, 0.13), transparent 8rem),
    rgba(216, 181, 69, 0.035);
}

.growth-mark {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  color: var(--gold);
  background: rgba(216, 181, 69, 0.1);
  place-items: center;
}

.sidebar-growth strong {
  display: block;
  color: #d5d9e0;
  font-size: 0.7rem;
  line-height: 1.55;
}

.sidebar-growth a {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.9rem;
  color: var(--gold-light);
  font-size: 0.62rem;
  font-weight: 750;
}

.sidebar-growth a svg {
  width: 0.75rem;
}

.sidebar-account {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.8rem;
  padding: 0.75rem 0.55rem 0;
  border-top: 1px solid var(--line);
}

.avatar,
.topbar-profile > span {
  display: grid;
  border: 1px solid rgba(216, 181, 69, 0.28);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.08);
  font-size: 0.58rem;
  font-weight: 800;
  place-items: center;
}

.avatar {
  width: 2.2rem;
  height: 2.2rem;
}

.sidebar-account > span:nth-child(2) {
  overflow: hidden;
}

.sidebar-account strong,
.sidebar-account small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account strong {
  font-size: 0.64rem;
}

.sidebar-account small {
  margin-top: 0.18rem;
  color: var(--muted-2);
  font-size: 0.54rem;
}

.sidebar-account button {
  padding: 0.4rem;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
}

.sidebar-backdrop {
  display: none;
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.15rem;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 8, 13, 0.83);
  backdrop-filter: blur(18px);
}

.topbar > div:first-of-type small,
.topbar > div:first-of-type strong {
  display: block;
}

.topbar > div:first-of-type small {
  margin-bottom: 0.2rem;
  color: var(--muted-2);
  font-size: 0.54rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.topbar > div:first-of-type strong {
  font-size: 0.85rem;
  font-weight: 700;
}

.menu-button {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.topbar-invite {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.82rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #d7dbe3;
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.65rem;
  font-weight: 700;
}

.topbar-invite svg {
  width: 0.95rem;
  color: var(--gold);
}

.topbar-profile {
  position: relative;
}

.topbar-profile > span {
  width: 2.35rem;
  height: 2.35rem;
}

.topbar-profile > i {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 0.55rem;
  height: 0.55rem;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--green);
}

.page-content {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 2.2rem clamp(1.25rem, 3vw, 3rem) 4rem;
}

.page-heading {
  margin-bottom: 1.65rem;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 3.4vw, 3.4rem);
  font-weight: 550;
  letter-spacing: -0.052em;
}

.page-heading > p:last-child,
.heading-split > div > p:last-child {
  max-width: 680px;
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.65;
}

.heading-split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.heading-actions {
  display: flex;
  gap: 0.65rem;
}

.heading-actions svg {
  width: 1rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 17px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.018), transparent 55%),
    var(--surface);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.13);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-heading h2,
.panel h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.metric-card {
  position: relative;
  min-height: 155px;
  overflow: hidden;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.008));
}

.metric-card::after {
  position: absolute;
  top: -3rem;
  right: -2rem;
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  content: "";
  opacity: 0.12;
  background: currentColor;
  filter: blur(35px);
}

.metric-card.gold { color: var(--gold); }
.metric-card.blue { color: var(--blue); }
.metric-card.green { color: var(--green); }
.metric-card.violet { color: var(--violet); }

.metric-icon {
  display: grid;
  width: 2.3rem;
  height: 2.3rem;
  margin-bottom: 1rem;
  border: 1px solid currentColor;
  border-radius: 10px;
  background: color-mix(in srgb, currentColor 9%, transparent);
  font-size: 0.65rem;
  font-weight: 850;
  place-items: center;
}

.metric-card p,
.metric-card strong,
.metric-card span {
  display: block;
}

.metric-card p {
  margin: 0 0 0.25rem;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 650;
}

.metric-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: clamp(1.28rem, 2vw, 1.75rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card span {
  margin-top: 0.42rem;
  color: var(--muted-2);
  font-size: 0.55rem;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.75fr);
  gap: 0.85rem;
}

.invite-panel,
.balance-panel,
.activity-panel,
.rank-panel,
.tree-panel,
.directory-panel,
.invite-builder,
.qr-panel,
.message-panel,
.profile-card,
.account-panel {
  padding: 1.35rem;
}

.live-badge,
.subtle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  padding: 0.36rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.52rem;
  font-weight: 700;
}

.live-badge i,
.status-chip i {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 9px rgba(97, 215, 161, 0.55);
}

.referral-builder {
  margin-top: 1.2rem;
}

.position-switch {
  display: grid;
  width: min(100%, 260px);
  grid-template-columns: repeat(2, 1fr);
  gap: 0.3rem;
  padding: 0.3rem;
  border: 1px solid rgba(216, 181, 69, 0.18);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.position-switch button {
  min-height: 36px;
  padding: 0 1rem;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  color: var(--muted-2);
  background: transparent;
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.position-switch button:hover:not(.active) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.position-switch button.active {
  color: #14120a;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: 0 6px 18px rgba(216, 181, 69, 0.18);
  transform: translateY(-1px);
}

.referral-link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.referral-link-row input {
  min-width: 0;
  min-height: 45px;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  color: #bbc3d0;
  background: rgba(0, 0, 0, 0.22);
  font-size: 0.66rem;
}

.icon-button {
  display: inline-flex;
  min-width: 45px;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  padding: 0 0.8rem;
  border: 1px solid rgba(216, 181, 69, 0.22);
  border-radius: 10px;
  cursor: pointer;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.07);
  font-size: 0.6rem;
  font-weight: 750;
}

.icon-button svg {
  width: 0.95rem;
}

.invite-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  color: var(--muted-2);
  font-size: 0.56rem;
}

.invite-footer a {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.15rem;
  color: var(--gold-light);
  font-weight: 750;
}

.balance-visual {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1.35rem;
}

.balance-ring {
  display: grid;
  width: 100px;
  height: 100px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--gold) 0 var(--left-share), var(--blue) var(--left-share) 100%);
  place-items: center;
}

.balance-ring::before {
  grid-area: 1 / 1;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  content: "";
  background: var(--surface);
}

.balance-ring span {
  z-index: 1;
  grid-area: 1 / 1;
  text-align: center;
}

.balance-ring strong,
.balance-ring small {
  display: block;
}

.balance-ring strong {
  font-size: 1.35rem;
}

.balance-ring small {
  margin-top: 0.1rem;
  color: var(--muted-2);
  font-size: 0.5rem;
}

.leg-stats {
  display: grid;
  width: 100%;
  gap: 0.7rem;
}

.leg-stats > div {
  display: grid;
  grid-template-columns: 0.55rem 1fr auto;
  align-items: center;
  gap: 0.45rem;
}

.leg-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
}

.leg-dot.left { background: var(--gold); }
.leg-dot.right { background: var(--blue); }

.leg-stats p {
  margin: 0;
  color: var(--muted);
  font-size: 0.61rem;
}

.leg-stats strong {
  font-size: 0.78rem;
}

.balance-note {
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 0.55rem;
  line-height: 1.5;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.75fr);
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.member-list {
  margin-top: 0.6rem;
}

.member-list > a {
  display: grid;
  grid-template-columns: 2.35rem 1fr auto;
  align-items: center;
  gap: 0.72rem;
  padding: 0.72rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.member-list > a:last-child {
  border-bottom: 0;
}

.member-avatar,
.table-member > i {
  display: grid;
  border: 1px solid rgba(112, 168, 255, 0.2);
  border-radius: 9px;
  color: #bdd4ff;
  background: rgba(112, 168, 255, 0.07);
  font-size: 0.54rem;
  font-style: normal;
  font-weight: 800;
  place-items: center;
}

.member-avatar {
  width: 2.35rem;
  height: 2.35rem;
}

.member-list strong,
.member-list small {
  display: block;
}

.member-list strong {
  font-size: 0.66rem;
}

.member-list small {
  margin-top: 0.22rem;
  color: var(--muted-2);
  font-size: 0.52rem;
}

.member-list time {
  color: var(--muted-2);
  font-size: 0.52rem;
}

.rank-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 95% 8%, rgba(216, 181, 69, 0.14), transparent 12rem),
    var(--surface);
}

.rank-panel h2 {
  margin-top: 2.5rem;
  font-size: 1.45rem;
}

.rank-panel > p:not(.eyebrow) {
  margin: 0.6rem 0 1rem;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1.6;
}

.rank-orbit {
  position: absolute;
  top: 1.1rem;
  right: 1.3rem;
  display: grid;
  width: 4rem;
  height: 4rem;
  border: 1px solid rgba(216, 181, 69, 0.18);
  border-radius: 50%;
  place-items: center;
}

.rank-orbit span {
  color: var(--gold);
  font-size: 0.85rem;
}

.rank-orbit i {
  position: absolute;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: var(--blue);
}

.rank-orbit i:first-of-type { top: 0.22rem; left: 0.7rem; }
.rank-orbit i:last-of-type { right: 0.2rem; bottom: 0.8rem; background: var(--gold); }

.rank-progress > span {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.rank-progress > span i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

.rank-progress small {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted-2);
  font-size: 0.5rem;
}

.rank-panel > a {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 1.05rem;
  color: var(--gold-light);
  font-size: 0.6rem;
  font-weight: 750;
}

/* Team */

.team-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.team-summary-strip > div {
  padding: 1.05rem 1.2rem;
  border-right: 1px solid var(--line);
}

.team-summary-strip > div:last-child {
  border-right: 0;
}

.team-summary-strip small,
.team-summary-strip strong {
  display: block;
}

.team-summary-strip small {
  color: var(--muted-2);
  font-size: 0.53rem;
}

.team-summary-strip strong {
  margin-top: 0.35rem;
  font-size: 1.25rem;
  font-weight: 650;
}

.tree-panel {
  margin-bottom: 0.85rem;
}

.tree-view {
  position: relative;
  max-width: 100%;
  margin: 1.8rem auto 0;
}

.compact-tree-viewport {
  width: 100%;
  overflow: auto;
  padding: 0.5rem 0.5rem 2rem;
  overscroll-behavior: contain;
}

.compact-binary-tree {
  width: max-content;
  min-width: 100%;
}

.compact-binary-tree ul {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 1.25rem 0 0;
}

.compact-binary-tree > ul {
  padding-top: 0;
}

.compact-tree-branch {
  position: relative;
  min-width: 150px;
  padding: 1.25rem 0.32rem 0;
  list-style: none;
  text-align: center;
}

.compact-tree-branch::before,
.compact-tree-branch::after {
  position: absolute;
  top: 0;
  right: 50%;
  width: 50%;
  height: 1.25rem;
  border-top: 1px solid var(--line-strong);
  content: "";
}

.compact-tree-branch::after {
  right: auto;
  left: 50%;
  border-left: 1px solid var(--line-strong);
}

.compact-tree-branch:only-child::before,
.compact-tree-branch:only-child::after {
  display: none;
}

.compact-tree-branch:first-child::before,
.compact-tree-branch:last-child::after {
  border: 0;
}

.compact-tree-branch:last-child::before {
  border-right: 1px solid var(--line-strong);
  border-radius: 0 8px 0 0;
}

.compact-tree-branch:first-child::after {
  border-radius: 8px 0 0;
}

.compact-tree-branch > ul::before {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 1.25rem;
  content: "";
  background: var(--line-strong);
}

.compact-tree-owner {
  padding-top: 0;
}

.compact-tree-node {
  position: relative;
  display: grid;
  width: 138px;
  min-height: 112px;
  margin: 0 auto;
  padding: 0.7rem 0.55rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.024);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  place-items: center;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.compact-tree-node > span {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid rgba(216, 181, 69, 0.28);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.07);
  font-size: 0.5rem;
  font-weight: 800;
  place-items: center;
}

.compact-tree-node strong,
.compact-tree-node small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-tree-node strong {
  margin-top: 0.38rem;
  font-size: 0.58rem;
}

.compact-tree-node small {
  margin-top: 0.12rem;
  color: var(--muted-2);
  font-size: 0.44rem;
}

.compact-tree-node b {
  margin-top: 0.38rem;
  padding: 0.22rem 0.4rem;
  border-radius: 999px;
  color: #b9cee9;
  background: rgba(112, 168, 255, 0.08);
  font-size: 0.4rem;
  font-weight: 700;
}

.compact-tree-node.owner {
  border-color: rgba(216, 181, 69, 0.3);
  background: rgba(216, 181, 69, 0.045);
}

.compact-tree-node.search-highlight {
  z-index: 2;
  border-color: var(--gold-light);
  box-shadow: 0 0 0 4px rgba(216, 181, 69, 0.12), 0 14px 40px rgba(216, 181, 69, 0.18);
  transform: translateY(-3px);
}

.compact-tree-empty-node {
  display: grid;
  width: 110px;
  min-height: 72px;
  margin: 0 auto;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.008);
  place-items: center;
}

.compact-tree-empty-node span {
  font-size: 1rem;
}

.compact-tree-empty-node small {
  margin-top: -0.8rem;
  font-size: 0.42rem;
  text-transform: uppercase;
}

.binary-inline-tools {
  display: grid;
  grid-template-columns: minmax(260px, 460px) auto;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.binary-inline-search {
  position: relative;
}

.binary-inline-search > label {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.binary-inline-search svg {
  width: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 1.8;
}

.binary-inline-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.7rem;
}

.binary-inline-results {
  position: absolute;
  top: calc(100% + 0.35rem);
  z-index: 20;
  width: 100%;
  max-height: 290px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0c1018;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
}

.binary-inline-results[hidden] {
  display: none;
}

.binary-inline-results button {
  display: block;
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.binary-inline-results button:hover {
  background: rgba(216, 181, 69, 0.07);
}

.binary-inline-results strong,
.binary-inline-results small {
  display: block;
}

.binary-inline-results strong {
  font-size: 0.62rem;
}

.binary-inline-results small,
.binary-inline-results > p {
  margin: 0.2rem 0 0;
  color: var(--muted-2);
  font-size: 0.5rem;
}

.binary-inline-results > p {
  padding: 0.75rem;
}

.binary-fullscreen-button {
  min-height: 44px;
  white-space: nowrap;
}

.tree-root {
  display: grid;
  justify-content: center;
  text-align: center;
}

.tree-root > span,
.tree-member > span {
  display: grid;
  margin: 0 auto;
  border: 1px solid rgba(216, 181, 69, 0.28);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.08);
  font-size: 0.58rem;
  font-weight: 800;
  place-items: center;
}

.tree-root > span {
  width: 3.1rem;
  height: 3.1rem;
}

.tree-root strong,
.tree-root small {
  display: block;
}

.tree-root strong {
  margin-top: 0.45rem;
  font-size: 0.7rem;
}

.tree-root small {
  margin-top: 0.18rem;
  color: var(--muted-2);
  font-size: 0.48rem;
}

.tree-connector {
  position: relative;
  width: 50%;
  height: 2.5rem;
  margin: 0.6rem auto 0;
  border-top: 1px solid var(--line-strong);
  border-right: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  border-radius: 8px 8px 0 0;
}

.tree-connector::before {
  position: absolute;
  bottom: 100%;
  left: calc(50% - 0.5px);
  width: 1px;
  height: 1.35rem;
  content: "";
  background: var(--line-strong);
}

.tree-legs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.2rem;
}

.tree-leg {
  min-height: 250px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: inherit;
  background: rgba(255, 255, 255, 0.014);
}

.tree-leg > p {
  display: flex;
  align-items: center;
  gap: 0.42rem;
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.57rem;
  font-weight: 700;
  text-transform: uppercase;
}

.tree-leg > p span {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 0.48rem;
  font-weight: 600;
  text-transform: none;
}

.tree-leg > p i {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
}

.tree-leg.left > p i { background: var(--gold); }
.tree-leg.right > p i { background: var(--blue); }

.tree-member,
.tree-empty {
  display: grid;
  padding: 0.75rem;
  text-align: center;
}

.tree-member > span {
  width: 2.6rem;
  height: 2.6rem;
}

.tree-member strong,
.tree-member small,
.tree-empty strong,
.tree-empty small {
  display: block;
}

.tree-member strong,
.tree-empty strong {
  margin-top: 0.45rem;
  font-size: 0.63rem;
}

.tree-member small,
.tree-empty small {
  margin-top: 0.22rem;
  color: var(--muted-2);
  font-size: 0.49rem;
}

.tree-empty > span {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  margin: 0 auto;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: var(--muted-2);
  place-items: center;
}

.tree-preview-list {
  display: grid;
  gap: 0.42rem;
  min-height: 150px;
}

.tree-preview-member {
  display: grid;
  min-height: 48px;
  margin-left: var(--preview-indent);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.018);
}

.tree-preview-member > span:first-child {
  display: grid;
  width: 1.9rem;
  height: 1.9rem;
  border: 1px solid rgba(216, 181, 69, 0.25);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.06);
  font-size: 0.46rem;
  font-weight: 800;
  place-items: center;
}

.tree-preview-member strong,
.tree-preview-member small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-preview-member strong {
  font-size: 0.56rem;
}

.tree-preview-member small {
  margin-top: 0.12rem;
  color: var(--muted-2);
  font-size: 0.46rem;
}

.tree-preview-member > b {
  padding: 0.25rem 0.4rem;
  border-radius: 999px;
  color: #b9cee9;
  background: rgba(112, 168, 255, 0.08);
  font-size: 0.43rem;
  font-weight: 700;
}

.tree-leg-action {
  display: flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  margin-top: 0.85rem;
  border: 1px solid rgba(216, 181, 69, 0.18);
  border-radius: 9px;
  cursor: pointer;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.04);
  font-size: 0.54rem;
  font-weight: 650;
  transition: border-color 160ms ease, background 160ms ease;
}

.tree-leg-action:hover {
  border-color: rgba(216, 181, 69, 0.38);
  background: rgba(216, 181, 69, 0.09);
}

.tree-leg-action svg {
  width: 0.8rem;
  height: 0.8rem;
}

.binary-explorer-open {
  overflow: hidden;
}

.binary-explorer {
  position: fixed;
  z-index: 1200;
  inset: 0;
  padding: clamp(0.6rem, 2vw, 1.4rem);
  background: rgba(2, 4, 8, 0.9);
  backdrop-filter: blur(12px);
}

.binary-explorer[hidden] {
  display: none;
}

.binary-explorer-shell {
  display: grid;
  width: min(100%, 1180px);
  height: 100%;
  margin: auto;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(216, 181, 69, 0.2);
  border-radius: 20px;
  background:
    radial-gradient(circle at 8% 0, rgba(216, 181, 69, 0.08), transparent 28rem),
    #080b11;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
}

.binary-explorer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1rem;
  border-bottom: 1px solid var(--line);
}

.binary-explorer-header h2 {
  margin: 0.15rem 0 0;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  font-weight: 550;
  letter-spacing: -0.04em;
}

.binary-explorer-header h2 span {
  color: var(--gold-light);
}

.binary-explorer-header small {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted-2);
  font-size: 0.62rem;
}

.binary-explorer-close {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.025);
  font-size: 1.55rem;
  place-items: center;
}

.binary-explorer-tools {
  display: grid;
  grid-template-columns: 220px minmax(240px, 420px);
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.binary-side-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.2);
}

.binary-side-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  font-size: 0.64rem;
  font-weight: 750;
}

.binary-side-switch button.active {
  color: #14120a;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
}

.binary-search {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
}

.binary-search svg {
  width: 1rem;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--muted-2);
  stroke-width: 1.8;
}

.binary-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 0.72rem;
}

.binary-tree-viewport {
  overflow: auto;
  overscroll-behavior: contain;
}

.binary-tree-list {
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 1.35rem 1.5rem 3rem;
}

.binary-tree-node {
  position: relative;
  display: grid;
  width: min(560px, calc(100vw - 5rem));
  min-height: 74px;
  margin: 0 0 0.65rem var(--tree-indent);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.024);
}

.binary-node-connector {
  position: absolute;
  top: -0.7rem;
  left: -1.2rem;
  width: 1.2rem;
  height: calc(50% + 0.7rem);
  border-bottom: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.binary-node-avatar {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  border: 1px solid rgba(216, 181, 69, 0.28);
  border-radius: 50%;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.07);
  font-size: 0.58rem;
  font-weight: 800;
  place-items: center;
}

.binary-node-copy strong,
.binary-node-copy small,
.binary-node-copy span {
  display: block;
}

.binary-node-copy strong {
  font-size: 0.72rem;
}

.binary-node-copy small {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.56rem;
}

.binary-node-copy span {
  margin-top: 0.3rem;
  color: var(--muted-2);
  font-size: 0.5rem;
}

.binary-tree-node > b {
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  color: #b9cee9;
  background: rgba(112, 168, 255, 0.08);
  font-size: 0.5rem;
  font-weight: 700;
  white-space: nowrap;
}

.binary-tree-empty {
  display: grid;
  min-height: 240px;
  color: var(--muted-2);
  font-size: 0.7rem;
  place-items: center;
}

.directory-panel {
  overflow: hidden;
}

.table-wrap {
  margin: 1rem -1.35rem -1.35rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 0.8rem 1.35rem;
  border-top: 1px solid rgba(255, 255, 255, 0.055);
  white-space: nowrap;
}

th {
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.018);
  font-size: 0.5rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: #adb5c2;
  font-size: 0.59rem;
}

.table-member {
  display: flex;
  align-items: center;
  gap: 0.62rem;
}

.table-member > i {
  width: 2rem;
  height: 2rem;
}

.table-member strong,
.table-member small {
  display: block;
}

.table-member strong {
  color: var(--text);
  font-size: 0.61rem;
}

.table-member small {
  margin-top: 0.17rem;
  color: var(--muted-2);
  font-size: 0.49rem;
}

.level-chip {
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  color: #bfd5ff;
  background: rgba(112, 168, 255, 0.08);
  font-size: 0.5rem;
  font-weight: 700;
}

/* Invite */

.invite-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.55fr);
  gap: 0.85rem;
}

.invite-builder .referral-builder {
  margin-top: 1.7rem;
}

.invite-builder .position-switch {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, 1fr);
}

.invite-builder .position-switch button {
  min-height: 38px;
}

.invite-builder .referral-link-row {
  margin-top: 1rem;
}

.invite-builder .referral-link-row input {
  min-height: 50px;
}

.invite-guidance {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.7rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.invite-guidance > div {
  display: grid;
  grid-template-columns: 1.85rem 1fr;
  align-items: center;
  gap: 0.7rem;
}

.invite-guidance > div > span {
  display: grid;
  width: 1.85rem;
  height: 1.85rem;
  border: 1px solid rgba(216, 181, 69, 0.2);
  border-radius: 8px;
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.06);
  font-size: 0.55rem;
  font-weight: 800;
  place-items: center;
}

.invite-guidance p {
  margin: 0;
}

.invite-guidance strong,
.invite-guidance small {
  display: block;
}

.invite-guidance strong {
  font-size: 0.62rem;
}

.invite-guidance small {
  margin-top: 0.2rem;
  color: var(--muted-2);
  font-size: 0.5rem;
}

.qr-panel {
  text-align: center;
}

.qr-panel .eyebrow {
  text-align: left;
}

.qr-panel h2 {
  text-align: left;
}

.qr-frame {
  display: grid;
  width: min(100%, 250px);
  aspect-ratio: 1;
  margin: 1.2rem auto;
  padding: 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.25);
  place-items: center;
}

.qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-panel > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.55;
}

.wide-button {
  width: 100%;
}

.message-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) 1fr auto;
  align-items: center;
  gap: 1.4rem;
  margin-top: 0.85rem;
}

.message-panel blockquote {
  margin: 0;
  color: #b2bac7;
  font-size: 0.67rem;
  line-height: 1.7;
}

.icon-button.labeled {
  white-space: nowrap;
}

/* Rewards */

.rewards-grid {
  grid-template-columns: minmax(0, 1.4fr) minmax(310px, 0.6fr);
}

.bonus-list {
  margin-top: 0.6rem;
}

.bonus-list > div {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto;
  align-items: center;
  gap: 0.7rem;
  padding: 0.72rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
}

.bonus-list > div:last-child {
  border-bottom: 0;
}

.bonus-icon {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 9px;
  font-size: 0.8rem;
  font-weight: 800;
  place-items: center;
}

.bonus-icon.credit {
  color: var(--green);
  background: rgba(97, 215, 161, 0.08);
}

.bonus-icon.debit {
  color: #ff9a9a;
  background: rgba(255, 122, 122, 0.08);
}

.bonus-list strong,
.bonus-list small {
  display: block;
}

.bonus-list strong {
  font-size: 0.61rem;
}

.bonus-list small {
  margin-top: 0.2rem;
  color: var(--muted-2);
  font-size: 0.5rem;
}

.bonus-list em {
  font-size: 0.57rem;
  font-style: normal;
  font-weight: 750;
}

.bonus-list em.credit { color: var(--green); }
.bonus-list em.debit { color: #ff9a9a; }

.data-note {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 11px;
  color: var(--muted-2);
  font-size: 0.54rem;
  line-height: 1.5;
}

.data-note strong {
  flex: none;
  color: var(--gold-light);
}

/* Profile */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
  gap: 0.85rem;
}

.profile-card {
  text-align: center;
}

.profile-avatar {
  display: grid;
  width: 5.5rem;
  height: 5.5rem;
  margin: 0 auto 1rem;
  border: 1px solid rgba(216, 181, 69, 0.3);
  border-radius: 50%;
  color: var(--gold-light);
  background:
    radial-gradient(circle at 35% 30%, rgba(216, 181, 69, 0.2), transparent 60%),
    rgba(216, 181, 69, 0.07);
  font-size: 1.2rem;
  font-weight: 800;
  place-items: center;
}

.profile-card h2 {
  font-size: 1.35rem;
}

.profile-card > p {
  margin: 0.38rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.62rem;
  border-radius: 999px;
  color: var(--green);
  background: rgba(97, 215, 161, 0.08);
  font-size: 0.53rem;
  font-weight: 750;
}

.status-chip.pending {
  color: var(--gold-light);
  background: rgba(216, 181, 69, 0.08);
}

.status-chip.pending i {
  background: var(--gold);
}

.profile-card dl {
  margin: 1.3rem 0 0;
  text-align: left;
}

.profile-card dl > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.profile-card dt,
.profile-card dd {
  margin: 0;
  font-size: 0.57rem;
}

.profile-card dt {
  color: var(--muted-2);
}

.profile-card dd {
  overflow: hidden;
  color: #c5cad3;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-stack {
  display: grid;
  gap: 0.85rem;
}

.account-panel > p {
  max-width: 700px;
  margin: 1rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.7;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.empty-state {
  display: grid;
  min-height: 220px;
  padding: 2rem;
  text-align: center;
  place-items: center;
  align-content: center;
}

.empty-state > span {
  display: grid;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.75rem;
  border-radius: 12px;
  color: var(--gold);
  background: rgba(216, 181, 69, 0.07);
  place-items: center;
}

.empty-state strong {
  font-size: 0.72rem;
}

.empty-state p {
  margin: 0.35rem 0 0.85rem;
  color: var(--muted-2);
  font-size: 0.56rem;
}

.empty-state a {
  display: inline-flex;
  align-items: center;
  color: var(--gold-light);
  font-size: 0.56rem;
  font-weight: 750;
}

.empty-state a svg {
  width: 0.8rem;
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 200;
  padding: 0.72rem 0.9rem;
  border: 1px solid rgba(216, 181, 69, 0.24);
  border-radius: 10px;
  opacity: 0;
  color: #17140a;
  background: var(--gold-light);
  box-shadow: var(--shadow);
  font-size: 0.61rem;
  font-weight: 800;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  :root { --sidebar: 238px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid,
  .lower-grid { grid-template-columns: 1fr; }
  .rank-panel { min-height: 270px; }
  .message-panel { grid-template-columns: 1fr auto; }
  .message-panel > div { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { padding: 2rem 1.2rem; }
  .mobile-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 4rem;
  }

  .sidebar {
    width: min(86vw, 310px);
    transform: translateX(-105%);
    transition: transform 220ms ease;
  }

  .menu-open .sidebar { transform: translateX(0); }
  .sidebar-close {
    display: block;
    padding: 0.2rem;
    border: 0;
    color: var(--muted);
    background: transparent;
    font-size: 1.5rem;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: block;
    border: 0;
    visibility: hidden;
    opacity: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(3px);
    transition: opacity 200ms ease, visibility 200ms ease;
  }

  .menu-open .sidebar-backdrop {
    visibility: visible;
    opacity: 1;
  }

  .app-main { margin-left: 0; }

  .topbar {
    height: 64px;
    padding: 0 1rem;
  }

  .menu-button {
    display: grid;
    width: 2.2rem;
    height: 2.2rem;
    padding: 0.58rem;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.025);
    align-content: center;
    gap: 0.3rem;
  }

  .menu-button span {
    display: block;
    height: 1px;
    background: #d6dae2;
  }

  .topbar > div:first-of-type {
    position: absolute;
    left: 50%;
    text-align: center;
    transform: translateX(-50%);
  }

  .topbar-invite span { display: none; }
  .topbar-invite { width: 2.35rem; padding: 0; justify-content: center; }
  .page-content { padding: 1.55rem 1rem 6rem; }
  .heading-split { align-items: flex-start; }
  .invite-layout,
  .profile-layout { grid-template-columns: 1fr; }
  .qr-panel { order: -1; }
  .qr-frame { max-width: 220px; }

  .mobile-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 40;
    display: grid;
    height: calc(64px + env(safe-area-inset-bottom));
    grid-template-columns: repeat(5, 1fr);
    padding: 0.3rem 0.4rem env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(7, 10, 15, 0.94);
    backdrop-filter: blur(18px);
  }

  .mobile-nav a {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.25rem;
    color: var(--muted-2);
  }

  .mobile-nav a span {
    display: grid;
    width: 1.7rem;
    height: 1.7rem;
    place-items: center;
  }

  .mobile-nav a svg { width: 1.05rem; }
  .mobile-nav a small { font-size: 0.47rem; font-weight: 650; }
  .mobile-nav a.active { color: var(--gold-light); }

  .mobile-nav a.featured span {
    width: 2.35rem;
    height: 2.35rem;
    margin-top: -1.2rem;
    border: 4px solid var(--bg);
    border-radius: 50%;
    color: #17130a;
    background: var(--gold);
  }

  .mobile-nav a.featured small { margin-top: -0.25rem; }
  .toast { right: 1rem; bottom: 5.2rem; left: 1rem; text-align: center; }
}

@media (max-width: 620px) {
  html { font-size: 14px; }
  .login-card h2 { font-size: 2.4rem; }
  .mobile-brand { margin-bottom: 3.2rem; }
  .join-details { grid-template-columns: 1fr; }
  .join-details > div { border-right: 0; }
  .join-details > div + div { border-top: 1px solid var(--line); }
  .page-heading h1 { font-size: 2.15rem; }
  .heading-split { display: block; }
  .heading-actions,
  .heading-split > .primary-button,
  .heading-split > .secondary-button { margin-top: 1rem; }
  .heading-actions { display: grid; grid-template-columns: 1fr 1fr; }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .metric-card {
    min-height: 140px;
    padding: 1rem;
  }

  .metric-card strong { font-size: 1.15rem; }
  .metric-card span { line-height: 1.35; }
  .overview-grid,
  .lower-grid { gap: 0.65rem; margin-top: 0.65rem; }

  .invite-panel,
  .balance-panel,
  .activity-panel,
  .rank-panel,
  .tree-panel,
  .directory-panel,
  .invite-builder,
  .qr-panel,
  .message-panel,
  .profile-card,
  .account-panel { padding: 1rem; }

  .position-switch {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }

  .position-switch button { padding: 0 0.3rem; }
  .referral-link-row { grid-template-columns: minmax(0, 1fr) 45px; }
  .referral-link-row .icon-button span { display: none; }
  .invite-footer { align-items: flex-start; flex-direction: column; }

  .balance-visual { justify-content: center; }
  .team-summary-strip { grid-template-columns: 1fr 1fr; }
  .team-summary-strip > div:nth-child(2) { border-right: 0; }
  .team-summary-strip > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .tree-connector { width: 70%; }
  .tree-legs { gap: 0.65rem; }
  .tree-leg { padding: 0.7rem; }
  .compact-tree-viewport {
    margin-right: -0.4rem;
    margin-left: -0.4rem;
    padding-right: 0;
    padding-left: 0;
  }
  .compact-tree-branch {
    min-width: 128px;
    padding-right: 0.2rem;
    padding-left: 0.2rem;
  }
  .compact-tree-node {
    width: 118px;
    min-height: 104px;
  }
  .binary-inline-tools { grid-template-columns: 1fr; }
  .binary-fullscreen-button { width: 100%; }
  .binary-explorer { padding: 0; }
  .binary-explorer-shell { border: 0; border-radius: 0; }
  .binary-explorer-header { padding: 1rem; }
  .binary-explorer-tools {
    grid-template-columns: 1fr;
    padding: 0.75rem 1rem;
  }
  .binary-tree-list { padding: 1rem 1rem 3rem; }
  .binary-tree-node {
    width: calc(100vw - 2rem - min(var(--tree-indent), 7.2rem));
    margin-left: min(var(--tree-indent), 7.2rem);
  }
  .message-panel { grid-template-columns: 1fr; }
  .icon-button.labeled { width: 100%; }
  .account-actions { align-items: flex-start; flex-direction: column; }
  .data-note { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
