:root {
  --onpe-red: #C41E3A;
  --onpe-red-dark: #9B1730;
  --onpe-blue: #003770;
  --onpe-blue-light: #0055AA;
  --gray-50: #F8F9FA;
  --gray-100: #F1F3F5;
  --gray-200: #E9ECEF;
  --gray-300: #DEE2E6;
  --gray-400: #CED4DA;
  --gray-500: #ADB5BD;
  --gray-600: #868E96;
  --gray-700: #495057;
  --gray-800: #343A40;
  --gray-900: #212529;
  --gold: #D4A017;
  --gold-glow: rgba(212,160,23,0.25);
  --silver: #607D8B;
  --silver-glow: rgba(96,125,139,0.2);
  --bronze: #8D6E63;
  --bronze-glow: rgba(141,110,99,0.2);
}

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

body {
  font-family: 'Poppins', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}

.app-header {
  background: linear-gradient(135deg, var(--onpe-red) 0%, var(--onpe-red-dark) 100%);
  color: white;
  padding: 0 2rem;
  box-shadow: 0 4px 20px rgba(196,30,58,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-brand {
  display: flex; align-items: baseline; gap: 0.75rem;
  color: white; text-decoration: none;
}

.nav-logo {
  font-size: 1.3rem; font-weight: 900;
  letter-spacing: 1px;
}

.nav-sub {
  font-size: 0.75rem; font-weight: 400; opacity: 0.8;
  border-left: 1px solid rgba(255,255,255,0.3);
  padding-left: 0.75rem;
}

.nav-links {
  display: flex; align-items: center; gap: 0;
}

.nav-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-links a:hover {
  background: rgba(255,255,255,0.12);
  color: white;
}

.nav-links a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

.nav-update {
  display: flex; align-items: center; gap: 0.4rem;
  margin-left: 0.75rem; padding-left: 0.75rem;
  border-left: 1px solid rgba(255,255,255,0.2);
  font-size: 0.65rem; opacity: 0.75;
}

.nav-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: #4ADE80; animation: pulse 2s infinite;
}

@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.3} }

.app-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.scope-tabs {
  display: flex; margin-bottom: 2rem;
  background: white; border-radius: 12px; padding: 4px;
  border: 1px solid var(--gray-200); width: fit-content;
}

.scope-tab {
  padding: 0.5rem 1.25rem; font-size: 0.8rem; font-weight: 600;
  color: var(--gray-500); cursor: pointer; border-radius: 8px;
  border: none; background: none; transition: all 0.2s; font-family: inherit;
}

.scope-tab:hover { color: var(--gray-700); }

.scope-tab.active {
  background: var(--onpe-red); color: white;
  box-shadow: 0 2px 8px rgba(196,30,58,0.3);
}

.mini-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem; margin-bottom: 2rem;
}

.mini-stat {
  background: white; border-radius: 12px; padding: 0.75rem 1rem;
  border: 1px solid var(--gray-200); text-align: center;
}

.mini-stat .label {
  font-size: 0.6rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--gray-500);
}

.mini-stat .value {
  font-size: 1.1rem; font-weight: 800; color: var(--gray-900); margin-top: 2px;
}

.mini-stat .value.red { color: var(--onpe-red); }
.mini-stat .value.blue { color: var(--onpe-blue); }
.mini-stat .value.green { color: #16A34A; }

.app-loading {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 400px; gap: 1rem;
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--onpe-red);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}

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

.app-error { text-align: center; padding: 3rem; }
.app-error h2 { color: var(--onpe-red); margin-bottom: 0.5rem; }

.retry-btn {
  margin-top: 1rem; padding: 0.6rem 1.5rem;
  background: var(--onpe-red); color: white;
  border: none; border-radius: 8px;
  font-family: inherit; font-weight: 600; cursor: pointer;
}

.app-footer {
  text-align: center; padding: 2rem;
  color: var(--gray-400); font-size: 0.7rem;
}

.app-footer a { color: var(--onpe-blue); text-decoration: none; }

.whatsapp-float {
  position: fixed; bottom: 24px; right: 24px;
  width: 56px; height: 56px; border-radius: 50%;
  background: #25D366; color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(37,211,102,0.4);
  text-decoration: none; z-index: 200;
  transition: transform 0.2s, box-shadow 0.2s;
}

.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(37,211,102,0.5);
}

.whatsapp-float svg { width: 28px; height: 28px; fill: white; }

@media (max-width: 640px) {
  .app-header { padding: 0 1rem; height: 54px; }
  .nav-sub { display: none; }
  .nav-links a { font-size: 0.7rem; padding: 0.4rem 0.6rem; }
  .app-container { padding: 1rem; }
  .mini-stats-row { grid-template-columns: repeat(2, 1fr); }
}
