/* ==========================================================================
   ESTILOS GENERALES Y SISTEMA DE DISEÑO — ESTRATEGIA DE LAS FASES (VIRAL)
   Tema Oficial ArduinoHN Métricas (Limpio, Alta Legibilidad, Modo Claro)
   ========================================================================== */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* ArduinoHN Official Brand Colors */
  --arduino-teal: #00979C;
  --arduino-teal-dark: #005C5F;
  --arduino-orange: #E47128;
  --arduino-orange-hover: #c95e1c;
  
  /* ArduinoHN Light Aesthetic (Misma línea que Cascada de Métricas) */
  --bg-main: #F7F9F9;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-subtle: rgba(0, 151, 156, 0.18);
  --border-focus: #00979C;
  
  --text-primary: #212529;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  --accent-teal: #00979C;
  --accent-orange: #E47128;
  --accent-blue: #0284c7;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --phase-0: #ef4444;
  --phase-novato: #E47128; /* Arduino Orange */
  --phase-1: #d97706;
  --phase-2: #00979C; /* Arduino Teal */
  --phase-3: #0284c7;
  --phase-final: #7c3aed;
  --phase-max: #059669;

  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: 1px solid rgba(0, 151, 156, 0.18);
  --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 151, 156, 0.04) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(228, 113, 40, 0.03) 0%, transparent 45%);
  background-attachment: fixed;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* App Header & Layout */
.app-header {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 14px 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--arduino-teal), var(--arduino-teal-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 14px rgba(0, 151, 156, 0.25);
}

.brand-titles h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(0, 151, 156, 0.12);
  color: #00979C;
  border: 1px solid rgba(0, 151, 156, 0.3);
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Navegación por pestañas */
.app-nav {
  display: flex;
  background: #ffffff;
  padding: 4px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 151, 156, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow-x: auto;
  gap: 4px;
}

.nav-tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 151, 156, 0.06);
}

.nav-tab-btn.active {
  color: var(--arduino-teal);
  background: rgba(0, 151, 156, 0.12);
  border: 1px solid rgba(0, 151, 156, 0.35);
  box-shadow: 0 2px 6px rgba(0, 151, 156, 0.08);
}

.tab-counter {
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 9999px;
  background: rgba(0, 151, 156, 0.12);
  color: var(--arduino-teal);
  font-weight: 700;
}

/* Botones de acción en Header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Botones universales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #00979C, #008184);
  color: white;
  box-shadow: 0 4px 14px rgba(0, 151, 156, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #008184, #005C5F);
  box-shadow: 0 6px 18px rgba(0, 151, 156, 0.35);
  transform: translateY(-1px);
}

.btn-accent {
  background: linear-gradient(135deg, #E47128, #c95e1c);
  color: white;
  box-shadow: 0 4px 14px rgba(228, 113, 40, 0.25);
}
.btn-accent:hover {
  background: linear-gradient(135deg, #c95e1c, #9f4713);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(0, 151, 156, 0.35);
  color: var(--arduino-teal);
}
.btn-outline:hover {
  color: var(--arduino-teal-dark);
  border-color: var(--arduino-teal);
  background: rgba(0, 151, 156, 0.08);
}

.btn-success {
  background: #10b981;
  color: white;
}
.btn-success:hover {
  background: #059669;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--radius-md);
}

/* Contenedor principal */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 28px 60px 28px;
}

/* Tarjetas con Glassmorphism / Clean Card */
.glass-card {
  background: var(--bg-card);
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-card:hover {
  border-color: rgba(0, 151, 156, 0.35);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.07);
}

/* Aviso de Hipótesis */
.hypothesis-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 151, 156, 0.08);
  border: 1px solid rgba(0, 151, 156, 0.25);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 24px;
  color: #005C5F;
  font-size: 0.9rem;
  box-shadow: 0 2px 8px rgba(0, 151, 156, 0.05);
}
.hypothesis-banner svg {
  flex-shrink: 0;
  color: #00979C;
}

/* Barra táctica de estado actual y siguiente paso */
.timeline-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  background: #ffffff;
  border: 1px solid rgba(0, 151, 156, 0.18);
  border-radius: var(--radius-lg);
  padding: 18px 24px;
  margin-bottom: 30px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.status-info-cluster {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.current-phase-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 0.85rem;
  background: rgba(0, 151, 156, 0.1);
  border: 1px solid rgba(0, 151, 156, 0.3);
  color: #00767a;
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.pending-test-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(228, 113, 40, 0.1);
  border: 1px solid rgba(228, 113, 40, 0.35);
  color: #c95e1c;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%, 100% { border-color: rgba(228, 113, 40, 0.35); }
  50% { border-color: rgba(228, 113, 40, 0.7); box-shadow: 0 0 10px rgba(228, 113, 40, 0.2); }
}

/* ==========================================================================
   LÍNEA DE TIEMPO VERTICAL DE FASES
   ========================================================================== */

.timeline-vertical {
  position: relative;
  padding-left: 48px;
  margin: 20px 0 40px 0;
}

.timeline-track-line {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 19px;
  width: 3px;
  background: linear-gradient(to bottom, #ef4444, #E47128, #d97706, #00979C, #0284c7, #7c3aed, #059669);
  border-radius: 999px;
  opacity: 0.8;
}

.timeline-node-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  transition: all var(--transition-normal);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.timeline-node-card:hover {
  border-color: rgba(0, 151, 156, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

.timeline-node-card.is-active-phase {
  border-color: var(--phase-color, #00979C);
  box-shadow: 0 0 0 1px var(--phase-color, #00979C), 0 8px 24px rgba(0, 0, 0, 0.08);
}

.timeline-node-card.is-active-phase::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--phase-color, #00979C);
}

/* Icono marcador en el track */
.timeline-marker-pin {
  position: absolute;
  left: -48px;
  top: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--phase-color, #64748b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--phase-color, #64748b);
  font-weight: 800;
  font-size: 0.85rem;
  z-index: 2;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.timeline-node-card.is-active-phase .timeline-marker-pin {
  background: var(--phase-color, #00979C);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 151, 156, 0.35);
}

/* Cabecera del nodo de fase */
.phase-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  border-bottom: 1px solid transparent;
  transition: background var(--transition-fast);
}

.phase-header-bar:hover {
  background: #f8fafc;
}

.phase-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.phase-title-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.phase-threshold-badge {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  color: var(--text-secondary);
  font-family: monospace;
  font-weight: 600;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.phase-progress-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.progress-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.expand-chevron {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
}
.timeline-node-card.expanded .expand-chevron {
  transform: rotate(180deg);
  color: var(--arduino-teal);
}

/* Contenido expandido del nodo de fase */
.phase-expanded-body {
  padding: 24px;
  border-top: 1px solid rgba(0, 151, 156, 0.12);
  background: #f8fafc;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.phase-diagnostico-box {
  background: #ffffff;
  border-left: 4px solid var(--phase-color, #00979C);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-right: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 14px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.phase-diagnostico-box h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.phase-diagnostico-box p {
  font-size: 0.92rem;
  color: #334155;
  line-height: 1.6;
}

/* Dos columnas: Causas vs Opciones de prueba */
.phase-columns-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .phase-columns-grid {
    grid-template-columns: 1fr;
  }
}

.phase-col-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.phase-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 151, 156, 0.12);
}

.phase-col-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
}

/* Lista de Causas con Casilla */
.causas-list, .opciones-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.causa-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.06);
  transition: all var(--transition-fast);
}

.causa-item:hover {
  background: #f1f5f9;
  border-color: rgba(0, 151, 156, 0.25);
}

.causa-item.is-revisada {
  opacity: 0.7;
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
}

.causa-item.is-revisada .causa-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.custom-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #94a3b8;
  border-radius: 4px;
  background: #ffffff;
  cursor: pointer;
  margin-top: 2px;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.custom-checkbox:checked {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.custom-checkbox:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.causa-text {
  flex: 1;
  font-size: 0.88rem;
  color: #334155;
  line-height: 1.45;
}

.item-delete-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.causa-item:hover .item-delete-btn,
.opcion-item:hover .item-delete-btn {
  opacity: 1;
}
.item-delete-btn:hover {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.1);
}

/* Lista de Opciones de Prueba */
.opcion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid rgba(0, 151, 156, 0.15);
  transition: all var(--transition-fast);
}

.opcion-item:hover {
  background: #f1f5f9;
  border-color: rgba(0, 151, 156, 0.35);
}

.opcion-item.is-probada {
  border-left: 3px solid var(--accent-green);
  background: rgba(16, 185, 129, 0.04);
}

.opcion-left-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.opcion-text {
  font-size: 0.88rem;
  color: #334155;
  font-weight: 500;
}

.probada-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
  white-space: nowrap;
  font-weight: 700;
}

.add-inline-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.add-inline-input {
  flex: 1;
  background: #ffffff;
  border: 1px solid rgba(0, 151, 156, 0.25);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  color: var(--text-primary);
  font-size: 0.85rem;
}
.add-inline-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(0, 151, 156, 0.15);
}

/* ==========================================================================
   PANTALLA DE REGISTRO
   ========================================================================== */

.form-grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label .required-star {
  color: var(--accent-red);
}

.form-control {
  width: 100%;
  background: #ffffff;
  border: 1px solid rgba(0, 151, 156, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 151, 156, 0.15);
}

.live-phase-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: #f8fafc;
  border: 1px solid rgba(0, 151, 156, 0.2);
  margin-top: 10px;
}

/* ==========================================================================
   TABLAS Y FILTROS (HISTORIAL Y PRUEBAS)
   ========================================================================== */

.filter-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  padding: 16px;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 151, 156, 0.18);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.filters-cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-select, .search-input {
  background: #ffffff;
  border: 1px solid rgba(0, 151, 156, 0.25);
  color: var(--text-primary);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.filter-select:focus, .search-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.data-table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 151, 156, 0.18);
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 700;
  color: #475569;
  border-bottom: 2px solid rgba(0, 151, 156, 0.18);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover {
  color: var(--arduino-teal);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  color: #334155;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(0, 151, 156, 0.04);
}

/* Badges por Fase */
.badge-fase {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Badges de Estados de Pruebas */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}
.status-pill.pendiente {
  background: rgba(217, 119, 6, 0.12);
  color: #d97706;
  border: 1px solid rgba(217, 119, 6, 0.3);
}
.status-pill.supera-la-fase {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-pill.mantiene-la-hipotesis {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.3);
}
.status-pill.descartada {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   DIAGNÓSTICO: CARDS, ESTANCAMIENTO Y MAPA DE CALOR
   ========================================================================== */

.diagnostico-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stagnation-alert-card {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.stagnation-alert-card.warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #b45309;
}
.stagnation-alert-card.info {
  background: rgba(0, 151, 156, 0.08);
  border: 1px solid rgba(0, 151, 156, 0.25);
  color: #005C5F;
}

/* ==========================================================================
   CONFIGURACIÓN
   ========================================================================== */

.config-phase-row {
  display: grid;
  grid-template-columns: 200px 120px 120px 1fr 100px;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  border: 1px solid rgba(0, 151, 156, 0.15);
}

@media (max-width: 900px) {
  .config-phase-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   MODALES Y TOASTS
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-box {
  background: #ffffff;
  border: 1px solid rgba(0, 151, 156, 0.25);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  padding: 24px;
  position: relative;
  color: var(--text-primary);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 151, 156, 0.15);
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
}
.modal-close-btn:hover {
  color: var(--arduino-teal);
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid rgba(0, 151, 156, 0.25);
  color: #1e293b;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-item.success { border-left: 4px solid var(--accent-green); }
.toast-item.info { border-left: 4px solid var(--accent-teal); }
.toast-item.warning { border-left: 4px solid var(--accent-amber); }
.toast-item.error { border-left: 4px solid var(--accent-red); }
