body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(to right, #4b0082, #8a2be2);
  color: #fff;
  font-family: Arial, sans-serif;
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px;
  background: rgba(75, 0, 130, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.analytics-header h1 {
  margin: 0;
  font-size: 2.3rem;
}

.analytics-header p {
  margin: 6px 0 0;
  opacity: 0.82;
}

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

.header-link,
#logoutBtn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  font-weight: 700;
}

.header-link:hover,
#logoutBtn:hover {
  background: rgba(0, 0, 0, 0.5);
}

.analytics-main {
  max-width: 1850px;
  margin: 30px auto;
  padding: 20px;
  box-sizing: border-box;
}

.analytics-shell {
  background: rgba(0, 0, 0, 0.6);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
}

.analytics-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.analytics-topbar h2 {
  margin: 0;
  color: #ffcc00;
}

.analytics-topbar p {
  margin: 6px 0 0;
  opacity: 0.82;
}

.range-controls,
.analytics-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.range-btn,
.analytics-tab {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  color: #ffcc00;
  background: rgba(0, 0, 0, 0.45);
  font-weight: 800;
}

.range-btn:hover,
.analytics-tab:hover {
  border-color: rgba(255, 204, 0, 0.35);
}

.range-btn.active,
.analytics-tab.active {
  outline: 2px solid rgba(255, 204, 0, 0.25);
  background: rgba(138, 43, 226, 0.55);
}

.status-box {
  margin-bottom: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.9);
}

.status-box.error {
  color: #ffb4b4;
  border-color: rgba(255, 80, 80, 0.35);
}

.status-box.success {
  color: #7CFFB5;
  border-color: rgba(25, 170, 90, 0.45);
}

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

.metric-card {
  background: rgba(0, 0, 0, 0.65);
  padding: 18px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(138, 43, 226, 0.3);
  border: 1px solid rgba(255,255,255,0.08);
}

.metric-card span {
  display: block;
  color: #ffcc00;
  font-weight: 800;
  margin-bottom: 8px;
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
}

.metric-card small {
  opacity: 0.75;
}

.danger-card strong {
  color: #ffb4b4;
}

.analytics-tabs {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.tab-panel {
  display: none;
  margin-top: 18px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 18px;
}

.tab-panel.active {
  display: block;
}

.tab-panel h3 {
  margin-top: 0;
  color: #ffcc00;
}

.placeholder-box {
  min-height: 160px;
  padding: 16px;
  border-radius: 10px;
  background: rgba(0,0,0,0.35);
  border: 1px dashed rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.78);
}

.data-list {
  display: grid;
  gap: 10px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.08);
}

.data-row b {
  color: #ffcc00;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .analytics-topbar,
  .analytics-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .header-link,
  #logoutBtn {
    text-align: center;
  }
}