.matomo-estadisticas-container {
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ==========================================
   Tarjetas e Identidad Institucional
   ========================================== */

/* Tarjeta del total histórico - Valor por defecto / Normateca (ID: 9) */
.historical-card {
  background-color: #6d2b34;
  color: #ffffff;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: background-color 0.3s ease;
}

/* Tarjeta del total histórico - Datos Abiertos (ID: 3) */
.matomo-estadisticas-container.site-3 .historical-card {
  background-color: #111111;
}

.historical-label {
  display: block;
  font-size: 1.1rem;
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.historical-number {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
}

.historical-sub {
  margin-top: 10px;
  display: flex;
  gap: 20px;
  font-size: 0.95rem;
  opacity: 0.9;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 8px;
}

.matomo-header-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 25px;
}

/* ==========================================
   Filtros de Fecha (Botones)
   ========================================== */

.matomo-filters {
  display: flex;
  gap: 10px;
}

/* Estilo Base / Normateca (ID: 9) */
.filter-btn {
  padding: 8px 16px;
  border: 1px solid #6d2b34;
  border-radius: 6px;
  background-color: #6d2b34;
  color: #ffffff !important;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.filter-btn:hover {
  opacity: 0.9;
  color: #ffffff !important;
  text-decoration: none;
}

.filter-btn.active {
  background-color: #3b2222;
  border-color: #3b2222;
  color: #ffffff !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Estilo para Datos Abiertos (ID: 3) */
.matomo-estadisticas-container.site-3 .filter-btn {
  background-color: #111111;
  border-color: #111111;
  color: #ffffff !important;
}

.matomo-estadisticas-container.site-3 .filter-btn:hover {
  background-color: #222222;
  border-color: #222222;
}

.matomo-estadisticas-container.site-3 .filter-btn.active {
  background-color: #000000;
  border-color: #000000;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* ==========================================
   Métricas y Tablas
   ========================================== */

.matomo-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.matomo-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.matomo-card h3 {
  margin: 0 0 10px 0;
  font-size: 0.95rem;
  color: #64748b;
}

.matomo-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #0f172a;
}

.stats-tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 30px;
  margin-top: 30px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.stats-table th, 
.stats-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.stats-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
}