/* ==========================================================================
   SUMINEXT INDUSTRIAL & DAEM FLUID CARE - PORTAL DE TELEMETRÍA Y MANTENIMIENTO
   Paleta Oficial Suminext: Deep Navy Slate, Industrial Energy Orange, Cyan & White
   ========================================================================== */

:root {
  /* Paleta Base Oficial Suminext (Coincide con styles.css) */
  --bg-primary: #07111f;
  --bg-secondary: #0b1d31;
  --bg-tertiary: #0e2646;
  --bg-card: rgba(14, 38, 70, 0.88);
  --bg-card-hover: rgba(20, 52, 94, 0.95);
  --bg-input: #08172b;

  --border-subtle: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --border-focus: #f36a21;
  --border-glow: rgba(243, 106, 33, 0.35);

  --text-main: #ffffff;
  --text-muted: #b8c8d8;
  --text-dim: #768a9e;

  /* Acentos Energéticos Suminext */
  --accent-orange: #f36a21;
  --accent-orange-hover: #e05810;
  --accent-gold: #ff9b45;
  --accent-cyan: #2bd9ff;
  --accent-blue: #0978f5;

  /* Semáforo Cárter de Salud Físico-Química */
  --status-green: #10b981;
  --status-green-glow: rgba(16, 185, 129, 0.4);
  --status-yellow: #f59e0b;
  --status-yellow-glow: rgba(245, 158, 11, 0.4);
  --status-red: #ef4444;
  --status-red-glow: rgba(239, 68, 68, 0.4);

  --font-heading: 'Barlow Condensed', sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-card: 0 14px 34px -10px rgba(0, 0, 0, 0.55), 0 0 1px 1px rgba(255, 255, 255, 0.08);
  --shadow-glow: 0 0 25px rgba(243, 106, 33, 0.25);
}

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

body.theme-dark {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 82% 18%, rgba(243, 106, 33, 0.12) 0%, transparent 42%),
    radial-gradient(circle at 12% 78%, rgba(43, 217, 255, 0.10) 0%, transparent 48%),
    radial-gradient(circle at 50% 50%, rgba(9, 120, 245, 0.06) 0%, transparent 60%),
    linear-gradient(180deg, #0b1d31 0%, var(--bg-primary) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   HEADER DEL PORTAL & IDENTIDAD SUMINEXT
   ========================================================================== */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 17, 31, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

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

.brand-group {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.2s ease;
}

.brand-logo:hover {
  transform: scale(1.02);
}

.brand-logo-img {
  height: 46px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.4));
}

.portal-badge {
  font-family: var(--font-heading);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ff9b45;
  background: rgba(243, 106, 33, 0.12);
  border: 1px solid rgba(243, 106, 33, 0.35);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.brand-separator {
  color: var(--text-dim);
  font-size: 1.2rem;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #94a3b8;
}

.status-dot.online {
  background-color: var(--status-green);
  box-shadow: 0 0 8px var(--status-green-glow);
}

.status-dot.offline {
  background-color: var(--status-yellow);
  box-shadow: 0 0 8px var(--status-yellow-glow);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.status-dot.pulsing {
  animation: pulse 1.8s infinite;
}

/* ==========================================================================
   ROLE SELECTOR TABS
   ========================================================================== */
.role-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.role-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
}

.role-tabs {
  display: flex;
  background: rgba(17, 24, 39, 0.9);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 0.2rem;
  overflow-x: auto;
  max-width: 100%;
}

.role-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.role-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.role-tab.active {
  background: linear-gradient(135deg, rgba(243, 106, 33, 0.35), rgba(232, 85, 18, 0.35));
  color: #ffffff;
  border: 1px solid rgba(243, 106, 33, 0.65);
  box-shadow: 0 4px 14px rgba(243, 106, 33, 0.25);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-session-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(11, 29, 49, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 4px 10px 4px 5px;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8a34, #e85512);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  display: grid;
  place-items: center;
  letter-spacing: 0.05em;
}

.user-meta-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-display-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #ffffff;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.66rem;
  color: #ff9b45;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 0.35rem;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.6);
}

.btn-login-trigger {
  background: linear-gradient(135deg, #ff8a34, #e85512);
  border: none;
  color: #ffffff;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(232, 85, 18, 0.35);
  transition: all 0.25s ease;
}

.btn-login-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232, 85, 18, 0.55);
}

.btn-ghost-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-ghost-sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   ROLE BANNER
   ========================================================================== */
.role-banner {
  background: linear-gradient(90deg, rgba(17, 24, 39, 0.7) 0%, rgba(10, 15, 29, 0.4) 100%);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.25rem 1.5rem;
}

.role-banner-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.role-avatar {
  font-size: 2.2rem;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-info {
  flex: 1;
}

.role-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.25rem;
}

.role-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.role-pill {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.role-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 900px;
}

/* ==========================================================================
   LAYOUT PRINCIPAL
   ========================================================================== */
.portal-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

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

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

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

.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.75rem;
}

/* ==========================================================================
   CARDS & CONTENEDORES
   ========================================================================== */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all 0.25s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

.card.card-glow {
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

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

.card-header {
  padding: 1.35rem 1.65rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-tag {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-cyan);
  margin-bottom: 0.2rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.card-body {
  padding: 1.65rem;
}

/* ==========================================================================
   FORMULARIOS & INPUTS
   ========================================================================== */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-dark {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-dark:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.input-unit-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-unit-wrapper .input-unit {
  position: absolute;
  right: 1rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  pointer-events: none;
}

.input-unit-wrapper .input-prefix {
  position: absolute;
  left: 1rem;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
  pointer-events: none;
}

.input-unit-wrapper .input-prefix + input {
  padding-left: 2rem;
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* BOTONES PRESET MARGEN */
.margin-presets {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.btn-preset {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-preset:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.btn-preset.active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 700;
}

/* ==========================================================================
   SIMULADOR DE PRECIO EN VIVO
   ========================================================================== */
.pricing-simulator-box {
  background: #080c18;
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 0.95rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sim-title {
  color: var(--text-dim);
  font-weight: 600;
}

.sim-blade-name {
  color: var(--accent-cyan);
  font-weight: 700;
}

.sim-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.sim-metric {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sim-metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  font-weight: 600;
}

.sim-metric-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.sim-metric-value.highlight {
  color: var(--accent-cyan);
}

.sim-metric.total {
  grid-column: 1 / -1;
  background: rgba(6, 182, 212, 0.08);
  border: 1px dashed rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.sim-metric-value.total-mxn {
  font-size: 1.5rem;
  color: #38bdf8;
  font-weight: 900;
}

/* ==========================================================================
   BOTONES Y ACCIONES
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.5);
  background: linear-gradient(135deg, #0891b2 0%, #1d4ed8 100%);
}

.card-footer-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.save-feedback {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--status-green);
}

/* ==========================================================================
   KPIS Y LISTADOS GLOBALES
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.kpi-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.kpi-number {
  font-family: var(--font-mono);
  font-size: 2.1rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 0.35rem;
}

.kpi-number.highlight { color: var(--accent-cyan); }
.kpi-number.warning { color: var(--status-yellow); }

.kpi-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

.plant-summary-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subheading {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.plant-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.plant-info strong {
  display: block;
  font-size: 0.9rem;
  color: #ffffff;
}

.plant-info span {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* BADGES */
.badge-accent {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.3);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.badge-verified {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-green);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.badge-status-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-green);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.badge-status-orange {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-yellow);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.badge-tag.green { background: rgba(16, 185, 129, 0.15); color: var(--status-green); }
.badge-tag.blue { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }

/* ==========================================================================
   DUELO DE DATOS (AUDITORÍA CRUZADA)
   ========================================================================== */
.duel-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.duel-card.alert {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.04);
}

.duel-badge-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.duel-alert-pill {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid var(--status-yellow);
  color: #fde68a;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.duel-time {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.duel-comparison {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.85rem;
}

.duel-party {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.duel-role {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

.duel-val {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
}

.duel-calc {
  font-size: 0.75rem;
  color: var(--accent-cyan);
}

.duel-vs {
  font-weight: 900;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.duel-status-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   GERENTE DE PLANTA - SEMÁFORO CÁRTER & TOP-UP
   ========================================================================== */
.machine-selector-pills {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.machine-pill {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 220px;
  position: relative;
  transition: all 0.2s ease;
}

.machine-pill:hover {
  background: rgba(255, 255, 255, 0.06);
}

.machine-pill.active {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.2);
}

.m-code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
}

.m-name {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.status-indicator {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-indicator.green { background-color: var(--status-green); box-shadow: 0 0 8px var(--status-green); }
.status-indicator.yellow { background-color: var(--status-yellow); box-shadow: 0 0 8px var(--status-yellow); }
.status-indicator.red { background-color: var(--status-red); box-shadow: 0 0 8px var(--status-red); }

.machine-telemetry-dashboard {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

.traffic-light-panel {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(10, 15, 29, 0.6) 100%);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.traffic-light-signal {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.traffic-light-signal.green {
  background: rgba(16, 185, 129, 0.2);
  border: 3px solid var(--status-green);
  box-shadow: 0 0 25px var(--status-green-glow);
}

.traffic-light-signal.green .signal-core {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--status-green);
  box-shadow: 0 0 15px var(--status-green);
}

.signal-badge {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--status-green);
}

.signal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0.15rem 0 0.35rem 0;
}

.signal-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* GAUGES */
.metrics-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.metric-gauge-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.gauge-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
}

.gauge-display {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0.35rem 0 0.65rem 0;
}

.gauge-value {
  font-family: var(--font-mono);
  font-size: 1.7rem;
  font-weight: 900;
  color: #ffffff;
}

.gauge-target {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.gauge-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.gauge-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.gauge-fill.green { background: var(--status-green); }
.gauge-fill.yellow { background: var(--status-yellow); }
.gauge-fill.red { background: var(--status-red); }
.gauge-fill.blue { background: var(--accent-cyan); }

.gauge-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* CALCULADORA TOP-UP */
.topup-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.topup-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.35rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.range-dark {
  width: 100%;
  accent-color: var(--accent-cyan);
}

.topup-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.topup-box {
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.topup-box.pure {
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.topup-box.water {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.topup-qty {
  font-family: var(--font-mono);
  font-size: 1.45rem;
  font-weight: 900;
  color: #ffffff;
}

.topup-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.2rem;
}

.topup-sub {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.topup-note-banner {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-left: 3px solid var(--accent-cyan);
}

/* ==========================================================================
   VISTA OPERADOR (PISO DE MAQUINADO CNC)
   ========================================================================== */
.operator-container {
  max-width: 540px;
  margin: 0 auto;
}

.operator-card {
  background: var(--bg-card);
  border: 2px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}

.operator-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.op-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.4);
  margin-bottom: 0.5rem;
}

.op-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: #ffffff;
}

.op-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.op-form-group {
  margin-bottom: 1.5rem;
}

.op-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.op-select-large {
  width: 100%;
  background: var(--bg-input);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.9rem 1rem;
  outline: none;
}

.op-touch-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.op-btn-step {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: #ffffff;
  font-size: 1.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.op-btn-step:hover, .op-btn-step:active {
  background: var(--accent-cyan);
  color: #000000;
  transform: scale(0.96);
}

.op-input-huge {
  flex: 1;
  height: 60px;
  background: var(--bg-input);
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 800;
  text-align: center;
  outline: none;
}

.op-input-huge:focus {
  border-color: var(--accent-cyan);
}

.op-hint-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.4rem;
}

.op-hint-row strong {
  color: var(--accent-cyan);
}

.op-level-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.op-level-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.75rem 0.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.op-level-btn.active {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.btn-op-submit {
  width: 100%;
  height: 68px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
  margin-top: 1.5rem;
}

.btn-op-submit:hover, .btn-op-submit:active {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.6);
}

.operator-result-box {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.operator-result-box.green {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid var(--status-green);
}

.operator-result-box.yellow {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid var(--status-yellow);
}

.operator-result-box.red {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid var(--status-red);
}

.result-icon { font-size: 2rem; }
.result-title { font-size: 1.1rem; font-weight: 800; color: #ffffff; }
.result-msg { font-size: 0.85rem; color: var(--text-muted); }

/* ==========================================================================
   CENTRO DE CONOCIMIENTO TÉCNICO
   ========================================================================== */
.knowledge-hub-section {
  margin-top: 4rem;
  padding-top: 3rem;
  border-top: 1px solid var(--border-subtle);
}

.text-center { text-align: center; }

.section-title {
  font-size: 1.85rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin: 0.5rem 0;
}

.section-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 750px;
  margin: 0 auto 2.5rem auto;
}

.knowledge-hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.knowledge-card-feature {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.feature-img-wrapper {
  position: relative;
  height: 240px;
  overflow: hidden;
}

.feature-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.knowledge-card-feature:hover .feature-img-wrapper img {
  transform: scale(1.03);
}

.feature-tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(10, 15, 29, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
}

.feature-body {
  padding: 1.75rem;
}

.feature-body h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.75rem;
}

.feature-body p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.knowledge-formula {
  background: #080c18;
  border: 1px dashed rgba(6, 182, 212, 0.4);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #38bdf8;
  text-align: center;
  margin: 1rem 0;
}

.bullet-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.bullet-list li strong {
  color: #ffffff;
}

/* TABLA COMPARATIVA DE FLUIDOS */
.fluid-comparison-box {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
}

.box-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
}

.table-responsive {
  overflow-x: auto;
}

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

.fluid-table th {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.fluid-table td {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

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

.fluid-table tr.highlight-row td {
  background: rgba(6, 182, 212, 0.06);
  color: #ffffff;
}

.product-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.product-badge.sem {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan);
}

.product-badge.cd {
  background: rgba(245, 158, 11, 0.2);
  color: var(--status-yellow);
  border: 1px solid var(--status-yellow);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.portal-footer {
  border-top: 1px solid var(--border-subtle);
  background: #080c18;
  padding: 1.5rem;
  margin-top: 4rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

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

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE & TABLETS)
   ========================================================================== */
@media (max-width: 1024px) {
  .machine-telemetry-dashboard {
    grid-template-columns: 1fr;
  }
  .knowledge-hero-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .portal-header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .role-selector-wrapper {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }
  .role-tabs {
    width: 100%;
  }
  .view-grid {
    grid-template-columns: 1fr;
  }
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .traffic-light-panel {
    flex-direction: column;
    text-align: center;
  }
  .topup-results-grid {
    grid-template-columns: 1fr;
  }
  .operator-card {
    padding: 1.25rem;
  }
  .portal-footer-container {
    flex-direction: column;
    text-align: center;
  }
}

/* ==========================================================================
   MODAL DE AUTENTICACIÓN & REGISTRO DE EMPRESAS (ONBOARDING)
   ========================================================================== */
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(5, 12, 22, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow-y: auto;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.auth-modal-card {
  background: linear-gradient(180deg, #0d223d 0%, #071324 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 680px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 40px rgba(243, 106, 33, 0.15);
  overflow: hidden;
  position: relative;
  margin: auto;
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.auth-modal-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.auth-logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.auth-badge {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ff9b45;
  background: rgba(243, 106, 33, 0.14);
  border: 1px solid rgba(243, 106, 33, 0.35);
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.btn-close-modal {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-close-modal:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ffffff;
  border-color: rgba(239, 68, 68, 0.5);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(5, 15, 28, 0.6);
  border-bottom: 1px solid var(--border-subtle);
}

.auth-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.auth-tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.02);
}

.auth-tab-btn.active {
  color: #ff9b45;
  border-bottom-color: #f36a21;
  background: rgba(243, 106, 33, 0.08);
}

.auth-form {
  padding: 2rem;
}

.auth-intro {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.7;
}

.input-with-icon input {
  padding-left: 2.6rem !important;
}

.form-divider-title {
  font-family: var(--font-heading);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2bd9ff;
  border-bottom: 1px solid rgba(43, 217, 255, 0.2);
  padding-bottom: 0.4rem;
  margin: 1.5rem 0 1rem;
}

.btn-auth-submit {
  width: 100%;
  background: linear-gradient(135deg, #1286ff, #0965dd);
  border: none;
  color: #ffffff;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.95rem 1.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
  box-shadow: 0 6px 20px rgba(18, 134, 255, 0.35);
  transition: all 0.25s ease;
}

.btn-auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(18, 134, 255, 0.5);
}

.btn-auth-submit.primary-orange {
  background: linear-gradient(135deg, #ff8a34, #e85512);
  box-shadow: 0 6px 20px rgba(232, 85, 18, 0.35);
}

.btn-auth-submit.primary-orange:hover {
  box-shadow: 0 10px 28px rgba(232, 85, 18, 0.55);
}

.auth-alert {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
}

.auth-alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.auth-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.quick-demo-accounts {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.quick-demo-title {
  display: block;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.demo-chips {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.demo-chip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.76rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.demo-chip:hover {
  background: rgba(243, 106, 33, 0.12);
  border-color: rgba(243, 106, 33, 0.4);
  color: #ffffff;
  transform: translateX(4px);
}

.demo-chip b {
  color: #ff9b45;
}
