*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #a5acc1;
  --bg2: #8a94ad;
  --bg3: #9aa7c6;
  --border: #2a3148;
  --accent: #4f8ef7;
  --accent2: #7c5cfc;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --text: #e8eaf0;
  --text2: #8b93a8;
  --platinum: #a78bfa;
  --gold: #f59e0b;
  --silver: #94a3b8;
  --bronze: #b45309;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 22px; }
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.live-badge {
  display: flex; align-items: center; gap: 6px;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.3);
  color: var(--green);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
}
.pulse {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
#last-updated { color: var(--text2); font-size: 12px; }
.btn-sim {
  background: var(--accent2);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s;
}
.btn-sim:hover { opacity: 0.85; }

/* KPI ROW */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 24px;
}
.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.kpi-label { color: var(--text2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 800; color: var(--text); }

/* MAIN GRID */
.main-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
  padding: 0 24px 24px;
}
.right-col { display: flex; flex-direction: column; gap: 16px; }

/* PANELS */
.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 { font-size: 14px; font-weight: 700; }
.badge {
  background: var(--bg3);
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
}
.search-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  width: 160px;
  outline: none;
}
.search-input:focus { border-color: var(--accent); }

/* ACTIVITY FEED */
.panel-activity { height: 580px; display: flex; flex-direction: column; }
.activity-feed {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.activity-feed::-webkit-scrollbar { width: 4px; }
.activity-feed::-webkit-scrollbar-track { background: transparent; }
.activity-feed::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(42,49,72,0.5);
  animation: slideIn 0.3s ease;
  transition: background 0.15s;
}
.activity-item:hover { background: var(--bg3); }
.activity-item.new { background: rgba(79,142,247,0.06); }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.activity-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}
.icon-login    { background: rgba(79,142,247,0.15); }
.icon-purchase { background: rgba(34,197,94,0.15); }
.icon-upgrade  { background: rgba(124,92,252,0.15); }
.icon-support  { background: rgba(245,158,11,0.15); }
.icon-download { background: rgba(148,163,184,0.15); }
.icon-default  { background: rgba(148,163,184,0.1); }

.activity-body { flex: 1; min-width: 0; }
.activity-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.activity-desc { color: var(--text2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-time { color: var(--text2); font-size: 11px; flex-shrink: 0; margin-top: 2px; }

/* TABLES */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  font-size: 13px;
  border-bottom: 1px solid rgba(42,49,72,0.4);
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* STATUS BADGES */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; }
.status-active    { background: rgba(34,197,94,0.12);  color: var(--green);  }
.status-active::before    { background: var(--green); }
.status-inactive  { background: rgba(148,163,184,0.1); color: var(--text2); }
.status-inactive::before  { background: var(--text2); }
.status-completed { background: rgba(34,197,94,0.12);  color: var(--green);  }
.status-completed::before { background: var(--green); }
.status-pending   { background: rgba(245,158,11,0.12); color: var(--yellow); }
.status-pending::before   { background: var(--yellow); }
.status-failed    { background: rgba(239,68,68,0.12);  color: var(--red);    }
.status-failed::before    { background: var(--red); }

/* LEVEL BADGES */
.level {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.level-Platinum { background: rgba(167,139,250,0.15); color: var(--platinum); }
.level-Gold     { background: rgba(245,158,11,0.15);  color: var(--gold); }
.level-Silver   { background: rgba(148,163,184,0.15); color: var(--silver); }
.level-Bronze   { background: rgba(180,83,9,0.15);    color: var(--bronze); }

.amount-positive { color: var(--green); font-weight: 700; }
.loading { color: var(--text2); padding: 20px; text-align: center; font-style: italic; }

@media (max-width: 1100px) {
  .main-grid { grid-template-columns: 1fr; }
  .kpi-row   { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .topbar  { flex-direction: column; gap: 10px; align-items: flex-start; }
}
