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

:root {
  --bg: #ffffff;
  --bg-subtle: #f7f7f7;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;
  --spacing: 2rem;
  --spacing-sm: 1rem;

  /* ---- chart tokens (single source of truth; validated light palette) ---- */

  /* chrome */
  --chart-grid: #ececec;
  --chart-baseline: #111827;
  --chart-axis-text: #6b7280;
  --chart-zero-line: #9ca3af;
  --chart-hover-line: #9ca3af;
  --chart-null: #e5e7eb;
  --chart-halo: #ffffff;

  /* geo highlights */
  --geo-primary: #2d2ad6;   /* Czechia: indigo-blue */
  --geo-secondary: #d62a2a; /* Euro Area: red */
  --geo-eu: #527c78;        /* European Union: muted teal */
  --geo-tertiary: #c98500;  /* V4 accent */
  --geo-neutral: #9ca3af;   /* other countries: bars, markers */
  --geo-neutral-line: #d1d5db; /* other countries: background lines */

  /* HICP category decomposition */
  --cat-services: #2a78d6;
  --cat-goods: #e34948;
  --cat-food: #eda100;
  --cat-energy: #008300;
  --line-headline: #111827;
  --line-core: #b83280;
  --line-average: #e34948;

  /* signed values (diverging pair) */
  --val-pos: #e34948;
  --val-neg: #2a78d6;

  /* comparison series ramp (fixed order, never cycled) */
  --series-1: #2a78d6;
  --series-2: #1baf7a;
  --series-3: #c98500;
  --series-4: #4a3aa7;
  --series-5: #008300;
  --series-6: #e34948;
  --series-7: #e87ba4;
  --series-8: #eb6834;

  /* rankings cohorts */
  --rank-new-eu: #eb6834;
  --rank-old-eu: #d1d5db;
  --rank-ref: #e5e7eb;

  /* legacy aliases */
  --color-cz: var(--geo-primary);
  --color-ea: var(--geo-secondary);
  --color-eu: var(--geo-eu);
  --color-v4: var(--geo-tertiary);
  --color-gray: var(--geo-neutral);
}

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing) 3rem;
  padding-left: max(var(--spacing), env(safe-area-inset-left));
  padding-right: max(var(--spacing), env(safe-area-inset-right));
  padding-bottom: calc(3rem + env(safe-area-inset-bottom));
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem max(var(--spacing), env(safe-area-inset-right)) calc(1.25rem + env(safe-area-inset-bottom)) max(var(--spacing), env(safe-area-inset-left));
  text-align: center;
}

.site-footer-separator {
  color: var(--border-strong);
}

/* Kills the double-tap-zoom delay on interactive controls */
button, input, select { touch-action: manipulation; }

h3 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.chart-coicop {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.15rem;
  letter-spacing: 0.01em;
}

.page-description {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 1.5rem;
  max-width: 680px;
  line-height: 1.55;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

.page-section { display: none; }
.page-section.active { display: block; padding-top: 2.5rem; }

.error-banner {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
}

.protocol-warning {
  background: #fffbeb;
  border-bottom: 1px solid #fcd34d;
  color: #92400e;
  padding: 0.75rem var(--spacing);
  font-size: 0.85rem;
  text-align: center;
}

.protocol-warning code {
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.06);
  padding: 0 5px;
}

.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.75);
  z-index: 999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.loading-overlay.visible { display: flex; }

.spinner {
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

.no-data {
  padding: 3rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.85rem;
  border: 1px solid var(--border);
  letter-spacing: 0.01em;
}

@media (max-width: 640px) {
  :root { --spacing: 1.25rem; --spacing-sm: 0.75rem; }
  html { font-size: 14px; }

  .site-footer-inner {
    flex-direction: column;
    gap: 0.2rem;
  }

  .site-footer-separator { display: none; }
}
