:root {
  --navy-950: #04122d;
  --navy-900: #061942;
  --navy-800: #09275c;
  --navy-100: #e8eef8;
  --ink: #0a1737;
  --muted: #60708f;
  --line: #dfe6f1;
  --surface: #ffffff;
  --surface-soft: #f6f8fc;
  --gold: #e7a51e;
  --gold-soft: #fff1c8;
  --green: #13995d;
  --red: #d83b3b;
  --blue: #1057d8;
  --shadow: 0 20px 70px rgba(6, 25, 66, 0.10);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

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

button,
input {
  font: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(4, 18, 45, 0.92), rgba(9, 39, 92, 0.88)),
    repeating-linear-gradient(45deg, rgba(231, 165, 30, 0.12) 0 1px, transparent 1px 18px);
}

.login-card {
  width: min(1040px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
  padding: 60px;
  color: white;
  background:
    linear-gradient(160deg, rgba(4, 18, 45, 0.96), rgba(9, 39, 92, 0.90)),
    linear-gradient(90deg, rgba(231, 165, 30, 0.18), transparent);
}

.login-crest {
  width: 100px;
}

.login-brand h1,
.topbar h1,
.panel h2 {
  margin: 0;
}

.login-brand h1 {
  max-width: 420px;
  font-family: Georgia, serif;
  font-size: 44px;
  line-height: 1.05;
}

.login-brand p {
  max-width: 430px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 64px 72px;
}

.form-title {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 800;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.login-form input {
  height: 52px;
  border: 1px solid #cbd5e4;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: white;
}

.login-form button,
.public-link,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.login-form button {
  margin-top: 8px;
  color: var(--navy-950);
  background: linear-gradient(135deg, #f6c04a, #df9c14);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  color: white;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-800));
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 6px 28px;
}

.brand img {
  width: 56px;
}

.brand strong {
  display: block;
  font-size: 18px;
}

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

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a,
.ghost-button {
  display: block;
  padding: 14px 16px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.84);
}

.sidebar nav a.active,
.sidebar nav a:hover {
  color: var(--navy-950);
  background: var(--gold);
}

.ghost-button {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  text-align: left;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-size: 30px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill,
.public-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--navy-900);
  font-size: 13px;
  font-weight: 800;
}

.status-pill.live {
  color: var(--green);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(6, 25, 66, 0.05);
}

.metric-card {
  min-height: 150px;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 20px;
}

.metric-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--blue);
  background: #e8efff;
  font-weight: 900;
}

.metric-icon.green {
  color: var(--green);
  background: #e5f7ee;
}

.metric-icon.gold {
  color: #a46500;
  background: var(--gold-soft);
}

.metric-icon.purple {
  color: #5f3fd1;
  background: #efeafd;
}

.metric-card p,
.metric-card small {
  margin: 0;
}

.metric-card p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  font-size: 28px;
}

.metric-card small,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.85fr);
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel.wide {
  grid-column: span 1;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 18px;
}

.leaderboard-table,
.compact-table,
.feed-list {
  display: grid;
  gap: 8px;
}

.leader-row {
  display: grid;
  grid-template-columns: 42px 1.2fr minmax(120px, 1fr) 90px 80px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.rank {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--navy-900);
  font-weight: 900;
}

.rank.top {
  background: var(--gold);
  color: var(--navy-950);
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--navy-800);
  font-size: 13px;
  font-weight: 900;
}

.person strong {
  display: block;
  overflow-wrap: anywhere;
}

.person small {
  color: var(--muted);
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e8edf5;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--navy-900);
}

.row-line {
  display: grid;
  grid-template-columns: 86px 1fr 90px 110px;
  gap: 12px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.transactions .row-line {
  grid-template-columns: 100px 1fr 90px 110px 110px;
}

.status {
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  text-transform: capitalize;
}

.status.paid {
  color: var(--green);
  background: #dff7e9;
}

.status.pending_payment {
  color: #9a6500;
  background: #fff0c7;
}

.status.payment_failed {
  color: var(--red);
  background: #ffe2e2;
}

.status-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.feed-item {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.feed-item strong {
  color: var(--navy-900);
}

canvas {
  width: 100%;
  max-width: 100%;
  min-height: 220px;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .ghost-button {
    margin-top: 16px;
  }

  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .login-shell,
  .workspace {
    padding: 16px;
  }

  .login-card {
    grid-template-columns: 1fr;
  }

  .login-brand,
  .login-form {
    padding: 32px;
  }

  .login-brand h1 {
    font-size: 34px;
  }

  .topbar,
  .topbar-actions,
  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .sidebar nav {
    grid-template-columns: 1fr 1fr;
  }

  .leader-row,
  .row-line,
  .transactions .row-line {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
