/* ==========================================================================
   SUMINEXT INDUSTRIAL & DAEM FLUID CARE - HIGH-END COCKPIT & PORTAL 2026
   Estética: Modern Industrial Executive Cockpit (Ultra-Nítido, Glassmorphism & Telemetría)
   Colores: Slate técnico (#f8fafc), Blanco puro, Azul Marino Suminext (#0b192c), 
            Naranja Energético (#f36a21), Cyan DAEM (#0284c7), Verde Bioestable (#10b981)
   ========================================================================== */

:root {
  /* Lienzo & Superficies */
  --bg-body: #f1f5f9;
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-surface-subtle: #f8fafc;
  --bg-navy: #0b192c;
  --bg-navy-dark: #07111f;
  --bg-navy-card: #0f233d;

  /* Bordes & Glassmorphism */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #f36a21;
  --glass-bg: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(226, 232, 240, 0.8);

  /* Tipografía */
  --text-dark: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #ffffff;

  /* Acentos de Marca Suminext & DAEM */
  --suminext-orange: #f36a21;
  --suminext-orange-hover: #e05810;
  --suminext-orange-glow: rgba(243, 106, 33, 0.25);
  --daem-blue: #0284c7;
  --daem-blue-light: #e0f2fe;
  --daem-cyan: #06b6d4;

  /* Semáforos Físico-Químicos (Alta Visibilidad en Planta) */
  --status-green-bg: #ecfdf5;
  --status-green-border: #a7f3d0;
  --status-green-text: #065f46;
  --status-green-badge: #10b981;

  --status-yellow-bg: #fffbeb;
  --status-yellow-border: #fde68a;
  --status-yellow-text: #92400e;
  --status-yellow-badge: #f59e0b;

  --status-red-bg: #fef2f2;
  --status-red-border: #fecaca;
  --status-red-text: #991b1b;
  --status-red-badge: #ef4444;

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

  /* Sombras y Radios */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 16px 36px -6px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  --shadow-instrument: 0 12px 30px rgba(11, 25, 44, 0.12), inset 0 2px 4px rgba(255, 255, 255, 0.8);
}

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

body {
  background-color: var(--bg-body);
  background-image: 
    radial-gradient(ellipse at 15% 10%, rgba(2, 132, 199, 0.05) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 60%, rgba(243, 106, 33, 0.04) 0%, transparent 45%);
  background-attachment: fixed;
  color: var(--text-body);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   HEADER EJECUTIVO (AZUL MARINO PROFUNDO CON LOGO OFICIAL SUMINEXT)
   ========================================================================== */
.portal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #ffffff;
  background-image: none;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  padding: 0.75rem 1.75rem;
}

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

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.brand-logo-img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.portal-badge {
  background: rgba(243, 106, 33, 0.1);
  color: #ea580c;
  border: 1px solid rgba(243, 106, 33, 0.3);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
}

.api-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.btn-header-link {
  color: #334155;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.btn-header-link:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: translateY(-1px);
}

/* ==========================================================================
   BARRA DE PESTAÑAS FUNCIONALES
   ========================================================================== */
.portal-nav-bar {
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  position: sticky;
  top: 61px;
  z-index: 90;
}

.portal-nav-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0 1.75rem;
  overflow-x: auto;
}

.nav-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.95rem 1.35rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-tool-btn:hover {
  color: var(--text-dark);
  background: #f8fafc;
}

.nav-tool-btn.active {
  color: var(--suminext-orange);
  border-bottom-color: var(--suminext-orange);
  font-weight: 700;
}

/* ==========================================================================
   BARRA DE ESCENARIOS RÁPIDOS / CASOS INDUSTRIALES PREDEFINIDOS
   ========================================================================== */
.scenarios-strip-wrap {
  margin-bottom: 1.5rem;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.scenarios-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.scenarios-pills-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
}

.scenario-chip {
  padding: 6px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border-medium);
  background: #f8fafc;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.scenario-chip:hover {
  border-color: var(--suminext-blue);
  background: var(--daem-blue-light);
  color: var(--daem-blue);
  transform: translateY(-1px);
}

.scenario-chip.active {
  background: #0b192c;
  border-color: #f36a21;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(11, 25, 44, 0.25);
}

/* ==========================================================================
   CONTENIDO PRINCIPAL
   ========================================================================== */
.portal-main {
  max-width: 1440px;
  margin: 1.5rem auto 4rem;
  padding: 0 1.75rem;
}

.tool-panel {
  display: none;
}

.tool-panel.active {
  display: block;
}

/* Grillas Modernas */
.card-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1040px) {
  .card-grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--suminext-orange);
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-dark);
}

.card-body {
  padding: 1.5rem;
}

/* ==========================================================================
   FORMULARIO Y CAMPOS DE ENTRADA INDUSTRIALES
   ========================================================================== */
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 680px) {
  .form-row-2, .form-row-3 {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0.85rem;
}

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

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

.input-control:focus {
  border-color: var(--suminext-orange);
  box-shadow: 0 0 0 3px var(--suminext-orange-glow);
}

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

.input-with-unit input {
  padding-right: 3.5rem;
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
}

.unit-label {
  position: absolute;
  right: 0.85rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-muted);
  pointer-events: none;
}

.help-text {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ==========================================================================
   INSTRUMENTO 1: REFRACTÓMETRO ÓPTICO INTERACTIVO (COCKPIT EYEPIECE)
   ========================================================================== */
.refractometer-instrument-box {
  background: linear-gradient(135deg, #09121f 0%, #0f1e33 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}

.refractometer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
}

.refractometer-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.refractometer-sub {
  font-size: 0.74rem;
  color: #94a3b8;
  font-family: var(--font-mono);
}

.eyepiece-assembly {
  position: relative;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: #000000;
  padding: 8px;
  box-shadow: 
    0 0 0 6px #1e293b,
    0 0 0 8px #0f172a,
    0 12px 30px rgba(0, 0, 0, 0.6);
  cursor: ns-resize;
  user-select: none;
}

.eyepiece-lens {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Zona Azul de Luz de Día (Arriba) */
.optical-daylight-blue {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%; /* Ajustado por JS */
  background: linear-gradient(180deg, #1d4ed8 0%, #2563eb 80%, #3b82f6 100%);
  transition: height 0.15s ease-out;
}

/* Zona Blanca de Prisma (Abajo) */
.optical-prism-white {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%; /* Ajustado por JS */
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  transition: height 0.15s ease-out;
}

/* Línea de Demarcación Láser */
.optical-boundary-line {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: #f36a21;
  box-shadow: 0 0 8px #f36a21, 0 0 2px #ffffff;
  top: 60%; /* Ajustado por JS */
  transform: translateY(-50%);
  z-index: 10;
  transition: top 0.15s ease-out;
}

/* Retícula Graduada Oficial */
.optical-reticle-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
}

.reticle-axis-y {
  position: absolute;
  left: 50%;
  top: 10%;
  bottom: 10%;
  width: 1px;
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 1px 0 0 rgba(255, 255, 255, 0.4);
}

.reticle-marks {
  position: absolute;
  left: 0;
  right: 0;
  top: 10%;
  bottom: 10%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.85);
  text-shadow: 0 0 3px #ffffff;
}

.reticle-mark-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
}

.reticle-mark-row::after {
  content: '';
  position: absolute;
  left: calc(50% - 6px);
  width: 12px;
  height: 1px;
  background: rgba(0, 0, 0, 0.5);
}

.optical-lens-flare {
  position: absolute;
  top: -20%;
  left: -20%;
  width: 140%;
  height: 140%;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
  z-index: 30;
}

/* Control Deslizante de Grados Brix */
.refractometer-slider-control {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
}

.slider-readout {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.slider-val-big {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
}

.slider-val-sub {
  font-size: 0.7rem;
  font-weight: 700;
  color: #f36a21;
}

.brix-range-input {
  flex: 1;
  accent-color: #f36a21;
  cursor: pointer;
}

/* ==========================================================================
   INSTRUMENTO 2: RELOJES COCKPIT / GAUGES RADIALES SVG
   ========================================================================== */
.gauges-cockpit-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 540px) {
  .gauges-cockpit-strip {
    grid-template-columns: 1fr;
  }
}

.cockpit-gauge-card {
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.gauge-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.5rem;
}

.gauge-title {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
}

.gauge-target-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: #ffffff;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-medium);
  color: var(--text-dark);
}

.gauge-svg-wrap {
  position: relative;
  width: 150px;
  height: 90px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.gauge-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gauge-arc-track {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 12;
  stroke-linecap: round;
}

.gauge-arc-fill {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  stroke-dasharray: 188.5;
  stroke-dashoffset: 60;
  transition: stroke-dashoffset 0.4s ease, stroke 0.3s ease;
}

.gauge-digital-readout {
  position: absolute;
  bottom: 4px;
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.gauge-readout-num {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.gauge-readout-unit {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
}

.gauge-footer-status {
  margin-top: 0.65rem;
  font-size: 0.76rem;
  font-weight: 700;
  text-align: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   INSTRUMENTO 3: TANQUE DE CÁRTER CNC EN CORTE (SIMULADOR DE FLUIDO)
   ========================================================================== */
.sump-tank-simulator {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.tank-simulator-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.tank-title-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

.tank-visual-glass {
  position: relative;
  height: 130px;
  background: #f8fafc;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.04);
}

/* Capa de Aceite Tramposo (Tramp Oil) */
.tank-tramp-oil-film {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(90deg, #d97706, #b45309, #d97706);
  box-shadow: 0 2px 6px rgba(180, 83, 9, 0.4);
  z-index: 15;
  display: none; /* Visible si pH bajo o alerta */
}

/* Cuerpo de Fluido DAEM SEM500 */
.tank-fluid-level {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 75%; /* Dinámico */
  background: linear-gradient(180deg, rgba(2, 132, 199, 0.75) 0%, rgba(3, 105, 161, 0.9) 100%);
  transition: height 0.4s ease, background 0.4s ease;
  z-index: 5;
}

.tank-fluid-level.CRITICO {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.75) 0%, rgba(185, 28, 28, 0.9) 100%);
}

.tank-fluid-level.ALERTA {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.75) 0%, rgba(180, 83, 9, 0.9) 100%);
}

/* Olas en la Superficie del Fluido */
.tank-fluid-waves {
  position: absolute;
  top: -12px;
  left: 0;
  width: 200%;
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 20'%3E%3Cpath d='M0 10 Q 200 0 400 10 T 800 10 L 800 20 L 0 20 Z' fill='rgba(2, 132, 199, 0.75)'/%3E%3C/svg%3E") repeat-x;
  animation: waveMotion 4s linear infinite;
  opacity: 0.8;
}

@keyframes waveMotion {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Regla Graduada Lateral */
.tank-ruler-marks {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  z-index: 20;
  pointer-events: none;
  padding: 6px 0;
}

.tank-stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

/* ==========================================================================
   SEMÁFORO DE SALUD FÍSICO-QUÍMICA (MÁXIMA VISIBILIDAD)
   ========================================================================== */
.health-banner {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  border: 1px solid transparent;
  transition: all 0.3s ease;
}

.health-banner.VERDE {
  background: var(--status-green-bg);
  border-color: var(--status-green-border);
  color: var(--status-green-text);
}

.health-banner.AMARILLO {
  background: var(--status-yellow-bg);
  border-color: var(--status-yellow-border);
  color: var(--status-yellow-text);
}

.health-banner.ROJO {
  background: var(--status-red-bg);
  border-color: var(--status-red-border);
  color: var(--status-red-text);
}

.health-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.health-details {
  flex: 1;
}

.health-status-badge {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-block;
  margin-bottom: 4px;
}

.health-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: inherit;
}

.health-desc {
  font-size: 0.88rem;
  line-height: 1.45;
  color: inherit;
  opacity: 0.92;
}

/* ==========================================================================
   DOSIFICACIÓN TOP-UP EXACTA
   ========================================================================== */
.topup-box-wrapper {
  background: #ffffff;
  border: 2px dashed #bae6fd;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  background-image: radial-gradient(ellipse at top right, rgba(2, 132, 199, 0.05) 0%, transparent 60%);
}

.topup-box-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topup-doses {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.topup-dose-item {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  transition: transform 0.2s;
}

.topup-dose-item.pure {
  border-color: #7dd3fc;
  background: #f0f9ff;
}

.topup-dose-item.water {
  border-color: #cbd5e1;
  background: #ffffff;
}

.dose-qty {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--suminext-blue);
  line-height: 1.1;
  margin-bottom: 4px;
}

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

/* ==========================================================================
   BOTONES DE ACCIÓN & WHATSAPP
   ========================================================================== */
.action-buttons-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

@media (max-width: 600px) {
  .action-buttons-group {
    grid-template-columns: 1fr;
  }
}

/* Historial operativo visible para clientes */
.client-history-section { margin:1.5rem 0; padding:clamp(1rem,2.2vw,1.75rem); background:#fff; border:1px solid #dce5ee; border-radius:20px; box-shadow:0 14px 36px rgba(7,21,37,.07); }
.client-history-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:1rem; margin-bottom:1.2rem; }
.client-history-heading h3 { margin:.35rem 0 .15rem; color:#071525; font-size:1.35rem; }.client-history-heading p{margin:0;color:#64748b;font-size:.86rem}
.history-live-badge { color:#047857; background:#ecfdf5; border:1px solid #a7f3d0; border-radius:999px; padding:6px 10px; font-size:.72rem; font-weight:800; white-space:nowrap; }
.history-kpis { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:14px; }.history-kpis article{padding:14px;background:#f5f8fb;border:1px solid #e3eaf1;border-radius:14px}.history-kpis small{display:block;color:#64748b;font-size:.7rem;text-transform:uppercase;font-weight:800}.history-kpis strong{display:block;margin-top:4px;color:#0b2138;font-size:1.25rem}
.history-layout { display:grid; grid-template-columns:minmax(260px,.7fr) minmax(520px,1.3fr); gap:14px; }.history-chart-card,.history-table-card{border:1px solid #e3eaf1;border-radius:14px;overflow:hidden}.history-card-title{padding:12px 14px;font-size:.8rem;font-weight:800;color:#334155;background:#f8fafc;border-bottom:1px solid #e3eaf1}
.history-bars{height:190px;display:flex;align-items:flex-end;justify-content:space-around;gap:10px;padding:20px 16px 12px}.history-month{height:100%;flex:1;min-width:28px;display:grid;grid-template-rows:1fr auto auto;text-align:center;gap:4px}.history-bar-track{position:relative;min-height:100px}.history-bar-track span{position:absolute;bottom:0;left:18%;right:18%;border-radius:8px 8px 3px 3px;background:linear-gradient(#ff985c,#f36a21)}.history-month strong{font-size:.72rem;color:#0b2138}.history-month small{color:#64748b;text-transform:capitalize}
.history-table{width:100%;border-collapse:collapse;font-size:.75rem}.history-table th,.history-table td{padding:9px 11px;border-bottom:1px solid #eef2f6;text-align:left;white-space:nowrap}.history-table th{color:#64748b;background:#fbfcfd}.history-table td small{display:block;color:#94a3b8;max-width:140px;overflow:hidden;text-overflow:ellipsis}.history-status{display:inline-block;padding:3px 7px;border-radius:999px;font-size:.66rem;font-weight:900}.history-status.verde{color:#047857;background:#ecfdf5}.history-status.amarillo{color:#b45309;background:#fffbeb}.history-status.rojo{color:#b91c1c;background:#fef2f2}.history-loading{padding:2rem;text-align:center;color:#64748b}.history-loading.error{color:#b91c1c}
@media(max-width:900px){.history-kpis{grid-template-columns:1fr 1fr}.history-layout{grid-template-columns:1fr}.history-table-card{min-width:0}.client-history-heading{flex-direction:column}}

.btn-primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: var(--suminext-orange);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px var(--suminext-orange-glow);
}

.btn-primary-action:hover {
  background: var(--suminext-orange-hover);
  transform: translateY(-1px);
}

.btn-whatsapp-direct {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: #16a34a;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.25);
  text-decoration: none;
}

.btn-whatsapp-direct:hover {
  background: #15803d;
  transform: translateY(-1px);
}

.btn-copy-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 0.85rem 1.25rem;
  background: #ffffff;
  border: 1px solid var(--border-medium);
  color: var(--text-dark);
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-action:hover {
  background: #f8fafc;
  border-color: var(--suminext-blue);
  color: var(--suminext-blue);
}

/* ==========================================================================
   WHATSAPP MOCKUP PREVIEW (TARJETA TIPO CHAT)
   ========================================================================== */
.whatsapp-chat-bubble {
  background: #dcf8c6;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.5;
  color: #111827;
  white-space: pre-wrap;
  border: 1px solid #bbf7d0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  position: relative;
  max-height: 280px;
  overflow-y: auto;
}

.whatsapp-chat-bubble::before {
  content: '';
  position: absolute;
  top: 12px;
  left: -8px;
  border-width: 6px 8px 6px 0;
  border-style: solid;
  border-color: transparent #dcf8c6 transparent transparent;
}

/* ==========================================================================
   TELEMETRÍA MULTI-MÁQUINA (PESTAÑA 2)
   ========================================================================== */
.machines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.machine-card-telemetry {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.machine-card-telemetry:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

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

.m-name-tag {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-dark);
}

.m-plant-city {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.m-status-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.m-status-pill.VERDE {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.m-status-pill.AMARILLO {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.m-status-pill.ROJO {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.m-telemetry-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  background: var(--bg-surface-subtle);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  text-align: center;
}

.m-metric-val {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--text-dark);
}

.m-metric-lbl {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.btn-inspect-machine {
  width: 100%;
  padding: 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--suminext-blue);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-inspect-machine:hover {
  background: var(--daem-blue-light);
  border-color: var(--daem-blue);
}

/* ==========================================================================
   PANEL COMERCIAL & SIMULADOR (PESTAÑA 3)
   ========================================================================== */
.commercial-sim-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.sim-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #bbf7d0;
}

.sim-total-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #166534;
}

.sim-total-value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 800;
  color: #15803d;
}

/* ==========================================================================
   TOAST NOTIFICATION (RETROALIMENTACIÓN FLOTANTE)
   ========================================================================== */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #0f172a;
  color: #ffffff;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.toast-notice.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   WIDGET DE SESIÓN DE USUARIO Y CONTROL DE ROLES (RBAC)
   ========================================================================== */
.user-session-widget {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-user-profile {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-user-profile:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(243, 106, 33, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  line-height: 1.1;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0f172a;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.user-role-badge.direccion_suminext,
.user-role-badge.super_admin {
  background: rgba(243, 106, 33, 0.15);
  color: #c2410c;
  border: 1px solid rgba(243, 106, 33, 0.5);
}

.user-role-badge.tecnico_daem,
.user-role-badge.tecnico_suminext {
  background: rgba(2, 132, 199, 0.15);
  color: #0369a1;
  border: 1px solid rgba(2, 132, 199, 0.5);
}

.user-role-badge.cliente,
.user-role-badge.admin_cliente {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.user-role-badge.invitado {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.admin-lock-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

/* ==========================================================================
   MODAL DE AUTENTICACIÓN Y CAMBIO DE ROL
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 17, 31, 0.7);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay[hidden] {
  display: none !important;
}

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

.modal-card {
  background: #ffffff;
  width: 100%;
  max-width: 600px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  animation: slideUp 0.25s ease-out;
}

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

.modal-header {
  padding: 1.25rem 1.5rem;
  background: #0b192c;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--suminext-orange);
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: #ffffff;
}

.modal-body {
  padding: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
}

.role-selector-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.role-option-card {
  background: #f8fafc;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.role-option-card:hover {
  border-color: var(--suminext-blue);
  background: #f0f9ff;
  transform: translateY(-1px);
}

.role-option-card.active {
  border-color: var(--suminext-orange);
  background: #fff7ed;
  box-shadow: 0 4px 14px rgba(243, 106, 33, 0.12);
}

.role-card-left {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.role-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.role-name {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 2px;
}

.role-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin-bottom: 6px;
}

.role-perms-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.perm-chip {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.perm-chip.green {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.perm-chip.red {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-switch-role {
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.role-option-card:hover .btn-switch-role,
.role-option-card.active .btn-switch-role {
  background: var(--suminext-orange);
  color: #ffffff;
  border-color: var(--suminext-orange);
}

/* BANNER DE NOTIFICACIÓN DE ROL ACTIVO */
.role-notification-banner {
  background: #0b1523;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  color: #94a3b8;
}

.role-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-banner-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.role-banner-content strong {
  color: #f8fafc;
}

.btn-banner-switch {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-banner-switch:hover {
  background: var(--suminext-orange);
  border-color: var(--suminext-orange);
  color: #ffffff;
}

/* REGLAS ESTRICTAS DE SEGREGACIÓN DE ROLES (RBAC) */
body.role-not-super-admin .distributor-price-col {
  display: none !important;
}

body.role-not-super-admin .admin-only-tab {
  display: none !important;
}

body.role-not-super-admin #tab-commercial {
  display: none !important;
}

/* ==========================================================================
   BARRA DE HERRAMIENTAS Y ANÁLISIS MULTI-CLIENTE TELEMETRÍA
   ========================================================================== */
.telemetry-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
}

.telemetry-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 280px;
}

.telemetry-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
}

.select-company-filter {
  padding: 7px 12px;
  font-size: 0.86rem;
  font-weight: 600;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-dark);
  cursor: pointer;
  max-width: 380px;
  width: 100%;
}

.company-locked-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid #bae6fd;
}

.btn-add-machine {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--suminext-orange);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px var(--suminext-orange-glow);
  white-space: nowrap;
}

.btn-add-machine:hover {
  background: var(--suminext-orange-hover);
  transform: translateY(-1px);
}

/* TIRA DE KPIS EJECUTIVOS DE PLANTA */
.telemetry-kpis-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.telemetry-kpi-chip {
  background: #ffffff;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.telemetry-kpi-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-dark);
}

.telemetry-kpi-lbl {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.m-water-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  margin-top: 4px;
}

.m-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 0.5rem;
}

.btn-action-sm {
  padding: 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-action-sm.primary {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
}

.btn-action-sm.primary:hover {
  background: #0284c7;
  color: #ffffff;
}

.btn-action-sm.secondary {
  background: #f8fafc;
  border: 1px solid var(--border-medium);
  color: var(--text-dark);
}

.btn-action-sm.secondary:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* PRESETS DE MÁQUINAS RÁPIDOS */
.model-presets-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.model-chip {
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s;
}

.model-chip:hover {
  background: var(--suminext-orange);
  color: #ffffff;
  border-color: var(--suminext-orange);
}

/* ==========================================================================
   PUERTA DE ENTRADA SEGURA (AUTH GATEWAY PORTAL PRIVADO)
   ========================================================================== */
.portal-gateway-overlay {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #ffffff 0%, #f1f5f9 60%, #e2e8f0 100%);
  padding: 2.5rem 1.25rem;
  box-sizing: border-box;
}

.portal-gateway-card {
  width: 100%;
  max-width: 580px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.08), 0 2px 8px rgba(15, 23, 42, 0.04);
  padding: 2.5rem 2.25rem;
  box-sizing: border-box;
  animation: fadeInGateway 0.35s ease-out;
}

@keyframes fadeInGateway {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

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

.gateway-logo-wrap {
  display: inline-block;
  margin-bottom: 1rem;
}

.gateway-logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
}

.gateway-badge {
  display: inline-block;
  background: rgba(243, 106, 33, 0.1);
  color: #ea580c;
  border: 1px solid rgba(243, 106, 33, 0.3);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.gateway-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.gateway-subtitle {
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

.gateway-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: #f1f5f9;
  padding: 6px;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

.gateway-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gateway-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.gateway-form {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.gateway-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.gateway-form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}

.gateway-form-group input,
.gateway-form-group select {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  background: #f8fafc;
  color: #0f172a;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.gateway-form-group input:focus,
.gateway-form-group select:focus {
  outline: none;
  border-color: #f36a21;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(243, 106, 33, 0.15);
}

.gateway-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .gateway-grid-2 {
    grid-template-columns: 1fr;
  }
}

.gateway-alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
}

.gateway-alert.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.gateway-alert.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

.gateway-submit-btn {
  height: 48px;
  background: linear-gradient(135deg, #f36a21 0%, #ea580c 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 16px rgba(243, 106, 33, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gateway-submit-btn:hover {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(243, 106, 33, 0.38);
}

.gateway-quick-roles {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.quick-label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 0.65rem;
  text-align: left;
}

.quick-chips-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.quick-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.quick-chip:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.quick-chip .chip-icon {
  font-size: 1.15rem;
}

.quick-chip .chip-text {
  display: flex;
  flex-direction: column;
}

.quick-chip .chip-text strong {
  font-size: 0.82rem;
  color: #0f172a;
}

.quick-chip .chip-text small {
  font-size: 0.72rem;
  color: #64748b;
}

.quick-chip.dir:hover {
  border-color: #f36a21;
}

.quick-chip.tech:hover {
  border-color: #0284c7;
}

.quick-chip.client:hover {
  border-color: #10b981;
}

.gateway-footer {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.gateway-back-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0284c7;
  text-decoration: none;
}

.gateway-back-link:hover {
  text-decoration: underline;
}

.gateway-lock-hint {
  font-size: 0.75rem;
  color: #94a3b8;
}

/* ==========================================================================
   VISTA EJECUTIVA DEL CLIENTE (DISEÑO ULTRA-CLARO & SEMÁFOROS)
   ========================================================================== */
.client-hero-card {
  background: linear-gradient(135deg, #0b1d31 0%, #102a45 100%);
  color: #ffffff;
  border-radius: 16px;
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  box-shadow: 0 10px 25px rgba(11, 29, 49, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.client-badge-plant {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(43, 217, 255, 0.15);
  color: #2bd9ff;
  border: 1px solid rgba(43, 217, 255, 0.3);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.client-hero-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.client-hero-desc {
  color: #94a3b8;
  font-size: 0.92rem;
  max-width: 600px;
  margin: 0;
  line-height: 1.5;
}

.client-hero-right {
  display: flex;
  gap: 12px;
}

.client-kpi-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 14px 18px;
  text-align: center;
  min-width: 120px;
}

.client-kpi-pill .kpi-num {
  font-family: var(--font-heading);
  font-size: 1.9rem;
  font-weight: 800;
  color: #ffffff;
  display: block;
  line-height: 1;
}

.client-kpi-pill .kpi-label {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 5px;
  display: block;
}

.client-kpi-pill.success .kpi-num {
  color: #10b981;
}

.client-kpi-pill.warning .kpi-num {
  color: #f59e0b;
}

.client-machines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.client-machine-card {
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.client-machine-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.07);
}

.client-machine-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.client-mach-info h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 4px;
}

.client-mach-tag {
  font-size: 0.75rem;
  color: #64748b;
  font-family: var(--font-mono);
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
}

.client-traffic-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.client-traffic-badge.verde {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.client-traffic-badge.amarillo {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.client-traffic-badge.rojo {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.client-readings-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 1.25rem;
  text-align: center;
}

.client-reading-col small {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

.client-reading-col strong {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: #0f172a;
  display: block;
  margin-top: 2px;
}

/* Caja de Acción del Día "¿Qué debo hacer hoy?" */
.client-action-box {
  border-radius: 12px;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  border: 1px solid #e2e8f0;
}

.client-action-box.verde {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.client-action-box.amarillo {
  background: #fffdf0;
  border-color: #fef08a;
}

.client-action-box.rojo {
  background: #fff5f5;
  border-color: #fecaca;
}

.action-box-header {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.client-action-box.verde .action-box-header { color: #166534; }
.client-action-box.amarillo .action-box-header { color: #854d0e; }
.client-action-box.rojo .action-box-header { color: #991b1b; }

.action-box-text {
  font-size: 0.88rem;
  line-height: 1.45;
  color: #334155;
  margin: 0;
}

.client-card-footer {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

.btn-client-reading {
  flex: 1;
  background: #0b1d31;
  color: #ffffff;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.btn-client-reading:hover {
  background: #f36a21;
}

.btn-client-refill {
  background: #10b981;
  color: #ffffff;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-client-refill:hover {
  background: #059669;
}

/* Barra de Soporte y Pedidos Rápidos */
.client-support-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.support-bar-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.support-bar-info .support-icon {
  font-size: 2rem;
}

.support-bar-info strong {
  font-size: 0.96rem;
  color: #0f172a;
  display: block;
}

.support-bar-info p {
  font-size: 0.82rem;
  color: #64748b;
  margin: 2px 0 0;
}

.support-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-wa-direct {
  background: #10b981;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease;
}

.btn-wa-direct:hover {
  background: #059669;
}

.btn-doc-link {
  background: #f8fafc;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.82rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-doc-link:hover {
  background: #e2e8f0;
}

/* ==========================================================================
   CARTERA DE CLIENTES (VENTAS & TÉCNICO DAEM)
   ========================================================================== */
.portfolio-header-wrap,
.users-header-wrap {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.sales-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.sales-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.sales-kpi-card .kpi-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #64748b;
  display: block;
}

.sales-kpi-card .kpi-val {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  display: block;
  margin: 4px 0 2px;
}

.sales-kpi-card .kpi-sub {
  font-size: 0.75rem;
  color: #94a3b8;
  display: block;
}

.sales-kpi-card.warning .kpi-val { color: #f59e0b; }
.sales-kpi-card.danger .kpi-val { color: #ef4444; }

.portfolio-companies-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.company-portfolio-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.company-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 0.85rem;
}

.company-card-name h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 4px;
}

.company-card-name span {
  font-size: 0.82rem;
  color: #64748b;
}

.restock-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.restock-tag.urgente {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.restock-tag.pedido {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.restock-tag.estable {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.company-machines-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 1rem;
}

.mini-mach-badge {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-mach-badge.verde { border-left: 3px solid #10b981; }
.mini-mach-badge.amarillo { border-left: 3px solid #f59e0b; }
.mini-mach-badge.rojo { border-left: 3px solid #ef4444; }

.company-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: #64748b;
}

/* ==========================================================================
   DIRECTORIO DE USUARIOS Y GESTIÓN DE CONTRASEÑAS (DIRECCIÓN)
   ========================================================================== */
.users-table-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.03);
}

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

.users-data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.users-data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}

.users-data-table tr:hover td {
  background: #f8fafc;
}

.badge-role-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge-role-tag.direccion_suminext {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-role-tag.tecnico_daem {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-role-tag.cliente {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.btn-table-action {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-table-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-table-action.primary {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.btn-table-action.primary:hover {
  background: #fee2e2;
}

@media (max-width: 900px) {
  .client-hero-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
  }
  .client-hero-right {
    width: 100%;
    justify-content: space-between;
  }
  .sales-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .client-support-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ========================================================================== 
   EXPERIENCIA 2026 · PORTAL B2B RESPONSIVO
   Capa visual de alta claridad para Dirección, Ventas, técnicos y operadores.
   ========================================================================== */
#portalAppContent {
  --portal-ink: #071525;
  --portal-navy: #0b2138;
  --portal-orange: #f36a21;
  --portal-surface: rgba(255, 255, 255, 0.94);
  --portal-line: #dce5ee;
}

#portalAppContent .portal-header {
  padding: .72rem clamp(1rem, 2.5vw, 2.25rem);
  background: rgba(255,255,255,.92);
  border-bottom-color: rgba(148,163,184,.24);
  box-shadow: 0 8px 30px rgba(7,21,37,.07);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

#portalAppContent .portal-header-container,
#portalAppContent .portal-nav-container,
#portalAppContent .portal-main {
  max-width: 1520px;
}

#portalAppContent .brand-logo-img { height: 46px; }
#portalAppContent .portal-badge {
  border: 0;
  border-radius: 999px;
  background: #fff0e7;
  padding: 6px 11px;
}
#portalAppContent .api-status-badge {
  color: #047857;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

#portalAppContent .btn-user-profile,
#portalAppContent .btn-header-link {
  min-height: 42px;
  border-radius: 12px;
}
#portalAppContent .btn-header-link { padding: 8px 13px; }
#portalAppContent .btn-quick-invite {
  color: #fff;
  border-color: #e9560c;
  background: linear-gradient(135deg, #f36a21, #e9560c);
  box-shadow: 0 8px 20px rgba(243,106,33,.26);
  font-weight: 800;
}
#portalAppContent .btn-quick-invite:hover { color:#fff; background:#dd4d08; }

#portalAppContent .portal-nav-bar {
  top: 71px;
  padding: 10px 0;
  background: linear-gradient(105deg, #061321 0%, #0b2138 66%, #112d4a 100%);
  border: 0;
  box-shadow: 0 12px 28px rgba(7,21,37,.16);
}
#portalAppContent .portal-nav-container {
  gap: 7px;
  padding: 0 clamp(1rem, 2.5vw, 2.25rem);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.28) transparent;
}
#portalAppContent .nav-tool-btn {
  min-height: 48px;
  padding: .72rem 1rem;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #b9c8d8;
  font-size: .84rem;
}
#portalAppContent .nav-tool-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.075);
  border-color: rgba(255,255,255,.1);
}
#portalAppContent .nav-tool-btn.active {
  color: #fff;
  border-color: rgba(243,106,33,.55);
  background: linear-gradient(135deg, #f36a21, #e9560c);
  box-shadow: 0 8px 22px rgba(243,106,33,.28);
}
#portalAppContent .nav-tool-icon { font-size: 1.05rem; }

#portalAppContent .role-notification-banner {
  max-width: 1470px;
  margin: 18px auto 0;
  border: 1px solid rgba(243,106,33,.18);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(7,21,37,.08);
}
#portalAppContent .portal-main {
  padding: clamp(1rem, 2.2vw, 2rem);
}
#portalAppContent .tool-panel.active {
  animation: portalPanelIn .34s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes portalPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

#portalAppContent .users-header-wrap {
  padding: clamp(1.25rem, 2.5vw, 2rem);
  margin-bottom: 16px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 18%, rgba(243,106,33,.34), transparent 24%),
    linear-gradient(125deg, #071525, #113352);
  box-shadow: 0 18px 42px rgba(7,21,37,.17);
}
#portalAppContent .users-header-wrap h2 { color: #fff !important; }
#portalAppContent .users-header-wrap p { color: #c5d2df !important; max-width: 760px; }
#portalAppContent .users-header-wrap > div:last-child { flex-wrap: wrap; }
#portalAppContent #btnInviteClient {
  color: #fff;
  background: linear-gradient(135deg, #f36a21, #e9560c);
  box-shadow: 0 8px 22px rgba(243,106,33,.3);
}
#portalAppContent #btnRefreshUsers { background: rgba(255,255,255,.1) !important; color: #fff !important; border-color: rgba(255,255,255,.18); }
#portalAppContent .users-table-card {
  border-color: var(--portal-line);
  border-radius: 20px;
  box-shadow: 0 14px 36px rgba(7,21,37,.075);
}
#portalAppContent .users-data-table th { background: #f4f7fa; color: #526579; }
#portalAppContent .users-data-table tr:last-child td { border-bottom: 0; }
#portalAppContent .badge-role-tag.agente_ventas { background:#fff7ed; color:#c2410c; border:1px solid #fed7aa; }

#portalAppContent .modal-overlay {
  padding: 22px;
  background: rgba(3,12,22,.72);
  backdrop-filter: blur(8px);
}
#portalAppContent .modal-card {
  width: min(100%, 760px);
  max-height: calc(100dvh - 44px);
  overflow: auto;
  border: 1px solid rgba(255,255,255,.4);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(3,12,22,.35);
}
#portalAppContent .modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(14px);
}
#portalAppContent .input-control { min-height: 46px; border-radius: 11px; }
#portalAppContent .input-control:focus { border-color: var(--portal-orange); box-shadow: 0 0 0 4px rgba(243,106,33,.11); }
#portalAppContent .gateway-submit-btn { min-height: 50px; border-radius: 12px; }

@media (max-width: 920px) {
  #portalAppContent .portal-header { position: relative; padding: .7rem .85rem; }
  #portalAppContent .portal-header-container { align-items: flex-start; flex-direction: column; gap: .7rem; }
  #portalAppContent .brand-group { width: 100%; justify-content: space-between; gap: .55rem; }
  #portalAppContent .brand-logo { min-width: 0; gap: .55rem; }
  #portalAppContent .brand-logo-img { height: 39px; max-width: 190px; }
  #portalAppContent .portal-badge { display: none; }
  #portalAppContent .api-status-badge { font-size: .67rem; padding: 4px 7px; }
  #portalAppContent .header-right {
    width: 100%;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 3px;
    scrollbar-width: none;
  }
  #portalAppContent .header-right::-webkit-scrollbar { display:none; }
  #portalAppContent .btn-user-profile,
  #portalAppContent .btn-header-link { flex: 0 0 auto; min-height: 40px; }
  #portalAppContent .user-meta { display:none; }
  #portalAppContent .btn-header-link { font-size: .76rem; padding: 7px 10px; }
  #portalAppContent .portal-nav-bar { top: 0; padding: 8px 0; }
  #portalAppContent .portal-nav-container { padding: 0 10px; scroll-snap-type: x proximity; }
  #portalAppContent .nav-tool-btn { scroll-snap-align: start; min-height: 44px; padding: .62rem .8rem; font-size: .78rem; }
  #portalAppContent .role-notification-banner { margin: 10px 10px 0; border-radius: 14px; }
  #portalAppContent .portal-main { padding: 12px 10px 24px; overflow-x: clip; }
  #portalAppContent .users-header-wrap { align-items: flex-start; flex-direction: column; border-radius: 16px; }
  #portalAppContent .users-header-wrap > div:last-child { width: 100%; }
  #portalAppContent #btnInviteClient, #portalAppContent #btnRefreshUsers { flex: 1 1 160px; justify-content: center; }
  #portalAppContent .users-table-card { border-radius: 14px; }
  #portalAppContent .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #portalAppContent .users-data-table { min-width: 900px; }
}

@media (max-width: 600px) {
  #portalAppContent .brand-logo-img { max-width: 170px; }
  #portalAppContent .role-notification-banner { display: none; }
  #portalAppContent .form-row-2 { grid-template-columns: 1fr; }
  #portalAppContent .modal-overlay { padding: 0; align-items: flex-end; }
  #portalAppContent .modal-card { max-height: 94dvh; border-radius: 20px 20px 0 0; }
  #portalAppContent .modal-body { padding: 1rem; }
}
