/* ===== Premium Analytics Dashboard ===== */

:root {
  --an-bg: #0b0e18;
  --an-card: #151929;
  --an-border: rgba(255, 255, 255, 0.07);
  --an-cyan: #06b6d4;
  --an-green: #10b981;
  --an-violet: #8b5cf6;
  --an-amber: #f59e0b;
  --an-rose: #f43f5e;
  --an-indigo: #6366f1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--an-bg);
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.an-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 75% 55% at 0% 0%, rgba(99, 102, 241, 0.14), transparent 55%),
    radial-gradient(ellipse 55% 45% at 100% 20%, rgba(6, 182, 212, 0.12), transparent 50%),
    radial-gradient(ellipse 45% 35% at 50% 100%, rgba(16, 185, 129, 0.08), transparent 55%);
  pointer-events: none;
  z-index: 0;
}

.an-navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(11, 14, 24, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--an-border);
}

.an-nav-left { display: flex; align-items: center; gap: 14px; }

.an-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--an-border);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.25s ease;
}

.an-back-btn:hover { border-color: rgba(99, 102, 241, 0.4); color: #a5b4fc; }
.an-back-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.an-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
}

.an-logo img { height: 28px; }
.an-nav-right { display: flex; align-items: center; gap: 14px; }
.an-user-bal { text-align: right; font-size: 12px; }
.an-user-bal .lbl { color: #64748b; display: block; margin-bottom: 2px; }
.an-user-bal .val { font-weight: 800; font-size: 14px; color: #6ee7b7; }

.an-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4338ca, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  border: 2px solid rgba(99, 102, 241, 0.35);
}

.an-container {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 70px;
}

/* Hero */
.an-hero {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid rgba(99, 102, 241, 0.25);
  animation: anIn 0.55s ease backwards;
}

.an-hero-mesh {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(17, 24, 39, 0.98) 45%, rgba(6, 182, 212, 0.08) 100%);
}

.an-hero-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  flex-wrap: wrap;
}

.an-hero-chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  margin-bottom: 10px;
}

.an-hero h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}

.an-hero h1 span {
  background: linear-gradient(90deg, #818cf8, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.an-hero p {
  margin: 0;
  font-size: 14px;
  color: #94a3b8;
  max-width: 480px;
  line-height: 1.5;
}

.an-refresh-btn {
  padding: 11px 20px;
  border-radius: 12px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.25s ease;
}

.an-refresh-btn:hover { background: rgba(99, 102, 241, 0.2); transform: translateY(-1px); }

/* Filters */
.an-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 18px;
  border-radius: 16px;
  background: var(--an-card);
  border: 1px solid var(--an-border);
  animation: anUp 0.5s ease backwards;
}

.an-filter-group { flex: 1; min-width: 200px; }
.an-filter-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 8px;
}

.an-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.an-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--an-border);
  background: rgba(255, 255, 255, 0.03);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.an-chip:hover { color: #e2e8f0; border-color: rgba(99, 102, 241, 0.3); }
.an-chip.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(6, 182, 212, 0.15));
  border-color: rgba(99, 102, 241, 0.4);
  color: #fff;
}

/* Sections */
.an-section {
  margin-bottom: 24px;
  animation: anUp 0.55s ease backwards;
}

.an-section-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 14px;
  color: #e2e8f0;
}

/* KPI Grid */
.an-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.an-general-grid { grid-template-columns: repeat(3, 1fr); }

.an-kpi {
  padding: 18px 16px;
  border-radius: 16px;
  background: var(--an-card);
  border: 1px solid var(--an-border);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  animation: anUp 0.5s ease backwards;
}

.an-kpi:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
}

.an-kpi-icon { font-size: 20px; margin-bottom: 8px; }
.an-kpi-val {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}

.an-kpi-val.an-kpi-sm { font-size: 14px; line-height: 1.3; word-break: break-word; }

.an-kpi-val.an-pos { color: #6ee7b7 !important; }
.an-kpi-val.an-neg { color: #fda4af !important; }

.an-kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.an-kpi.c-cyan { border-top: 3px solid var(--an-cyan); }
.an-kpi.c-green { border-top: 3px solid var(--an-green); }
.an-kpi.c-emerald { border-top: 3px solid #34d399; }
.an-kpi.c-violet { border-top: 3px solid var(--an-violet); }
.an-kpi.c-amber { border-top: 3px solid var(--an-amber); }
.an-kpi.c-rose { border-top: 3px solid var(--an-rose); }
.an-kpi.c-indigo { border-top: 3px solid var(--an-indigo); }
.an-kpi.c-orange { border-top: 3px solid #fb923c; }
.an-kpi.c-gold { border-top: 3px solid #fbbf24; }
.an-kpi.c-teal { border-top: 3px solid #2dd4bf; }

.an-kpi.c-green .an-kpi-val { color: #6ee7b7; }
.an-kpi.c-rose .an-kpi-val { color: #fda4af; }

/* Charts */
.an-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.an-chart-card {
  background: var(--an-card);
  border: 1px solid var(--an-border);
  border-radius: 18px;
  overflow: hidden;
  animation: anUp 0.55s ease backwards;
}

.an-chart-wide { margin-bottom: 0; }

.an-chart-head {
  padding: 16px 20px 0;
}

.an-chart-head h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.an-chart-sub {
  font-size: 11px;
  color: #64748b;
}

.an-chart-wrap {
  position: relative;
  height: 280px;
  padding: 12px 16px 20px;
}

.an-chart-pie { height: 300px; }

/* Tables */
.an-table-card {
  background: var(--an-card);
  border: 1px solid var(--an-border);
  border-radius: 18px;
  overflow: hidden;
}

.an-table-scroll { overflow-x: auto; }

.an-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.an-table th,
.an-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.an-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.an-table .pos { color: #6ee7b7; font-weight: 700; }
.an-table .neg { color: #fda4af; font-weight: 700; }

.an-pct-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.an-pct-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  min-width: 60px;
}

.an-pct-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #06b6d4);
}

.an-empty {
  text-align: center;
  padding: 32px !important;
  color: #64748b;
}

/* Empty state */
.an-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 24px;
  position: relative;
}

.an-empty-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15), transparent 70%);
}

.an-empty-icon { font-size: 52px; margin-bottom: 14px; position: relative; }
.an-empty-state h3 { font-size: 18px; margin: 0 0 8px; position: relative; }
.an-empty-state p { color: #64748b; max-width: 320px; margin: 0 0 20px; position: relative; }

.an-cta-btn {
  position: relative;
  padding: 12px 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 14px;
}

.an-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10000;
  opacity: 0;
  transition: all 0.35s ease;
  pointer-events: none;
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid var(--an-border);
}

.an-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes anIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes anUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
  .an-kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .an-general-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .an-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .an-charts-row { grid-template-columns: 1fr; }
  .an-hero-inner { flex-direction: column; align-items: flex-start; }
  .an-chart-wrap { height: 240px; }
  .an-back-btn .back-text { display: none; }
}

@media (max-width: 480px) {
  .an-container { padding: 16px 14px 48px; }
  .an-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .an-kpi { padding: 14px 12px; }
  .an-kpi-val { font-size: 18px; }
  .an-hero h1 { font-size: 22px; }
}
