:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --light: #f8fafc;
  --dark: #111827;
  --gray: #64748b;
  --border: #d8e0eb;
  --radius: 8px;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 18px 44px rgba(15, 23, 42, 0.12);
}

html {
  background: #f6f8fb;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  color: var(--dark) !important;
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0) 340px),
    #f6f8fb !important;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 85% 6%, rgba(20, 184, 166, 0.12), transparent 22rem),
    radial-gradient(circle at 35% 18%, rgba(245, 158, 11, 0.08), transparent 18rem);
  z-index: -1;
}

.sidebar {
  width: 264px !important;
  background: #18181b !important;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 12px 0 36px rgba(15, 23, 42, 0.16);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: 1.25rem 1.35rem !important;
  font-size: 1rem !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.sidebar-user {
  margin: 0.85rem;
  padding: 0.95rem !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-user .name {
  font-size: 0.95rem !important;
}

.sidebar-user .role {
  color: #a7f3d0;
  opacity: 1 !important;
}

.nav-section {
  padding: 1rem 1.2rem 0.45rem !important;
  color: #a1a1aa;
  opacity: 1 !important;
  letter-spacing: 0.08em !important;
}

.nav-item {
  margin: 0.12rem 0.75rem;
  padding: 0.68rem 0.85rem !important;
  border-left: 0 !important;
  border-radius: 8px;
  color: #d4d4d8 !important;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}

.nav-item.active {
  background: #fff !important;
  color: #111827 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.nav-item .icon {
  display: inline-grid;
  place-items: center;
  width: 28px !important;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.nav-item.active .icon {
  background: #eff6ff;
}

.sidebar-footer {
  padding: 1rem !important;
  border-top-color: rgba(255, 255, 255, 0.08) !important;
}

.main-content {
  margin-left: 264px !important;
  padding: 1.4rem clamp(1rem, 2vw, 2rem) 2.5rem !important;
}

.page-header {
  min-height: 54px;
  margin-bottom: 1.1rem !important;
  padding: 0.15rem 0;
}

.page-title {
  color: #0f172a !important;
  font-size: clamp(1.35rem, 2vw, 1.8rem) !important;
  letter-spacing: 0;
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
  gap: 0.85rem !important;
  margin-bottom: 1.1rem !important;
}

.card,
.stat-card,
.chart-card,
.filter-bar {
  background: rgba(255, 255, 255, 0.94) !important;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px !important;
  box-shadow: var(--shadow) !important;
}

.card:hover,
.stat-card:hover,
.chart-card:hover {
  box-shadow: var(--shadow-hover) !important;
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 1.1rem !important;
  border-left: 0 !important;
}

.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: var(--primary);
}

.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: #f59e0b; }
.stat-card.purple::before { background: #7c3aed; }
.stat-card.gold::before { background: #eab308; }

.stat-card .stat-value {
  color: #0f172a !important;
  font-size: 1.65rem !important;
  line-height: 1.16;
}

.stat-card .stat-label {
  color: #64748b !important;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .stat-icon {
  opacity: 0.14 !important;
}

.chart-card {
  min-height: 280px;
}

.chart-title {
  color: #0f172a !important;
  font-size: 0.98rem;
}

.filter-bar {
  padding: 0.9rem !important;
  align-items: end !important;
}

.raffle-selector {
  margin-bottom: 0 !important;
  justify-content: flex-end;
}

.raffle-chip {
  border: 1px solid var(--border) !important;
  border-radius: 999px !important;
  background: #fff !important;
  color: #475569;
}

.raffle-chip.active {
  background: #111827 !important;
  border-color: #111827 !important;
  color: #fff !important;
}

.btn {
  min-height: 38px;
  border-radius: 8px !important;
  font-weight: 850 !important;
  box-shadow: none !important;
  transform: none !important;
}

.btn:hover {
  transform: translateY(-1px) !important;
}

.btn-primary {
  background: var(--primary) !important;
  color: #fff !important;
}

.btn-primary:hover {
  background: var(--primary-dark) !important;
}

.btn-outline {
  background: #fff !important;
  border: 1px solid #bfdbfe !important;
  color: var(--primary) !important;
}

.btn-outline:hover {
  background: #eff6ff !important;
}

.btn-danger {
  background: var(--danger) !important;
  color: #fff !important;
}

.btn-success {
  background: var(--success) !important;
  color: #fff !important;
}

.form-label {
  color: #334155 !important;
  font-weight: 800 !important;
}

.form-control {
  min-height: 42px;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  background: #f8fafc !important;
}

.form-control:focus {
  border-color: var(--primary) !important;
  background: #fff !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12) !important;
}

.tabs {
  border-bottom: 0 !important;
  gap: 0.5rem;
  margin-bottom: 1rem !important;
}

.tab-btn {
  min-height: 42px;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #475569 !important;
}

.tab-btn.active {
  background: #111827 !important;
  color: #fff !important;
  border-color: #111827 !important;
}

.section-title {
  border-bottom: 0 !important;
  padding-bottom: 0 !important;
  color: #0f172a !important;
}

.badge {
  border-radius: 999px !important;
  font-weight: 850 !important;
}

.progress {
  background: #e2e8f0 !important;
  border-radius: 999px !important;
}

.progress-bar {
  background: linear-gradient(90deg, #16a34a, #2563eb) !important;
}

table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

thead tr {
  background: #f8fafc !important;
}

th {
  color: #475569 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

td {
  color: #1f2937;
}

tbody tr:hover {
  background: #f8fafc !important;
}

#global-modal {
  background: rgba(15, 23, 42, 0.58) !important;
  backdrop-filter: blur(6px);
}

#global-modal > div {
  border-radius: 8px !important;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.26) !important;
}

.status-dot.green { background: var(--success) !important; }
.status-dot.yellow { background: #f59e0b !important; }
.status-dot.red { background: var(--danger) !important; }

.spinner {
  border-color: #d8e0eb !important;
  border-top-color: var(--primary) !important;
}

.login-box {
  max-width: 430px !important;
  padding: 2rem !important;
  border: 1px solid rgba(255, 255, 255, 0.44);
  border-radius: 8px !important;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22) !important;
}

.login-logo {
  font-size: 2.2rem !important;
}

.login-title {
  color: #0f172a;
  font-size: 1.65rem !important;
}

.login-sub {
  color: #64748b !important;
}

body:has(.login-box) {
  background:
    radial-gradient(circle at 18% 15%, rgba(20, 184, 166, 0.22), transparent 22rem),
    radial-gradient(circle at 86% 12%, rgba(245, 158, 11, 0.18), transparent 20rem),
    linear-gradient(135deg, #eef6ff, #f8fafc 52%, #f1f5f9) !important;
}

body:has(.login-box)::before {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    width: min(86vw, 292px) !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 1rem !important;
  }

  #mobile-header {
    position: sticky;
    top: 0;
    z-index: 100;
    margin: -1rem -1rem 1rem !important;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(148, 163, 184, 0.24);
    backdrop-filter: blur(14px);
  }

  .page-header {
    align-items: flex-start !important;
  }

  .raffle-selector {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .stats-grid,
  .charts-grid {
    grid-template-columns: 1fr !important;
  }

  .page-header > div:last-child,
  .page-header > button,
  .page-header .btn {
    width: 100%;
  }

  .filter-bar {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .filter-bar .form-control,
  .filter-bar select,
  .filter-bar input {
    width: 100% !important;
  }
}
