/* ============================================================
   MODERN EXECUTIVE USER PANEL DESIGN SYSTEM
   Inspired by docs/ref-user-panel/2799912.jpg (Open Sans + JetBrains Mono)
   Dark charcoal structural header (#22292d), crisp light canvas (#e9edf1),
   clean flat white cards (#ffffff), vibrant vector accents (Green #37b34a,
   Ocean Teal #2196a8, Warm Amber #f5a623, Coral Red #e73c3e),
   high-contrast WCAG AA/AAA legibility, and strict CSP compliance.
============================================================ */

:root {
  color-scheme: light;
  --up-charcoal: #22292d;
  --up-charcoal-deep: #1b2125;
  --up-charcoal-soft: #2d363c;
  --up-canvas: #e9edf1;
  --up-surface: #f4f6f9;
  --up-card: #ffffff;
  --up-border: #dce2e8;
  --up-border-strong: #c5ced8;

  --up-green: #37b34a;
  --up-green-dark: #288f38;
  --up-teal: #2196a8;
  --up-teal-dark: #187584;
  --up-amber: #f5a623;
  --up-amber-dark: #c97f08;
  --up-coral: #e73c3e;
  --up-coral-dark: #c52a2c;

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
}

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

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--up-canvas);
  color: var(--text-primary);
  min-height: 100vh;
  font-family: "Open Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Native selects & options in light user panel */
select option {
  background: #ffffff;
  color: #1e293b;
}

/* Tabular numbers for accurate data grids & metrics */
table, .font-mono, .tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

#countdownTimer {
  contain: layout paint;
  will-change: contents;
}

#progressBarFill {
  width: 15%;
}

#mProgressBar {
  width: 100%;
}

/* ============================================================
   EXECUTIVE TWO-TIER USER PANEL HEADER
   Top band: Dark Charcoal (#22292d) | Bottom band: Crisp White Toolbar
   ============================================================ */

.header-glass {
  position: sticky;
  z-index: 30;
  background: var(--up-card);
  border: 1px solid var(--up-border);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.07);
  border-radius: 10px;
  overflow: visible;
}

.up-header-top {
  background: var(--up-charcoal);
  border-radius: 9px 9px 0 0;
  border-bottom: 1px solid #323c42;
  color: #f8fafc;
}

.up-header-toolbar {
  background: #ffffff;
  border-radius: 0 0 9px 9px;
  color: var(--text-primary);
}

/* Brand mark inspired by the green/amber geometric logo in 2799912.jpg */
.up-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #1a2024;
  border: 2.5px solid var(--up-green);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--up-amber);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.up-brand-badge {
  background: rgba(55, 179, 74, 0.18);
  border: 1px solid rgba(55, 179, 74, 0.65);
  color: #86efac;
}

/* Status pills inside dark header top band */
.up-header-top .ctrl-pill {
  background: var(--up-charcoal-soft);
  border: 1px solid #434f57;
  color: #f1f5f9;
  box-shadow: none;
}

.up-header-top .ctrl-pill:hover {
  background: #364148;
  border-color: #5b6a74;
}

/* Main card container (Sábana / Modals) */
.liquid-glass {
  background: var(--up-card);
  border: 1px solid var(--up-border);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  border-radius: 10px;
  color: var(--text-primary);
}

.hud-frame {
  position: relative;
}

/* ============================================================
   4 EXECUTIVE KPI CARDS (USER PANEL TEMPLATE STYLE)
   ============================================================ */

.liquid-glass-card, .glass-card {
  position: relative;
  overflow: hidden;
  background: var(--up-card);
  border: 1px solid var(--up-border);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.045);
  border-radius: 8px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.liquid-glass-card:hover, .glass-card:hover {
  transform: translateY(-2px);
  border-color: var(--up-border-strong);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.kpi-hud-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
}

.kpi-hud-accent-cyan {
  border-top: 3px solid var(--up-green);
}
.kpi-hud-accent-emerald {
  border-top: 3px solid var(--up-teal);
}
.kpi-hud-accent-blue {
  border-top: 3px solid var(--up-amber);
}
.kpi-hud-accent-amber {
  border-top: 3px solid var(--up-coral);
}

.up-kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.up-kpi-icon-green {
  background: #eaf7ec;
  color: #248232;
  border: 1px solid #bce4c3;
}

.up-kpi-icon-teal {
  background: #e6f5f7;
  color: #166c7a;
  border: 1px solid #b3dfe6;
}

.up-kpi-icon-amber {
  background: #fef5e4;
  color: #a86400;
  border: 1px solid #f7d99c;
}

.up-kpi-icon-coral {
  background: #fdecec;
  color: #b91c1c;
  border: 1px solid #f5bcbc;
}

.kpi-divider {
  width: 32px;
  height: 2px;
  background: #dce2e8;
  border-radius: 2px;
  margin: 0.35rem 0;
}

/* KPI 4: Flat Donut Ring Gauge (exact motif of 65% / 50% rings in 2799912.jpg) */
.hud-ring-svg {
  width: 68px;
  height: 68px;
  flex-shrink: 0;
}

.hud-ring-track {
  stroke: #d5dce3;
}

.hud-ring-arc {
  stroke: var(--up-green);
  stroke-linecap: butt;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.25s ease;
}

.hud-ring-arc-optimal { stroke: var(--up-green); }
.hud-ring-arc-media   { stroke: var(--up-amber); }
.hud-ring-arc-low     { stroke: var(--up-coral); }

/* KPI 1: Gráfico de barras horizontal proporcional real de estado de flota */
.kpi-fleet-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.kpi-fleet-bar-svg {
  width: 100%;
  height: 12px;
  border-radius: 9999px;
  background: #e2e8f0;
  overflow: hidden;
  display: block;
}

.kpi-fleet-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10px;
  color: #475569;
  font-weight: 600;
}

.kpi-fleet-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kpi-fleet-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}

.kpi-fleet-dot-op   { background: #10b981; }
.kpi-fleet-dot-inop { background: #f59e0b; }
.kpi-fleet-dot-baja { background: #ef4444; }

/* KPI 2 & 3: Píldora de tendencia/proyección y mini-gráfico SVG dinámico */
.kpi-trend-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  flex-shrink: 0;
}

.kpi-trend-alza {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.kpi-trend-baja {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.kpi-trend-estable {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.kpi-spark-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}

.kpi-spark-wrap {
  width: 160px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
}

.kpi-spark-svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.kpi-proj-range {
  font-size: 9.5px;
  line-height: 1.2;
  font-family: 'JetBrains Mono', monospace;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
  text-align: right;
}

/* KPI 2: Píldora de Eficiencia de Programación */
.kpi-eff-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.3;
  max-width: 100%;
  white-space: normal;
  overflow: visible;
  word-break: keep-all;
  flex-wrap: wrap;
}

.kpi-info-hint {
  display: inline-block;
  margin-top: 4px;
  font-size: 9.5px;
  font-weight: 600;
  color: #64748b;
  cursor: help;
  border-bottom: 1px dotted #94a3b8;
}

.kpi-info-hint:hover {
  color: #0369a1;
}

.kpi-rot-proj-range {
  margin-top: 5px;
  text-align: left;
}

.kpi-eff-optimal {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.kpi-eff-media {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.kpi-eff-low {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.kpi-eff-neutral {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* KPI 4: Base de cálculo y barra horizontal segmentada de rotación */
.kpi-rot-base {
  font-size: 10px;
  color: #475569;
  font-weight: 600;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-rot-dist-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.kpi-rot-bar-svg {
  width: 100%;
  height: 14px;
  border-radius: 9999px;
  background: #e2e8f0;
  overflow: hidden;
  display: block;
}

.kpi-rot-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 10px;
  color: #475569;
  font-weight: 600;
}

.kpi-rot-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 1px 3px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}

.kpi-rot-item:hover {
  background: rgba(15, 23, 42, 0.06);
}

.kpi-rot-dot {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}

.kpi-rot-dot-exc  { background: #10b981; }
.kpi-rot-dot-med  { background: #f59e0b; }
.kpi-rot-dot-inef { background: #ef4444; }

/* Interactividad SVG y Tooltip flotante para gráficos KPI */
.kpi-svg-bar,
.kpi-svg-node,
.kpi-svg-hit {
  cursor: pointer;
  transition: opacity 0.18s ease, filter 0.18s ease, r 0.18s ease;
}

.kpi-svg-node:hover {
  r: 5.5px;
}

.kpi-svg-bar:hover,
.kpi-svg-node:hover {
  filter: brightness(1.1);
  opacity: 1 !important;
}

.kpi-chart-tooltip,
#kpiChartTooltip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.96);
  color: #f1f5f9;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
  width: max-content;
  max-width: min(320px, calc(100vw - 24px));
  height: auto;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  box-sizing: border-box;
}

.kpi-chart-tooltip-title {
  font-weight: 700;
  color: #38bdf8;
  margin-bottom: 4px;
  font-size: 0.78rem;
}

.kpi-chart-tooltip-line {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #f1f5f9;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

/* ============================================================
   USER PANEL CONTROLS, FILTERS & ACTION BUTTONS
   ============================================================ */

.ctrl-pill, .pill-capsule {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--text-primary);
  transition: all 0.16s ease;
}

.ctrl-pill:hover, .pill-capsule:hover {
  background: #ffffff;
  border-color: #94a3b8;
}

input[type="date"], select, #searchInput {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  border-radius: 8px;
  font-size: 12px;
}

#searchInput {
  background: #ffffff;
  border: 1px solid #d1d8e0;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

#searchInput::placeholder {
  color: #64748b;
}

input[type="date"]:focus, select:focus, #searchInput:focus {
  border-color: var(--up-teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 168, 0.16);
}

.ctrl-pill input[type="date"],
.ctrl-pill select {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  color: #0f172a !important;
}

/* Action Buttons — Crisp Flat User Panel Palette */
.btn-consultar {
  background: var(--up-teal) !important;
  color: #ffffff !important;
  border: 1px solid var(--up-teal-dark);
  border-radius: 6px;
  font-weight: 600;
  transition: background-color 0.15s ease, transform 0.12s ease;
}
.btn-consultar:hover {
  background: var(--up-teal-dark) !important;
}

.btn-export-excel {
  background: var(--up-green) !important;
  color: #ffffff !important;
  border: 1px solid var(--up-green-dark);
  border-radius: 8px;
  font-weight: 600;
  transition: background-color 0.15s ease, transform 0.12s ease;
}
.btn-export-excel:hover {
  background: var(--up-green-dark) !important;
}

.btn-auditoria {
  background: var(--up-charcoal) !important;
  color: #ffffff !important;
  border: 1px solid #121619;
  border-radius: 8px;
  font-weight: 600;
  transition: background-color 0.15s ease, transform 0.12s ease;
}
.btn-auditoria:hover {
  background: #333d43 !important;
}

/* ============================================================
   ROTATION SEMANTIC CHIPS (HIGH CONTRAST ON LIGHT PANEL)
   ============================================================ */

.rot-optimal {
  background: #dcfce7;
  border: 1px solid #37b34a;
  color: #14532d;
  font-weight: 700;
}

.rot-media {
  background: #fef3c7;
  border: 1px solid #f5a623;
  color: #78350f;
  font-weight: 700;
}

.rot-ineficiente {
  background: #fee2e2;
  border: 1px solid #e73c3e;
  color: #991b1b;
  font-weight: 700;
}

/* ============================================================
   HIGH-CONTRAST SEMANTIC BADGES
   ============================================================ */

.hud-badge-success {
  background-color: #dcfce7 !important;
  border: 1px solid #37b34a !important;
  color: #14532d !important;
  font-weight: 700 !important;
}

.hud-badge-warning {
  background-color: #fef3c7 !important;
  border: 1px solid #e59400 !important;
  color: #78350f !important;
  font-weight: 700 !important;
}

.hud-badge-danger {
  background-color: #fee2e2 !important;
  border: 1px solid #e73c3e !important;
  color: #991b1b !important;
  font-weight: 700 !important;
}

.hud-badge-info {
  background-color: #e0f2fe !important;
  border: 1px solid #2196a8 !important;
  color: #0c4a6e !important;
  font-weight: 700 !important;
}

/* High-contrast solid badges when placed inside dark charcoal modal headers */
.up-dark-header .hud-badge-warning {
  background-color: #f5a623 !important;
  border-color: #f5a623 !important;
  color: #1e293b !important;
}

.up-dark-header .hud-badge-success {
  background-color: #37b34a !important;
  border-color: #37b34a !important;
  color: #ffffff !important;
}

.up-dark-header .hud-badge-danger {
  background-color: #e73c3e !important;
  border-color: #e73c3e !important;
  color: #ffffff !important;
}

.up-dark-header .hud-badge-info {
  background-color: #2196a8 !important;
  border-color: #2196a8 !important;
  color: #ffffff !important;
}

/* ============================================================
   MATRIX / SÁBANA OPERATIVA (CLEAN LIGHT USER PANEL TABLE)
   Also cleanly styles dynamic HTML injected by app.js without altering JS.
   ============================================================ */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #e9edf1; }
::-webkit-scrollbar-thumb { background: #b4c0cc; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #8c9baa; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.up-matrix-titlebar {
  background: var(--up-charcoal);
  color: #ffffff;
  border-bottom: 1px solid #323c42;
}

#matrixScrollContainer {
  position: relative;
  z-index: 10;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.sticky-header-top, .sticky-header-sub {
  position: sticky;
  background: #edf1f5 !important;
  color: #1e293b !important;
  font-weight: 700;
}
.sticky-header-top { top: 0; z-index: 20; }
.sticky-header-sub { top: 38px; z-index: 18; background: #f8fafc !important; }

.sticky-col-1 { position: sticky; left: 0px;   z-index: 15; background: #ffffff !important; }
.sticky-col-2 { position: sticky; left: 110px; z-index: 15; background: #ffffff !important; }
.sticky-col-3 { position: sticky; left: 205px; z-index: 15; background: #ffffff !important; }
.sticky-col-4 { position: sticky; left: 315px; z-index: 15; background: #ffffff !important; }

.matrix-row-odd .sticky-col-1,
.matrix-row-odd .sticky-col-2,
.matrix-row-odd .sticky-col-3,
.matrix-row-odd .sticky-col-4 {
  background: #f8fafc !important;
}

.sticky-corner-1 { position: sticky; left: 0px;   top: 0; z-index: 25; background: #e8eef3 !important; color: #0f172a !important; }
.sticky-corner-2 { position: sticky; left: 110px; top: 0; z-index: 25; background: #e8eef3 !important; color: #0f172a !important; }
.sticky-corner-3 { position: sticky; left: 205px; top: 0; z-index: 25; background: #e8eef3 !important; color: #0f172a !important; }
.sticky-corner-4 { position: sticky; left: 315px; top: 0; z-index: 25; background: #e8eef3 !important; color: #0f172a !important; }

.sticky-sub-1 { position: sticky; left: 0px;   top: 38px; z-index: 22; background: #f4f7fa !important; color: #334155 !important; }
.sticky-sub-2 { position: sticky; left: 110px; top: 38px; z-index: 22; background: #f4f7fa !important; color: #334155 !important; }
.sticky-sub-3 { position: sticky; left: 205px; top: 38px; z-index: 22; background: #f4f7fa !important; color: #334155 !important; }
.sticky-sub-4 { position: sticky; left: 315px; top: 38px; z-index: 22; background: #f4f7fa !important; color: #166c7a !important; }

.sticky-col-boundary {
  box-shadow: 4px 0 12px -4px rgba(15, 23, 42, 0.14);
}

#matrixTable th,
#matrixTable td {
  border-color: #dce3ea !important;
}

.matrix-row-even {
  background: #ffffff;
}

.matrix-row-odd {
  background: #f8fafc;
}

.matrix-row-even:hover,
.matrix-row-odd:hover {
  background: #eef7f9 !important;
}

.matrix-row-even:hover .sticky-col-1,
.matrix-row-even:hover .sticky-col-2,
.matrix-row-even:hover .sticky-col-3,
.matrix-row-even:hover .sticky-col-4,
.matrix-row-odd:hover .sticky-col-1,
.matrix-row-odd:hover .sticky-col-2,
.matrix-row-odd:hover .sticky-col-3,
.matrix-row-odd:hover .sticky-col-4 {
  background: #eef7f9 !important;
}

.matrix-day-even {
  background: #edf2f7 !important;
  color: #0f172a !important;
}

.matrix-day-odd {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

/* Harmonize dynamic classes injected by app.js inside #matrixTable for crisp light-panel contrast */
#matrixThead .text-slate-100,
#matrixThead .text-slate-200 {
  color: #1e293b !important;
}

#matrixThead .text-cyan-300 {
  color: #156674 !important;
}

#matrixThead .bg-\[\#14253d\] {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

#matrixTbody .text-slate-100,
#matrixTbody .text-slate-200 {
  color: #0f172a !important;
}

#matrixTbody .text-slate-300 {
  color: #475569 !important;
}

#matrixTbody .text-cyan-300 {
  color: #156674 !important;
}

#matrixTbody .hover\:text-cyan-300:hover {
  color: #2196a8 !important;
}

/* Zonal pill in col 1 */
#matrixTbody .bg-\[\#1b314f\] {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  border-color: #cbd5e1 !important;
}

/* Placa pill in col 2 */
#matrixTbody .bg-cyan-500\/15 {
  background-color: #e6f5f7 !important;
  color: #0f5c68 !important;
  border-color: #7bc7d4 !important;
}

#matrixTbody .text-cyan-200 {
  color: #0f5c68 !important;
}

/* Sin capacidad warning pill in col 3 */
#matrixTbody .bg-amber-500\/20 {
  background-color: #fef3c7 !important;
  color: #78350f !important;
  border-color: #f5a623 !important;
}

#matrixTbody .text-amber-300 {
  color: #78350f !important;
}

/* Historical / Alert cell highlights on light table */
#matrixTbody .bg-amber-500\/15 {
  background-color: #fffbeb !important;
  border-color: #f5a623 !important;
}

#matrixTbody .bg-rose-500\/20 {
  background-color: #fef2f2 !important;
  border-color: #e73c3e !important;
}

/* Zero cells in matrix */
.matrix-zero-cell {
  color: #64748b;
  font-weight: 500;
}

.matrix-zero-pill {
  display: inline-block;
  padding: 0.125rem 0.4rem;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  font-size: 10px;
  font-weight: 600;
}

/* Matrix Footer Totals — Dark Charcoal Strip for Executive Contrast */
#matrixTfoot,
#matrixTfoot tr,
#matrixTfoot td {
  background-color: var(--up-charcoal) !important;
  color: #ffffff !important;
  border-color: #364148 !important;
}

#matrixTfoot .text-cyan-300,
#matrixTfoot .text-cyan-200 {
  color: #7dd3fc !important;
}

#matrixTfoot .bg-cyan-500\/10 {
  background-color: #293238 !important;
}

/* ============================================================
   HUMAN-IN-THE-LOOP ML FEEDBACK BUTTONS (LIGHT USER PANEL)
   ============================================================ */

.ml-fb-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.ml-btn-normal,
.ml-btn-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.ml-btn-normal {
  background-color: #dcfce7;
  color: #14532d;
  border: 1px solid #37b34a;
}

.ml-btn-normal:hover:not(:disabled) {
  background-color: #bbf7d0;
  border-color: #288f38;
}

.ml-btn-confirm {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #e73c3e;
}

.ml-btn-confirm:hover:not(:disabled) {
  background-color: #fecaca;
  border-color: #c52a2c;
}

.ml-btn-normal:disabled,
.ml-btn-confirm:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ============================================================
   SCOPED LIGHT USER PANEL HARMONIZATION FOR MODALS & DRAWERS
   Guarantees WCAG AA/AAA legibility for static & JS-injected content.
   ============================================================ */

/* Modales y drawers principales por encima del header (z-30) y Zeta Bot (z-45) */
.hud-modal-scope.fixed.inset-0 {
  z-index: 60;
}

.hud-modal-scope .liquid-glass {
  background: #ffffff;
  border: 1px solid #cfd8e3;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.24);
  color: #1e293b;
}

/* Defensive light-surface text contrast for any residual light-slate text inside modal body */
.hud-modal-scope :not(.up-dark-header) > .text-slate-200,
.hud-modal-scope tbody.text-slate-200 {
  color: #1e293b;
}

.hud-modal-scope input[type="text"],
.hud-modal-scope input[type="password"],
.hud-modal-scope input[type="url"],
.hud-modal-scope input[type="number"],
.hud-modal-scope input[type="date"],
.hud-modal-scope input[type="time"],
.hud-modal-scope select,
.hud-modal-scope textarea {
  background-color: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
  border-radius: 6px;
}

.hud-modal-scope input:focus,
.hud-modal-scope select:focus,
.hud-modal-scope textarea:focus {
  border-color: var(--up-teal);
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 168, 0.16);
}

.hud-modal-scope input::placeholder,
.hud-modal-scope textarea::placeholder {
  color: #64748b;
}

/* Ensure JS-injected dark-on-light or light-on-light badges stay high-contrast */
.hud-modal-scope .bg-amber-50,
.hud-modal-scope .bg-amber-100 {
  background-color: #fef3c7;
  border-color: #f5a623;
  color: #78350f;
}

.hud-modal-scope .bg-rose-50,
.hud-modal-scope .bg-rose-100 {
  background-color: #fee2e2;
  border-color: #e73c3e;
  color: #991b1b;
}

.hud-modal-scope .bg-emerald-50,
.hud-modal-scope .bg-emerald-100 {
  background-color: #dcfce7;
  border-color: #37b34a;
  color: #14532d;
}

.hud-modal-scope .bg-sky-50,
.hud-modal-scope .bg-sky-100,
.hud-modal-scope .bg-blue-50,
.hud-modal-scope .bg-blue-100,
.hud-modal-scope .bg-indigo-50,
.hud-modal-scope .bg-indigo-100 {
  background-color: #e0f2fe;
  border-color: #2196a8;
  color: #0c4a6e;
}

/* ============================================================
   AMBER DOT FOR HISTORICAL DEPARTURE
   ============================================================ */

.dot-historical {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--up-amber);
  box-shadow: 0 0 0 2px rgba(245, 166, 35, 0.28);
  margin-right: 4px;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* ============================================================
   ZETA BOT 3D FLOTANTE 100% SIN FONDO: AZUL ELÉCTRICO + NARANJA NEÓN
   Personaje libre, arrastrable y reactivo a estado EN LÍNEA / OFFLINE · CSP estricto
   Estados: .state-idle, .state-listening, .state-thinking,
            .state-success, .state-error, .state-online, .state-offline
   ============================================================ */

/* Contenedor flotante arrastrable del robot */
.zbot-floating-container {
  position: fixed;
  bottom: 22px;
  right: 22px;
  top: auto;
  left: auto;
  z-index: 45;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.zbot-floating-container.zbot-custom-pos {
  right: auto;
  bottom: auto;
}

.zbot-floating-container.zbot-dragging {
  z-index: 48;
}

.zbot-floating-container.zbot-dragging .zbot-floating-launcher {
  cursor: grabbing;
  transform: scale(1.04) translateY(-2px);
  transition: none;
}

/* Botón discreto para minimizar desde el avatar flotante */
.zbot-minimize-floating-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 46;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  opacity: 0.75;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.zbot-minimize-floating-btn:hover {
  opacity: 1;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  transform: scale(1.06);
}

/* Píldora minimizada animada de Zeta Bot en la barra superior */
@keyframes zbot-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.48), 0 2px 6px rgba(15, 23, 42, 0.32);
    border-color: rgba(34, 211, 238, 0.6);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(34, 211, 238, 0.18), 0 0 14px rgba(34, 211, 238, 0.55);
    border-color: rgba(56, 189, 248, 0.95);
  }
}

@keyframes zbot-dot-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.38);
    opacity: 1;
  }
}

@keyframes zbot-mini-blink {
  0%, 44%, 50%, 92%, 100% {
    transform: scaleY(1);
  }
  47%, 95% {
    transform: scaleY(0.15);
  }
}

@keyframes zbot-mini-wave {
  0%, 76%, 100% {
    transform: rotate(0deg) translateY(0px);
  }
  82% {
    transform: rotate(-10deg) translateY(-1px);
  }
  88% {
    transform: rotate(10deg) translateY(-1px);
  }
  94% {
    transform: rotate(-5deg) translateY(0px);
  }
}

@keyframes zbot-mini-hover-greet {
  0% {
    transform: rotate(0deg) scale(1.06);
  }
  25% {
    transform: rotate(-14deg) scale(1.12) translateY(-1px);
  }
  50% {
    transform: rotate(12deg) scale(1.12) translateY(-1px);
  }
  75% {
    transform: rotate(-8deg) scale(1.1);
  }
  100% {
    transform: rotate(0deg) scale(1.08);
  }
}

@keyframes zbot-antenna-glow {
  0%, 100% {
    opacity: 0.88;
    filter: drop-shadow(0 0 2px rgba(251, 146, 60, 0.55));
  }
  50% {
    opacity: 1;
    filter: drop-shadow(0 0 6px #fb923c);
  }
}

.zbot-floating-container.hidden,
.zbot-panel.hidden,
.zbot-restore-pill.hidden {
  display: none !important;
}

.zbot-restore-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: zbot-pulse 3.2s ease-in-out infinite;
}

.zbot-restore-pill:hover {
  transform: translateY(-1px) scale(1.02);
  border-color: rgba(56, 189, 248, 1);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.22), 0 0 16px rgba(34, 211, 238, 0.5);
}

.zbot-restore-label {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.1;
}

.zbot-restore-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #37b34a;
  box-shadow: 0 0 7px rgba(55, 179, 74, 0.9);
  animation: zbot-dot-pulse 2.2s ease-in-out infinite;
}

.zbot-mini-svg {
  width: 26px;
  height: 26px;
  transform-origin: center bottom;
  animation: zbot-mini-wave 5.2s ease-in-out infinite;
}

.zbot-restore-pill:hover .zbot-mini-svg {
  animation: zbot-mini-hover-greet 0.65s ease-in-out;
  transform: scale(1.08);
}

.zbot-mini-antenna {
  animation: zbot-antenna-glow 2s ease-in-out infinite;
}

.zbot-mini-eye {
  transform-box: fill-box;
  transform-origin: center;
  filter: drop-shadow(0 0 2.5px rgba(34, 211, 238, 0.85));
  animation: zbot-mini-blink 4.8s ease-in-out infinite;
}

/* Panel del chat posicionado dinámicamente dentro del viewport */
.zbot-panel {
  position: fixed;
  z-index: 45;
  margin: 0;
  width: 384px;
  height: 460px;
  min-width: 340px;
  min-height: 380px;
  max-width: 90vw;
  max-height: 85vh;
}

.zbot-panel.zbot-expanded {
  width: min(900px, 90vw);
  height: 85vh;
}

.zbot-panel.zbot-interacting {
  user-select: none;
  -webkit-user-select: none;
}

.zbot-drag-handle {
  cursor: move;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.zbot-drag-handle button {
  cursor: pointer;
}

.zbot-resize-handle {
  position: absolute;
  z-index: 5;
  touch-action: none;
}

.zbot-resize-e {
  top: 44px;
  right: 0;
  bottom: 14px;
  width: 6px;
  cursor: ew-resize;
}

.zbot-resize-s {
  left: 0;
  right: 14px;
  bottom: 0;
  height: 6px;
  cursor: ns-resize;
}

.zbot-resize-se {
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 55%, rgba(100, 116, 139, 0.65) 55%, rgba(100, 116, 139, 0.65) 62%, transparent 62%, transparent 74%, rgba(100, 116, 139, 0.65) 74%, rgba(100, 116, 139, 0.65) 81%, transparent 81%);
}

/* Lanzador flotante 100% transparente (sin caja, sin borde, sin pedestal) */
.zbot-floating-launcher,
.zbot-launcher {
  position: relative;
  width: 126px;
  height: 134px;
  padding: 0;
  margin: 0;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  overflow: visible;
  transition: transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reacción juguetona al pasar el cursor: salto entusiasta + propulsores y saludo acelerado */
.zbot-floating-launcher:hover,
.zbot-launcher:hover {
  transform: scale(1.08) translateY(-6px);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.zbot-floating-launcher:hover .zbot-svg-main,
.zbot-launcher:hover .zbot-svg-main {
  filter: drop-shadow(0 8px 14px rgba(14, 165, 233, 0.32)) drop-shadow(0 0 6px rgba(251, 146, 60, 0.28));
}

.zbot-floating-launcher:hover .zbot-thruster-flame,
.zbot-launcher:hover .zbot-thruster-flame {
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 1)) drop-shadow(0 3px 10px rgba(251, 146, 60, 0.95));
  animation: zbot-flame-boost 0.18s ease-in-out infinite alternate;
}

.zbot-floating-launcher:hover .zbot-container.state-idle .zbot-arm-right-group,
.zbot-launcher:hover .zbot-container.state-idle .zbot-arm-right-group {
  animation: zbot-wave-hover 0.52s ease-in-out infinite alternate;
}

.zbot-floating-launcher:hover .zbot-container.state-idle .zbot-head,
.zbot-launcher:hover .zbot-container.state-idle .zbot-head {
  animation: none;
  transform: rotate(-6deg) translateY(-1px);
}

.zbot-floating-launcher:hover .zbot-palm-glow,
.zbot-launcher:hover .zbot-palm-glow,
.zbot-floating-launcher:hover .zbot-antenna-orb,
.zbot-launcher:hover .zbot-antenna-orb {
  animation: zbot-orange-flash-fast 0.45s ease-in-out infinite alternate;
}

.zbot-floating-launcher:active,
.zbot-launcher:active {
  transform: scale(0.95) translateY(-2px);
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.zbot-floating-launcher:focus-visible .zbot-svg-main {
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.85));
}

.zbot-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  pointer-events: none;
  overflow: visible;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.zbot-container.zbot-stage {
  width: 100%;
  height: 100%;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Avatar compacto para cabecera del chat (dentro del drawer) */
.zbot-container.zbot-compact {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: radial-gradient(circle at 50% 30%, #0f172a 0%, #050b14 100%) !important;
  border: 1.5px solid rgba(34, 211, 238, 0.72) !important;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.26), inset 0 1px 3px rgba(255, 255, 255, 0.12) !important;
  flex-shrink: 0;
  overflow: hidden;
}

.zbot-svg {
  display: block;
  overflow: visible;
}

.zbot-svg-main {
  width: 118px;
  height: 122px;
  margin-bottom: 8px;
  z-index: 3;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.22));
  transition: filter 0.25s ease;
}

.zbot-svg-header {
  width: 42px;
  height: 42px;
}

/* Micro-sombra radial despegada en el suelo virtual (sincronizada con zbot-hover-alive) */
.zbot-shadow {
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 60px;
  height: 11px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.88) 0%, rgba(15, 23, 42, 0.38) 48%, rgba(15, 23, 42, 0) 76%);
  opacity: 0.2;
  filter: blur(2.2px);
  transform: translateX(-50%);
  transform-origin: center center;
  pointer-events: none;
  z-index: 1;
  animation: zbot-shadow-alive 3.4s ease-in-out infinite;
}

/* Brillos LED y elementos internos del SVG */
.zbot-led-glow {
  filter: drop-shadow(0 0 3.5px rgba(34, 211, 238, 0.95));
}

.zbot-smile-glow {
  filter: drop-shadow(0 0 3px rgba(6, 182, 212, 0.92));
}

.zbot-success-glow {
  filter: drop-shadow(0 0 4.5px rgba(16, 185, 129, 0.98));
}

.zbot-error-glow {
  filter: drop-shadow(0 0 4.5px rgba(244, 63, 94, 0.95));
}

.zbot-face-thinking,
.zbot-face-success,
.zbot-face-error,
.zbot-face-offline {
  display: none;
}

.zbot-visor-scan {
  display: none;
}

/* Levitación viva y dinámica (zbot-hover-alive) + gestos expresivos en reposo */
.zbot-character {
  transform-box: fill-box;
  transform-origin: center center;
  animation: zbot-hover-alive 3.4s ease-in-out infinite;
}

.zbot-head {
  transform-origin: 90px 76px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.zbot-container.state-idle .zbot-head {
  animation: zbot-head-curious 4.6s ease-in-out infinite;
}

.zbot-eyes-gaze {
  transform-box: fill-box;
  transform-origin: center center;
  animation: zbot-eye-gaze 6.4s ease-in-out infinite;
}

.zbot-eyes-blink {
  transform-box: fill-box;
  transform-origin: center center;
  animation: zbot-eye-blink 4.2s ease-in-out infinite;
}

.zbot-arm-right-group {
  transform-origin: 122px 89px;
  animation: zbot-wave-idle 4.6s ease-in-out infinite;
  transition: transform 0.25s ease;
}

.zbot-waving-hand {
  transform-origin: 147px 58px;
}

.zbot-container.state-idle .zbot-waving-hand {
  animation: zbot-hand-flick 4.6s ease-in-out infinite;
}

.zbot-arm-left-group {
  transform-origin: 58px 89px;
  transition: transform 0.3s ease;
}

.zbot-palm-glow {
  transform-box: fill-box;
  transform-origin: center center;
  filter: drop-shadow(0 0 3px rgba(251, 146, 60, 0.85));
}

.zbot-container.state-idle .zbot-palm-glow {
  animation: zbot-orange-flash 4.6s ease-in-out infinite;
}

.zbot-antenna-group {
  transform-origin: 90px 23px;
}

.zbot-antenna-orb {
  transform-box: fill-box;
  transform-origin: center center;
  filter: drop-shadow(0 0 4px rgba(251, 146, 60, 0.9));
}

.zbot-container.state-idle .zbot-antenna-orb {
  animation: zbot-orange-flash 4.6s ease-in-out infinite;
}

.zbot-thruster-flame {
  transform-box: fill-box;
  transform-origin: top center;
  filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.85));
  animation: zbot-flame-pulse 0.42s ease-in-out infinite alternate;
  transition: filter 0.25s ease;
}

/* Ondas de escucha y destellos festivos */
.zbot-waves {
  display: none;
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 76px;
  height: 76px;
  pointer-events: none;
  z-index: 1;
}

.zbot-wave {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(34, 211, 238, 0.72);
}

.zbot-sparkles {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.zbot-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981, 0 0 12px #22d3ee;
}
.zbot-spark-1 { top: 6px; left: 16px; background: #10b981; }
.zbot-spark-2 { top: 4px; right: 16px; background: #22d3ee; }
.zbot-spark-3 { top: 40px; right: 8px; background: #fb923c; }
.zbot-spark-4 { top: 44px; left: 8px; background: #38bdf8; }

/* ============================================================
   GESTOS Y ESTADOS REACTIVOS DE ZETA BOT 3D (SIN CAJAS NI BORDES)
   ============================================================ */

/* 1. LISTENING (Escuchando): inclinación atenta, pulso en orejeras y propulsores cian */
.zbot-container.state-listening .zbot-waves {
  display: block;
}
.zbot-container.state-listening .zbot-wave-1 {
  animation: zbot-wave-pulse 1.2s ease-out infinite;
}
.zbot-container.state-listening .zbot-wave-2 {
  animation: zbot-wave-pulse 1.2s ease-out infinite 0.45s;
}
.zbot-container.state-listening .zbot-character {
  animation: zbot-listen-lean 1.35s ease-in-out infinite;
}
.zbot-container.state-listening .zbot-head {
  animation: none;
  transform: rotate(-7deg) translateY(-1px);
}
.zbot-container.state-listening .zbot-eyes-gaze {
  animation: none;
  transform: translateX(0px) scale(1.06);
}
.zbot-container.state-listening .zbot-arm-right-group {
  animation: none;
  transform: rotate(-8deg);
}
.zbot-container.state-listening .zbot-ear-cup {
  animation: zbot-ear-pulse 0.42s ease-in-out infinite alternate;
}
.zbot-container.state-listening .zbot-antenna-orb {
  animation: zbot-orange-flash-fast 0.6s ease-in-out infinite alternate;
}
.zbot-container.state-listening .zbot-thruster-flame {
  filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.98));
  animation: zbot-flame-pulse 0.26s ease-in-out infinite alternate;
}

/* 2. THINKING (Procesando): giro/escaneo rápido de ojos y antena, propulsores ámbar */
.zbot-container.state-thinking .zbot-face-idle { display: none; }
.zbot-container.state-thinking .zbot-face-thinking { display: block; }
.zbot-container.state-thinking .zbot-visor-scan {
  display: block;
  animation: zbot-visor-sweep 0.72s linear infinite;
}
.zbot-container.state-thinking .zbot-scan-eyes-group {
  transform-box: fill-box;
  transform-origin: center center;
  animation: zbot-eye-scan-fast 0.85s ease-in-out infinite;
}
.zbot-container.state-thinking .zbot-scan-eye {
  animation: zbot-scan-pulse 0.4s ease-in-out infinite alternate;
}
.zbot-container.state-thinking .zbot-scan-eye-alt {
  animation-delay: 0.2s;
}
.zbot-container.state-thinking .zbot-antenna-group {
  animation: zbot-antenna-spin 0.65s ease-in-out infinite;
}
.zbot-container.state-thinking .zbot-antenna-orb {
  filter: drop-shadow(0 0 8px rgba(251, 146, 60, 1)) drop-shadow(0 0 12px rgba(34, 211, 238, 0.9));
  animation: zbot-orange-flash-fast 0.35s ease-in-out infinite alternate;
}
.zbot-container.state-thinking .zbot-character {
  animation: zbot-think-rock 1.25s ease-in-out infinite;
}
.zbot-container.state-thinking .zbot-head {
  animation: none;
  transform: rotate(4deg);
}
.zbot-container.state-thinking .zbot-arm-right-group {
  animation: none;
  transform: rotate(10deg);
}
.zbot-container.state-thinking .zbot-thruster-flame {
  filter: drop-shadow(0 0 8px rgba(251, 146, 60, 0.98));
  animation: zbot-flame-pulse 0.22s ease-in-out infinite alternate;
}
.zbot-container.state-thinking .zbot-chest-core {
  fill: #fb923c;
  filter: drop-shadow(0 0 6px #fb923c);
}

/* 3. SUCCESS (Éxito): salto de celebración, sonrisa luminosa y destellos esmeralda */
.zbot-container.state-success .zbot-face-idle { display: none; }
.zbot-container.state-success .zbot-face-success { display: block; }
.zbot-container.state-success .zbot-success-smile {
  filter: drop-shadow(0 0 6px rgba(34, 211, 238, 1)) drop-shadow(0 0 10px rgba(16, 185, 129, 0.95));
  animation: zbot-smile-celebrate 0.55s ease-in-out infinite alternate;
}
.zbot-container.state-success .zbot-sparkles {
  display: block;
}
.zbot-container.state-success .zbot-spark {
  animation: zbot-spark-burst 0.8s ease-out infinite;
}
.zbot-container.state-success .zbot-spark-2 { animation-delay: 0.15s; }
.zbot-container.state-success .zbot-spark-3 { animation-delay: 0.3s; }
.zbot-container.state-success .zbot-spark-4 { animation-delay: 0.45s; }
.zbot-container.state-success .zbot-character {
  animation: zbot-success-hop 0.68s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}
.zbot-container.state-success .zbot-shadow {
  animation: zbot-shadow-hop 0.68s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}
.zbot-container.state-success .zbot-head {
  animation: none;
  transform: rotate(-4deg) translateY(-2px);
}
.zbot-container.state-success .zbot-arm-right-group {
  animation: zbot-wave-cheer 0.34s ease-in-out infinite alternate;
}
.zbot-container.state-success .zbot-arm-left-group {
  animation: zbot-left-cheer 0.34s ease-in-out infinite alternate;
}
.zbot-container.state-success .zbot-chest-core {
  fill: #10b981;
  filter: drop-shadow(0 0 7px #10b981);
}
.zbot-container.state-success .zbot-antenna-orb {
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 1));
}
.zbot-container.state-success .zbot-thruster-flame {
  filter: drop-shadow(0 0 9px rgba(16, 185, 129, 0.98));
  animation: zbot-flame-boost 0.22s ease-in-out infinite alternate;
}

/* 4. ERROR (Error / No entendido): sacudida suave en ámbar/rojo y alerta en visor */
.zbot-container.state-error .zbot-face-idle { display: none; }
.zbot-container.state-error .zbot-face-error { display: block; }
.zbot-container.state-error .zbot-head {
  animation: none;
  transform: rotate(9deg) translateY(2px);
}
.zbot-container.state-error .zbot-visor-frame {
  stroke: #f43f5e;
  animation: zbot-visor-error-blink 0.4s ease-in-out infinite alternate;
}
.zbot-container.state-error .zbot-character {
  animation: zbot-error-shake 0.48s ease-in-out 3, zbot-hover-alive 3.4s ease-in-out 1.45s infinite;
}
.zbot-container.state-error .zbot-arm-right-group {
  animation: none;
  transform: rotate(18deg);
}
.zbot-container.state-error .zbot-chest-core {
  fill: #f43f5e;
  filter: drop-shadow(0 0 7px #f43f5e);
}
.zbot-container.state-error .zbot-antenna-orb {
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.98)) drop-shadow(0 0 12px rgba(245, 158, 11, 0.9));
  animation: zbot-visor-error-blink 0.38s ease-in-out infinite alternate;
}
.zbot-container.state-error .zbot-thruster-flame {
  filter: drop-shadow(0 0 8px rgba(244, 63, 94, 0.95)) drop-shadow(0 0 10px rgba(245, 158, 11, 0.85));
}

/* 5. ONLINE (EN LÍNEA): núcleo/reactor de pecho y antena con pulso cian/esmeralda activo */
.zbot-chest-reactor-ring {
  transform-box: fill-box;
  transform-origin: center center;
}

.zbot-container.state-online:not(.state-thinking):not(.state-error):not(.state-offline) .zbot-chest-core {
  animation: zbot-reactor-core-pulse 2.2s ease-in-out infinite;
}

.zbot-container.state-online:not(.state-thinking):not(.state-error):not(.state-offline) .zbot-chest-reactor-ring {
  animation: zbot-reactor-ring-pulse 2.2s ease-in-out infinite;
}

.zbot-container.state-online:not(.state-thinking):not(.state-error):not(.state-offline) .zbot-chest-bar {
  filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.9));
  animation: zbot-reactor-bar-pulse 2.2s ease-in-out infinite;
}

.zbot-container.state-online.state-idle:not(.state-offline) .zbot-antenna-orb {
  animation: zbot-antenna-online-pulse 2.2s ease-in-out infinite;
}

/* 6. OFFLINE (SIN CONEXIÓN / DESCANSO): modo durmiendo, párpados cerrados (- -), luces atenuadas y z Z z */
.zbot-zzz {
  display: none;
  position: absolute;
  top: -6px;
  right: 12px;
  width: 44px;
  height: 44px;
  pointer-events: none;
  z-index: 8;
}

.zbot-z {
  position: absolute;
  font-family: "Plus Jakarta Sans", "Open Sans", sans-serif;
  font-weight: 800;
  color: #38bdf8;
  text-shadow: 0 1px 4px rgba(15, 23, 42, 0.35), 0 0 8px rgba(56, 189, 248, 0.45);
  line-height: 1;
  opacity: 0;
}

.zbot-z-1 {
  font-size: 11px;
  left: 4px;
  bottom: 4px;
}

.zbot-z-2 {
  font-size: 15px;
  left: 16px;
  bottom: 12px;
}

.zbot-z-3 {
  font-size: 12px;
  left: 28px;
  bottom: 22px;
}

.zbot-container.state-offline .zbot-zzz {
  display: block;
}

.zbot-container.state-offline .zbot-z-1 {
  animation: zbot-zzz-float 2.8s ease-in-out infinite 0s;
}

.zbot-container.state-offline .zbot-z-2 {
  animation: zbot-zzz-float 2.8s ease-in-out infinite 0.75s;
}

.zbot-container.state-offline .zbot-z-3 {
  animation: zbot-zzz-float 2.8s ease-in-out infinite 1.5s;
}

.zbot-container.state-offline .zbot-face-idle,
.zbot-container.state-offline .zbot-face-thinking,
.zbot-container.state-offline .zbot-face-success,
.zbot-container.state-offline .zbot-face-error {
  display: none;
}

.zbot-container.state-offline .zbot-face-offline {
  display: block;
}

.zbot-container.state-offline .zbot-character {
  animation: zbot-sleep-rest 4.2s ease-in-out infinite;
}

.zbot-container.state-offline .zbot-shadow {
  animation: zbot-shadow-sleep 4.2s ease-in-out infinite;
}

.zbot-container.state-offline .zbot-head {
  animation: zbot-head-sleep 4.2s ease-in-out infinite;
}

.zbot-container.state-offline .zbot-arm-right-group {
  animation: none;
  transform: rotate(26deg) translateY(4px);
}

.zbot-container.state-offline .zbot-waving-hand {
  animation: none;
  transform: rotate(6deg);
}

.zbot-container.state-offline .zbot-antenna-orb {
  animation: none;
  opacity: 0.28;
  filter: grayscale(0.9) brightness(0.55);
}

.zbot-container.state-offline .zbot-chest-core {
  animation: none;
  fill: #334155;
  opacity: 0.48;
  filter: none;
}

.zbot-container.state-offline .zbot-chest-core-inner {
  opacity: 0.2;
}

.zbot-container.state-offline .zbot-chest-reactor-ring {
  animation: none;
  stroke: #475569;
  opacity: 0.16;
  filter: none;
}

.zbot-container.state-offline .zbot-chest-bar {
  animation: none;
  fill: #475569;
  opacity: 0.35;
  filter: none;
}

.zbot-container.state-offline .zbot-palm-glow {
  animation: none;
  opacity: 0.18;
  filter: none;
}

.zbot-container.state-offline .zbot-thruster-flame {
  animation: none;
  opacity: 0.08;
  transform: scaleY(0.32) scaleX(0.58);
  filter: none;
}

.zbot-container.state-offline .zbot-svg-main {
  filter: drop-shadow(0 4px 7px rgba(15, 23, 42, 0.2)) saturate(0.82);
}

/* En modo descanso, el hover es sutil y no reactiva propulsores ni saludo enérgico */
.zbot-floating-launcher:hover .zbot-container.state-offline .zbot-thruster-flame,
.zbot-launcher:hover .zbot-container.state-offline .zbot-thruster-flame {
  animation: none;
  filter: none;
  opacity: 0.12;
}

.zbot-floating-launcher:hover .zbot-container.state-offline .zbot-arm-right-group,
.zbot-launcher:hover .zbot-container.state-offline .zbot-arm-right-group {
  animation: none;
  transform: rotate(26deg) translateY(4px);
}

.zbot-floating-launcher:hover .zbot-container.state-offline .zbot-head,
.zbot-launcher:hover .zbot-container.state-offline .zbot-head {
  animation: zbot-head-sleep 4.2s ease-in-out infinite;
}

.zbot-floating-launcher:hover .zbot-container.state-offline .zbot-antenna-orb,
.zbot-launcher:hover .zbot-container.state-offline .zbot-antenna-orb,
.zbot-floating-launcher:hover .zbot-container.state-offline .zbot-palm-glow,
.zbot-launcher:hover .zbot-container.state-offline .zbot-palm-glow {
  animation: none;
}

/* ---------------- KEYFRAMES FÍSICOS E INTERACTIVOS ---------------- */
@keyframes zbot-reactor-core-pulse {
  0%, 100% {
    fill: #22d3ee;
    filter: drop-shadow(0 0 4px rgba(34, 211, 238, 0.92)) drop-shadow(0 0 8px rgba(16, 185, 129, 0.65));
  }
  50% {
    fill: #10b981;
    filter: drop-shadow(0 0 7px rgba(16, 185, 129, 1)) drop-shadow(0 0 13px rgba(34, 211, 238, 0.9));
  }
}

@keyframes zbot-reactor-ring-pulse {
  0%, 100% {
    transform: scale(0.92);
    stroke: #22d3ee;
    stroke-opacity: 0.55;
    filter: drop-shadow(0 0 3px rgba(34, 211, 238, 0.6));
  }
  50% {
    transform: scale(1.16);
    stroke: #10b981;
    stroke-opacity: 0.95;
    filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.95));
  }
}

@keyframes zbot-reactor-bar-pulse {
  0%, 100% { opacity: 0.78; }
  50% { opacity: 1; }
}

@keyframes zbot-antenna-online-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.92)) drop-shadow(0 0 9px rgba(16, 185, 129, 0.72));
    opacity: 0.95;
  }
  50% {
    filter: drop-shadow(0 0 9px rgba(16, 185, 129, 1)) drop-shadow(0 0 15px rgba(34, 211, 238, 0.95)) brightness(1.22);
    opacity: 1;
  }
}

@keyframes zbot-sleep-rest {
  0%, 100% { transform: translateY(9px) rotate(1.5deg); }
  50% { transform: translateY(11.5px) rotate(2.5deg); }
}

@keyframes zbot-shadow-sleep {
  0%, 100% { transform: translateX(-50%) scaleX(1.14) scaleY(1.06); opacity: 0.28; }
  50% { transform: translateX(-50%) scaleX(1.18) scaleY(1.1); opacity: 0.31; }
}

@keyframes zbot-head-sleep {
  0%, 100% { transform: rotate(9deg) translateY(3px); }
  50% { transform: rotate(12deg) translateY(4.5px); }
}

@keyframes zbot-zzz-float {
  0% {
    opacity: 0;
    transform: translate(0px, 6px) scale(0.72);
  }
  25% {
    opacity: 0.95;
  }
  75% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translate(10px, -16px) scale(1.12);
  }
}
@keyframes zbot-hover-alive {
  0%, 100% { transform: translateY(0px) rotate(-2.5deg); }
  25% { transform: translateY(-5px) rotate(2.5deg); }
  50% { transform: translateY(-9.5px) rotate(3deg); }
  75% { transform: translateY(-4.5px) rotate(-3deg); }
}

@keyframes zbot-shadow-alive {
  0%, 100% { transform: translateX(-52%) scaleX(1.02) scaleY(1); opacity: 0.22; }
  25% { transform: translateX(-48%) scaleX(0.86) scaleY(0.88); opacity: 0.16; }
  50% { transform: translateX(-47%) scaleX(0.68) scaleY(0.74); opacity: 0.11; }
  75% { transform: translateX(-53%) scaleX(0.86) scaleY(0.88); opacity: 0.16; }
}

@keyframes zbot-shadow-hop {
  0%, 100% { transform: translateX(-50%) scaleX(1.04) scaleY(1); opacity: 0.22; }
  50% { transform: translateX(-50%) scaleX(0.62) scaleY(0.68); opacity: 0.09; }
}

@keyframes zbot-head-curious {
  0%, 52%, 94%, 100% { transform: rotate(0deg); }
  60%, 86% { transform: rotate(-7deg) translateY(-1px); }
}

@keyframes zbot-eye-blink {
  0%, 42%, 46%, 90%, 100% { transform: scaleY(1); }
  44% { transform: scaleY(0.08); }
  94% { transform: scaleY(0.08); }
}

@keyframes zbot-eye-gaze {
  0%, 18%, 100% { transform: translateX(0px); }
  26%, 44% { transform: translateX(-2.8px); }
  54%, 64% { transform: translateX(0px); }
  72%, 88% { transform: translateX(2.8px); }
}

@keyframes zbot-wave-idle {
  0%, 52%, 100% { transform: rotate(0deg); }
  58% { transform: rotate(-12deg); }
  65% { transform: rotate(18deg); }
  72% { transform: rotate(-12deg); }
  79% { transform: rotate(18deg); }
  86% { transform: rotate(-10deg); }
  93% { transform: rotate(6deg); }
}

@keyframes zbot-hand-flick {
  0%, 52%, 100% { transform: rotate(0deg); }
  58% { transform: rotate(-10deg); }
  65% { transform: rotate(12deg); }
  72% { transform: rotate(-10deg); }
  79% { transform: rotate(12deg); }
  86% { transform: rotate(-6deg); }
}

@keyframes zbot-wave-hover {
  0% { transform: rotate(-12deg) translateY(-1px); }
  100% { transform: rotate(18deg) translateY(-1px); }
}

@keyframes zbot-orange-flash {
  0%, 52%, 100% {
    filter: drop-shadow(0 0 3px rgba(251, 146, 60, 0.85));
    opacity: 0.92;
  }
  62%, 76%, 88% {
    filter: drop-shadow(0 0 9px rgba(251, 146, 60, 1)) drop-shadow(0 0 14px rgba(254, 215, 170, 0.95)) brightness(1.35);
    opacity: 1;
  }
  69%, 82% {
    filter: drop-shadow(0 0 4px rgba(251, 146, 60, 0.9));
    opacity: 0.95;
  }
}

@keyframes zbot-orange-flash-fast {
  0% {
    filter: drop-shadow(0 0 4px rgba(251, 146, 60, 0.9));
    opacity: 0.9;
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(251, 146, 60, 1)) drop-shadow(0 0 14px rgba(254, 215, 170, 0.95)) brightness(1.35);
    opacity: 1;
  }
}

@keyframes zbot-wave-cheer {
  0% { transform: rotate(-18deg) translateY(-3px); }
  100% { transform: rotate(16deg) translateY(-3px); }
}

@keyframes zbot-left-cheer {
  0% { transform: rotate(18deg) translateY(-2px); }
  100% { transform: rotate(-8deg) translateY(-1px); }
}

@keyframes zbot-flame-pulse {
  0% { transform: scaleY(0.84) scaleX(0.92); opacity: 0.78; }
  100% { transform: scaleY(1.22) scaleX(1.06); opacity: 1; }
}

@keyframes zbot-flame-boost {
  0% { transform: scaleY(1.02) scaleX(0.98); opacity: 0.9; }
  100% { transform: scaleY(1.42) scaleX(1.14); opacity: 1; }
}

@keyframes zbot-ear-pulse {
  0% { filter: drop-shadow(0 0 2px #fb923c); opacity: 0.85; }
  100% { filter: drop-shadow(0 0 9px #fb923c) brightness(1.28); opacity: 1; }
}

@keyframes zbot-listen-lean {
  0%, 100% { transform: translateY(-2px) rotate(-3deg) scale(1.03); }
  50% { transform: translateY(-7px) rotate(-5deg) scale(1.06); }
}

@keyframes zbot-think-rock {
  0%, 100% { transform: translateY(-2px) rotate(-5deg); }
  50% { transform: translateY(-7px) rotate(5deg); }
}

@keyframes zbot-eye-scan-fast {
  0%, 100% { transform: translateX(-4.5px); }
  50% { transform: translateX(4.5px); }
}

@keyframes zbot-antenna-spin {
  0% { transform: rotate(-18deg) scale(1); }
  50% { transform: rotate(18deg) scale(1.12); }
  100% { transform: rotate(-18deg) scale(1); }
}

@keyframes zbot-success-hop {
  0%, 100% { transform: translateY(0px) scale(1); }
  45% { transform: translateY(-11px) scale(1.08); }
}

@keyframes zbot-smile-celebrate {
  0% { transform: scale(1); opacity: 0.92; }
  100% { transform: scale(1.06); opacity: 1; }
}

@keyframes zbot-error-shake {
  0%, 100% { transform: translateX(0px) rotate(0deg); }
  20% { transform: translateX(-5px) rotate(-3deg); }
  50% { transform: translateX(5px) rotate(3deg); }
  80% { transform: translateX(-3px) rotate(-1.5deg); }
}

@keyframes zbot-visor-sweep {
  0% { transform: translateY(-13px); opacity: 0; }
  50% { opacity: 0.95; }
  100% { transform: translateY(13px); opacity: 0; }
}

@keyframes zbot-scan-pulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; filter: drop-shadow(0 0 6px #22d3ee); }
}

@keyframes zbot-visor-error-blink {
  0% { opacity: 0.58; filter: drop-shadow(0 0 4px #f59e0b); }
  100% { opacity: 1; filter: drop-shadow(0 0 8px #f43f5e); }
}

@keyframes zbot-wave-pulse {
  0% { transform: scale(0.7); opacity: 0.85; }
  100% { transform: scale(1.55); opacity: 0; }
}

@keyframes zbot-spark-burst {
  0% { transform: scale(0.3) translateY(4px); opacity: 0; }
  40% { transform: scale(1.25) translateY(-4px); opacity: 1; }
  100% { transform: scale(0.4) translateY(-12px); opacity: 0; }
}

.robot-success-badge {
  position: absolute;
  top: -26px;
  right: 4px;
  background: #10b981;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.45);
  white-space: nowrap;
  pointer-events: none;
  animation: badgePop 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  z-index: 46;
  display: flex;
  align-items: center;
  gap: 3px;
}

@keyframes badgePop {
  0% { opacity: 0; transform: translateY(6px) scale(0.85); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.mic-recording {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #e73c3e !important;
  animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 60, 62, 0.38); }
  50% { box-shadow: 0 0 0 6px rgba(231, 60, 62, 0.10); }
}

/* Radar ERP: botones de previsualización de tabla */
.btn-radar-preview-table {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #166c7a;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}
.btn-radar-preview-table:hover {
  color: #2196a8;
}

/* ============================================================
   AJUSTES PUNTUALES: SCROLL MODAL AUDITORÍA & COLUMNA N° RUTA
   ============================================================ */

/* 1. Delimitación estricta entre encabezado fijo y cuerpo desplazable en Auditoría */
#auditoriaModal > .liquid-glass {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#auditoriaModal .up-dark-header {
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}

#auditoriaModal > .liquid-glass > .overflow-y-auto {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  z-index: 10;
  overscroll-behavior: contain;
  isolation: isolate;
}

#auditoriaModal > .liquid-glass > :last-child {
  flex-shrink: 0;
  position: relative;
  z-index: 30;
}

#auditoriaModal thead.sticky {
  z-index: 15;
  background-color: #f1f5f9;
}

/* 2. Contraste máximo en columna N° RUTA de Pedidos Despachados */
#mPedidosTbody tr > td:first-child {
  color: #0369a1 !important;
  font-weight: 700 !important;
}

/* 3. Acordeón unificado para tarjetas de Auditoría Técnica (Secciones 1 a 10) */
.audit-accordion-toggle {
  cursor: pointer;
}

.audit-accordion-icon {
  transition: transform 0.2s ease;
  transform: rotate(0deg);
}

.audit-accordion-icon.rotate-180 {
  transform: rotate(180deg);
}

.audit-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  flex-shrink: 0;
}

.audit-alert-badge--warning {
  background-color: #fef3c7;
  color: #b45309;
  border: 1px solid #f59e0b;
}

.audit-alert-badge--critical {
  background-color: #fee2e2;
  color: #b91c1c;
  border: 1px solid #ef4444;
}

.audit-alert-bang {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.875rem;
  height: 0.875rem;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 900;
  color: #ffffff;
}

.audit-alert-badge--warning .audit-alert-bang {
  background-color: #d97706;
}

.audit-alert-badge--critical .audit-alert-bang {
  background-color: #dc2626;
}

/* ============================================================
   RESPONSIVE MÓVIL (< 640px PORTRAIT)
   Mantiene intacto el layout horizontal en tablet y escritorio
   ============================================================ */
@media (max-width: 640px) {
  html,
  body {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-container,
  #ventasWorkspace,
  #moduleWorkspaceView {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* 1. Encuadre completo del bloque superior oscuro y barra de filtros */
  header.header-glass {
    box-sizing: border-box;
    margin: 0.5rem !important;
    width: calc(100% - 1rem) !important;
    max-width: calc(100% - 1rem) !important;
    overflow: hidden;
  }

  header.header-glass .up-header-top {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 0.625rem 0.75rem !important;
    gap: 8px !important;
    flex-direction: column;
    align-items: stretch;
  }

  header.header-glass .up-brand-wrap {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    flex-shrink: 1 !important;
    min-width: 0;
    align-items: flex-start;
    gap: 8px !important;
  }

  header.header-glass .up-brand-mark {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
  }

  header.header-glass .up-brand-text {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 0%;
  }

  header.header-glass .up-header-title {
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    flex-shrink: 1 !important;
    min-width: 0;
    max-width: 100%;
    font-size: 0.98rem !important;
    line-height: 1.25 !important;
  }

  header.header-glass .up-header-subtitle {
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
    font-size: 0.72rem !important;
    line-height: 1.3;
    margin-top: 2px;
  }

  header.header-glass .up-header-right {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0 !important;
    justify-content: flex-start !important;
    flex-wrap: wrap;
    gap: 8px !important;
  }

  #moduleNavBar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 6px;
  }

  header.header-glass .up-status-strip {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: wrap !important;
    justify-content: flex-start;
    gap: 8px !important;
    flex-shrink: 1 !important;
  }

  header.header-glass .up-status-strip #connectionBadge,
  header.header-glass .up-status-strip .ctrl-pill {
    box-sizing: border-box;
    flex-shrink: 1 !important;
    min-width: 0;
    max-width: 100%;
    height: 32px !important;
    padding-left: 0.625rem !important;
    padding-right: 0.625rem !important;
  }

  /* Barra de filtros y acciones con separación uniforme (gap: 8px) sin solapamientos */
  header.header-glass .up-header-toolbar {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0.625rem 0.75rem !important;
    gap: 8px !important;
    align-items: stretch;
  }

  header.header-glass .up-date-range-pill {
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    height: auto !important;
    white-space: normal !important;
    flex-shrink: 1 !important;
    padding: 8px !important;
    gap: 8px !important;
  }

  header.header-glass .up-date-range-pill .up-date-icon {
    display: none;
  }

  header.header-glass .up-date-pair {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px !important;
    min-width: 0;
    max-width: 100%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 8px;
  }

  header.header-glass .up-date-pair input[type="date"] {
    width: 100% !important;
    min-width: 0;
    max-width: 100%;
    height: 24px !important;
    font-size: 0.75rem !important;
  }

  header.header-glass .up-date-actions {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
  }

  #btnConsultarRango,
  #btnDesdeInicioOperativo {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 34px !important;
    justify-content: center;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  header.header-glass .up-filter-pill {
    box-sizing: border-box;
    flex: 1 1 calc(50% - 4px) !important;
    min-width: 0 !important;
    max-width: 100%;
    height: 36px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    white-space: normal !important;
    flex-shrink: 1 !important;
  }

  header.header-glass .up-filter-pill select {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    font-size: 0.75rem !important;
    text-overflow: ellipsis;
  }

  header.header-glass .up-toolbar-btn {
    box-sizing: border-box;
    flex: 1 1 calc(50% - 4px) !important;
    min-width: 0 !important;
    max-width: 100%;
    height: 36px !important;
    justify-content: center;
    flex-shrink: 1 !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    overflow: hidden;
  }

  #authContainer {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin-left: 0 !important;
    justify-content: flex-end;
    flex-wrap: wrap;
    flex-shrink: 1 !important;
    gap: 8px !important;
  }

  #authContainer #userProfile,
  #authContainer #btnLoginOpen,
  #authContainer #btnRestoreZetaBot {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
    height: 36px !important;
  }

  /* KPIs compactos en 2 columnas para móvil */
  .up-kpi-section {
    padding: 0.375rem 0.5rem;
  }

  .up-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .kpi-hud-card {
    padding: 0.625rem 0.75rem;
    gap: 0.375rem;
  }

  .up-kpi-icon {
    width: 22px;
    height: 22px;
    border-radius: 5px;
  }

  .up-kpi-icon svg {
    width: 13px;
    height: 13px;
  }

  .kpi-divider {
    width: 24px;
    margin: 0.2rem 0;
  }

  .up-kpi-value {
    font-size: 1.2rem;
    line-height: 1.15;
  }

  .up-mini-bars {
    width: 34px;
    gap: 3px;
  }

  .up-mini-bar-track {
    height: 4px;
  }

  .hud-orb-track {
    height: 4px;
    margin-top: 4px;
  }

  .hud-col-chart {
    height: 30px;
    gap: 3px;
    padding-left: 3px;
    padding-bottom: 2px;
  }

  .hud-col-bar {
    width: 5px;
  }

  .hud-ring-svg {
    width: 42px;
    height: 42px;
  }

  .kpi-spark-wrap {
    width: 104px;
    height: 36px;
  }

  .kpi-proj-range {
    font-size: 8.5px;
  }

  .kpi-eff-pill {
    font-size: 9px;
    padding: 1px 5px;
  }

  .kpi-rot-base {
    font-size: 9px;
  }

  .kpi-rot-legend {
    font-size: 9px;
    gap: 4px;
  }

  /* 2. Sábana de Ventas: columnas compactas y navegación táctil fluida */
  #matrixScrollContainer {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  #matrixTable {
    width: max-content;
    min-width: 100%;
    font-size: 0.72rem;
  }

  #matrixTable tr {
    transition: none !important;
  }

  #matrixTable th,
  #matrixTable td {
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
    line-height: 1.2 !important;
  }

  /* Compactar columnas fijas de escritorio que no son sticky en móvil */
  #matrixTable .sticky-corner-1,
  #matrixTable .sticky-corner-3,
  #matrixTable .sticky-corner-4,
  #matrixTable .sticky-col-1,
  #matrixTable .sticky-col-3,
  #matrixTable .sticky-col-4,
  #matrixTable .sticky-sub-1,
  #matrixTable .sticky-sub-3,
  #matrixTable .sticky-sub-4 {
    position: static !important;
    left: auto !important;
    box-shadow: none !important;
    width: auto !important;
    min-width: 56px !important;
    max-width: 92px;
  }

  #matrixTable .sticky-col-2,
  #matrixTable .sticky-corner-2,
  #matrixTable .sticky-sub-2 {
    position: sticky !important;
    left: 0 !important;
    min-width: 68px !important;
    width: 68px !important;
    max-width: 74px !important;
    padding: 4px 4px !important;
    box-shadow: 3px 0 8px -3px rgba(15, 23, 42, 0.14);
    transform: translateZ(0);
    backface-visibility: hidden;
  }

  #matrixTable .sticky-col-2 > span {
    padding: 1px 4px !important;
    font-size: 0.72rem !important;
  }

  /* Encabezados de fecha apilados y subcolumnas angostas para mostrar más fechas */
  #matrixTable .matrix-day-header {
    min-width: 96px !important;
    padding: 4px 5px !important;
  }

  #matrixTable .matrix-day-header-inner {
    flex-direction: column;
    gap: 2px !important;
    line-height: 1.15;
  }

  #matrixTable .matrix-day-title {
    font-size: 0.72rem !important;
    white-space: nowrap;
  }

  #matrixTable .matrix-day-total {
    font-size: 0.65rem !important;
    padding: 1px 4px !important;
    white-space: nowrap;
  }

  #matrixTable .matrix-sub-col {
    min-width: 48px !important;
    max-width: 62px;
    padding: 4px 4px !important;
    font-size: 0.68rem !important;
    line-height: 1.1 !important;
    white-space: normal !important;
    word-break: break-word;
  }

  #matrixTable .matrix-vol-cell,
  #matrixTable .matrix-rot-cell {
    min-width: 48px !important;
    padding: 4px 5px !important;
    font-size: 0.72rem !important;
    white-space: nowrap;
  }

  #matrixTbody .matrix-vol-btn {
    font-size: 0.72rem !important;
  }

  #matrixTbody .matrix-rot-badge,
  #matrixTbody .matrix-zero-pill {
    font-size: 0.68rem !important;
    padding: 1px 4px !important;
    line-height: 1.15;
  }

  #matrixTfoot td {
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
    white-space: nowrap;
  }

  .sticky-header-sub,
  .sticky-sub-2 {
    top: 39px;
  }
}
