:root {
  --bg: #f3f6fb;
  --panel: #ffffff;
  --ink: #152033;
  --muted: #68758a;
  --line: #e5ebf3;
  --navy: #061b31;
  --blue: #1b65d8;
  --gold: #d9a640;
  --green: #15935c;
  --red: #d94a4a;
  --shadow: 0 16px 38px rgba(14, 29, 52, 0.1);
}

* {
  box-sizing: border-box;
}

body.dash-body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}

.dash-brand {
  font-weight: 800;
  text-transform: uppercase;
}

.dash-brand span {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 32px;
  line-height: 1;
}

.dash-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.dash-nav a {
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.dash-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 22px;
}

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

.page-head {
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.05;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

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

.card {
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat {
  display: grid;
  gap: 7px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  font-size: 28px;
}

.btn,
button.btn {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.btn.secondary {
  color: var(--ink);
  background: #eef3fa;
}

.btn.success {
  background: var(--green);
}

.btn.danger {
  background: var(--red);
}

.btn.gold {
  background: var(--gold);
}

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

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

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: inherit;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef3fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.active,
.badge.approved {
  background: #e6f8ef;
  color: var(--green);
}

.badge.pending {
  background: #fff7df;
  color: #9b6b13;
}

.badge.banned,
.badge.rejected {
  background: #ffe9e9;
  color: var(--red);
}

.flash {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #eef3fa;
  font-weight: 700;
}

.flash.success {
  background: #e6f8ef;
  color: #09683e;
}

.flash.error {
  background: #ffe9e9;
  color: #a92828;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.password-form,
.deposit-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.deposit-form {
  grid-template-columns: minmax(105px, 0.8fr) minmax(135px, 1fr) auto;
}

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

.level-card {
  display: grid;
  gap: 10px;
  border-left: 4px solid var(--gold);
}

.tree-level {
  margin-bottom: 18px;
}

.tree-users {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.tree-user {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.thumb {
  width: 86px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.payment-qr {
  width: min(260px, 100%);
  border-radius: 8px;
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
}

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

@media (max-width: 900px) {
  .dash-menu-btn {
    display: block;
  }

  .dash-nav {
    display: none;
    position: absolute;
    top: 76px;
    left: 16px;
    right: 16px;
    padding: 18px;
    flex-direction: column;
    align-items: flex-start;
    background: var(--navy);
    border-radius: 8px;
  }

  .dash-nav.open {
    display: flex;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .page-head,
  .referral-box {
    grid-template-columns: 1fr;
    display: grid;
  }
}

@media (max-width: 560px) {
  .dash-shell {
    width: min(100% - 20px, 1180px);
    margin-top: 16px;
  }

  .card {
    padding: 16px;
  }

  .dash-topbar {
    padding: 0 14px;
  }
}
