:root {
  --bg: #050507;
  --panel: #0b0d12;
  --panel-2: #11141b;
  --line: #242833;
  --soft-line: #1a1d26;
  --text: #f5f7fb;
  --muted: #9ba3b2;
  --red: #f01824;
  --red-2: #9d0f19;
  --gold: #ffb74a;
  --green: #38d46f;
  --blue: #3a8bff;
  --cyan: #1ed4dd;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 0%, rgba(240, 24, 36, 0.22), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(240, 24, 36, 0.13), transparent 36%),
    linear-gradient(135deg, #030304 0%, #08090d 44%, #11090b 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  background: #090b10;
  color: var(--text);
}

button {
  cursor: pointer;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-panel {
  width: min(720px, 100%);
  background: linear-gradient(145deg, rgba(13, 15, 20, 0.94), rgba(8, 9, 12, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 36px;
}

.brand-lockup {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 26px;
  align-items: center;
}

.brand-lockup img,
.sidebar-brand img {
  width: 100%;
  background: white;
  border-radius: 12px;
  padding: 10px;
}

.brand-lockup p,
.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.04;
}

.login-form {
  margin-top: 30px;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.login-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 12px;
}

.login-row input,
.search-input,
select {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 14px;
  outline: none;
}

.login-row input:focus,
.search-input:focus,
select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(240, 24, 36, 0.15);
}

.login-row button,
.top-actions button,
.sponsor-actions button,
.report-options button,
.mini-btn {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(240, 24, 36, 0.45);
  background: linear-gradient(180deg, var(--red), #b90e19);
  color: white;
  padding: 0 15px;
  font-weight: 800;
  box-shadow: 0 12px 34px rgba(240, 24, 36, 0.24);
}

.login-error {
  min-height: 22px;
  color: #ff7b83;
}

.developer-line {
  margin: 20px 0 0;
  color: var(--muted);
}

.locked {
  display: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: rgba(5, 5, 7, 0.88);
  backdrop-filter: blur(20px);
}

.sidebar-brand {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  align-items: center;
}

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

.sidebar-brand span,
.side-card span,
.side-card small,
.panel p {
  color: var(--muted);
  font-size: 12px;
}

.nav-stack {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-btn {
  min-height: 44px;
  border-radius: 10px;
  text-align: left;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.nav-item.active,
.nav-item:hover,
.ghost-btn:hover {
  color: white;
  background: linear-gradient(90deg, rgba(240, 24, 36, 0.32), rgba(240, 24, 36, 0.05));
  border-color: rgba(240, 24, 36, 0.45);
}

.side-card {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.side-card strong {
  color: var(--green);
}

.workspace {
  padding: 18px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(11, 13, 18, 0.86);
  box-shadow: var(--shadow);
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-actions select {
  width: 210px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.kpi {
  position: relative;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(17, 20, 27, 0.98), rgba(9, 10, 14, 0.98));
}

.kpi::after {
  content: "";
  position: absolute;
  inset: auto -40px -58px auto;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(240, 24, 36, 0.18);
}

.kpi span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 27px;
  line-height: 1;
}

.kpi small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
}

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(13, 15, 20, 0.98), rgba(8, 9, 12, 0.98));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.26);
  padding: 16px;
}

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

.dashboard-grid > .wide:first-child,
.dashboard-grid > .sponsor-hero,
.dashboard-grid > .panel.wide:only-child {
  grid-column: 1 / -1;
}

.panel-head,
.filter-row,
.sponsor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.panel p {
  margin: 0;
}

.leaderboard {
  display: grid;
  gap: 8px;
}

.leader-row {
  display: grid;
  grid-template-columns: 42px 1.2fr 0.9fr 0.7fr 0.7fr;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.leader-row .rank {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(240, 24, 36, 0.18);
  color: white;
  font-weight: 900;
}

.meter {
  height: 8px;
  border-radius: 99px;
  background: #171a22;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold));
}

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

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 140px 1fr 96px;
  gap: 12px;
  align-items: center;
}

.bar-track {
  height: 18px;
  border-radius: 999px;
  background: #171a22;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), #ff6969);
}

.sponsor-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(110deg, rgba(240, 24, 36, 0.24), rgba(17, 20, 27, 0.98) 58%);
}

.sponsor-hero h3 {
  font-size: 32px;
}

.mini-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.mini-kpis div {
  min-height: 84px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.mini-kpis span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-kpis strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

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

.table-wrap.tall {
  max-height: 680px;
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--soft-line);
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #151924;
  color: #fff;
}

td {
  color: #dce3ee;
}

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

.matrix-card {
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.matrix-card strong {
  display: flex;
  justify-content: space-between;
}

.matrix-card small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
}

.report-options {
  display: grid;
  gap: 14px;
}

.report-options label {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.methodology {
  display: grid;
  gap: 12px;
  color: #dce3ee;
}

.methodology div {
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.hidden {
  display: none;
}

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

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

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

@media (max-width: 760px) {
  .brand-lockup,
  .login-row,
  .topbar,
  .sponsor-hero,
  .panel-head,
  .filter-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .brand-lockup img {
    max-width: 180px;
  }

  .dashboard-grid,
  .kpi-grid,
  .mini-kpis {
    grid-template-columns: 1fr;
  }

  .leader-row,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 10px;
  }
}
