body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 50% 18%, rgba(30, 183, 255, 0.12), transparent 0 18%),
    radial-gradient(circle at 50% 82%, rgba(39, 217, 143, 0.08), transparent 0 16%),
    linear-gradient(180deg, #07101f 0%, #0b1530 52%, #0f1a38 100%);
  color: #eef4ff;
  min-height: 100vh;
}

.hidden { display: none !important; }

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.auth-visual {
  display: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
}

.glow-a {
  width: 320px;
  height: 320px;
  background: rgba(0, 197, 255, 0.16);
  top: -120px;
  left: -120px;
}

.glow-b {
  width: 320px;
  height: 320px;
  background: rgba(67, 255, 154, 0.12);
  bottom: -120px;
  right: -120px;
}

.brand-lockup {
  position: relative;
  z-index: 1;
  display: none;
}

.brand-badge,
.brand-chip {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #14b8ff, #5fffa8);
  color: #071325;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 20px 40px rgba(0,0,0,0.28);
}

.eyebrow,
.form-eyebrow {
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.18em;
  color: #8bb8ff;
}

.auth-card {
  margin: 0;
  width: min(460px, calc(100vw - 32px));
  position: relative;
  z-index: 1;
  text-align: center;
  display: grid;
  gap: 12px;
  justify-items: stretch;
}

.form-eyebrow {
  justify-self: center;
}

.auth-card h2,
.auth-card p,
.auth-card .error {
  margin: 0;
}

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

.sidebar {
  padding: 24px 18px;
  background: rgba(8, 15, 32, 0.92);
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.sidebar-top span {
  display: block;
  color: #9eb2d9;
  margin-top: 4px;
}

.main {
  padding: 26px;
  max-width: 1480px;
  width: 100%;
  box-sizing: border-box;
}

.card {
  background: rgba(16, 26, 52, 0.9);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 24px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
}

.section-head,
.card-title-row,
.traffic-card-top,
.traffic-footer,
.date-row,
.filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.muted {
  color: #96a8ca;
}

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

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 18px 0;
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 32px;
}

.metric-icon {
  font-size: 24px;
}

.metric-label {
  margin-top: 10px;
  color: #adc1e8;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.nav-btn,
button {
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  background: #172749;
  color: #fff;
  cursor: pointer;
  transition: 0.18s ease;
}

.nav-btn:hover,
button:hover {
  transform: translateY(-1px);
}

.nav-btn.active,
.primary-btn {
  background: linear-gradient(135deg, #18bcff, #27d98f);
  color: #071325;
  font-weight: 700;
}

.nav-btn.danger {
  margin-top: auto;
  background: linear-gradient(135deg, #ff6d7a, #ff9e55);
  color: #fff;
}

input,
textarea,
select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  background: #0d1733;
  color: #fff;
  padding: 13px 14px;
}

.auth-card input {
  text-align: center;
}

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

.stack {
  display: grid;
  gap: 12px;
}

.traffic-hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.traffic-grid,
.top-users,
.chat-list {
  display: grid;
  gap: 14px;
}

.user-row,
.chat-row,
.message {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
}

.rank-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(24,188,255,0.18);
  color: #8de7ff;
  font-weight: 700;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  background: #22365f;
}

.avatar.placeholder {
  display: grid;
  place-items: center;
}

.user-copy,
.chat-row-copy {
  display: grid;
  gap: 4px;
}

.user-row-card {
  align-items: flex-start;
}

.user-actions {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-btn {
  min-width: 160px;
  font-weight: 600;
}

.action-btn.success {
  background: linear-gradient(135deg, #20d7b5, #39e177);
  color: #071325;
}

.action-btn.danger {
  background: linear-gradient(135deg, #ff6777, #ff9357);
  color: #fff;
}

.action-btn.ghost {
  background: #142241;
  color: #cfe0ff;
  border: 1px solid rgba(255,255,255,0.08);
}

.traffic-card {
  display: grid;
  gap: 16px;
}

.category-moderation {
  display: grid;
  gap: 12px;
}

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

.traffic-name {
  font-size: 20px;
  font-weight: 700;
}

.traffic-metrics {
  display: flex;
  gap: 18px;
}

.traffic-metrics div {
  display: grid;
  gap: 4px;
  text-align: right;
}

.traffic-links {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.chat-layout.active {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
}

.chat-messages {
  min-height: 440px;
  max-height: 60vh;
  overflow: auto;
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

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

.message.out {
  background: rgba(39,217,143,0.14);
}

.message.in {
  background: rgba(255,255,255,0.06);
}

.message-meta {
  color: #92efc3;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.chat-form {
  display: grid;
  gap: 12px;
}

.range-btn.active {
  background: linear-gradient(135deg, #4e82ff, #14b8ff);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.64);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-card {
  width: min(640px, 100%);
}

.modal-links {
  display: grid;
  gap: 8px;
  margin: 16px 0 18px;
}

.error {
  color: #ff8ba0;
}

code {
  display: block;
  word-break: break-all;
  white-space: pre-wrap;
  padding: 12px;
  border-radius: 14px;
  background: #081123;
  border: 1px solid rgba(255,255,255,0.08);
}

@media (max-width: 980px) {
  .auth-shell,
  .app-shell,
  .traffic-hero,
  .chat-layout.active {
    grid-template-columns: 1fr;
  }

  .main {
    padding: 18px;
  }

  .sidebar {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .auth-shell {
    padding: 12px;
  }

  .auth-visual {
    display: none;
  }

  .auth-card {
    margin: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .sidebar-top {
    margin-bottom: 10px;
  }

  .nav-btn {
    width: 100%;
  }

  .main {
    padding: 14px;
  }

  .stats-grid,
  .traffic-hero,
  .chat-layout.active {
    grid-template-columns: 1fr;
  }

  .filters,
  .date-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .filters button,
  .date-row input,
  .date-row button {
    width: 100%;
  }

  .chat-list-card,
  .chat-window-card,
  .creator-card,
  .filters-card {
    min-width: 0;
  }

  .user-row-card {
    flex-direction: column;
  }

  .user-actions {
    width: 100%;
    margin-left: 0;
  }

  .action-btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .filters,
  .date-row {
    grid-template-columns: 1fr;
  }

  .card {
    border-radius: 18px;
    padding: 15px;
  }

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

  .brand-lockup {
    flex-direction: column;
    align-items: flex-start;
  }
}
