/* Body & background */ 
html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body { 
  background-color: #000; 
  color: #e5e7eb; 
  font-family: 'Montserrat', sans-serif;
  margin: 0;
}

/* Navigation Bar */
.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-link:hover {
  background-color: #1f2937 !important;
  color: #ffffff !important;
}

.nav-link.active {
  background-color: #1f2937 !important;
  color: #ffffff !important;
}

/* Model cards (uptime) */
.model { 
  margin: 16px auto; 
  background: #111827; 
  border-radius: 10px; 
  padding: 8px 12px; 
  max-width: 100%;
  width: 100%; /* Ensure full width */
  box-sizing: border-box; /* Include padding in width calculation */
  overflow: visible; /* Allow tooltips to be visible */
  position: relative;
}

/* Divider */ 
.endpoint-divider { 
  border: 0; 
  height: 1px; 
  background: #444; 
  margin: 12px 20%; 
}

/* Model header & blocks */
.model-header {
  margin-bottom: 8px;
}

/*
 * Grid: escritorio = status|uptime / name|latency (metrics con display:contents).
 * Móvil = status ancho completo; fila 2: nombre | columna (uptime encima + latencia).
 */
.model-header--stacked {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 8px;
  align-items: start;
}

/* Escritorio: Outage + chips regionales en una misma línea (fila). Móvil: columna en @media 768px */
.model-header-status {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.model-name-with-tag {
  grid-column: 1;
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.model-header-metrics {
  display: contents;
}

.model-header-metrics .model-header-uptime {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
}

.model-header-metrics .model-latency {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  align-self: start;
}

/* Historical Data (solo badge arriba): uptime en la misma fila que el nombre, a la derecha */
.model-header--stacked.model-header--historical .model-header-metrics .model-header-uptime {
  grid-row: 2;
  grid-column: 2;
  align-self: center;
}

.model-region-chips {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.region-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #fde68a;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.5);
  white-space: nowrap;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
}

.region-chip:hover {
  background: rgba(245, 158, 11, 0.28);
  color: #fef3c7;
}

.region-chip:active {
  transform: scale(0.98);
}

/* Test env: mismo aspecto, sin enlace */
.region-chip.region-chip--static {
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}

.region-chip.region-chip--static:hover,
.region-chip.region-chip--static:active {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  transform: none;
}

.model-header-uptime {
  flex-shrink: 0;
  white-space: nowrap;
  text-align: right;
  line-height: 1.25;
  padding-bottom: 1px; /* alinea ópticamente con badges con padding */
}

.model-status-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.model-status-badge.model-status--ok {
  background: rgba(17, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(17, 185, 129, 0.4);
}

.model-status-badge.model-status--bad {
  background: rgba(248, 113, 113, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

.model-status-badge.model-status--unknown {
  background: rgba(156, 163, 175, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(156, 163, 175, 0.3);
}

.model-status-badge.model-status--nodata {
  background: rgba(107, 114, 128, 0.2);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.45);
}

.model-name-block {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  min-width: 0;
  flex: 1;
}

.model-header--stacked .model-name-with-tag .model-name {
  flex: 0 1 auto;
  min-width: 0;
  word-break: break-word;
}

.model-name { 
  font-weight: 500; 
  font-size: 14px; 
  display: flex; 
  align-items: center; 
  gap: 6px;
  min-width: 0;
}

.model-latency {
  font-size: 12px;
  font-weight: 600;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.model-latency--na {
  color: #64748b;
  font-weight: 500;
}

.model-name.nodata {
  color: #9ca3af;
}

.uptime { 
  font-size: 13px; 
  font-weight: 500; 
}

.uptime-green { color: #11b981; } 
.uptime-yellow { color: #facc15; } 
.uptime-orange { color: #fb923c; } 
.uptime-red { color: #f97171; }
.uptime-blue { color: #5FA5FA; }

.blocks { 
  display: flex; 
  flex-wrap: nowrap; 
  overflow: visible; /* Allow tooltips to be visible */
  gap: 2px; 
  width: 100%; 
  position: relative;
  min-width: 0; /* Allow flex items to shrink */
  box-sizing: border-box; /* Include padding in width calculation */
}

.block { 
  flex: 0 1 auto; 
  height: 30px; 
  border-radius: 4px;
  transition: filter 0.15s ease;
  position: relative; /* For tooltip positioning */
  min-width: 2px; /* Minimum width to ensure visibility */
  box-sizing: border-box;
}

.block:hover { 
  filter: brightness(1); 
}

.block .tooltip-text {
  opacity: 0;
  position: absolute;
  bottom: 70%; /* above the block */
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  background: linear-gradient(135deg, #333, #555);
  color: #fff;
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  white-space: nowrap;
  z-index: 10000;
  transition: opacity 0.2s, transform 0.2s;
  min-width: max-content;
  pointer-events: none;
  overflow: visible;
  max-width: none;
  margin-bottom: 8px;
}
.block:hover .tooltip-text {
  overflow: visible;
  opacity: 1;
  transform: translateX(-50%) translateY(-8px); /* slight pop effect above */
}
.tooltip-status {
  font-weight: 300;
  font-size: 0.85rem;
  color: white;
  text-transform: capitalize;
}
.tooltip-divider {
  height: 1px;
  background-color: rgba(255,255,255,0.3);
  margin: 4px 0;
}
.tooltip-time {
  font-size: 0.75rem;
  color: #9b9b9b;
}
.block.up { background-color: #11b981; }
.block.down { background-color: #f97171; }
.block.shortlyDown { background-color: #f1a262; }
.block.nodata { background-color: #6b7280; }
.block.maintenance { background-color: #5FA5FA; }

.block.up:hover {
  background-color: #0e7a50;
}

.block.down:hover {
  background-color: #5c0c0c;
}

.block.shortlyDown:hover {
  background-color: #b85c1c;
}

.block.maintenance:hover {
  background-color: #477cc0;
}
.block.nodata:hover {
  background-color: #4b5563;
}

/* Móvil: toque en un día → panel fijo bajo la tira (no tooltip flotante) */
@media (max-width: 768px) {
  .blocks {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding-bottom: 2px;
  }

  .blocks .block {
    cursor: pointer;
    flex-shrink: 1;
    min-width: 0;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
  }

  /* No mostrar el globo dentro de la barra en móvil (evita solapes y recortes) */
  .block .tooltip-text {
    display: none !important;
  }

  .block:hover .tooltip-text {
    display: none !important;
  }

  .block.block--day-tip {
    outline: 2px solid rgba(226, 232, 240, 0.95);
    outline-offset: 1px;
    border-radius: 4px;
    position: relative;
    z-index: 2;
  }

  .mobile-day-detail {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    margin-bottom: 2px;
    padding: 7px 10px;
    border-radius: 6px;
    background: linear-gradient(135deg, #2d3748, #1f2937);
    border: 1px solid #4b5563;
    color: #fff;
    text-align: left;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
  }

  .mobile-day-detail[hidden] {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    min-height: 0;
    overflow: hidden;
  }

  .mobile-day-detail .tooltip-status {
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.25;
    color: #fff;
    text-transform: capitalize;
  }

  .mobile-day-detail .tooltip-divider {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.22);
    margin: 5px 0;
  }

  .mobile-day-detail .tooltip-time {
    font-size: 0.68rem;
    color: #cbd5e1;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
  }
}

.footer { 
  display: flex; 
  justify-content: space-between; 
  font-size: 11px; 
  color: #9ca3af; 
  margin-top: 6px; 
}

/* Maintenance section - Previous maintenance windows */
#maintenance-windows {
  margin-top: 40px;
  max-width: 40%;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
}

.maintenance-section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 24px;
  padding: 0;
}

/* Historical Data block (below recent maintenance & incidents) — mismo ancho que .section (60%), no 40%×60% anidado */
.historical-data-region {
  margin-top: 5rem;
  padding-top: 0.75rem;
  scroll-margin-top: 1.5rem;
  max-width: 60%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
  box-sizing: border-box;
}

.historical-data-region .section {
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}

/* Misma apariencia de barras que el uptime principal (historical sin clase extra) */

/* Fila en maintenance (query): badge y nombre en azul #5FA5FA */
.model.model--maintenance .model-name.maintenance {
  color: #5fa5fa;
}

.model-status-badge.model-status--maintenance {
  background: rgba(95, 165, 250, 0.2);
  color: #5fa5fa;
  border: 1px solid rgba(95, 165, 250, 0.55);
}

.historical-data-top-rule {
  margin-top: 0;
  margin-bottom: 2rem;
}

.historical-data-title {
  text-align: center;
  font-size: 1.35rem;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0 auto 14px;
  padding: 0;
  letter-spacing: 0.02em;
}

.historical-data-intro {
  text-align: center;
  color: #9ca3af;
  font-size: 15px;
  line-height: 1.5;
  margin: 0 auto 36px;
  max-width: 640px;
  padding: 0 16px;
}

.maintenance-incidents {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.maintenance-incident {
  padding: 16px;
  border: 0.5px solid #1f2937;
  border-radius: 8px;
}

.incident-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  width: 100%;
}

.incident-header .incident-date {
  flex-shrink: 0;
}

.incident-header .incident-badge {
  margin-left: auto;
  flex-shrink: 0;
}

.incident-date {
  font-size: 0.9rem;
  color: #9ca3af;
  font-weight: 500;
}

.incident-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
}

.maintenance-badge {
  background-color: #5FA5FA;
  color: #ffffff;
}

.incident-badge-red {
  background-color: #ef4444;
  color: #ffffff;
}

.incident-description {
  font-size: 0.95rem;
  color: #e5e7eb;
  margin-bottom: 12px;
  font-weight: 500;
}

/* Status page — truncated affected lists (maintenance: link; incidents: hint, whole card is the link) */
.incident-affected-preview {
  font-size: 0.875rem;
  color: #d1d5db;
  margin-bottom: 10px;
  line-height: 1.45;
}

a.recent-affected-more {
  color: #5fa5fa;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.recent-affected-more:hover {
  color: #93c5fd;
}

.recent-affected-more-hint {
  color: #5fa5fa;
  font-weight: 500;
}

.incident-resolved {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(17, 185, 129, 0.1);
  border-radius: 6px;
  border-left: 3px solid #11b981;
}

.resolved-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background-color: #11b981;
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 2px;
}

.resolved-content {
  flex: 1;
}

.resolved-text {
  font-size: 0.85rem;
  color: #e5e7eb;
  font-weight: 500;
  margin-bottom: 4px;
}

.resolved-detail {
  font-size: 0.8rem;
  color: #9ca3af;
}

.incident-in-progress {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(250, 204, 21, 0.1);
  border-radius: 6px;
  border-left: 3px solid #facc15;
}

.incident-in-progress-long {
  background: rgba(239, 68, 68, 0.12);
  border-left-color: #ef4444;
}

.in-progress-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background-color: #facc15;
  color: #000000;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 2px;
  animation: spin 2s linear infinite;
}

.in-progress-icon-long {
  background-color: #ef4444;
  color: #ffffff;
}

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

.in-progress-content {
  flex: 1;
}

.in-progress-text {
  font-size: 0.85rem;
  color: #e5e7eb;
  font-weight: 500;
  margin-bottom: 4px;
}

.in-progress-detail {
  font-size: 0.8rem;
  color: #9ca3af;
}

/* Collapsible sections */ 
.section { 
  margin: 16px auto; 
  max-width: 60%; 
  background: #111827; 
  border-radius: 10px; 
  padding: 0; 
  overflow: visible; /* Allow tooltips to be visible */
  border: 1px solid #1f2937;
  position: relative;
}

.section-header { 
  width: 100%; 
  padding: 14px 16px; 
  background: #0f1620; 
  color: #e5e7eb; 
  border: none;
  border-radius: 10px;
  font-size: 16px; 
  font-weight: 600; 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  cursor: pointer; 
  text-align: left;
}

.section-header:hover { 
  background: #1a2332; 
}

.arrow { 
  transition: transform 0.25s ease; 
  font-size: 14px; 
}

/* collapsed by default */ 
.section-content { 
  max-height: 0; 
  overflow: hidden;
  transition: max-height 0.25s ease, padding 0.25s ease; 
}

/* expanded state */ 
.section-content.open { 
  padding-right: 16px;
  padding-left: 16px;
  padding-bottom: 24px; /* Extra padding at bottom to prevent overlap */
  overflow: visible; /* Allow tooltips to be visible */
  position: relative;
  margin-bottom: 0;
  min-height: 0; /* Allow content to determine height */
  max-height: none; /* Remove max-height restriction */
  width: 100%; /* Ensure full width */
  box-sizing: border-box; /* Include padding in width calculation */
}

/* Ensure model containers don't restrict block width but stay contained */
.section-content.open .model {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: visible; /* Allow tooltips to be visible */
}

/* Empty state message (e.g. "No data available.") – spacing below section header */
.empty-state-message {
  padding-top: 1rem;
}

/* Page Title */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #e5e7eb;
  margin: 0 0 24px 0;
  text-align: center;
}

/* Events Container */
.events-container {
  max-width: 60%;
  margin: 0 auto;
  padding: 0 20px;
}

.incidents-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Month Section */
.month-section {
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.month-header {
  font-size: 1.1rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 20px;
}

/* Day Section */
.day-section {
  margin-bottom: 24px;
}

.day-section:last-child {
  margin-bottom: 0;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.day-header-clickable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #1a1f2e;
  border: 1px solid #1f2937;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
  margin-bottom: 12px;
}

.day-header-clickable:hover {
  background-color: #1f2937;
}

.day-header-clickable[style*="cursor: default"]:hover {
  background-color: #1a1f2e;
  cursor: default;
}

.day-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
}

.day-toggle-icon {
  font-size: 0.9rem;
  color: #9ca3af;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  margin-left: 12px;
  min-width: 20px;
}

.day-header-clickable:hover .day-toggle-icon {
  color: #e5e7eb;
}

.day-content {
  padding-left: 24px;
  padding-right: 16px;
  padding-top: 8px;
  padding-bottom: 12px;
  animation: slideDown 0.2s ease;
  border-left: 2px solid #1f2937;
  margin-left: 8px;
  margin-bottom: 8px;
}

.day-content .event-card {
  margin-left: 0;
  margin-right: 0;
}

.day-content .incident-card {
  margin-left: 0;
  margin-right: 0;
}

.day-default-content {
  padding-left: 16px;
  padding-right: 16px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.more-incidents-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: rgba(31, 41, 55, 0.5);
  border-top: 1px solid #1f2937;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
  margin-top: 0;
  margin-bottom: 0;
  border-radius: 0 0 8px 8px;
}

.more-incidents-indicator:hover {
  background-color: #1f2937;
}

.more-incidents-text {
  font-size: 0.85rem;
  color: #9ca3af;
  font-weight: 500;
}

.more-incidents-indicator:hover .more-incidents-text {
  color: #e5e7eb;
}

.more-incidents-icon {
  font-size: 0.9rem;
  color: #9ca3af;
  transition: color 0.2s ease;
}

.more-incidents-indicator:hover .more-incidents-icon {
  color: #e5e7eb;
}

.day-date {
  font-size: 0.8rem;
  font-weight: 600;
  color: #e5e7eb;
}

.day-count {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* Event Card */
.event-card {
  background-color: #0f1620;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
}

.event-card:last-child {
  margin-bottom: 0;
}

.incident-card {
  padding: 0;
  overflow: hidden;
}

.incident-header-clickable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  user-select: none;
}

.incident-header-clickable:hover {
  background-color: #1a1f2e;
}

.incident-header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  padding-right: 16px;
  min-width: 0; /* Allow flex item to shrink */
}

.incident-header-content .event-title {
  padding-right: 120px;
  min-width: 0;
  flex: 1;
}

.incident-toggle-icon {
  font-size: 0.9rem;
  color: #9ca3af;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  margin-left: 8px;
  min-width: 20px;
}

.incident-header-clickable:hover .incident-toggle-icon {
  color: #e5e7eb;
}

.incident-details {
  padding: 0 20px 16px 20px;
  border-top: 1px solid #1f2937;
  margin-top: 0;
  animation: slideDown 0.2s ease;
  margin-left: 12px;
  border-left: 2px solid #374151;
  padding-left: 24px;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 1000px;
  }
}

.affected-models-section {
  margin: 16px 0;
  padding: 12px;
  background-color: rgba(31, 41, 55, 0.5);
  border-radius: 6px;
  border-left: 3px solid #6b7280;
  margin-left: 0;
}

.affected-models-label {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 8px;
  font-weight: 500;
}

.affected-models-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.affected-model-item {
  font-size: 0.9rem;
  color: #e5e7eb;
  padding: 6px 10px;
  background-color: rgba(15, 22, 32, 0.6);
  border-radius: 4px;
  border-left: 2px solid #4b5563;
}

.event-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e5e7eb;
  margin: 0;
  padding-right: 120px;
  flex: 1;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.maintenance-card .event-title {
  padding-right: 120px;
}

.event-status {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: rgba(17, 185, 129, 0.1);
  border-radius: 6px;
  border-left: 3px solid #11b981;
  margin-top: 10px;
  margin-bottom: 8px;
}

.event-status.in-progress {
  background: rgba(250, 204, 21, 0.1);
  border-left: 3px solid #facc15;
}

.event-status.ongoing {
  background: rgba(239, 68, 68, 0.1);
  border-left: 3px solid #ef4444;
}

.event-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background-color: #11b981;
  color: #ffffff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: bold;
  flex-shrink: 0;
  margin-top: 2px;
}

.event-status-icon.in-progress-icon {
  background-color: #facc15;
  color: #000000;
  font-size: 0.9rem;
  animation: spin 2s linear infinite;
}

.event-status-icon.ongoing-icon {
  background-color: #ef4444;
  color: #ffffff;
  font-size: 0.9rem;
  animation: spin 2s linear infinite;
}

.event-status-content {
  flex: 1;
}

.event-status-text {
  font-size: 0.85rem;
  color: #e5e7eb;
  font-weight: 500;
  margin-bottom: 4px;
}

.event-description {
  font-size: 0.8rem;
  color: #9ca3af;
}

.event-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  position: absolute;
  top: 16px;
  right: 16px;
  white-space: nowrap;
  z-index: 1;
}

.incident-card .event-badge {
  position: relative;
  top: 0;
  right: 0;
  margin-left: auto;
  flex-shrink: 0;
}

.event-badge.maintenance {
  background-color: #5FA5FA;
  color: #ffffff;
}

.event-badge.downtime {
  background-color: #ef4444;
  color: #ffffff;
}

.event-badge.resolved {
  background-color: #11b981;
  color: #ffffff;
}

.event-updates {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.event-updates:hover {
  color: #9ca3af;
}

@media (max-width: 768px) {
  /* Contenido y bordes dentro del viewport + safe area (notch) */
  html {
    overflow-x: clip;
    max-width: 100%;
  }

  body {
    overflow-x: clip;
    max-width: 100%;
  }

  #page-wrapper {
    max-width: 100%;
    overflow-x: clip;
    min-width: 0;
  }

  #main-content {
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: clip;
    min-width: 0;
  }

  .section { 
    max-width: 100%;
    margin-bottom: 32px !important; /* More space between sections on mobile */
    margin-left: 0;
    margin-right: 0;
    overflow: hidden; /* Contain content within section */
    width: 100%;
    box-sizing: border-box;
  }
  
  .model {
    margin-bottom: 20px; /* Add more space between models */
    position: relative;
    width: 100%; /* Ensure models take full width */
    box-sizing: border-box; /* Include padding in width calculation */
    max-width: 100%;
    overflow: hidden; /* Contain blocks within model */
  }
  
  .section-content {
    position: relative;
    width: 100%; /* Ensure content takes full width */
    box-sizing: border-box;
  }
  
  .section-content.open {
    margin-bottom: 0;
    overflow: visible; /* Allow tooltips to be visible */
    position: relative;
    width: 100%; /* Ensure full width */
    box-sizing: border-box; /* Include padding in width calculation */
    max-height: none;
    min-width: 0; /* flex: la tira de barras no fuerza ancho > viewport */
  }
  
  .section {
    overflow: visible; /* Allow tooltips to be visible on mobile */
  }
  
  .model {
    overflow: visible; /* Allow tooltips to be visible on mobile */
    min-width: 0;
  }

  /* Tipografía más pequeña en móvil (menos saturación y más aire a los bordes) */
  .model {
    padding: 6px 10px;
  }

  .section-header {
    font-size: 14px;
    padding: 12px 14px;
  }

  /* Uptime encima de latencia, misma columna derecha; badges ocupan fila superior */
  .model-header--stacked {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 8px;
    row-gap: 6px;
  }

  .model-header-status {
    grid-column: 1 / -1;
    grid-row: 1;
    flex: none;
    max-width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  .model-name-with-tag {
    grid-column: 1;
    grid-row: 2;
    gap: 5px 8px;
    min-width: 0;
  }

  .model-header-metrics {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 2px;
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }

  .model-header-metrics .model-header-uptime,
  .model-header-metrics .model-latency {
    grid-column: unset;
    grid-row: unset;
    align-self: auto;
    justify-self: auto;
  }

  .model-name {
    font-size: 12.5px;
    line-height: 1.35;
    font-weight: 500;
  }

  .model-latency {
    font-size: 10.5px;
    font-weight: 600;
  }

  .uptime,
  .model-header-uptime {
    font-size: 11px;
    font-weight: 500;
  }

  .model-status-badge {
    font-size: 10.5px;
    padding: 3px 8px;
    border-radius: 5px;
    gap: 3px;
  }

  .region-chip {
    font-size: 9.5px;
    padding: 3px 7px;
    line-height: 1.25;
    border-radius: 5px;
    white-space: normal;
    max-width: min(100%, 10.5rem);
    text-align: center;
  }

  .model .footer {
    font-size: 10px;
    margin-top: 5px;
  }

  .mobile-day-detail {
    padding: 6px 9px;
    margin-top: 5px;
  }

  .mobile-day-detail .tooltip-status {
    font-size: 0.72rem;
  }

  .mobile-day-detail .tooltip-time {
    font-size: 0.65rem;
  }

  .mobile-day-detail .tooltip-divider {
    margin: 4px 0;
  }

  .model-region-chips {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 5px;
    width: auto;
    max-width: 100%;
  }

  .region-chip {
    width: auto;
    flex: 0 0 auto;
    min-height: 0;
    justify-content: center;
    box-sizing: border-box;
  }

  @media (max-width: 440px) {
    .model-header--stacked {
      column-gap: 6px;
      row-gap: 5px;
    }

    .model-header-status {
      flex-direction: column;
      align-items: flex-start;
      gap: 5px;
    }

    .model-region-chips {
      gap: 4px;
      max-width: 100%;
    }

    .region-chip {
      padding: 2px 6px;
      font-size: 8px;
      letter-spacing: 0;
      max-width: min(100%, 9.25rem);
    }

    .model-status-badge {
      font-size: 9px;
      padding: 2px 7px;
    }

    .model-header-uptime,
    .uptime {
      font-size: 10px;
      line-height: 1.2;
      text-align: right;
      white-space: nowrap;
    }

    .model-header-metrics .model-latency {
      font-size: 10px;
      text-align: right;
      white-space: nowrap;
      line-height: 1.25;
    }

    .model-name {
      font-size: 10px;
      line-height: 1.32;
    }
  }
  
  .blocks {
    overflow: visible; /* Allow tooltips to be visible on mobile */
  }
  
  #maintenance-windows { 
    max-width: 100%; 
    padding: 0 16px;
  }

  .historical-data-region {
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }
  .events-container {
    max-width: 100%;
    padding: 0 16px;
  }
  .page-title {
    font-size: 1.25rem;
    line-height: 1.25;
  }
  
  /* Navigation */
  .main-nav {
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
  }
  
  .nav-link {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
  
  /* Day headers */
  .day-header-clickable,
  .day-header {
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  
  .day-header-content {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  .day-date {
    font-size: 0.75rem;
  }
  
  .day-count {
    font-size: 0.7rem;
  }
  
  /* Event cards */
  .event-card {
    padding: 12px;
  }
  
  .event-title {
    font-size: 0.9rem;
    padding-right: 80px;
    word-break: break-word;
  }
  
  .event-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    top: 12px;
    right: 12px;
  }
  
  .incident-card .event-badge {
    position: relative;
    top: 0;
    right: 0;
  }
  
  /* Incident headers */
  .incident-header-clickable,
  .incident-header {
    padding: 12px;
    flex-wrap: wrap;
  }
  
  .incident-header-content {
    flex-wrap: wrap;
    gap: 6px; /* Reduced from 8px */
    padding-right: 4px; /* Reduced from 8px */
  }
  
  .incident-header-content .event-title {
    padding-right: 50px; /* Reduced from 70px */
    word-break: keep-all;
    line-height: 1.4;
    font-size: 0.8rem;
    white-space: normal;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: calc(100% - 80px); /* Reduced from 100px */
  }
  
  .incident-toggle-icon {
    margin-left: 4px !important; /* Reduced from 8px */
    min-width: 16px !important; /* Reduced from 20px */
    font-size: 0.8rem !important; /* Reduced from 0.9rem */
  }
  
  .event-badge {
    padding: 3px 8px !important; /* Reduced from 4px 12px */
    font-size: 0.7rem !important; /* Reduced from 0.75rem */
  }
  
  /* For very small screens */
  @media (max-width: 400px) {
    .incident-header-content {
      padding-right: 2px;
      gap: 4px;
    }
    
    .incident-header-content .event-title {
      padding-right: 40px; /* Reduced from 55px */
      font-size: 0.7rem;
      line-height: 1.5;
      max-width: calc(100% - 70px); /* Reduced from 85px */
      letter-spacing: -0.3px;
    }
    
    .incident-toggle-icon {
      margin-left: 2px !important;
      min-width: 14px !important;
      font-size: 0.75rem !important;
    }
    
    .event-badge {
      padding: 2px 6px !important;
      font-size: 0.65rem !important;
    }
  }
  
  /* For small screens */
  @media (max-width: 420px) {
    .incident-header-content {
      padding-right: 3px;
      gap: 5px;
    }
    
    .incident-header-content .event-title {
      padding-right: 20px; /* Reduced from 60px */
      font-size: 0.75rem;
      line-height: 1.5;
      max-width: calc(100% - 75px); /* Reduced from 90px */
    }
    
    .incident-toggle-icon {
      margin-left: 3px !important;
      min-width: 15px !important;
      font-size: 0.8rem !important;
    }
    
    .event-badge {
      padding: 2.5px 7px !important;
      font-size: 0.68rem !important;
    }
  }
  
  /* For medium-small screens */
  @media (max-width: 480px) {
    .incident-header-content {
      padding-right: 4px;
      gap: 6px;
    }
    
    .incident-header-content .event-title {
      padding-right: 10px; /* Reduced from 65px */
      font-size: 0.78rem;
      line-height: 1.4;
      max-width: calc(100% - 80px); /* Reduced from 95px */
    }
    
    .incident-toggle-icon {
      margin-left: 4px !important;
      min-width: 16px !important;
      font-size: 0.85rem !important;
    }
    
    .event-badge {
      padding: 3px 8px !important;
      font-size: 0.7rem !important;
    }
  }
  
  /* Status sections */
  .event-status {
    padding: 10px;
    flex-wrap: wrap;
  }
  
  .event-status-icon {
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
  }
  
  .event-status-text {
    font-size: 0.8rem;
  }
  
  .event-description {
    font-size: 0.75rem;
  }
  
  /* More incidents indicator */
  .more-incidents-indicator {
    padding: 10px 12px;
  }
  
  .more-incidents-text {
    font-size: 0.8rem;
  }
  
  /* Month sections */
  .month-section {
    padding: 16px;
  }
  
  .month-header {
    font-size: 1rem;
  }
  
  /* Day content */
  .day-content {
    padding-left: 16px;
    padding-right: 12px;
  }
  
  .incident-details {
    padding: 0 12px 12px 12px;
    margin-left: 8px;
    padding-left: 16px;
  }
  
  /* Affected models */
  .affected-models-section {
    padding: 10px;
  }
  
  .affected-models-label {
    font-size: 0.8rem;
  }
  
  .affected-model-item {
    font-size: 0.85rem;
    padding: 5px 8px;
  }

}
