:root {
  --bg-base:        #080C14;
  --bg-surface:     #0D1220;
  --bg-elevated:    #111827;
  --blue-primary:   #2D8CF0;
  --blue-light:     #5BA8F5;
  --blue-subtle:    #1A3A5C;
  --text-primary:   #F0F6FF;
  --text-secondary: #8BA3C0;
  --text-muted:     #445566;
  --success:        #22C55E;
  --danger:         #EF4444;
  --rarity-white:   #B0BEC5;
  --rarity-blue:    #4FC3F7;
  --rarity-purple:  #AB47BC;
  --rarity-pink:    #F06292;
  --rarity-red:     #EF5350;
  --rarity-gold:    #FFD600;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'SF Pro Display', -apple-system, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue-primary); text-decoration: none; }
a:hover { color: var(--blue-light); }

img {
  max-width: 100%;
  display: block;
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

/* Layout */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-wrapper {
  display: flex;
  flex: 1;
}

.main-content {
  flex: 1;
  padding: 32px 24px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* Sidebar nav */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid rgba(45, 140, 240, 0.1);
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(45, 140, 240, 0.08);
  margin-bottom: 12px;
}

.sidebar-logo .logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sidebar-logo .logo-text span {
  color: var(--blue-primary);
}

.sidebar-nav { flex: 1; }

.nav-section {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
  border-radius: 8px;
  margin: 2px 8px;
  cursor: pointer;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(45, 140, 240, 0.08);
}

.nav-item.active {
  color: var(--blue-primary);
  background: rgba(45, 140, 240, 0.12);
}

.nav-item .icon {
  width: 18px;
  height: 18px;
  opacity: 0.8;
  flex-shrink: 0;
}

/* Top header */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid rgba(45, 140, 240, 0.1);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  display: none;
}

.topbar-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-logo span { color: var(--blue-primary); }

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

/* Balance chip */
.balance-chip {
  background: rgba(45, 140, 240, 0.1);
  border: 1px solid rgba(45, 140, 240, 0.2);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--blue-light);
}

/* User avatar */
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--blue-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--blue-light);
  overflow: hidden;
  cursor: pointer;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Bottom nav (mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 1px solid rgba(45, 140, 240, 0.1);
  padding: 8px 0 env(safe-area-inset-bottom, 8px);
  z-index: 100;
}

.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  cursor: pointer;
  transition: color 0.15s;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--blue-primary);
}

.bottom-nav-item svg {
  width: 20px;
  height: 20px;
}

/* Page title */
.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Grids */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

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

/* Loading */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(45, 140, 240, 0.2);
  border-top-color: var(--blue-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Divider */
.divider {
  height: 1px;
  background: rgba(45, 140, 240, 0.08);
  margin: 24px 0;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(45, 140, 240, 0.08);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(45, 140, 240, 0.05);
  color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(45, 140, 240, 0.03); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .topbar { display: flex; }
  .bottom-nav { display: block; }
  .main-content { padding: 20px 16px 80px; }
  .page-title { font-size: 22px; }
  .cases-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
