/* ELIS NAJERA 4.0 - Estilos Industriales */
:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --header-bg: #ffffff;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;
  --primary-blue: #0284c7;
  --primary-blue-hover: #0369a1;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --border-color: #334155;
  --border-light: #e2e8f0;
  --disabled-bg: linear-gradient(135deg, rgba(30, 41, 59, 0.4) 0%, rgba(15, 23, 42, 0.7) 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header Blanco Radiante */
.app-header {
  background-color: var(--header-bg);
  color: var(--text-dark);
  height: 70px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-logo {
  height: 48px;
  object-fit: contain;
}

.header-title-container {
  display: flex;
  flex-direction: column;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #0369a1;
}

.header-subtitle {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #f1f5f9;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-light);
}

.user-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--primary-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-dark);
}

.user-role {
  font-size: 0.7rem;
  font-weight: 600;
  color: #0284c7;
  text-transform: uppercase;
}

.btn-header {
  background-color: #e2e8f0;
  color: var(--text-dark);
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-header:hover {
  background-color: #cbd5e1;
}

.btn-logout {
  background-color: #fee2e2;
  color: #dc2626;
}

.btn-logout:hover {
  background-color: #fca5a5;
}

.btn-login {
  background-color: var(--primary-blue);
  color: white;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.btn-login:hover {
  background-color: var(--primary-blue-hover);
  color: white;
  transform: translateY(-1px);
}

/* Layout Principal */
.main-wrapper {
  display: flex;
  flex: 1;
}

/* Sidebar de Menú a la Izquierda */
.sidebar {
  width: 260px;
  background-color: #0b1120;
  border-right: 1px solid var(--border-color);
  padding: 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin: 12px 12px 4px 12px;
}

.menu-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.25s ease;
}

.menu-btn-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-btn i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.menu-btn:hover:not(.locked) {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
  transform: translateX(4px);
}

.menu-btn.active {
  background-color: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
}

/* Botón Bloqueado / Degradado */
.menu-btn.locked {
  background: var(--disabled-bg);
  color: #475569;
  border: 1px dashed #334155;
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(80%);
}

.lock-badge {
  font-size: 0.75rem;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.15);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Área de Contenido Principal */
.content-area {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  background-color: var(--bg-dark);
}

.view-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.view-section.active {
  display: block;
}

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

/* Página de Inicio /inicio */
.inicio-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-card {
  width: 100%;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.hero-image {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  border-radius: 12px;
  margin-top: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  border: 2px solid #334155;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  width: 100%;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s;
}

.metric-card:hover {
  transform: translateY(-4px);
}

.metric-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.metric-icon.blue { background-color: rgba(2, 132, 199, 0.2); color: #38bdf8; }
.metric-icon.green { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
.metric-icon.amber { background-color: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.metric-icon.purple { background-color: rgba(168, 85, 247, 0.2); color: #c084fc; }

.metric-info h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 4px;
}

/* Tarjetas Gráficas de Máquinas (Módulo Producción) */
.machines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 24px;
  margin-top: 20px;
}

.machine-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.machine-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #0284c7, #10b981);
}

.machine-card.clickable-card {
  cursor: pointer;
}

.machine-card.clickable-card:hover {
  transform: translateY(-6px);
  border-color: #38bdf8;
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.3);
}

.card-link-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(2, 132, 199, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  float: right;
}

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

.machine-title-box {
  display: flex;
  align-items: center;
  gap: 14px;
}

.machine-avatar {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.machine-avatar.calandra-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.machine-avatar.calandra-avatar i {
  font-size: 1.12rem;
}

.machine-avatar.calandra-avatar .calandra-avatar-num {
  font-size: 1.18rem;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1;
}

.machine-title-text h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: 0.5px;
}

.machine-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Banner de Turno y Horario */
.shift-banner {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 8px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.shift-banner .shift-title {
  font-weight: 700;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 6px;
}

.shift-banner .shift-time {
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Subtítulo Resumen Turno Actual */
.section-subtitle-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  margin-bottom: 2px;
}

.section-subtitle-bar h4 {
  font-size: 0.85rem;
  font-weight: 800;
  color: #fbbf24;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.section-subtitle-bar .subtitle-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.4), transparent);
}

/* Cuadrícula de Indicadores de Turno (3 columnas) */
.shift-indicators-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.shift-indicator-box {
  background-color: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: border-color 0.2s;
}

.shift-indicator-box:hover {
  border-color: #38bdf8;
}

.shift-indicator-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
  letter-spacing: 0.4px;
}

.shift-indicator-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: #34d399;
}

/* Estilos de Tarjetas Grandes de Colores Contrastantes para Dashboard Túnel de Lavado */
.dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-top: 24px;
  margin-bottom: 30px;
}

/* Dashboard Ampliado Rediseñado (4 columnas x 2 filas) */
.dashboard-grid-layout {
  display: grid;
  grid-template-columns: 240px 1fr 1fr 220px;
  grid-template-rows: auto 1fr;
  gap: 16px;
  margin-top: 16px;
}

.kpi-card-striking {
  border-radius: 14px;
  padding: 18px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.kpi-card-striking:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.kpi-card-cyan {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #0f172a 100%);
  border-color: #38bdf8;
}

.kpi-card-amber {
  background: linear-gradient(135deg, #d97706 0%, #b45309 50%, #0f172a 100%);
  border-color: #fbbf24;
}

.kpi-card-emerald {
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #0f172a 100%);
  border-color: #34d399;
}

.kpi-card-red {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 50%, #0f172a 100%);
  border-color: #ef4444;
}

.kpi-card-orange {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 50%, #0f172a 100%);
  border-color: #f97316;
}

.kpi-card-green {
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #0f172a 100%);
  border-color: #34d399;
}

.kpi-card-purple {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 50%, #0f172a 100%);
  border-color: #a78bfa;
}

.kpi-card-indigo {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 50%, #0f172a 100%);
  border-color: #818cf8;
}

.status-inactivo {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.status-inactivo .status-dot {
  background-color: #94a3b8;
  box-shadow: 0 0 6px #94a3b8;
}

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.kpi-card-header h4 {
  font-size: 0.82rem;
  font-weight: 800;
  color: #f8fafc;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.kpi-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: white;
  backdrop-filter: blur(4px);
}

.kpi-big-number {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 6px 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.kpi-card-subtext {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.25);
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  align-self: flex-start;
}

.machine-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-operativa {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34d399;
  box-shadow: 0 0 8px #34d399;
}

/* Cuadrícula de Métricas Operativas */
.telemetry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.telemetry-item {
  background-color: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--border-color);
  padding: 12px 14px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}

.telemetry-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.telemetry-value {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Barra de OEE y Rendimiento */
.performance-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.performance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.oee-value-tag {
  color: #38bdf8;
  font-weight: 800;
  font-size: 0.9rem;
}

.progress-track {
  width: 100%;
  height: 10px;
  background-color: #0b1120;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7 0%, #10b981 100%);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.program-footer {
  font-size: 0.78rem;
  color: #94a3b8;
  background: rgba(2, 132, 199, 0.08);
  border: 1px dashed rgba(56, 189, 248, 0.25);
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modales y Formularios */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay.active,
.modal-overlay[style*="display: flex"],
.modal-overlay[style*="display:flex"],
#modal-peso-vt.active,
#modal-peso-vt[style*="display: flex"],
#login-modal.active,
#login-modal[style*="display: flex"] {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 480px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
  position: relative;
  z-index: 1000000;
}

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

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: #0f172a;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: white;
  font-size: 0.95rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
}

.btn-primary {
  background-color: var(--primary-blue);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}

.btn-primary:hover {
  background-color: var(--primary-blue-hover);
}

/* Tablas estilo industrial */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin-top: 15px;
}

.data-table th, .data-table td {
  padding: 14px 18px;
  text-align: left;
}

.data-table th {
  background-color: #0b1120;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.data-table tr {
  border-bottom: 1px solid var(--border-color);
}

.data-table tr:last-child {
  border-bottom: none;
}

.data-table tr:hover {
  background-color: rgba(255, 255, 255, 0.02);
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-admin { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.badge-direccion { background: rgba(56, 189, 248, 0.2); color: #38bdf8; }
.badge-produccion { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-mtto { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* Tarjetas Compactas de Indicadores Generales de Turno */
.dashboard-secondary-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 24px;
}

.kpi-card-compact {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card-compact:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
}

.kpi-compact-info h5 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-compact-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 2px;
}

.kpi-compact-sub {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 2px;
}

.kpi-compact-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(2, 132, 199, 0.15);
  color: #38bdf8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.col-secondary-kpis {
  grid-column: 4;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: space-between;
}

.col-secondary-kpis .kpi-card-compact {
  padding: 10px 14px;
  border-radius: 12px;
}

/* Gráfica de Avance Productivo del Turno */
.chart-section-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

.chart-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-header-title h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-main);
}

.chart-wrapper {
  position: relative;
  height: 320px;
  width: 100%;
}

/* ==========================================================================
   ESTILOS CALANDRAS 2 & 3: TARJETAS DE PRODUCCIÓN Y GRÁFICA HORA A HORA
   ========================================================================== */

.status-valle-alert {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.status-valle-alert .status-dot {
  background-color: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
}

.calandra-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.calandra-kpi-box {
  background-color: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  padding: 10px 10px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: all 0.2s ease;
  min-height: 94px;
  justify-content: space-between;
}

.calandra-kpi-box:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.calandra-kpi-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 5px;
  letter-spacing: 0.3px;
}

.calandra-kpi-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
  line-height: 1.2;
}

.calandra-pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 6px;
  width: 100%;
}

.cal-badge-g {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cal-badge-p {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cal-badge-subtle {
  font-size: 0.95rem;
  color: #94a3b8;
}

.calandra-kpi-box .cal-badge-g,
.calandra-kpi-box .cal-badge-p {
  font-size: 0.72rem;
  padding: 2px 6px;
}

.valle-pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.valle-pill.running {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.valle-pill.in-valle {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulse-valle 2s infinite;
}

@keyframes pulse-valle {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

.calandra-chart-wrapper {
  margin-top: 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calandra-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.calandra-chart-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.calandra-chart-subtitle {
  font-size: 0.7rem;
  color: #94a3b8;
}

.calandra-chart-canvas-box {
  position: relative;
  height: 190px;
  width: 100%;
}

/* Layout del Dashboard Ampliado de Calandras (4 cols x 2 filas, igual a Túnel de Lavado) */
.calandra-dashboard-grid-layout {
  display: grid;
  grid-template-columns: 260px 1fr 1fr 1fr;
  grid-template-rows: auto 1fr;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 1200px) {
  .calandra-dashboard-grid-layout {
    grid-template-columns: repeat(2, 1fr);
  }
  .calandra-dashboard-grid-layout .calandra-card-kg-hora {
    grid-column: 1 !important;
    grid-row: auto !important;
  }
  .calandra-dashboard-grid-layout .calandra-chart-section {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }
}

@media (max-width: 768px) {
  .calandra-dashboard-grid-layout {
    grid-template-columns: 1fr;
  }
}

/* Estilos para el Informe PDF y Modal de Previsualización */
#modal-informe-pdf.active,
#modal-informe-pdf[style*="display: flex"],
#modal-informe-pdf[style*="display:flex"] {
  display: flex !important;
}

#informe-pdf-paper {
  background: #ffffff;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  line-height: 1.45;
  font-size: 9.5pt;
}

@media print {
  body * {
    visibility: hidden !important;
  }
  #modal-informe-pdf,
  #modal-informe-pdf * {
    visibility: visible !important;
  }
  #modal-informe-pdf {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: transparent !important;
    backdrop-filter: none !important;
    display: block !important;
    overflow: visible !important;
    z-index: 99999 !important;
  }
  #modal-informe-pdf > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    overflow: visible !important;
  }
  #modal-informe-pdf > div > div:first-child {
    display: none !important;
  }
  #modal-informe-pdf > div > div:last-child {
    padding: 0 !important;
    background: transparent !important;
  }
  #informe-pdf-paper {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10mm !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
}


/* ========================================================
   MÓDULO DE RENDIMIENTO Y PERFORMANCE DE LA JETSON
   ======================================================== */
.rendimiento-header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 16px;
  padding: 22px 26px;
  margin-bottom: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.rend-header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.rend-icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #38bdf8;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.2);
}

.rend-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.rend-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: rendPulse 2s infinite ease-in-out;
}

@keyframes rendPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #34d399; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.rend-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.rend-timer-box, .rend-last-update-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}

.rend-timer-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rend-timer-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
  font-family: monospace;
}

.rend-btn-measure {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  border: 1px solid #38bdf8;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
  transition: all 0.25s ease;
}

.rend-btn-measure:hover:not(:disabled) {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(56, 189, 248, 0.5);
}

.rend-btn-measure:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* Grilla KPI */
.rend-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.rend-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.rend-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.4);
}

.rend-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.rend-card-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rend-card-main-val {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}

.rend-huge-val {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: #f8fafc;
}

.rend-val-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.rend-progress-track {
  width: 100%;
  height: 8px;
  background-color: rgba(51, 65, 85, 0.6);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.rend-progress-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.rend-progress-fill.blue { background: linear-gradient(90deg, #0284c7, #38bdf8); }
.rend-progress-fill.cyan { background: linear-gradient(90deg, #06b6d4, #22d3ee); }
.rend-progress-fill.purple { background: linear-gradient(90deg, #8b5cf6, #c084fc); }
.rend-progress-fill.green { background: linear-gradient(90deg, #059669, #34d399); }
.rend-progress-fill.amber { background: linear-gradient(90deg, #d97706, #fbbf24); }
.rend-progress-fill.red { background: linear-gradient(90deg, #dc2626, #f87171); }

.rend-card-footer {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
  padding-top: 10px;
}

.rend-pill-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rend-pill-badge.blue { background: rgba(2, 132, 199, 0.18); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.rend-pill-badge.green { background: rgba(16, 185, 129, 0.18); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.3); }
.rend-pill-badge.purple { background: rgba(168, 85, 247, 0.18); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.3); }
.rend-pill-badge.amber { background: rgba(245, 158, 11, 0.18); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.rend-pill-badge.red { background: rgba(239, 68, 68, 0.18); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.3); }

.rend-card-details-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
  padding-top: 10px;
}

.rend-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Grillas de Gráficos Chart.js */
.rend-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.rend-chart-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.rend-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.rend-chart-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rend-chart-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.7);
  padding: 3px 8px;
  border-radius: 6px;
}

.rend-chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Sub-grillas Cores y Térmicas */
.rend-subgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.rend-detail-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.rend-section-subtitle {
  font-size: 1.05rem;
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rend-cores-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.rend-core-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rend-core-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.rend-core-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
}

.rend-core-freq {
  font-size: 0.72rem;
  color: #38bdf8;
  font-weight: 600;
}

.rend-thermals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
}

.rend-thermal-item {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rend-thermal-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.rend-thermal-temp {
  font-size: 1.2rem;
  font-weight: 800;
  color: #34d399;
}

/* Tablas de Servicios y Procesos */
.rend-table-card {
  background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.rend-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.rend-table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.rend-table th {
  background-color: rgba(15, 23, 42, 0.7);
  color: #94a3b8;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.rend-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4);
  color: #f8fafc;
  vertical-align: middle;
}

.rend-table tr:hover td {
  background-color: rgba(51, 65, 85, 0.25);
}

.rend-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.rend-status-tag.running {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.rend-status-tag.stopped {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

.rend-code-pill {
  font-family: monospace;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #38bdf8;
}

