:root {
  color-scheme: dark;
  --bg: #07080b;
  --panel: #0f1117;
  --panel-2: #151923;
  --line: rgba(148, 163, 184, 0.2);
  --text: #f6f7fb;
  --muted: #9ca3af;
  --green: #22c55e;
  --cyan: #60a5fa;
  --warn: #facc15;
  --danger: #fb7185;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 220px),
    radial-gradient(circle at 50% 0%, rgba(96, 165, 250, 0.16), transparent 34rem),
    radial-gradient(circle at 92% 14%, rgba(34, 197, 94, 0.1), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 11, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.brand span { display: grid; line-height: 1.08; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; }

.topnav {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.topnav a,
.topnav button,
.ghost-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
  cursor: pointer;
}

.topnav a {
  color: var(--muted);
  font-size: 14px;
}

.topnav button {
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}

.topnav a:hover,
.topnav button:hover,
.topnav button[data-active="true"] {
  color: var(--text);
  background: rgba(148, 163, 184, 0.08);
}

.top-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { color: var(--green); font-weight: 800; font-size: 13px; }

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}

.primary-button {
  background: linear-gradient(135deg, var(--green), #5eead4);
  color: #03110b;
  border: 0;
}

.secondary-button {
  background: rgba(148, 163, 184, 0.08);
  color: var(--text);
  border-color: var(--line);
}

.full { width: 100%; }

.landing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 30px;
  align-items: center;
  min-height: calc(100vh - 76px);
  padding: 54px 0 40px;
}

.landing-copy h1 {
  max-width: 760px;
  margin: 14px 0 18px;
  font-size: clamp(46px, 8vw, 86px);
  line-height: 0.95;
  letter-spacing: 0;
}

.landing-copy p {
  max-width: 650px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.landing-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 30px;
}

.landing-strip span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  background: rgba(148, 163, 184, 0.06);
  color: color-mix(in oklab, var(--text) 82%, var(--muted));
  font-size: 13px;
  font-weight: 800;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.auth-card,
.panel,
.referral-card,
.profile-card,
.qrcode-card,
.records-card,
.stat-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in oklab, var(--panel) 92%, transparent);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

.auth-card { padding: 20px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.05);
}

.auth-tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.auth-tab[data-active="true"] {
  background: rgba(51, 209, 122, 0.16);
  color: var(--text);
}

form { display: grid; gap: 14px; }

label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 800; }

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1017;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: color-mix(in oklab, var(--green) 72%, var(--line));
  box-shadow: 0 0 0 3px rgba(51, 209, 122, 0.12);
}

.auth-intro {
  margin-bottom: 18px;
}

.auth-intro h2 {
  margin: 6px 0 8px;
  font-size: 20px;
}

.auth-intro p,
.access-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.turnstile-box {
  min-height: 65px;
  display: grid;
  align-items: center;
  overflow: hidden;
}

.auth-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--warn);
  font-size: 13px;
}

.twofa-panel {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.panel {
  margin: 22px 0 34px;
  padding: 24px;
}

.app-shell {
  padding-top: 8px;
}

.panel-head,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.panel h2,
.section-title h3,
.referral-card h3 {
  margin: 4px 0 0;
  letter-spacing: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card { padding: 16px; }
.stat-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; }
.stat-card strong { display: block; margin-top: 8px; font-size: 27px; line-height: 1; }

.referral-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.11), rgba(96, 165, 250, 0.08));
}

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.referral-card p { margin: 0; color: var(--muted); }

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: 14px;
  margin-bottom: 14px;
}

.profile-card,
.qrcode-card,
.records-card {
  padding: 18px;
}

.upload-box input {
  padding: 10px;
  min-height: 48px;
}

.upload-box em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.qrcode-preview {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.06);
  overflow: hidden;
}

.qrcode-preview img {
  max-width: 100%;
  max-height: 360px;
  display: block;
}

.qrcode-preview span { color: var(--muted); font-weight: 800; }

.profile-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
}

.profile-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.profile-list dt { color: var(--muted); font-weight: 800; }
.profile-list dd { margin: 0; font-weight: 800; }

.table-wrap {
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #111722;
  color: var(--muted);
  font-size: 12px;
  z-index: 1;
}

td {
  color: color-mix(in oklab, var(--text) 86%, var(--muted));
  font-size: 14px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.admin-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.04);
}

.agent-list,
.admin-detail {
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.04);
}

.agent-list {
  max-height: 620px;
  overflow: auto;
  padding: 8px;
}

.agent-button {
  width: 100%;
  display: grid;
  gap: 4px;
  margin-bottom: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.agent-button:hover,
.agent-button[data-active="true"] {
  border-color: rgba(51, 209, 122, 0.35);
  background: rgba(51, 209, 122, 0.1);
}

.agent-button strong { font-size: 15px; }
.agent-button span { color: var(--muted); font-size: 12px; }

.admin-detail {
  padding: 18px;
  max-height: 620px;
  overflow: auto;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 460px;
  color: var(--muted);
  font-weight: 800;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.04);
}

.admin-form label:last-of-type {
  grid-column: span 2;
}

.admin-form button { align-self: end; }

.payout-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  max-width: 360px;
  border: 1px solid rgba(51, 209, 122, 0.35);
  border-radius: 8px;
  background: #0c1511;
  color: var(--text);
  padding: 12px 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  font-weight: 800;
}

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 12px 0; }
  .topnav { order: 3; width: 100%; overflow-x: auto; margin-left: 0; }
  .landing,
  .split-grid,
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-form,
  .payout-form,
  .admin-search { grid-template-columns: 1fr; }
  .admin-form label:last-of-type { grid-column: auto; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1180px); }
  .landing { padding-top: 34px; }
  .landing-copy h1 { font-size: 42px; }
  .copy-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
  .panel { padding: 14px; }
}
