:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(18, 24, 38, 0.85);
  --bg-card-hover: rgba(26, 34, 53, 0.95);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(0, 242, 254, 0.4);

  --text-main: #f3f4f6;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-standby: #6366f1;

  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

*::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar,
div::-webkit-scrollbar,
section::-webkit-scrollbar,
main::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(0, 242, 254, 0.07) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(79, 172, 254, 0.05) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 0.75rem 1rem;
  max-width: 100%;
  margin: 0;
  width: 100%;
}

/* ==================== HEADER ==================== */
.header {
  position: relative;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.logo-cube {
  width: 22px;
  height: 22px;
  background: var(--accent-gradient);
  border-radius: 6px;
  transform: rotate(45deg);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.5);
}

.brand-name {
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: -0.5px;
}

.brand-name strong {
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-version {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
}

.printer-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.styled-select {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.styled-select:focus {
  border-color: var(--accent-cyan);
}

.btn-discover-printers {
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.35);
  color: var(--accent-cyan);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.38rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-discover-printers:hover {
  background: var(--accent-cyan);
  color: #040810;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.45);
}

.btn-discover-printers.is-searching {
  pointer-events: none;
  opacity: 0.7;
  animation: pulseSearch 1s infinite alternate;
}

@keyframes pulseSearch {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.header-center {
  display: flex;
  align-items: center;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
  transition: background 0.3s;
}

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

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

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

.btn-emergency {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: white;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
  transition: all 0.2s ease;
}

.btn-emergency:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.btn-emergency svg {
  width: 18px;
  height: 18px;
}

/* ==================== DASHBOARD ARQUITECTURA 3 COLUMNAS INDEPENDIENTES (CERO HUECOS) ==================== */
.dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  width: 100%;
}

.dashboard-columns-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  width: 100%;
  align-items: start;
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  width: 100%;
  min-width: 0;
}

.dashboard-col > .card {
  width: 100%;
  margin: 0;
}

.dashboard-bottom-row {
  width: 100%;
}

.dashboard-bottom-row > .card {
  width: 100%;
  margin: 0;
}

/* Ocultar selector de ancho manual para que el layout fluya 100% orgánico sin deformarse */
.card-col-switcher {
  display: none !important;
}

/* Modificadores de compatibilidad legacy si alguna card tiene la clase */
.col-span-1, .col-span-2, .col-span-3, .col-span-4 {
  grid-column: auto !important;
}

/* Adaptación responsive inteligente */
@media (max-width: 1200px) {
  .dashboard-columns-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-col#colOperation {
    grid-column: span 2;
  }
  .dashboard-col#colOperation .motion-layout {
    display: flex;
    justify-content: space-around;
  }
}

@media (max-width: 768px) {
  .dashboard-columns-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-col#colOperation {
    grid-column: span 1;
  }
}

/* Selector de Ancho por Columnas en Header */
.card-col-switcher {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
  user-select: none;
}

.btn-span {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-span:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

.btn-span.active {
  background: var(--accent-gradient);
  color: #050d1a;
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.45);
}

@media (max-width: 1380px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dashboard-grid > .card.col-span-1,
  .dashboard-grid > .card.col-span-2 {
    grid-column: span 1 !important;
  }
  .dashboard-grid > .card.col-span-3,
  .dashboard-grid > .card.col-span-4 {
    grid-column: span 2 !important;
  }
}

@media (max-width: 820px) {
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
  .dashboard-grid > .card {
    grid-column: span 1 !important;
  }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
  height: auto;
  min-height: min-content;
  box-sizing: border-box;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  gap: 0.5rem;
  flex-wrap: wrap; /* Nunca permite que los botones o texto rompan la tarjeta */
  min-width: 0;
}

.card-header:active {
  cursor: grabbing;
}

.card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
  border-color: var(--accent-cyan);
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 auto;
}

.card-title .icon {
  width: 20px;
  height: 20px;
  color: var(--accent-cyan);
  flex-shrink: 0;
}

.card-title h3 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

/* Modo Edición / Organización */
.layout-organize-active .card {
  border: 1px dashed var(--accent-cyan);
  box-shadow: 0 0 15px rgba(0, 242, 254, 0.2);
  cursor: grab;
}
.layout-organize-active .card:hover {
  border-color: #fff;
}

.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.5px;
}

.pill-standby { background: rgba(99, 102, 241, 0.2); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.4); }
.pill-printing { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.4); }
.pill-paused { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.4); }
.pill-error { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.4); }

/* ==================== JOB PROGRESS & CAMERA ==================== */
.progress-ring-container {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0.5rem auto;
}

.progress-ring-indicator {
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  stroke-dasharray: 358.14;
  stroke-dashoffset: 358.14;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-pct {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.progress-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==================== ANIMACIÓN HUD VIVA PARA PORCENTAJE EN IMPRESIÓN ==================== */
.progress-ring-container.is-printing {
  filter: drop-shadow(0 0 16px rgba(0, 242, 254, 0.35));
}

.progress-ring-container.is-printing::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 6px;
  border-radius: 50%;
  border: 1.5px dashed rgba(0, 242, 254, 0.45);
  animation: radarSpinRing 14s linear infinite;
  pointer-events: none;
}

.progress-ring-container.is-printing::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  bottom: 18px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.16) 0%, rgba(79, 172, 254, 0.05) 55%, transparent 75%);
  animation: auraBreathRing 2.8s ease-in-out infinite alternate;
  pointer-events: none;
}

.progress-ring-container.is-printing .progress-ring-indicator {
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.95)) drop-shadow(0 0 18px rgba(79, 172, 254, 0.55));
  animation: indicatorNeonPulse 2.4s ease-in-out infinite alternate;
}

.progress-ring-container.is-printing .progress-pct {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.9), 0 0 20px rgba(0, 242, 254, 0.45);
  animation: pctNeonPulse 2.4s ease-in-out infinite alternate;
}

.progress-ring-container.is-printing .progress-sub {
  color: var(--accent-cyan);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.7);
  animation: subGlowPulse 1.8s ease-in-out infinite alternate;
}

@keyframes radarSpinRing {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes auraBreathRing {
  0% { transform: scale(0.92); opacity: 0.35; }
  100% { transform: scale(1.08); opacity: 0.85; }
}

@keyframes indicatorNeonPulse {
  0% { stroke-width: 11; filter: drop-shadow(0 0 6px rgba(0, 242, 254, 0.8)); }
  100% { stroke-width: 12.5; filter: drop-shadow(0 0 14px rgba(0, 242, 254, 1)) drop-shadow(0 0 24px rgba(79, 172, 254, 0.7)); }
}

@keyframes pctNeonPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

@keyframes subGlowPulse {
  0% { opacity: 0.75; }
  100% { opacity: 1; }
}

.job-meta {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.meta-item {
  display: flex;
  justify-content: space-between;
}

.meta-label {
  color: var(--text-muted);
}

.meta-val {
  font-weight: 500;
  font-family: var(--font-mono);
}

.job-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.job-idle-banner {
  text-align: center;
  padding: 0.65rem 0.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 0.4rem;
}

.camera-preview {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 0.5rem;
}

.camera-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.8rem;
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cam-tabs {
  display: flex;
  gap: 0.4rem;
}

.cam-tab-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.cam-tab-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.cam-tab-btn.active {
  background: var(--accent-gradient);
  color: #050d1a;
  border-color: transparent;
}

.cam-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--color-danger);
  font-weight: 700;
  font-size: 0.7rem;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-danger);
  animation: pulse 1.5s infinite;
}

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

.camera-stream {
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020712;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  transition: aspect-ratio 0.2s ease;
}

.camera-stream.aspect-screen {
  aspect-ratio: 480 / 320;
}

.camera-feed-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.cam-fallback {
  text-align: center;
  color: var(--text-dim);
}

.cam-fallback svg {
  width: 38px;
  height: 38px;
  margin-bottom: 0.3rem;
  opacity: 0.6;
}

/* ==================== THERMAL CONTROLS ==================== */
.sub-section {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.temp-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.temp-tile {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.temp-tile-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.tool-selector {
  display: flex;
  gap: 0.3rem;
  margin: -0.2rem 0 0.2rem 0;
}

.tool-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tool-btn.active {
  background: var(--accent-gradient);
  color: #050d1a;
  border-color: transparent;
  font-weight: 700;
}

.macros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  max-height: 160px;
  overflow-y: auto;
  padding-right: 4px;
}

.macro-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: all 0.15s;
}

.macro-btn:hover {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
  color: white;
}

.temp-display {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.temp-actual {
  font-size: 2.2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.temp-unit {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.temp-target-badge {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.temp-input-row {
  display: flex;
  gap: 0.4rem;
}

.temp-input-row input {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.temp-presets {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  width: 100%;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.3rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  border-color: var(--accent-cyan);
}

.preset-cooldown {
  border-color: rgba(79, 172, 254, 0.3);
  color: #38bdf8;
}

@media (max-width: 650px) {
  .temp-presets {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==================== MOTION CONTROLS ==================== */
.step-selector {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

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

.step-btn {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.step-btn.active {
  background: var(--accent-gradient);
  color: #050d1a;
  border-color: transparent;
  font-weight: 700;
}

.motion-layout {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  border: 1px solid var(--border-color);
}

.jog-cross {
  display: grid;
  grid-template-columns: repeat(3, 50px);
  grid-template-rows: repeat(3, 50px);
  gap: 6px;
}

.jog-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.jog-btn:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  transform: scale(1.05);
}

.jog-btn:active {
  transform: scale(0.95);
}

.jog-up { grid-column: 2; grid-row: 1; }
.jog-left { grid-column: 1; grid-row: 2; }
.jog-center { grid-column: 2; grid-row: 2; background: rgba(99, 102, 241, 0.15); border-color: rgba(99, 102, 241, 0.4); font-size: 0.75rem; }
.jog-right { grid-column: 3; grid-row: 2; }
.jog-down { grid-column: 2; grid-row: 3; }

.jog-z-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.axis-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.jog-z {
  width: 50px;
  height: 50px;
}

.jog-z-home {
  width: 50px;
  height: 50px;
  font-size: 0.75rem;
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}

.jog-actions {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
}

.coordinates-readout {
  display: flex;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.coordinates-readout span {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* ==================== KLIPPER MACROS ==================== */
.macros-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  max-height: 240px;
  overflow-y: auto;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  align-content: flex-start;
}

.macro-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  user-select: none;
}

.macro-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 242, 254, 0.15);
}

.macro-btn:active {
  transform: translateY(1px);
}

/* ==================== G-CODE TERMINAL ==================== */
.terminal-card {
  height: 100%;
}

.terminal-body {
  background: #060911;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
  height: 480px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.35) rgba(0, 0, 0, 0.3);
}

/* Custom Scrollbar moderno para eliminar barras grises nativas de Windows */
.terminal-body::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

.terminal-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.35);
  border-radius: 4px;
  transition: background 0.2s;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
  background: var(--accent-cyan);
}

.terminal-body::-webkit-scrollbar-corner {
  background: transparent;
}

.terminal-line {
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: block;
}

.terminal-line.sent,
.terminal-line.cmd-sent {
  color: #c084fc;
  font-weight: 500;
}

.terminal-line.cmd-translated {
  color: #38bdf8;
  font-weight: 500;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  background: rgba(56, 189, 248, 0.06);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  border-left: 2px solid var(--accent-cyan);
}

.terminal-line.klipper-info {
  color: #94a3b8;
}

.terminal-line.klipper-heating {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  border-left: 2px solid #fbbf24;
}

.terminal-line.klipper-success {
  color: #4ade80;
  font-weight: 500;
}

.terminal-line.system-line {
  color: #64748b;
  font-style: italic;
  font-size: 0.74rem;
}

.terminal-line.error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  border-left: 2px solid #ef4444;
}

.terminal-input-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.terminal-input-bar input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
}

.terminal-input-bar input:focus {
  border-color: var(--accent-cyan);
}

/* ==================== BUTTON UTILITIES ==================== */
.btn {
  background: var(--accent-gradient);
  color: #050d1a;
  border: none;
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger-soft {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger-soft:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-clear {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-clear:hover {
  color: var(--text-main);
}

/* Pantalla Táctil Interactiva */
.camera-feed-img.interactive-touch-screen {
  border: 2px solid var(--accent-cyan) !important;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.touch-ripple {
  position: fixed;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  transform: translate(-50%, -50%) scale(0.6);
  pointer-events: none;
  z-index: 99999;
  animation: ripple-anim 0.25s ease-out forwards;
}

@keyframes ripple-anim {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

/* ==================== G-CODE FILE MANAGER ==================== */
.files-list-container {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  cursor: pointer;
  gap: 0.75rem;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transform: translateY(-1px);
}

.file-thumb-mini {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 8px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, rgba(0, 0, 0, 0.5) 100%);
  border: 1px solid rgba(56, 189, 248, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  user-select: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-thumb-mini:hover {
  transform: scale(1.18);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.6);
  background: radial-gradient(circle, rgba(56, 189, 248, 0.35) 0%, rgba(0, 0, 0, 0.7) 100%);
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  flex: 1;
}

.file-name {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.file-submeta {
  font-size: 0.73rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.file-actions-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.btn-file-print {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-file-print:hover {
  background: rgba(34, 197, 94, 0.35);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.btn-file-delete {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  font-size: 0.76rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-file-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* Popover Flotante de Miniatura 3D */
.gcode-thumb-popover {
  position: fixed;
  display: none;
  width: 260px;
  background: rgba(7, 13, 26, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid var(--accent-cyan);
  border-radius: 14px;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), 0 0 25px rgba(56, 189, 248, 0.35);
  z-index: 999999;
  pointer-events: none;
  overflow: hidden;
  flex-direction: column;
  padding: 0.8rem;
  gap: 0.6rem;
}

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

.popover-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.popover-img-box {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12) 0%, rgba(0, 0, 0, 0.7) 85%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.popover-img-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.popover-img-box.loading-box {
  flex-direction: column;
  gap: 0.6rem;
}

.thumb-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid rgba(56, 189, 248, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

.popover-no-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.popover-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.45rem;
}

/* ==================== TAB PILLS & HISTORIAL ==================== */
.tab-pill-group {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 3px;
}

.tab-pill-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.76rem;
  font-weight: 500;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-pill-btn.active {
  background: var(--accent-gradient);
  color: #050d1a;
  font-weight: 700;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.icon-inline {
  width: 13px;
  height: 13px;
}

.history-view-container {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.history-stats-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.stat-name {
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-list-items {
  max-height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.85rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  gap: 0.75rem;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(56, 189, 248, 0.35);
}

.history-item-status {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.status-completed {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.status-cancelled {
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.status-in_progress {
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-width: 0;
}

.history-filename {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
}

.history-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  align-items: center;
}

.btn-history-reprint {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  font-size: 0.72rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-history-reprint:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #ffffff;
}

/* ==================== BOTONES DE CABECERA ==================== */
.btn-header-action {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-header-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
}

.btn-header-action svg {
  width: 15px;
  height: 15px;
  stroke: var(--accent-cyan);
}

@media (max-width: 640px) {
  .btn-text-desktop {
    display: none;
  }
}

/* ==================== MODALES & LOCKSCREEN ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.88);
  backdrop-filter: blur(16px);
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.auth-card {
  width: 100%;
  max-width: 320px;
  background: #081022;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(56, 189, 248, 0.25);
  padding: 1.8rem 1.4rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-lock-shield {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, rgba(0, 0, 0, 0.6) 100%);
  border: 1.5px solid var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}

.auth-card h3 {
  font-size: 1.15rem;
  color: #ffffff;
  margin-bottom: 0.3rem;
}

.auth-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 1.2rem;
  line-height: 1.35;
}

.auth-form {
  width: 100%;
}

.auth-form input[type="password"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  border: 1.5px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 1.4rem;
  text-align: center;
  padding: 0.5rem;
  letter-spacing: 6px;
  font-family: var(--font-mono);
  outline: none;
}

.auth-form input[type="password"]:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3);
}

.auth-error-msg {
  display: none;
  background: rgba(239, 68, 68, 0.18) !important;
  border: 1px solid rgba(239, 68, 68, 0.5) !important;
  color: #fca5a5 !important;
  padding: 0.65rem 0.85rem !important;
  border-radius: var(--radius-sm, 8px) !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  text-align: center !important;
  margin: 0.75rem 0 !important;
  line-height: 1.35 !important;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  width: 100%;
  margin-top: 1rem;
}

.numpad-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 600;
  padding: 0.65rem 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-mono);
}

.numpad-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
}

.numpad-btn:active {
  transform: scale(0.95);
}

.numpad-clear {
  color: #f87171;
}

.numpad-back {
  color: #38bdf8;
}

.auth-hint {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 1rem;
}

/* Modal de Alertas WAN & Seguridad Amplio y Cómodo */
.alerts-modal-card {
  width: 92vw;
  max-width: 660px;
  max-height: 86vh;
  overflow-y: auto;
  background: #0a1120;
  border: 1px solid rgba(0, 242, 254, 0.25);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 1rem;
  margin-bottom: 0.8rem;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-title h3 {
  font-size: 1.1rem;
  color: #ffffff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

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

.modal-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px;
  border-radius: var(--radius-sm);
}

.modal-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.45rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-tab-btn.active {
  background: var(--accent-gradient);
  color: #050d1a;
  font-weight: 700;
}

.alert-channel-group {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.88rem;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-custom {
  width: 34px;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  position: relative;
  transition: all 0.2s;
}

.toggle-custom::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
}

.toggle-label input[type="checkbox"]:checked + .toggle-custom {
  background: #38bdf8;
}

.toggle-label input[type="checkbox"]:checked + .toggle-custom::after {
  transform: translateX(16px);
}

.channel-fields {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.input-field label {
  font-size: 0.74rem;
  color: var(--text-dim);
}

.input-field input {
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  outline: none;
}

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

.alert-events-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.4rem;
}

.event-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  cursor: pointer;
}

.preset-light {
  border-color: rgba(250, 204, 21, 0.4);
  color: #facc15;
}

.preset-light.active {
  background: rgba(250, 204, 21, 0.2);
  color: #fef08a;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.3);
}

/* ==================== LIVE TUNING PANEL (Paso 5) ==================== */
.live-tuning-panel {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 0.6rem;
  transition: all 0.2s ease;
}

.tuning-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.tuning-header:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.tuning-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tuning-title svg {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
}

.tuning-toggle-icon {
  font-size: 0.75rem;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.live-tuning-panel.collapsed .tuning-toggle-icon {
  transform: rotate(-90deg);
}

.live-tuning-panel.collapsed .tuning-body {
  display: none;
}

.tuning-body {
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tuning-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tuning-row-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
}

.tuning-label {
  color: var(--text-muted);
  font-weight: 500;
}

.tuning-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-cyan);
}

.tuning-btn-group {
  display: flex;
  gap: 0.3rem;
}

.btn-tune {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 0.35rem 0.2rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.btn-tune:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: rgba(0, 242, 254, 0.4);
  color: #ffffff;
}

.btn-tune:active {
  transform: scale(0.96);
}

.btn-tune-reset {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.25);
  color: var(--accent-cyan);
  font-weight: 600;
}

.btn-tune-save {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.btn-tune-save:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #34d399;
  color: #ffffff;
}

/* ========================================================
   RACK MULTI-EXTRUSOR (T0, T1, T2, T3) & FILAMENT MANAGER
   ======================================================== */
.extruders-rack {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-top: 0.85rem;
}

@media (max-width: 900px) {
  .extruders-rack {
    grid-template-columns: repeat(2, 1fr);
  }
}

.extruder-slot {
  background: rgba(13, 22, 38, 0.65);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.extruder-slot:hover {
  border-color: rgba(0, 242, 254, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.extruder-slot.active-tool-slot {
  border-color: var(--accent-cyan);
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.08) 0%, rgba(13, 22, 38, 0.85) 100%);
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.2), inset 0 0 12px rgba(0, 242, 254, 0.05);
}

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

.slot-tool-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.76rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.extruder-slot.active-tool-slot .slot-tool-badge {
  background: var(--accent-cyan);
  color: #040810;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(0, 242, 254, 0.5);
}

.slot-active-tag {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.15);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  animation: pulseSlotActive 1.8s infinite ease-in-out;
}

@keyframes pulseSlotActive {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.btn-slot-edit {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  transition: all 0.2s;
}

.btn-slot-edit:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.slot-filament-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.filament-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 8px currentColor;
  transition: all 0.25s ease;
}

.filament-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.2;
}

.filament-name {
  font-size: 0.74rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.filament-type {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.slot-temp-row {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.2rem;
}

.slot-temp-val {
  font-size: 0.88rem;
  color: var(--text-main);
}

.slot-temp-val strong {
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
}

.extruder-slot.active-tool-slot .slot-temp-val strong {
  color: var(--accent-cyan);
}

.slot-temp-target {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.slot-actions {
  display: flex;
  gap: 0.25rem;
  margin-top: auto;
}

.btn-slot-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-slot-select {
  flex: 1;
  font-weight: 600;
}

.btn-slot-action:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.extruder-slot.active-tool-slot .btn-slot-select {
  background: rgba(0, 242, 254, 0.18);
  border-color: rgba(0, 242, 254, 0.45);
  color: var(--accent-cyan);
}

/* Badges de Metadatos de Trabajo */
.badge-filament-pill, .badge-time-pill {
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.badge-filament-pill {
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.3);
  color: #fde047;
}

.badge-time-pill {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
}

/* Paleta rápida de colores en Filament Modal */
.color-palette-presets {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

.color-swatch-opt {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.color-swatch-opt:hover {
  transform: scale(1.22);
  border-color: #ffffff;
  box-shadow: 0 0 10px currentColor;
}

/* Bed Mesh Canvas Wrap */
.bed-mesh-canvas-wrap {
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

#bedMeshCanvas {
  background: #040810;
}

/* ==========================================================================
   ESTILOS NUEVOS: TEMPERATURAS DRIVERS & AUXILIARES
   ========================================================================== */
.extra-temp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

/* ==========================================================================
   MACROS: COLORES PASTEL MODERNOS & DESCRIPCIONES (GLASSMORPHISM)
   ========================================================================== */
.macros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
  margin-top: 0.6rem;
}

.macro-card-pastel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
  user-select: none;
}

.macro-card-pastel:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.macro-card-pastel:active {
  transform: translateY(0);
}

.macro-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.25;
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.macro-card-desc {
  font-size: 0.71rem;
  line-height: 1.3;
  opacity: 0.82;
  font-family: var(--font-main);
  color: #e2e8f0;
}

/* Paleta Pastel Suave */
.pastel-mint {
  background: rgba(167, 243, 208, 0.12);
  border-color: rgba(110, 231, 183, 0.38);
}
.pastel-mint .macro-card-title { color: #6ee7b7; }
.pastel-mint:hover {
  background: rgba(167, 243, 208, 0.22);
  border-color: rgba(110, 231, 183, 0.7);
  box-shadow: 0 6px 18px rgba(110, 231, 183, 0.2);
}

.pastel-lavender {
  background: rgba(221, 214, 254, 0.12);
  border-color: rgba(196, 181, 253, 0.38);
}
.pastel-lavender .macro-card-title { color: #c4b5fd; }
.pastel-lavender:hover {
  background: rgba(221, 214, 254, 0.22);
  border-color: rgba(196, 181, 253, 0.7);
  box-shadow: 0 6px 18px rgba(196, 181, 253, 0.2);
}

.pastel-peach {
  background: rgba(254, 215, 170, 0.12);
  border-color: rgba(253, 186, 116, 0.38);
}
.pastel-peach .macro-card-title { color: #fdba74; }
.pastel-peach:hover {
  background: rgba(254, 215, 170, 0.22);
  border-color: rgba(253, 186, 116, 0.7);
  box-shadow: 0 6px 18px rgba(253, 186, 116, 0.2);
}

.pastel-sky {
  background: rgba(186, 230, 253, 0.12);
  border-color: rgba(125, 211, 252, 0.38);
}
.pastel-sky .macro-card-title { color: #7dd3fc; }
.pastel-sky:hover {
  background: rgba(186, 230, 253, 0.22);
  border-color: rgba(125, 211, 252, 0.7);
  box-shadow: 0 6px 18px rgba(125, 211, 252, 0.2);
}

.pastel-rose {
  background: rgba(251, 207, 232, 0.12);
  border-color: rgba(244, 114, 182, 0.38);
}
.pastel-rose .macro-card-title { color: #f472b6; }
.pastel-rose:hover {
  background: rgba(251, 207, 232, 0.22);
  border-color: rgba(244, 114, 182, 0.7);
  box-shadow: 0 6px 18px rgba(244, 114, 182, 0.2);
}

.pastel-yellow {
  background: rgba(254, 240, 138, 0.12);
  border-color: rgba(253, 224, 71, 0.38);
}
.pastel-yellow .macro-card-title { color: #fde047; }
.pastel-yellow:hover {
  background: rgba(254, 240, 138, 0.22);
  border-color: rgba(253, 224, 71, 0.7);
  box-shadow: 0 6px 18px rgba(253, 224, 71, 0.2);
}

.pastel-teal {
  background: rgba(153, 246, 228, 0.12);
  border-color: rgba(94, 234, 212, 0.38);
}
.pastel-teal .macro-card-title { color: #5eead4; }
.pastel-teal:hover {
  background: rgba(153, 246, 228, 0.22);
  border-color: rgba(94, 234, 212, 0.7);
  box-shadow: 0 6px 18px rgba(94, 234, 212, 0.2);
}

/* Items de Configuración de Selección de Macros */
.macro-select-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.macro-select-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--accent-cyan);
}

.macro-select-item input[type="checkbox"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--accent-cyan);
}

.macro-select-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.macro-select-title {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-main);
}

.macro-select-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
}

/* ==========================================================================
   VISUALIZADOR 3D BED MESH (ESTILO FLUIDD / MAINSAIL)
   ========================================================================== */
.bed-mesh-range-badge {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10;
}

.bed-mesh-colorbar {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  z-index: 10;
  user-select: none;
}

.colorbar-max {
  color: #ef4444;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.65);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.colorbar-min {
  color: #3b82f6;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.65);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.colorbar-gradient {
  position: relative;
  width: 14px;
  height: 220px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
  background: linear-gradient(to bottom, #ef4444 0%, #f97316 20%, #fef08a 45%, #ffffff 50%, #bae6fd 60%, #38bdf8 80%, #1d4ed8 100%);
}

.colorbar-pin-top {
  position: absolute;
  top: -3px;
  left: -2px;
  right: -2px;
  height: 6px;
  border-radius: 3px;
  border: 2px solid #ef4444;
}

.colorbar-pin-bottom {
  position: absolute;
  bottom: -3px;
  left: -2px;
  right: -2px;
  height: 6px;
  border-radius: 3px;
  border: 2px solid #1d4ed8;
}

/* ==========================================================================
   BARRA DE ORGANIZACIÓN / MODO EDICIÓN DE INTERFAZ
   ========================================================================== */
.layout-edit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(99, 102, 241, 0.25));
  border: 1px solid var(--accent-cyan);
  border-radius: var(--radius-md);
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px rgba(0, 242, 254, 0.15);
  animation: fadeInDown 0.25s ease;
}

.layout-bar-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-main);
}

.layout-bar-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.card-order-controls {
  display: flex;
  gap: 0.25rem;
}

.btn-card-order {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-card-order:hover {
  background: var(--accent-cyan);
  color: #000;
}

.card.card-edit-mode {
  border: 1px dashed var(--accent-cyan) !important;
  cursor: grab;
  position: relative;
}

.card.card-edit-mode.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

/* ==========================================================================
   BANNER DE DETECCIÓN INTELIGENTE DE FALLAS IA (NUNCA CANCELA AUTOMÁTICO)
   ========================================================================== */
.ai-anomaly-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(245, 158, 11, 0.18));
  border: 1.5px solid #ef4444;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.25);
  animation: pulseAlert 2s infinite ease-in-out;
}

@keyframes pulseAlert {
  0%, 100% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.25); }
  50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.5); }
}

.ai-banner-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.ai-pulse-icon {
  font-size: 1.8rem;
  animation: bounce 1s infinite alternate;
}

.ai-banner-text strong {
  color: #fca5a5;
  font-size: 0.95rem;
  display: block;
}

.ai-banner-text p {
  margin: 0.2rem 0 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.ai-banner-text em {
  color: #fef08a;
  font-style: normal;
  font-weight: 600;
}

.ai-banner-preview {
  max-width: 130px;
  max-height: 80px;
  overflow: hidden;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-banner-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   SPOOLMAN PROPIO INTEGRADO (TARJETAS DE BOBINAS)
   ========================================================================== */
.spool-card {
  background: rgba(18, 22, 34, 0.85);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.spool-card:hover {
  border-color: var(--accent-cyan);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.spool-card-top {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.spool-color-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.spool-badge-assigned {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 600;
}

.spool-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.spool-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.spool-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   CANCEL OBJECT FILAS
   ========================================================================== */
.object-exclude-row {
  transition: all 0.15s ease;
}

.object-exclude-row:hover {
  border-color: var(--accent-cyan) !important;
}

/* ==========================================================================
/* ==========================================================================
   ADAPTATIVIDAD MOBILE RESPONSIVE (< 1200px, < 960px y < 600px)
   ========================================================================== */
@media (max-width: 1200px) {
  .dashboard-columns-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem;
  }
}

@media (max-width: 960px) {
  .app-container {
    padding: 0.5rem 0.6rem;
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.85rem;
  }

  .header-left {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .printer-selector-wrapper {
    flex: 1 1 auto;
    min-width: 160px;
  }

  .printer-selector-wrapper select {
    width: 100%;
    font-size: 0.85rem;
  }

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

  .nav-switch-pills {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
  }

  .header-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.45rem;
  }

  .btn-text-desktop {
    display: none !important;
  }

  .btn-header-action {
    padding: 0.45rem 0.65rem !important;
  }

  .btn-emergency {
    padding: 0.45rem 0.85rem !important;
  }

  .dashboard-columns-grid {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  /* Rack multi-extrusor 2x2 táctil en tablets */
  .extruders-rack:not(.single-extruder-layout) {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem;
  }

  .layout-edit-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .layout-bar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .ai-anomaly-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .ai-banner-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .modal-card {
    width: 95vw !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
  }
}

@media (max-width: 600px) {
  .brand-name {
    font-size: 1.15rem;
  }

  .extruders-rack.single-extruder-layout .extruder-slot:not(.slot-hidden) {
    padding: 0.7rem 0.85rem !important;
    column-gap: 0.65rem !important;
    row-gap: 0.55rem !important;
  }

  .extruders-rack:not(.single-extruder-layout) {
    grid-template-columns: 1fr !important;
    gap: 0.45rem;
  }

  .temp-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  .filament-name {
    font-size: 0.85rem;
  }

  .slot-temp-val strong {
    font-size: 1.05rem;
  }

  .jog-container {
    flex-direction: column;
    gap: 0.85rem;
  }

  .jog-pad {
    margin: 0 auto;
  }

  .jog-z-column {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
  }

  .history-stats-banner {
    grid-template-columns: 1fr !important;
    gap: 0.4rem;
  }

  .cam-stream-container {
    min-height: 220px;
  }

  .camera-feed-img {
    max-height: 55vh;
  }
}

/* ==================== ESTILOS FILATECA LD3D (ESTANTE DE CARRETES) ==================== */
.filateca-spool-card {
  background: linear-gradient(145deg, rgba(17, 24, 39, 0.85) 0%, rgba(10, 16, 28, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.filateca-spool-card:hover {
  border-color: rgba(0, 242, 254, 0.35);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 242, 254, 0.1);
  transform: translateY(-2px);
}

.filateca-spool-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--spool-accent, var(--accent-cyan));
  box-shadow: 0 0 10px var(--spool-accent, var(--accent-cyan));
}

.spool-bobbin-graphic {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #0d131f 32%, var(--spool-color, #00ffcc) 35%, var(--spool-color, #00ffcc) 68%, #0d131f 70%, #1f2937 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 14px var(--spool-glow, rgba(0, 255, 204, 0.35));
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spool-bobbin-inner-hole {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #06090e;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
}

.spool-material-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 242, 254, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spool-assigned-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.spool-capacity-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.spool-capacity-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.btn-card-width {
  background: rgba(0, 242, 254, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.3);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s;
}

.btn-card-width:hover {
  background: rgba(0, 242, 254, 0.25);
  color: #ffffff;
}

.btn-card-height {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-card-height:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==================== MODALES ESTILIZADOS CON BORDES DEFINIDOS ==================== */
.modal-card {
  background: #090e1a !important;
  border: 1px solid rgba(0, 242, 254, 0.38) !important;
  border-radius: 16px !important;
  box-shadow: 0 25px 65px rgba(0, 0, 0, 0.92), 0 0 35px rgba(0, 242, 254, 0.12) !important;
  overflow: hidden;
  position: relative;
}

.btn-close-modal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.btn-close-modal:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* ==================== BOTÓN DE LUZ EN CÁMARA (ROJO EN APAGADO) ==================== */
.btn-cam-light {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 16px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  letter-spacing: 0.3px;
  user-select: none;
}

.btn-cam-light.light-off {
  background: rgba(239, 68, 68, 0.16) !important;
  border: 1.5px solid #ef4444 !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}

.btn-cam-light.light-off:hover {
  background: rgba(239, 68, 68, 0.3) !important;
  color: #ffffff !important;
}

.btn-cam-light.light-on {
  background: rgba(16, 185, 129, 0.2) !important;
  border: 1.5px solid #10b981 !important;
  color: #34d399 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}

.btn-cam-light.light-on:hover {
  background: rgba(16, 185, 129, 0.35) !important;
  color: #ffffff !important;
}

/* ==================== SELECTOR DE VISTAS (HEADER NAV) ==================== */
.nav-switch-pills {
  display: flex;
  gap: 0.3rem;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: 24px;
  border: 1px solid var(--border-color);
}

.nav-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-pill-btn.active {
  background: var(--accent-gradient);
  color: #030712;
  box-shadow: 0 2px 10px rgba(0, 242, 254, 0.3);
}

.nav-pill-btn:hover:not(.active) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* ==================== VISTA COMPLETA: FILATECA & CARRETES ==================== */
.filateca-full-view {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

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

.filateca-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
}

.filateca-stat-box {
  background: rgba(18, 24, 38, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.filateca-stat-icon {
  font-size: 1.8rem;
}

.filateca-stat-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-mono);
}

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

.filateca-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  background: rgba(18, 24, 38, 0.8);
  border: 1px solid var(--border-color);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
}

.filateca-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem;
  width: 100%;
}

/* ==================== MODAL MINIMALISTA DE ASIGNACIÓN PARA EXTRUSORES ==================== */
.quick-filament-card {
  max-width: 520px;
  width: 94vw;
}

.quick-spool-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 0.5rem;
}

.quick-spool-item:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: var(--accent-cyan);
  transform: translateX(4px);
}

.quick-spool-item.is-selected {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

/* ==================== RESIZE LIBRE CON MOUSE DE LAS CARDS ==================== */
.dashboard-grid > .card {
  position: relative;
  min-width: 280px;
  min-height: 200px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card-resizer-handle {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 25;
  opacity: 0.35;
  transition: opacity 0.2s, transform 0.2s;
  background-image: radial-gradient(circle, var(--accent-cyan) 1.5px, transparent 1.5px);
  background-size: 5px 5px;
  background-repeat: repeat;
}

.dashboard-grid > .card:hover .card-resizer-handle {
  opacity: 0.9;
}

.card-resizer-handle:hover {
  opacity: 1 !important;
  transform: scale(1.2);
}

.card.is-resizing {
  user-select: none;
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.4) !important;
}

/* ==================== BARRA COMPACTA DE SENSORES EXTRA (CABINA Y DRIVERS) ==================== */
.sensors-compact-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.6rem;
  padding: 0.45rem 0.65rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  align-items: center;
}

.sensor-chip-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  padding: 0.2rem 0.3rem;
  white-space: nowrap;
}

.sensor-chip-item .chip-ico {
  font-size: 0.9rem;
}

.sensor-chip-item .chip-lbl {
  color: var(--text-dim);
  font-size: 0.76rem;
}

.sensor-chip-item .chip-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 0.9rem;
}

.sensor-chip-item .chip-deg {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==================== TUNING CARD: AJUSTES EN VIVO ==================== */
.tuning-card .tuning-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tuning-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.tuning-row-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.tuning-label {
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tuning-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 0.9rem;
}

.tuning-btn-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.btn-tune {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #cbd5e1;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 0.3rem 0.2rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn-tune:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--accent-cyan);
  color: #ffffff;
}

.btn-tune-reset {
  color: var(--accent-cyan);
  font-weight: 700;
  border-color: rgba(0, 242, 254, 0.3);
}

.btn-tune-save {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
  font-family: inherit;
  grid-column: span 2;
}

.btn-tune-save:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10b981;
}

/* ==================== FILATECA: AJUSTE DE CARDS Y MODO LISTA ==================== */
.filateca-spool-card {
  background: rgba(18, 24, 38, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3.5px solid var(--spool-accent, var(--accent-cyan));
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.filateca-spool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.18);
}

.filateca-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.3rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 0.5rem;
}

.filateca-list-container {
  width: 100%;
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

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

.filateca-table th {
  background: rgba(0, 0, 0, 0.45);
  color: var(--text-dim);
  padding: 0.75rem 1rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}

.filateca-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #fff;
  vertical-align: middle;
}

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

/* ==================== ESTILOS GENERALES DE MODALES ==================== */
.modal-overlay {
  background: rgba(5, 9, 18, 0.8) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

.modal-card {
  max-height: 88vh !important;
  display: flex !important;
  flex-direction: column !important;
  border: 1.5px solid rgba(0, 242, 254, 0.4) !important;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95), 0 0 30px rgba(0, 242, 254, 0.15) !important;
}

.modal-body {
  flex: 1 !important;
  overflow-y: auto !important;
}

/* ==================== ESTILOS DEDICADOS PARA FORMULARIOS Y MODAL BOBINA ==================== */
.modal-header {
  padding: 1.25rem 1.6rem !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  flex-shrink: 0 !important;
}

.modal-body {
  padding: 1.5rem 1.6rem !important;
  flex: 1 !important;
  overflow-y: auto !important;
}

.modal-footer {
  padding: 1.1rem 1.6rem 1.4rem !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
  display: flex !important;
  justify-content: flex-end !important;
  gap: 0.8rem !important;
  flex-shrink: 0 !important;
}

.calc-hidden,
.input-field.calc-hidden,
div.calc-hidden,
.input-field[style*="display: none"] {
  display: none !important;
}

.input-field {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.4rem !important;
  margin-bottom: 0.4rem !important;
}

.input-field label {
  font-size: 0.82rem !important;
  font-weight: 500 !important;
  color: #cbd5e1 !important;
}

.input-field input, .input-field select {
  background: rgba(0, 0, 0, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: var(--text-main) !important;
  padding: 0.6rem 0.85rem !important;
  border-radius: var(--radius-sm) !important;
  font-size: 0.9rem !important;
  font-family: inherit !important;
  outline: none !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
}

.input-field input:focus, .input-field select:focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.28) !important;
  background: rgba(0, 0, 0, 0.7) !important;
}

/* ==================== RESALTE VISUAL CLAVE: TIEMPO Y PESO ==================== */
.calc-highlight-field {
  background: linear-gradient(145deg, rgba(0, 242, 254, 0.08) 0%, rgba(2, 132, 199, 0.04) 100%) !important;
  border: 1.5px solid rgba(0, 242, 254, 0.38) !important;
  border-radius: var(--radius-sm, 10px) !important;
  padding: 0.65rem 0.8rem !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 0 12px rgba(0, 242, 254, 0.06) !important;
  transition: all 0.25s ease !important;
}

.calc-highlight-field:focus-within {
  border-color: var(--accent-cyan, #00f2fe) !important;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.32), inset 0 0 14px rgba(0, 242, 254, 0.1) !important;
  background: linear-gradient(145deg, rgba(0, 242, 254, 0.12) 0%, rgba(2, 132, 199, 0.08) 100%) !important;
}

.calc-highlight-label {
  color: #38bdf8 !important;
  font-weight: 700 !important;
  font-size: 0.86rem !important;
  letter-spacing: 0.3px !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.35rem !important;
  margin-bottom: 0.35rem !important;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.35) !important;
}

.calc-highlight-input {
  font-size: 1.18rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  background: rgba(3, 8, 20, 0.9) !important;
  border: 1.5px solid rgba(0, 242, 254, 0.35) !important;
  border-radius: 8px !important;
  padding: 0.55rem 0.75rem !important;
  letter-spacing: 0.5px !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7) !important;
  transition: all 0.2s ease !important;
}

.calc-highlight-input:focus {
  border-color: #00f2fe !important;
  box-shadow: 0 0 14px rgba(0, 242, 254, 0.45), inset 0 2px 6px rgba(0, 0, 0, 0.7) !important;
  color: #00f2fe !important;
}

/* ==========================================================================
   SISTEMA DE DISEÑO RESPONSIVO POR TAMAÑO DE CARD (1x, 2x, 3x, 4x)
   Garantiza que todo el contenido sea 100% entendible y sin espacios vacíos.
   ========================================================================== */

/* 1. ESTADO DE TRABAJO (cardJobState): Porcentaje a la izquierda, Imagen a la derecha */
.job-visual-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  padding: 0.4rem 0.2rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.job-visual-row .progress-ring-container {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.job-model-preview-container {
  width: 136px;
  height: 136px;
  background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.95) 0%, rgba(6, 11, 24, 0.98) 100%);
  border: 1.5px solid rgba(0, 242, 254, 0.35);
  border-radius: 12px;
  box-shadow: inset 0 0 16px rgba(0, 242, 254, 0.08), 0 8px 24px rgba(0, 0, 0, 0.45);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.job-model-preview-container:hover {
  border-color: var(--accent-cyan);
  box-shadow: inset 0 0 20px rgba(0, 242, 254, 0.15), 0 0 16px rgba(0, 242, 254, 0.25);
}

.job-model-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7));
  transition: transform 0.25s ease;
}

.job-model-img:hover {
  transform: scale(1.06);
}

.job-model-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: var(--text-dim);
  text-align: center;
  padding: 0.5rem;
}

.model-placeholder-icon {
  font-size: 2.2rem;
  opacity: 0.65;
  filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.3));
}

.model-placeholder-text {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.2;
}

.job-model-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0, 242, 254, 0.2);
  color: var(--accent-cyan);
  border: 1.2px solid rgba(0, 242, 254, 0.45);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
}

/* cardJobState en anchos 2x, 3x, 4x: diseño horizontal con metadatos y controles al lado */
.card.col-span-2.job-card .job-body,
.card.col-span-3.job-card .job-body,
.card.col-span-4.job-card .job-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: start;
}

.card.col-span-2.job-card .job-visual-row,
.card.col-span-3.job-card .job-visual-row,
.card.col-span-4.job-card .job-visual-row {
  margin-bottom: 0;
  gap: 1.25rem;
  padding: 0.6rem 0.9rem;
}


/* 2. CONTROL TÉRMICO & FILAMENTOS (cardThermalControl) */
/* Caso A: Impresoras con 1 solo extrusor (Ender 5 S1, Ender 3, K1, etc.) */
#cardThermalControl .extruders-rack.single-extruder-layout,
.extruders-rack.single-extruder-layout {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 0 !important;
  margin-top: 0.85rem !important;
  margin-bottom: 0.35rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.slot-hidden,
.extruder-slot.slot-hidden {
  display: none !important;
}

#cardThermalControl .extruders-rack.single-extruder-layout .extruder-slot:not(.slot-hidden),
.extruders-rack.single-extruder-layout .extruder-slot:not(.slot-hidden) {
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  grid-template-rows: auto auto !important;
  grid-template-areas: 
    "header temp"
    "filament actions" !important;
  align-items: center !important;
  row-gap: 0.65rem !important;
  column-gap: 0.85rem !important;
  padding: 0.8rem 1rem !important;
  border-radius: var(--radius-md) !important;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.08) 0%, rgba(13, 22, 38, 0.9) 100%) !important;
  border: 1.5px solid var(--accent-cyan) !important;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.15) !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.extruders-rack.single-extruder-layout .slot-header {
  grid-area: header !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  min-width: 0 !important;
}

.extruders-rack.single-extruder-layout .slot-temp-row {
  grid-area: temp !important;
  display: flex !important;
  align-items: baseline !important;
  justify-content: flex-end !important;
  gap: 0.35rem !important;
  margin: 0 !important;
  white-space: nowrap !important;
}

.extruders-rack.single-extruder-layout .slot-temp-val strong {
  font-size: 1.25rem !important;
  color: var(--accent-cyan) !important;
}

.extruders-rack.single-extruder-layout .slot-filament-info {
  grid-area: filament !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.6rem !important;
  min-width: 0 !important;
  background: rgba(0, 0, 0, 0.25) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.35rem 0.65rem !important;
  overflow: hidden !important;
}

.extruders-rack.single-extruder-layout .filament-text {
  min-width: 0 !important;
  overflow: hidden !important;
}

.extruders-rack.single-extruder-layout .filament-name {
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
}

.extruders-rack.single-extruder-layout .filament-type {
  font-size: 0.72rem !important;
  color: var(--text-muted) !important;
  white-space: nowrap !important;
  display: block !important;
}

.extruders-rack.single-extruder-layout .slot-actions {
  grid-area: actions !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.45rem !important;
}

/* En 1 solo extrusor, el botón 'Activar' es redundante */
.extruders-rack.single-extruder-layout .btn-slot-select {
  display: none !important;
}

.extruders-rack.single-extruder-layout .btn-slot-load,
.extruders-rack.single-extruder-layout .btn-slot-unload {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.35rem 0.7rem !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  border-radius: var(--radius-sm) !important;
  cursor: pointer !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  transition: all 0.2s ease !important;
}

.extruders-rack.single-extruder-layout .btn-slot-load:hover,
.extruders-rack.single-extruder-layout .btn-slot-unload:hover {
  background: rgba(0, 242, 254, 0.2) !important;
  border-color: var(--accent-cyan) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}

/* Caso B: Impresoras con 2 o 4 extrusores (Snapmaker U1, Toolchangers, IDEX) */
.dashboard-col .extruders-rack:not(.single-extruder-layout),
.card.col-span-1 .extruders-rack:not(.single-extruder-layout),
#cardThermalControl .extruders-rack:not(.single-extruder-layout) {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.55rem !important;
}

.dashboard-col .extruders-rack:not(.single-extruder-layout) .extruder-slot,
.card.col-span-1 .extruders-rack:not(.single-extruder-layout) .extruder-slot,
#cardThermalControl .extruders-rack:not(.single-extruder-layout) .extruder-slot {
  padding: 0.55rem !important;
}

.dashboard-col .extruders-rack:not(.single-extruder-layout) .slot-filament-info,
.card.col-span-1 .extruders-rack:not(.single-extruder-layout) .slot-filament-info,
#cardThermalControl .extruders-rack:not(.single-extruder-layout) .slot-filament-info {
  gap: 0.4rem !important;
  padding: 0.3rem 0.4rem !important;
}

.dashboard-col .extruders-rack:not(.single-extruder-layout) .filament-name,
.card.col-span-1 .extruders-rack:not(.single-extruder-layout) .filament-name,
#cardThermalControl .extruders-rack:not(.single-extruder-layout) .filament-name {
  font-size: 0.78rem !important;
  max-width: 120px !important;
}

.dashboard-col .extruders-rack:not(.single-extruder-layout) .slot-actions,
.card.col-span-1 .extruders-rack:not(.single-extruder-layout) .slot-actions,
#cardThermalControl .extruders-rack:not(.single-extruder-layout) .slot-actions {
  display: flex !important;
  gap: 0.25rem !important;
}

.dashboard-col .extruders-rack:not(.single-extruder-layout) .btn-slot-select,
.card.col-span-1 .extruders-rack:not(.single-extruder-layout) .btn-slot-select,
#cardThermalControl .extruders-rack:not(.single-extruder-layout) .btn-slot-select {
  font-size: 0.7rem !important;
  padding: 0.25rem 0.35rem !important;
}

.dashboard-col .temp-cards-grid,
.card.col-span-1 .temp-cards-grid,
#cardThermalControl .temp-cards-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.5rem !important;
}

.dashboard-col .temp-presets,
.card.col-span-1 .temp-presets,
#cardThermalControl .temp-presets {
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 0.35rem !important;
}

/* En 2x, 3x, 4x: Los 4 extrusores en fila espaciosa */
.card.col-span-2 .extruders-rack,
.card.col-span-3 .extruders-rack,
.card.col-span-4 .extruders-rack {
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 0.75rem !important;
}

.card.col-span-2 .temp-presets,
.card.col-span-3 .temp-presets,
.card.col-span-4 .temp-presets {
  grid-template-columns: repeat(5, 1fr) !important;
}


/* 3. CONSOLA G-CODE & MACROS (cardConsole) */
/* En columna individual: Apilado vertical compacto con altura limitada para no generar vacíos */
.dashboard-col .console-layout-wrapper,
.card.col-span-1 .console-layout-wrapper,
#cardConsole .console-layout-wrapper {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
}

.dashboard-col .console-terminal-col .terminal-body,
.card.col-span-1 .console-terminal-col .terminal-body,
#cardConsole .console-terminal-col .terminal-body {
  height: 200px !important;
  max-height: 200px !important;
}

.dashboard-col .console-macros-col,
.card.col-span-1 .console-macros-col,
#cardConsole .console-macros-col {
  margin-top: 0.2rem !important;
  border-left: none !important;
  padding-left: 0 !important;
}

.dashboard-col .console-macros-col .macros-grid,
.card.col-span-1 .console-macros-col .macros-grid,
#cardConsole .console-macros-col .macros-grid {
  grid-template-columns: repeat(2, 1fr) !important;
  max-height: none !important;
  height: auto !important;
  overflow: visible !important;
}

/* ==================== TIRADOR INFERIOR DE REDIMENSIONADO VERTICAL ==================== */
.card-height-resizer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 12px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.25;
  transition: opacity 0.2s, background 0.2s;
  z-index: 20;
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  user-select: none;
}

.card-height-resizer::after {
  content: '';
  width: 42px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.4);
  transition: all 0.2s;
}

.card:hover .card-height-resizer {
  opacity: 0.65;
}

.card-height-resizer:hover {
  opacity: 1 !important;
  background: rgba(0, 242, 254, 0.08);
}

.card-height-resizer:hover::after {
  background: var(--accent-cyan);
  width: 60px;
  box-shadow: 0 0 10px var(--accent-cyan);
}

.card.is-resizing-v {
  user-select: none;
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 25px rgba(0, 242, 254, 0.35) !important;
}

/* En 2x, 3x, 4x: ¡LADO A LADO! Terminal a la izquierda y Macros a la derecha */
.card.col-span-2 .console-layout-wrapper,
.card.col-span-3 .console-layout-wrapper,
.card.col-span-4 .console-layout-wrapper {
  display: grid !important;
  grid-template-columns: 1.25fr 1fr !important;
  gap: 1.15rem !important;
  align-items: start !important;
}

.card.col-span-2 .console-terminal-col,
.card.col-span-3 .console-terminal-col,
.card.col-span-4 .console-terminal-col {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.6rem !important;
}

.card.col-span-2 .console-terminal-col .terminal-body,
.card.col-span-3 .console-terminal-col .terminal-body,
.card.col-span-4 .console-terminal-col .terminal-body {
  height: 240px !important;
  max-height: 240px !important;
}

.card.col-span-2 .console-macros-col,
.card.col-span-3 .console-macros-col,
.card.col-span-4 .console-macros-col {
  margin-top: 0 !important;
  border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding-left: 1.15rem !important;
}

.card.col-span-2 .console-macros-col .macros-grid,
.card.col-span-3 .console-macros-col .macros-grid,
.card.col-span-4 .console-macros-col .macros-grid {
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
  max-height: 280px !important;
  overflow-y: auto !important;
}


/* 4. CONTROL DE MOVIMIENTO (cardMotionControl) */
/* En 2x, 3x, 4x: Distribución horizontal con jogpad a la izquierda y controles a la derecha */
.card.col-span-2 .motion-layout,
.card.col-span-3 .motion-layout,
.card.col-span-4 .motion-layout {
  display: flex !important;
  justify-content: space-around !important;
  align-items: center !important;
  gap: 1.5rem !important;
  padding: 0.5rem 0.2rem !important;
}

.card.col-span-2 .jog-actions,
.card.col-span-3 .jog-actions,
.card.col-span-4 .jog-actions {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.6rem !important;
}


/* 5. AJUSTES DE IMPRESIÓN EN VIVO (cardTuning) */
/* En 2x, 3x, 4x: Dos columnas paralelas de ajustes */
.card.col-span-2 .tuning-body,
.card.col-span-3 .tuning-body,
.card.col-span-4 .tuning-body {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 0.85rem !important;
}


/* ==================== MULTI-USUARIO & LOGIN PROFESIONAL ==================== */
.user-menu-wrapper {
  position: relative;
}

.btn-user-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(13, 22, 38, 0.85);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-user-pill:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
}

.user-email-text {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.user-role-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 10px;
  background: rgba(0, 242, 254, 0.18);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 242, 254, 0.35);
  text-transform: uppercase;
}

.user-role-badge.role-admin {
  background: rgba(234, 179, 8, 0.18);
  color: #fbbf24;
  border-color: rgba(234, 179, 8, 0.4);
}

.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(13, 22, 38, 0.98);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 242, 254, 0.2);
  min-width: 230px;
  padding: 0.5rem;
  z-index: 999999 !important;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.user-dropdown-header {
  padding: 0.5rem 0.6rem;
}

.user-dropdown-header strong {
  display: block;
  font-size: 0.85rem;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-header small {
  color: var(--accent-cyan);
  font-size: 0.72rem;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0.25rem 0;
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.82rem;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.18s ease;
}

.user-dropdown-item:hover {
  background: rgba(0, 242, 254, 0.12);
  color: #fff;
}

.user-dropdown-item.item-logout {
  color: #ef4444;
}

.user-dropdown-item.item-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* Modal de Login Avanzado */
.auth-modal-overlay {
  backdrop-filter: blur(20px) !important;
  background: rgba(4, 8, 16, 0.88) !important;
  z-index: 9999 !important;
}

.login-card-advanced {
  max-width: 400px;
  width: 90%;
  background: linear-gradient(145deg, rgba(13, 22, 38, 0.95) 0%, rgba(8, 13, 24, 0.98) 100%) !important;
  border: 1.5px solid rgba(0, 242, 254, 0.25) !important;
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 242, 254, 0.15) !important;
  border-radius: var(--radius-lg) !important;
  padding: 2rem 1.8rem !important;
}

.auth-brand-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-cube {
  width: 32px;
  height: 32px;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.6);
}

.login-brand-titles h2 {
  font-size: 1.5rem;
  margin: 0;
}

.login-brand-titles span {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.login-instructions h3 {
  font-size: 1.15rem;
  margin: 0 0 0.3rem 0;
  color: #fff;
}

.login-instructions p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 1.2rem 0;
}

.auth-form-styled {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.auth-input-group label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

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

.auth-input-icon {
  position: absolute;
  left: 0.75rem;
  font-size: 0.9rem;
  pointer-events: none;
  opacity: 0.7;
}

.auth-input-wrapper input {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem 0.65rem 2.2rem;
  color: #fff;
  font-family: var(--font-family);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.auth-input-wrapper input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
  outline: none;
}

.btn-toggle-pwd {
  position: absolute;
  right: 0.6rem;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.9rem;
}

.btn-login-submit {
  margin-top: 0.5rem;
  padding: 0.75rem !important;
  font-size: 0.95rem !important;
  font-weight: 600;
}

.login-footer-info {
  margin-top: 1.4rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.7rem;
}

/* Onboarding Pantalla Vacía */
.onboarding-container {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.onboarding-card {
  max-width: 680px;
  width: 100%;
  background: linear-gradient(145deg, rgba(13, 22, 38, 0.9) 0%, rgba(8, 14, 26, 0.95) 100%);
  border: 1.5px solid rgba(0, 242, 254, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 242, 254, 0.12);
  border-radius: var(--radius-lg);
  padding: 2.2rem 2rem;
  text-align: center;
}

.onboarding-hero-icon {
  font-size: 3rem;
  margin-bottom: 0.8rem;
  animation: floatHero 3s ease-in-out infinite alternate;
}

@keyframes floatHero {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.onboarding-card h2 {
  font-size: 1.6rem;
  color: #fff;
  margin: 0 0 0.5rem 0;
}

.onboarding-lead {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 1.8rem auto;
  line-height: 1.5;
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  text-align: left;
  margin-bottom: 1.8rem;
}

.onboarding-step {
  display: flex;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: #040810;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content strong {
  display: block;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.step-content p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.6rem 0;
}

.code-box-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
}

.code-box-wrapper code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-cyan);
  overflow-x: auto;
  white-space: nowrap;
}

.onboarding-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 242, 254, 0.1);
  border: 1px solid rgba(0, 242, 254, 0.3);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.82rem;
  color: var(--accent-cyan);
}

/* Tabla de Administración de Usuarios */
#usersAdminModal {
  z-index: 10000000 !important;
}

#createUserModal {
  z-index: 10000050 !important;
}

#assignPrintersModal {
  z-index: 10000060 !important;
}

#addBambuModal {
  z-index: 10000020 !important;
}

.assign-printer-checkbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.assign-printer-checkbox-item:hover {
  background: rgba(0, 242, 254, 0.08);
  border-color: rgba(0, 242, 254, 0.3);
}

.assign-printer-checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.users-admin-modal-card {
  max-width: 980px !important;
  width: 96vw !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 242, 254, 0.25) !important;
}

.users-table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: rgba(11, 19, 38, 0.65);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.users-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.users-table th {
  background: rgba(8, 14, 29, 0.85);
  padding: 0.85rem 1rem;
  text-align: left;
  color: var(--text-dim);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.users-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
}

.users-table tr:hover td {
  background: rgba(0, 242, 254, 0.035);
}

.user-badge-status {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

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

.user-status-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-perm-row-user {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #38bdf8 !important;
  border: 1px solid rgba(56, 189, 248, 0.45) !important;
  font-weight: 700 !important;
  transition: all 0.15s ease !important;
}

.btn-perm-row-user:hover {
  background: rgba(56, 189, 248, 0.25) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.3) !important;
  transform: translateY(-1px);
}


/* ==================== CALCULADORA DE COSTOS & MERCADOLIBRE PRO ==================== */
.calc-full-view {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0.5rem 0 2.5rem 0;
  animation: fadeIn 0.25s ease-out;
}

.calc-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
  gap: 1rem;
}

.calc-title-box h2 {
  font-size: 1.28rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2rem;
}

.calc-title-box p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
}

.calc-top-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.calc-layout-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1080px) {
  .calc-layout-grid {
    grid-template-columns: 1fr;
  }
}

.calc-inputs-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.calc-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease;
}

.calc-card:hover {
  border-color: rgba(0, 242, 254, 0.25);
}

.calc-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.calc-card-header h3 {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.calc-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

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

.calc-readonly-stat {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 242, 254, 0.06);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  min-height: 38px;
}

.calc-results-column {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  position: sticky;
  top: 1rem;
}

.calc-summary-card {
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
}

.calc-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.calc-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.calc-breakdown-row strong {
  color: var(--text-main);
  font-family: var(--font-mono);
}

.calc-breakdown-row.total-base {
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  font-weight: 700;
  color: var(--accent-cyan);
}

.calc-breakdown-row.total-base strong {
  font-size: 1.05rem;
  color: var(--accent-cyan);
}

/* Tarjetas de Precios Efectivo vs MercadoLibre */
.price-box-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.price-cash-card {
  background: linear-gradient(145deg, rgba(16, 185, 129, 0.12) 0%, rgba(6, 78, 59, 0.25) 100%);
  border: 1.5px solid rgba(16, 185, 129, 0.4);
}

.price-ml-card {
  background: linear-gradient(145deg, rgba(234, 179, 8, 0.12) 0%, rgba(113, 63, 18, 0.25) 100%);
  border: 1.5px solid rgba(234, 179, 8, 0.4);
}

.price-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.price-box-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.25);
  color: #4ade80;
  border: 1px solid rgba(16, 185, 129, 0.5);
}

.price-box-tag.ml-tag {
  background: rgba(234, 179, 8, 0.25);
  color: #facc15;
  border-color: rgba(234, 179, 8, 0.5);
}

.price-big-number {
  font-size: 2.3rem;
  font-weight: 800;
  font-family: var(--font-family);
  color: #4ade80;
  letter-spacing: -0.5px;
  margin: 0.2rem 0;
  text-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
}

.price-big-number.ml-number {
  color: #facc15;
  text-shadow: 0 0 20px rgba(250, 204, 21, 0.3);
}

.price-box-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ml-config-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0.75rem 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.custom-checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-main);
  cursor: pointer;
  margin-bottom: 0.4rem;
  user-select: none;
}

.custom-checkbox-row input[type="checkbox"] {
  accent-color: #facc15;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.ml-deduction-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  margin: 0.6rem 0;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius-sm);
}

.ml-deduct-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
}

.ml-deduct-row strong {
  color: #f87171;
  font-family: var(--font-mono);
}

.ml-deduct-row.net-row {
  margin-top: 0.3rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #4ade80;
  font-weight: 700;
}

.ml-deduct-row.net-row strong {
  color: #4ade80;
  font-size: 0.92rem;
}

.calc-save-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
}

.saved-quote-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s;
}

.saved-quote-item:hover {
  background: rgba(0, 242, 254, 0.1);
}

/* ==================== MULTIPLICADORES INTELIGENTES & ESCALA DE DESCUENTOS ==================== */
.badge-intel-multiplier {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #4ade80;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  letter-spacing: 0.5px;
}

.volume-discount-box {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
}

.volume-discount-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.vol-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--accent-cyan);
}

.vol-badge-active {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4ade80;
}

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

@media (max-width: 680px) {
  .volume-discount-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.vol-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.vol-card:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.2);
}

.vol-card.active {
  border: 1.5px solid #22c55e !important;
  background: rgba(34, 197, 94, 0.12) !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}

.vol-units {
  font-size: 0.85rem;
  font-weight: 700;
  color: #4ade80;
  font-family: var(--font-mono);
}

.vol-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.multiplier-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (max-width: 580px) {
  .multiplier-cards-grid {
    grid-template-columns: 1fr;
  }
}

.mult-card {
  background: rgba(18, 24, 38, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.mult-card:hover {
  border-color: rgba(0, 242, 254, 0.3);
  transform: translateY(-1px);
}

.mult-card.active {
  border: 2px solid #22c55e !important;
  background: rgba(34, 197, 94, 0.1) !important;
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.35);
}

.mult-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.mult-icon {
  font-size: 1.25rem;
}

.mult-factor {
  font-size: 1.25rem;
  font-family: var(--font-mono);
  font-weight: 800;
  color: #4ade80;
}

.mult-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.15rem;
}

.mult-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  line-height: 1.25;
}

/* Inputs y Selects Estilizados de la Calculadora (Dark Glassmorphism) */
#calcUnitsCount {
  background: rgba(0, 0, 0, 0.6) !important;
  border: 1.5px solid rgba(34, 197, 94, 0.4) !important;
  color: #4ade80 !important;
  border-radius: 6px !important;
  transition: all 0.2s ease;
}

#calcUnitsCount:focus {
  border-color: #22c55e !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.35) !important;
  outline: none !important;
  background: rgba(0, 0, 0, 0.8) !important;
}

.calc-card input[type="number"],
.calc-card input[type="text"],
.calc-card select,
.styled-select {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(11, 15, 25, 0.75) !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2300f2fe' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  padding-right: 2.2rem !important;
  border: 1px solid var(--border-color);
  color: #fff !important;
  border-radius: var(--radius-sm);
  padding-left: 0.75rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  font-size: 0.85rem;
  font-family: var(--font-family);
  transition: all 0.2s ease;
  width: 100%;
}

.calc-card select:focus,
.styled-select:focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.3) !important;
  outline: none !important;
  background-color: rgba(15, 23, 42, 0.95) !important;
}

.calc-card select option,
.styled-select option {
  background: #0b0f19 !important;
  color: #fff !important;
  padding: 8px 12px;
}

/* Ocultar campos innecesarios en la calculadora */
.calc-hidden,
.input-field.calc-hidden,
.input-field[style*="display: none"],
.input-field[style*="display:none"] {
  display: none !important;
}

/* Toast de Notificación Flotante LD3D */
.ld3d-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1.5px solid #22c55e;
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 15px rgba(34, 197, 94, 0.25);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  z-index: 999999;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}


/* ==================== MODO CLARO (LIGHT THEME) ==================== */
body.light-theme {
  --bg-main: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: rgba(241, 245, 249, 0.98);
  --border-color: rgba(148, 163, 184, 0.25);
  --border-focus: rgba(2, 132, 199, 0.5);

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-dim: #64748b;

  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
  background-image: 
    radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(37, 99, 235, 0.05) 0px, transparent 50%);
}

body.light-theme .header,
body.light-theme .card,
body.light-theme .modal-dialog,
body.light-theme .user-dropdown-menu {
  background: var(--bg-card);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

body.light-theme .styled-select,
body.light-theme .terminal-body,
body.light-theme .terminal-input-bar input {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.4);
}

body.light-theme .nav-switch-pills {
  background: rgba(226, 232, 240, 0.8);
  border-color: rgba(148, 163, 184, 0.35);
}

body.light-theme .nav-pill-btn {
  color: #475569;
}

body.light-theme .nav-pill-btn.active {
  color: #ffffff;
}

/* ==================== BOTONES DE CABECERA ICON-ONLY ==================== */
.btn-header-action.btn-icon-only {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-header-action.btn-icon-only:hover {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* ==================== ESTILOS CONTROL TÉRMICO & EXTRUSORES ==================== */
.extruder-slot {
  position: relative;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.extruder-slot.active-tool-slot {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.28) !important;
  background: rgba(0, 242, 254, 0.06) !important;
}

.slot-tool-icon {
  font-size: 0.95rem;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.6));
}

.temp-readout.temp-cold {
  color: #94a3b8;
}

.temp-readout.temp-warming {
  color: #f59e0b;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.temp-readout.temp-hot {
  color: #ef4444;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.7);
}

.slot-quick-temp {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.4rem 0 0.5rem 0;
  padding: 0.25rem 0.35rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.slot-temp-input {
  width: 48px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: 4px;
  font-size: 0.75rem;
  padding: 0.2rem 0.3rem;
  text-align: center;
}

.btn-slot-temp-set {
  flex: 1;
  background: rgba(0, 242, 254, 0.15);
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-slot-temp-set:hover {
  background: var(--accent-cyan);
  color: #050d1a;
}

.btn-slot-temp-off {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #ef4444;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-slot-temp-off:hover {
  background: #ef4444;
  color: #fff;
}

/* ==================== FILA CAMA CALIENTE COMPACTA ==================== */
.bed-thermal-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  gap: 0.8rem;
}

.bed-strip-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.bed-icon {
  font-size: 1.3rem;
}

.bed-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  display: block;
  line-height: 1.1;
}

.bed-temp-readout {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  margin-top: 0.15rem;
}

.bed-actual {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

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

.bed-target-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 0.3rem;
}

.bed-strip-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.bed-temp-input {
  width: 55px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.4rem;
  font-size: 0.8rem;
  text-align: center;
}

.btn-primary-compact {
  background: var(--accent-gradient);
  color: #040810;
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary-compact:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.btn-ghost-compact {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.28rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-ghost-compact:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: #ef4444;
}

/* ==================== VISTA DUAL CÁMARAS (CASE + GUI SPLIT) ==================== */
.cam-dual-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #020617;
  padding: 0.35rem;
}

.dual-cam-pane {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #0a0f1d;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
}

#dualPaneGui {
  cursor: pointer;
}

.dual-cam-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.dual-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
}

.touch-hint {
  font-size: 0.64rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.dual-cam-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

#dualCamGuiImg {
  width: 100%;
  aspect-ratio: 3 / 2 !important;
  object-fit: contain !important;
  cursor: pointer !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  display: block;
}


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

/* ==================== CONSOLA G-CODE: FORMATEO & COLORES ==================== */
.terminal-line {
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.2rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.4;
  word-break: break-word;
}

.terminal-line.error {
  background: rgba(239, 68, 68, 0.12);
  border-left: 3px solid #ef4444;
  color: #fca5a5;
  font-weight: 600;
}

.terminal-line.warning {
  background: rgba(245, 158, 11, 0.12);
  border-left: 3px solid #f59e0b;
  color: #fde68a;
  font-weight: 500;
}

.terminal-line.info {
  background: rgba(0, 242, 254, 0.08);
  border-left: 3px solid var(--accent-cyan);
  color: #7dd3fc;
}

.terminal-line.klipper-success {
  background: rgba(16, 185, 129, 0.12);
  border-left: 3px solid #10b981;
  color: #86efac;
}

.terminal-line.cmd-sent {
  background: rgba(168, 85, 247, 0.08);
  border-left: 3px solid #a855f7;
  color: #d8b4fe;
}

.term-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.terminal-line.error .term-tag {
  background: #ef4444;
  color: #fff;
}

.terminal-line.warning .term-tag {
  background: #f59e0b;
  color: #000;
}

.terminal-line.info .term-tag {
  background: var(--accent-cyan);
  color: #040810;
}

/* ==================== SELECTOR DE IMPRESORAS CON MINIATURA ==================== */
.custom-printer-dropdown {
  position: relative;
  display: inline-block;
}

.printer-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.35rem 0.75rem;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 600;
}

.printer-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--accent-cyan);
}

.printer-thumb-icon-wrap {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: rgba(0, 242, 254, 0.1);
  overflow: hidden;
  flex-shrink: 0;
}

.printer-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.printer-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  flex-shrink: 0;
}

.printer-status-dot.printing {
  background: #00f2fe;
  box-shadow: 0 0 8px #00f2fe;
}

.printer-status-dot.standby {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.printer-status-dot.offline {
  background: #64748b;
  box-shadow: none;
}

.custom-printer-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 250px;
  background: rgba(13, 22, 38, 0.98);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 242, 254, 0.15);
  padding: 0.4rem;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.printer-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.printer-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 242, 254, 0.3);
}

.printer-menu-item.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: var(--accent-cyan);
}

.printer-menu-thumb {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.printer-menu-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.printer-menu-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: #fff;
}

.printer-menu-status {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ==================== OCULTAR SPINNERS DE INPUTS NUMÉRICOS ==================== */
.slot-temp-input::-webkit-outer-spin-button,
.slot-temp-input::-webkit-inner-spin-button,
.bed-temp-input::-webkit-outer-spin-button,
.bed-temp-input::-webkit-inner-spin-button,
input[type="number"].slot-temp-input::-webkit-inner-spin-button,
input[type="number"].slot-temp-input::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
  display: none !important;
}

.slot-temp-input,
.bed-temp-input {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}

/* ==================== SELECTOR DE LÍMITE DE ARCHIVOS ==================== */
.select-micro-limit {
  background: transparent;
  border: none;
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  outline: none;
  padding: 0 2px;
}

.select-micro-limit option {
  background: #0d1626;
  color: #fff;
}

/* ==================== BOTONES DE ACCIONES EN TABLA DE FILAMENTOS ==================== */
.filateca-table .btn-dup-group,
.filateca-table .btn-edit-spool,
.filateca-table .btn-del-spool {
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 6px !important;
  font-size: 0.85rem !important;
}

/* ==================== MODO CLARO / COLORES PASTEL INTEGRAL ==================== */
body.light-theme {
  --bg-main: #edf2f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-color: #cbd5e1;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  background-color: #edf2f7 !important;
  color: #0f172a;
}

/* 1. Cabecera */
body.light-theme .header {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 18px rgba(100, 116, 139, 0.08) !important;
}

body.light-theme .brand-name {
  color: #0f172a !important;
}

body.light-theme .printer-selector-wrapper label {
  color: #475569 !important;
}

body.light-theme .printer-trigger-btn {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.light-theme .printer-trigger-btn:hover {
  background: #e2e8f0 !important;
  border-color: #0284c7 !important;
}

body.light-theme .printer-thumb-icon-wrap {
  background: #e0f2fe !important;
  border: 1px solid #bae6fd !important;
}

body.light-theme .custom-printer-menu {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.14) !important;
}

body.light-theme .printer-menu-item {
  color: #0f172a !important;
}

body.light-theme .printer-menu-item:hover {
  background: #f1f5f9 !important;
}

body.light-theme .printer-menu-item.active {
  background: #e0f2fe !important;
  border-color: #7dd3fc !important;
}

body.light-theme .printer-menu-thumb {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .printer-menu-name {
  color: #0f172a !important;
  font-weight: 600;
}

body.light-theme .printer-menu-status {
  color: #64748b !important;
}

body.light-theme .btn-discover-printers {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0284c7 !important;
}

body.light-theme .btn-discover-printers:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
}

/* Pastillas de navegación del header */
body.light-theme .nav-switch-pills {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .nav-pill-btn {
  color: #475569 !important;
}

body.light-theme .nav-pill-btn:hover {
  color: #0f172a !important;
  background: rgba(255, 255, 255, 0.6) !important;
}

body.light-theme .nav-pill-btn.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .btn-header-action {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

body.light-theme .btn-header-action:hover {
  background: #e2e8f0 !important;
  color: #0284c7 !important;
}

/* Pastilla de usuario y menú */
body.light-theme .btn-user-pill {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .btn-user-pill:hover {
  background: #e2e8f0 !important;
  border-color: #0284c7 !important;
}

body.light-theme .user-role-badge {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #bae6fd !important;
}

body.light-theme .user-role-badge.role-admin {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
}

body.light-theme .user-dropdown-menu {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14) !important;
}

body.light-theme .user-dropdown-header {
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .user-dropdown-header strong {
  color: #0f172a !important;
}

body.light-theme .user-dropdown-header small {
  color: #64748b !important;
}

body.light-theme .user-dropdown-divider {
  background: #e2e8f0 !important;
}

body.light-theme .user-dropdown-item {
  color: #334155 !important;
}

body.light-theme .user-dropdown-item:hover {
  background: #f1f5f9 !important;
  color: #0284c7 !important;
}

/* 2. Tarjetas Generales (Cards) */
body.light-theme .card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(100, 116, 139, 0.06), 0 1px 3px rgba(100, 116, 139, 0.04) !important;
}

body.light-theme .card-header {
  border-bottom: 1px solid #f1f5f9;
}

body.light-theme .card-title h3,
body.light-theme .card-title h4 {
  color: #0f172a !important;
}

body.light-theme .card-title .icon {
  color: #0284c7 !important;
}

body.light-theme .badge-job-state {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

/* 3. Card Estado de Trabajo */
body.light-theme .job-visual-row {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

body.light-theme .job-model-preview-container {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%) !important;
  border: 1.5px solid #bae6fd !important;
  box-shadow: 0 4px 16px rgba(2, 132, 199, 0.1) !important;
}

body.light-theme .job-model-placeholder {
  color: #0369a1 !important;
}

body.light-theme .model-placeholder-text {
  color: #0369a1 !important;
  font-weight: 600;
}

body.light-theme .job-meta {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .job-meta .meta-label {
  color: #64748b !important;
}

body.light-theme .job-meta .meta-val {
  color: #0f172a !important;
}

body.light-theme .progress-text-overlay .progress-pct {
  color: #0f172a !important;
}

body.light-theme .progress-text-overlay .progress-sub {
  color: #64748b !important;
}

body.light-theme .progress-ring-bg {
  stroke: #e2e8f0 !important;
}

body.light-theme .btn-link-action {
  color: #0284c7 !important;
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
}

body.light-theme .btn-link-action:hover {
  background: #e0f2fe !important;
}

/* 4. Card Control Térmico & Filamentos (Extrusores Pastel) */
body.light-theme .extruder-slot {
  background: #f8fafc !important;
  border: 1.5px solid #e2e8f0 !important;
}

body.light-theme .extruder-slot:hover {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .extruder-slot.active,
body.light-theme .extruder-slot.active-tool-slot {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.14) !important;
}

body.light-theme .slot-tool-badge {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  font-weight: 700;
}

body.light-theme .slot-active-tag {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #86efac !important;
}

body.light-theme .btn-slot-edit {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}

body.light-theme .btn-slot-edit:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

body.light-theme .slot-filament-info {
  background: #eef2f6 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .filament-name {
  color: #0f172a !important;
  font-weight: 700;
}

body.light-theme .filament-type {
  color: #475569 !important;
}

body.light-theme .slot-temp-val strong {
  color: #0f172a !important;
}

body.light-theme .slot-temp-val strong.temp-cold {
  color: #0284c7 !important;
}

body.light-theme .slot-temp-val strong.temp-warming {
  color: #ea580c !important;
}

body.light-theme .slot-temp-val strong.temp-hot {
  color: #dc2626 !important;
}

body.light-theme .slot-temp-target {
  color: #64748b !important;
}

body.light-theme .slot-temp-input,
body.light-theme .bed-temp-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .btn-slot-temp-set,
body.light-theme .btn-slot-temp-off,
body.light-theme .btn-bed-set,
body.light-theme .btn-bed-off {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

body.light-theme .btn-slot-temp-set:hover,
body.light-theme .btn-bed-set:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

body.light-theme .btn-slot-select {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #bae6fd !important;
  font-weight: 600;
}

body.light-theme .btn-slot-select:hover {
  background: #bae6fd !important;
}

body.light-theme .btn-slot-load,
body.light-theme .btn-slot-unload {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

body.light-theme .btn-slot-load:hover,
body.light-theme .btn-slot-unload:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

body.light-theme .bed-thermal-strip {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .bed-title,
body.light-theme .bed-actual {
  color: #0f172a !important;
}

body.light-theme .bed-target-tag {
  color: #64748b !important;
}

body.light-theme .sensors-compact-strip {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .sensor-chip-item {
  color: #334155 !important;
}

body.light-theme .sensor-chip-item strong {
  color: #0284c7 !important;
}

body.light-theme .quick-materials-bar {
  border-top: 1px solid #f1f5f9;
}

body.light-theme .quick-mat-label {
  color: #64748b !important;
}

body.light-theme .btn-preset-material {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

body.light-theme .btn-preset-material:hover {
  background: #e0f2fe !important;
  border-color: #7dd3fc !important;
  color: #0284c7 !important;
}

/* 5. Card Movimiento (Motion Controls Pastel) */
body.light-theme .motion-layout {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .step-selector {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
}

body.light-theme .step-label {
  color: #475569 !important;
  font-weight: 600;
}

body.light-theme .step-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
  font-weight: 600;
}

body.light-theme .step-btn:hover {
  background: #f1f5f9 !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

body.light-theme .step-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  font-weight: 700;
}

body.light-theme .jog-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  font-weight: 700;
}

body.light-theme .jog-btn:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

body.light-theme .jog-btn.jog-center {
  background: #ede9fe !important;
  border-color: #c4b5fd !important;
  color: #6d28d9 !important;
}

body.light-theme .jog-btn.jog-center:hover {
  background: #ddd6fe !important;
}

body.light-theme .jog-btn.jog-z-home {
  background: #ede9fe !important;
  border-color: #c4b5fd !important;
  color: #6d28d9 !important;
}

body.light-theme .axis-title {
  color: #64748b !important;
}

body.light-theme #btnHomeAll {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  font-weight: 600;
}

body.light-theme #btnHomeAll:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

body.light-theme .coordinates-readout {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #0369a1 !important;
}

/* 6. Card Cámara & Pestañas */
body.light-theme .cam-tab-btn {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}

body.light-theme .cam-tab-btn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

body.light-theme .cam-tab-btn.active {
  background: #e0f2fe !important;
  border: 1px solid #7dd3fc !important;
  color: #0284c7 !important;
  font-weight: 700;
}

body.light-theme .camera-timelapse-strip {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

body.light-theme .camera-timelapse-strip select {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .btn-timelapse-videos {
  background: #ede9fe !important;
  border: 1px solid #c4b5fd !important;
  color: #6d28d9 !important;
}

/* 7. Card Consola G-Code (Terminal se preserva en modo oscuro técnico) */
body.light-theme .terminal-body {
  background: #090e17 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .terminal-input-bar input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .btn-clear {
  color: #64748b !important;
}

body.light-theme .btn-clear:hover {
  color: #0f172a !important;
}

/* 8. Filateca / Gestión de Filamentos Pastel */
body.light-theme .filateca-table {
  background: #ffffff !important;
}

body.light-theme .filateca-table th {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

body.light-theme .filateca-table td {
  border-bottom: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

body.light-theme .filateca-table tr:hover td {
  background: #f8fafc !important;
}

body.light-theme .filateca-stat-box {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(100, 116, 139, 0.05) !important;
}

body.light-theme .filateca-stat-num {
  color: #0f172a !important;
}

body.light-theme .filateca-stat-lbl {
  color: #64748b !important;
}

/* 9. Ventanas Modales */
body.light-theme .modal-card,
body.light-theme .modal-dialog {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16) !important;
}

body.light-theme .modal-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .modal-header h3 {
  color: #0f172a !important;
}

body.light-theme .input-field label {
  color: #475569 !important;
}

body.light-theme .input-field input,
body.light-theme .input-field select,
body.light-theme .input-field textarea {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .modal-footer {
  border-top: 1px solid #e2e8f0 !important;
}

/* 10. Ajustes de Impresión (Live Tuning) */
body.light-theme .tuning-card {
  background: #ffffff !important;
}

body.light-theme .tuning-row {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .tuning-label {
  color: #475569 !important;
}

body.light-theme .tuning-val {
  color: #0284c7 !important;
}

body.light-theme .btn-tune {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.light-theme .btn-tune:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}

body.light-theme .btn-tune-reset {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0369a1 !important;
}

body.light-theme .btn-tune-save {
  background: #dcfce7 !important;
  border-color: #86efac !important;
  color: #15803d !important;
}

body.light-theme .btn-tune-save:hover {
  background: #bbf7d0 !important;
}

/* 11. Gestor de Archivos G-Code */
body.light-theme .files-list-container {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .file-item {
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

body.light-theme .file-item:hover {
  background: #f1f5f9 !important;
  border-color: #0284c7 !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.08);
}

body.light-theme .file-name {
  color: #0f172a !important;
  font-weight: 600;
}

body.light-theme .file-meta {
  color: #64748b !important;
}

body.light-theme .file-thumb-mini {
  background: #e0f2fe !important;
  border: 1px solid #bae6fd !important;
  color: #0284c7 !important;
}

/* 12. Macros de Klipper (Chips Pastel Alta Legibilidad) */
body.light-theme .macros-grid {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .macro-card-pastel {
  backdrop-filter: none;
}

body.light-theme .pastel-mint {
  background: #f0fdf4 !important;
  border-color: #86efac !important;
}
body.light-theme .pastel-mint .macro-card-title { color: #15803d !important; }
body.light-theme .pastel-mint .macro-card-desc { color: #475569 !important; }

body.light-theme .pastel-lavender {
  background: #f5f3ff !important;
  border-color: #c4b5fd !important;
}
body.light-theme .pastel-lavender .macro-card-title { color: #6d28d9 !important; }
body.light-theme .pastel-lavender .macro-card-desc { color: #475569 !important; }

body.light-theme .pastel-rose {
  background: #fff1f2 !important;
  border-color: #fecdd3 !important;
}
body.light-theme .pastel-rose .macro-card-title { color: #be123c !important; }
body.light-theme .pastel-rose .macro-card-desc { color: #475569 !important; }

body.light-theme .pastel-amber {
  background: #fffbeb !important;
  border-color: #fde68a !important;
}
body.light-theme .pastel-amber .macro-card-title { color: #b45309 !important; }
body.light-theme .pastel-amber .macro-card-desc { color: #475569 !important; }

body.light-theme .pastel-blue,
body.light-theme .pastel-sky {
  background: #f0f9ff !important;
  border-color: #7dd3fc !important;
}
body.light-theme .pastel-blue .macro-card-title,
body.light-theme .pastel-sky .macro-card-title { color: #0284c7 !important; font-weight: 700 !important; }
body.light-theme .pastel-blue .macro-card-desc,
body.light-theme .pastel-sky .macro-card-desc { color: #334155 !important; font-weight: 500 !important; }

body.light-theme .pastel-peach {
  background: #fff7ed !important;
  border-color: #fdba74 !important;
}
body.light-theme .pastel-peach .macro-card-title { color: #ea580c !important; font-weight: 700 !important; }
body.light-theme .pastel-peach .macro-card-desc { color: #334155 !important; font-weight: 500 !important; }

body.light-theme .pastel-teal {
  background: #f0fdfa !important;
  border-color: #5eead4 !important;
}
body.light-theme .pastel-teal .macro-card-title { color: #0f766e !important; font-weight: 700 !important; }
body.light-theme .pastel-teal .macro-card-desc { color: #334155 !important; font-weight: 500 !important; }

body.light-theme .pastel-yellow {
  background: #fefce8 !important;
  border-color: #fde047 !important;
}
body.light-theme .pastel-yellow .macro-card-title { color: #a16207 !important; font-weight: 700 !important; }
body.light-theme .pastel-yellow .macro-card-desc { color: #334155 !important; font-weight: 500 !important; }

body.light-theme .macro-card-desc {
  color: #334155 !important;
  font-weight: 500 !important;
}

/* 13. Barra de Control de Cámara & Footer */
body.light-theme .camera-header {
  background: transparent !important;
}

body.light-theme .cam-footer {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
}

body.light-theme #camStatusText {
  color: #475569 !important;
}

body.light-theme .timelapse-control-strip {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

/* 14. Calculadora de Costos & MercadoLibre */
body.light-theme .calc-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(100, 116, 139, 0.06) !important;
}

body.light-theme .calc-card-header h3 {
  color: #0f172a !important;
}

body.light-theme .calc-readonly-stat {
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  color: #0369a1 !important;
}

body.light-theme .calc-summary-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(100, 116, 139, 0.06) !important;
}

body.light-theme .calc-breakdown-row {
  color: #475569 !important;
}

body.light-theme .calc-breakdown-row strong {
  color: #0f172a !important;
}

body.light-theme .calc-breakdown-row.total-base {
  border-top: 1px dashed #cbd5e1 !important;
  color: #0284c7 !important;
}

body.light-theme .calc-breakdown-row.total-base strong {
  color: #0284c7 !important;
}

body.light-theme .price-cash-card {
  background: linear-gradient(145deg, #f0fdf4 0%, #dcfce7 100%) !important;
  border: 1.5px solid #86efac !important;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.1) !important;
}

body.light-theme .price-cash-card .price-big-number {
  color: #15803d !important;
  text-shadow: none !important;
}

body.light-theme .price-cash-card .price-box-meta {
  color: #166534 !important;
}

body.light-theme .price-cash-card .price-box-tag {
  background: #dcfce7 !important;
  color: #15803d !important;
  border-color: #86efac !important;
}

body.light-theme .price-ml-card {
  background: linear-gradient(145deg, #fffbeb 0%, #fef3c7 100%) !important;
  border: 1.5px solid #fde68a !important;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.1) !important;
}

body.light-theme .price-ml-card .price-big-number {
  color: #b45309 !important;
  text-shadow: none !important;
}

body.light-theme .price-ml-card .price-box-meta {
  color: #78350f !important;
}

body.light-theme .price-ml-card .price-box-tag.ml-tag {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border-color: #fde68a !important;
}

body.light-theme .ml-config-box {
  background: #ffffff !important;
  border: 1px solid #fde68a !important;
}

body.light-theme .ml-deduction-breakdown {
  background: #fffdf5 !important;
  border: 1px solid #fef3c7 !important;
  color: #78350f !important;
}

/* 14. Filateca / Estante de Carretes (Modo Claro) */
body.light-theme .filateca-spool-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
  color: #1e293b !important;
}

body.light-theme .filateca-spool-card:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.12) !important;
}

body.light-theme .filateca-spool-card strong {
  color: #0f172a !important;
}

body.light-theme .filateca-spool-card span {
  color: #475569 !important;
}

body.light-theme .spool-bobbin-graphic {
  border: 2px solid rgba(0, 0, 0, 0.25) !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12) !important;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.4)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15)) !important;
}

body.light-theme .filateca-table th {
  background: #f8fafc !important;
  color: #334155 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

body.light-theme .filateca-table td {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

body.light-theme .filateca-table td strong {
  color: #0f172a !important;
}

body.light-theme .filateca-table tr:hover td {
  background: #f8fafc !important;
}

body.light-theme .spool-list-color-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.35) !important;
  box-shadow: 0 0 0 1px #cbd5e1, 0 2px 5px rgba(0, 0, 0, 0.15) !important;
}

/* 15. Modales (Alertas, Tabs y Opciones) */
body.light-theme .alerts-modal-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .modal-tabs {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .modal-tab-btn {
  color: #475569 !important;
}

body.light-theme .modal-tab-btn:hover {
  color: #0f172a !important;
  background: rgba(255, 255, 255, 0.6) !important;
}

body.light-theme .modal-tab-btn.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .alert-channel-group {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px;
  padding: 0.85rem;
}

body.light-theme .event-checkbox {
  color: #334155 !important;
}

body.light-theme .toggle-custom {
  background-color: #cbd5e1 !important;
}

body.light-theme input:checked + .toggle-custom {
  background-color: #0284c7 !important;
}

/* ==================== ALERTS MODAL FIX (BOTÓN SIEMPRE VISIBLE) ==================== */
.alerts-modal-card {
  width: 94vw !important;
  max-width: 660px !important;
  max-height: 85vh !important;
  max-height: 85dvh !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  padding: 1.25rem 1.4rem !important;
}

.alerts-modal-scrollable-body {
  flex: 1 1 auto !important;
  overflow-y: auto !important;
  padding: 0.2rem 0.4rem 0.5rem 0.2rem !important;
  min-height: 0 !important;
}

.alerts-tab-footer {
  position: sticky !important;
  bottom: 0 !important;
  margin-top: 1rem !important;
  padding-top: 0.65rem !important;
  background: inherit !important;
  backdrop-filter: blur(8px) !important;
  border-top: 1px solid var(--border-color) !important;
  z-index: 10 !important;
}

/* ==================== LOGIN MODAL & MOBILE RESPONSIVENESS ==================== */
html, body {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

.app-container {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: hidden !important;
}

/* Bloqueo estricto cuando no hay sesión autenticada */
body.auth-locked .app-container {
  filter: blur(14px) brightness(0.6) !important;
  pointer-events: none !important;
  user-select: none !important;
}

.auth-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  width: 100dvw !important;
  height: 100vh !important;
  height: 100dvh !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem 0.75rem !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  z-index: 999999 !important;
  cursor: default !important;
}

@keyframes authShakeCard {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

.shake-auth {
  animation: authShakeCard 0.4s ease-in-out !important;
}

.auth-modal-overlay.hidden,
.auth-modal-overlay[style*="display: none"],
.auth-modal-overlay[style*="display:none"],
.modal-overlay[style*="display: none"],
.modal-overlay[style*="display:none"] {
  display: none !important;
}

.auth-modal-overlay:not(.hidden):not([style*="display: none"]):not([style*="display:none"]) {
  display: flex !important;
}

.login-card-advanced {
  width: 100% !important;
  max-width: 380px !important;
  margin: auto !important;
  padding: 1.6rem 1.4rem !important;
  box-sizing: border-box !important;
}

@media (max-width: 600px) {
  .app-container {
    padding: 0.35rem 0.45rem !important;
  }

  .header {
    padding: 0.65rem 0.75rem !important;
    gap: 0.5rem !important;
    margin-bottom: 0.6rem !important;
  }

  .header-left {
    gap: 0.4rem !important;
    width: 100% !important;
    flex-wrap: wrap !important;
  }

  .printer-selector-wrapper {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.35rem !important;
  }

  .custom-printer-dropdown {
    flex: 1 1 auto !important;
    min-width: 150px !important;
  }

  .btn-discover-printers {
    padding: 0.35rem 0.6rem !important;
    font-size: 0.75rem !important;
  }

  .nav-switch-pills {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    gap: 0.25rem !important;
    overflow-x: auto !important;
  }

  .nav-pill-btn {
    flex: 1 1 auto !important;
    padding: 0.4rem 0.5rem !important;
    font-size: 0.76rem !important;
    white-space: nowrap !important;
    text-align: center !important;
  }

  .header-right {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.3rem !important;
  }

  .user-email-text {
    max-width: 105px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .btn-user-pill {
    padding: 0.35rem 0.55rem !important;
  }

  .btn-header-action.btn-icon-only {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
  }

  .btn-emergency {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.76rem !important;
  }

  .login-card-advanced {
    padding: 1.35rem 1.1rem !important;
    border-radius: 14px !important;
  }

  .login-instructions p {
    font-size: 0.78rem !important;
    margin-bottom: 0.8rem !important;
  }

  .auth-form-styled {
    gap: 0.75rem !important;
  }

  .auth-input-wrapper input {
    font-size: 0.85rem !important;
    padding: 0.55rem 0.65rem 0.55rem 2.2rem !important;
  }

  .cam-dual-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==================== MODO DÍA: PALETA PASTEL ARMONIOSA Y COLORIDA ==================== */
body.light-theme {
  background: linear-gradient(135deg, #eef3f9 0%, #e2ecf8 50%, #ebf2fb 100%) !important;
  color: #1e293b !important;
}

/* Card Cámara & Stream Preview */
body.light-theme .camera-preview {
  background: #f1f5fa !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(100, 116, 139, 0.08) !important;
}

body.light-theme .camera-header {
  background: #e2ecf8 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

body.light-theme .cam-tab-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #475569 !important;
}

body.light-theme .cam-tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3) !important;
}

body.light-theme .cam-footer {
  background: #eef4fa !important;
  border-top: 1px solid #cbd5e1 !important;
}

body.light-theme .timelapse-control-strip {
  background: #f1f6fc !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

body.light-theme .timelapse-mode-select {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

/* Barra de Paso en Movimiento */
body.light-theme .step-selector-bar {
  background: #e8eff8 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .step-btn {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .step-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}

/* Control Térmico Rápido T0..T3 */
body.light-theme .slot-quick-temp {
  background: #e8eff8 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .slot-temp-input {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .btn-slot-temp-set {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  border: 1px solid #bae6fd !important;
}

body.light-theme .btn-slot-temp-set:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
}

body.light-theme .btn-slot-temp-off {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}

body.light-theme .btn-slot-temp-off:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
}

/* Toolbar de Filamentos */
body.light-theme .filateca-toolbar {
  background: #e8eff8 !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 14px rgba(100, 116, 139, 0.06) !important;
}

body.light-theme .filateca-search-input {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .filateca-search-input::placeholder {
  color: #94a3b8 !important;
}

body.light-theme .filateca-view-mode-toggle {
  background: #e2e8f0 !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .filateca-view-mode-toggle .btn {
  color: #475569 !important;
}

body.light-theme .filateca-view-mode-toggle .btn.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08) !important;
}

body.light-theme .filateca-table th {
  background: #e2ecf8 !important;
  color: #1e293b !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

body.light-theme .filateca-table tr:nth-child(even) td {
  background: #f8fafc !important;
}

body.light-theme .filateca-table tr:hover td {
  background: #e0f2fe !important;
}

/* Calculadora & Margen de Rentabilidad */
body.light-theme .vol-card {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .vol-card:hover {
  background: #e0f2fe !important;
  border-color: #38bdf8 !important;
}

body.light-theme .vol-card.active {
  background: #f0fdf4 !important;
  border: 1.5px solid #22c55e !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2) !important;
}

body.light-theme .vol-units {
  color: #16a34a !important;
}

body.light-theme .vol-label {
  color: #475569 !important;
}

body.light-theme .calc-qty-row {
  background: #e8eff8 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.65rem;
}

body.light-theme .calc-units-input {
  background: #dcfce7 !important;
  color: #166534 !important;
  border: 1.5px solid #86efac !important;
  border-radius: 6px !important;
  font-weight: 700;
  text-align: center;
  width: 75px;
  padding: 0.3rem 0.4rem;
}

body.light-theme .mult-card {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(100, 116, 139, 0.05) !important;
}

body.light-theme .mult-card:hover {
  background: #e0f2fe !important;
  border-color: #38bdf8 !important;
}

body.light-theme .mult-card.active {
  background: #f0fdf4 !important;
  border: 2px solid #22c55e !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.25) !important;
}

body.light-theme .mult-name {
  color: #0f172a !important;
}

body.light-theme .mult-factor {
  color: #16a34a !important;
}

body.light-theme .mult-desc {
  color: #64748b !important;
}

body.light-theme .calc-manual-mult-box {
  background: #e8eff8 !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  margin-top: 1rem;
}

body.light-theme .calc-save-box {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: var(--radius-sm);
  padding: 0.8rem;
}

body.light-theme .calc-jobname-input {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .calc-jobname-input::placeholder {
  color: #94a3b8 !important;
}

/* ========================================================
   LIGHT THEME: VISTA DUAL CÁMARA (CASE + GUI)
   ======================================================== */
body.light-theme .dual-cam-pane {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .dual-cam-header {
  background: #f1f5f9 !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

body.light-theme .dual-badge {
  color: #0f172a !important;
}

body.light-theme .touch-hint {
  color: #0284c7 !important;
}

/* ========================================================
   LIGHT THEME: EXTRUSOR ENDER 5 (SINGLE EXTRUDER LAYOUT)
   ======================================================== */
body.light-theme #cardThermalControl .extruders-rack.single-extruder-layout .extruder-slot:not(.slot-hidden),
body.light-theme .extruders-rack.single-extruder-layout .extruder-slot:not(.slot-hidden) {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(100, 116, 139, 0.08) !important;
}

body.light-theme .extruders-rack.single-extruder-layout .slot-filament-info {
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
}

body.light-theme .extruders-rack.single-extruder-layout .slot-temp-val strong {
  color: #0284c7 !important;
}

body.light-theme .extruders-rack.single-extruder-layout .filament-name {
  color: #0f172a !important;
}

body.light-theme .extruders-rack.single-extruder-layout .filament-type {
  color: #64748b !important;
}

/* ========================================================
   LIGHT THEME: CALCULADORA DE COSTOS (RESALTES & VOLUMEN)
   ======================================================== */
body.light-theme .calc-highlight-field {
  background: #f0f9ff !important;
  border: 1.5px solid #7dd3fc !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08) !important;
}

body.light-theme .calc-highlight-field:focus-within {
  border-color: #0284c7 !important;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.2) !important;
  background: #e0f2fe !important;
}

body.light-theme .calc-highlight-label {
  color: #0369a1 !important;
  text-shadow: none !important;
}

body.light-theme .calc-highlight-input {
  color: #0f172a !important;
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .volume-discount-box {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme .vol-tag {
  color: #0284c7 !important;
}

body.light-theme .vol-badge-active {
  color: #16a34a !important;
}

body.light-theme .vol-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .vol-card:hover {
  background: #e0f2fe !important;
  border-color: #38bdf8 !important;
}

body.light-theme .vol-card.active {
  border: 2px solid #22c55e !important;
  background: #f0fdf4 !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.2) !important;
}

body.light-theme .vol-units {
  color: #15803d !important;
}

body.light-theme .vol-label {
  color: #475569 !important;
}

body.light-theme .calc-qty-row label {
  color: #334155 !important;
}

/* ========================================================
   LIGHT THEME: BOTONES CON ALTO CONTRASTE (TEXTO BLANCO)
   ======================================================== */
body.light-theme .btn,
body.light-theme .btn-primary,
body.light-theme .btn-primary-compact,
body.light-theme #btnSetBed,
body.light-theme #btnUploadGcode,
body.light-theme #terminalForm button[type="submit"] {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25) !important;
}

body.light-theme .btn:hover,
body.light-theme .btn-primary:hover,
body.light-theme .btn-primary-compact:hover,
body.light-theme #btnSetBed:hover,
body.light-theme #btnUploadGcode:hover,
body.light-theme #terminalForm button[type="submit"]:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
}

body.light-theme .btn-slot-temp-set {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 600 !important;
}

body.light-theme .btn-slot-temp-set:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
  color: #ffffff !important;
}

body.light-theme .btn-slot-temp-off,
body.light-theme #btnOffBed,
body.light-theme .btn-ghost-compact {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
  font-weight: 600 !important;
}

body.light-theme .btn-slot-temp-off:hover,
body.light-theme #btnOffBed:hover,
body.light-theme .btn-ghost-compact:hover {
  background: #dc2626 !important;
  color: #ffffff !important;
}

/* Tabs Archivos G-Code & Historial */
body.light-theme .tab-pill-btn {
  color: #64748b !important;
  font-weight: 600 !important;
}

body.light-theme .tab-pill-btn:hover {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}

body.light-theme .tab-pill-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3) !important;
}

body.light-theme .tab-pill-btn.active .icon-inline {
  stroke: #ffffff !important;
}

body.light-theme .nav-pill-btn.active {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* ========================================================
   BAMBU LAB LAN MODE: COMPLEMENTO & MODAL
   ======================================================== */
.btn-bambu-connect {
  background: linear-gradient(135deg, rgba(0, 174, 66, 0.15), rgba(0, 242, 254, 0.15)) !important;
  border: 1px solid rgba(0, 174, 66, 0.45) !important;
  color: #00ff88 !important;
  font-weight: 600;
  transition: all 0.25s ease;
}

.btn-bambu-connect:hover {
  background: linear-gradient(135deg, rgba(0, 174, 66, 0.35), rgba(0, 242, 254, 0.35)) !important;
  border-color: #00ff88 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 174, 66, 0.35) !important;
}

body.light-theme .btn-bambu-connect {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
  color: #059669 !important;
}

body.light-theme .btn-bambu-connect:hover {
  background: #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;
}

/* Sub-Modal Crear Usuario: SIEMPRE encima de la ventana de administración */
#createUserModal {
  z-index: 10000050 !important;
}

/* ========================================================
   BAMBU LAB LAN MODE: COMPLEMENTO & MODAL OSCURO PREMIUM
   ======================================================== */
.bambu-modal-card {
  max-width: 490px !important;
  width: 95% !important;
  background: #09101f !important;
  border: 1px solid rgba(0, 242, 254, 0.25) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 174, 66, 0.15) !important;
  border-radius: 16px !important;
}

.bambu-header-icon-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(0, 174, 66, 0.15);
  border: 1px solid rgba(0, 174, 66, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.bambu-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(0, 174, 66, 0.08) !important;
  border: 1px solid rgba(0, 174, 66, 0.25) !important;
  border-radius: 10px !important;
  padding: 12px 14px !important;
  margin-bottom: 6px;
}

.bambu-info-svg {
  width: 20px;
  height: 20px;
  stroke: #00ff88;
  flex-shrink: 0;
  margin-top: 2px;
}

.bambu-modal-card .input-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bambu-modal-card .input-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.2px;
}

.bambu-modal-card .input-field input {
  background: rgba(15, 23, 42, 0.8) !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  color: #f8fafc !important;
  border-radius: 8px !important;
  padding: 0.65rem 0.85rem !important;
  font-size: 0.86rem !important;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
  box-sizing: border-box;
}

.bambu-modal-card .input-field input:focus {
  border-color: #00ff88 !important;
  box-shadow: 0 0 12px rgba(0, 255, 136, 0.25) !important;
  background: rgba(15, 23, 42, 0.98) !important;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  padding-right: 42px !important;
}

.btn-eye-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.2s;
}

.btn-eye-toggle:hover {
  color: #00ff88;
}

.btn-bambu-submit {
  background: linear-gradient(135deg, #00c853 0%, #009624 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: none !important;
  padding: 0.6rem 1.25rem !important;
  border-radius: 8px !important;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 200, 83, 0.35) !important;
  transition: all 0.2s ease !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-bambu-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 200, 83, 0.45) !important;
}

body.light-theme .bambu-modal-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12) !important;
}

body.light-theme .bambu-modal-card .modal-title h3 {
  color: #0f172a !important;
}

body.light-theme .bambu-modal-card .input-field label {
  color: #475569 !important;
}

body.light-theme .bambu-modal-card .input-field input {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .bambu-modal-card .input-field input:focus {
  border-color: #00ae42 !important;
  background: #ffffff !important;
  box-shadow: 0 0 10px rgba(0, 174, 66, 0.2) !important;
}

/* ========================================================
   ONBOARDING PANTALLA BIENVENIDA (USUARIOS SIN IMPRESORAS)
   ======================================================== */
.onboarding-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem 1.5rem;
  box-sizing: border-box;
}

#emptyPrintersOnboarding.hidden,
#emptyPrintersOnboarding[style*="display: none"],
.onboarding-container.hidden,
.onboarding-container[style*="display: none"] {
  display: none !important;
}

.onboarding-card {
  max-width: 920px !important;
  width: 100% !important;
  background: linear-gradient(145deg, rgba(13, 22, 38, 0.95) 0%, rgba(8, 14, 26, 0.98) 100%) !important;
  border: 1.5px solid rgba(0, 242, 254, 0.3) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 242, 254, 0.12) !important;
  border-radius: 18px !important;
  padding: 2.4rem 2rem !important;
  text-align: center;
  box-sizing: border-box !important;
  overflow: hidden;
}

.onboarding-options-grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  gap: 1.4rem !important;
  margin: 1.8rem 0 2rem 0 !important;
  text-align: left;
  width: 100% !important;
  box-sizing: border-box !important;
}

@media (max-width: 768px) {
  .onboarding-options-grid {
    grid-template-columns: 1fr !important;
  }
}

.onboarding-option-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(0, 242, 254, 0.22);
  border-radius: 14px;
  padding: 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s ease;
  box-sizing: border-box !important;
  min-width: 0 !important;
  width: 100% !important;
  overflow: hidden;
}

.onboarding-option-card:hover {
  border-color: rgba(0, 242, 254, 0.55);
  box-shadow: 0 8px 28px rgba(0, 242, 254, 0.12);
  transform: translateY(-2px);
}

.onboarding-option-card.bambu-option {
  border-color: rgba(0, 174, 66, 0.35);
}

.onboarding-option-card.bambu-option:hover {
  border-color: rgba(0, 174, 66, 0.65);
  box-shadow: 0 8px 28px rgba(0, 174, 66, 0.18);
}

.option-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.option-card-header .option-icon {
  font-size: 1.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.option-card-header div {
  min-width: 0;
}

.option-card-header strong {
  display: block;
  font-size: 0.96rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.option-card-header small {
  color: var(--text-dim);
  font-size: 0.78rem;
  display: block;
}

.option-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0;
}

.onboarding-option-card .code-box-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 0.5rem !important;
  background: rgba(0, 0, 0, 0.6) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.45rem 0.6rem !important;
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.onboarding-option-card .code-box-wrapper code {
  font-family: var(--font-mono) !important;
  font-size: 0.74rem !important;
  color: var(--accent-cyan) !important;
  overflow-x: auto !important;
  white-space: nowrap !important;
  min-width: 0 !important;
  flex: 1 !important;
  padding-right: 4px;
}

.onboarding-option-card .code-box-wrapper button {
  flex-shrink: 0 !important;
  padding: 0.35rem 0.65rem !important;
  font-size: 0.76rem !important;
}

.option-hint {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: auto;
}

.btn-onboarding-bambu {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 0.65rem 1rem !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  margin-top: 4px;
  box-sizing: border-box !important;
}

/* Day Mode fix for buttons across all cards: Fijar, Subir, Enviar */
body.light-theme .btn-slot-temp-set,
body.light-theme .btn-primary,
body.light-theme .btn-primary-compact,
body.light-theme #btnSetBed,
body.light-theme #btnUploadGcode,
body.light-theme #terminalForm button[type="submit"] {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%) !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25) !important;
}

body.light-theme .btn-slot-temp-set:hover,
body.light-theme .btn-primary:hover,
body.light-theme .btn-primary-compact:hover,
body.light-theme #btnSetBed:hover,
body.light-theme #btnUploadGcode:hover,
body.light-theme #terminalForm button[type="submit"]:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%) !important;
  color: #ffffff !important;
}

/* ==================== MODELOTECA / GESTOR DE ARCHIVOS 3D ==================== */
.nav-link-btn {
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  color: inherit !important;
}

.models-full-view {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  width: 100%;
  animation: fadeIn 0.25s ease-out;
}

.models-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.2rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.models-title-box h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.models-title-box p {
  margin: 0.35rem 0 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.models-top-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.models-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1rem 1.4rem;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.models-search-wrap {
  width: 100%;
}

.models-search-input {
  width: 100%;
  padding: 0.65rem 1rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.models-search-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.models-filter-group {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.2rem;
  width: 100%;
}

.model-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.model-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
}

.model-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.model-ext-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-main);
}

.badge-stl { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border-color: rgba(59, 130, 246, 0.4); }
.badge-3mf { background: rgba(168, 85, 247, 0.2); color: #c084fc; border-color: rgba(168, 85, 247, 0.4); }
.badge-step { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border-color: rgba(245, 158, 11, 0.4); }
.badge-gcode { background: rgba(16, 185, 129, 0.2); color: #34d399; border-color: rgba(16, 185, 129, 0.4); }

.model-folder-badge {
  font-size: 0.74rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 7px;
  border-radius: 4px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  title: attr(data-full-name);
}

.model-card-meta {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 0.7rem;
}

.model-card-notes {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 0.85rem;
  line-height: 1.35;
  min-height: 1.35rem;
}

.model-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-color);
}

.btn-model-action {
  padding: 0.45rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  text-decoration: none;
}

.btn-model-action:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-cyan);
  color: #fff;
}

.btn-model-action.btn-u1-convert {
  grid-column: span 2;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.15));
  border-color: rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.btn-model-action.btn-u1-convert:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(239, 68, 68, 0.3));
  border-color: #f59e0b;
  color: #fff;
}

.models-dropzone-box {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
}

.models-dropzone-box:hover,
.models-dropzone-box.drag-over {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.05);
}

.model-color-tag-picker {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.35rem;
}

.color-swatch-tag {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s ease;
}

.color-swatch-tag:hover {
  transform: scale(1.15);
}

.color-swatch-tag.active {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transform: scale(1.18);
}

/* 3D Viewer Modal Styles */
.viewer-3d-stats-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(13, 22, 38, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: none;
  z-index: 10;
}

.viewer-stat-item {
  display: flex;
  gap: 0.5rem;
  font-size: 0.78rem;
}

.viewer-stat-label {
  color: var(--text-dim);
}

.viewer-stat-val {
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-weight: 600;
}

.viewer-3d-controls-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 22, 38, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 10;
}

.viewer-3d-controls-hint kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 5px;
  border-radius: 3px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* User Permissions Config Group */
.perm-config-group {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.perm-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.perm-item:hover {
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.14);
}

/* ==================== INSUMOTECA & STOCK DE TALLER ==================== */
.stock-full-view {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0.5rem 0 3rem 0;
  animation: fadeIn 0.25s ease-out;
}

.stock-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  flex-wrap: wrap;
  gap: 1rem;
}

.stock-kpis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.stock-kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s, border-color 0.2s;
}

.stock-kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 242, 254, 0.4);
}

.stock-kpi-card.kpi-warning {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.05);
}

.stock-kpi-icon {
  font-size: 2rem;
  opacity: 0.9;
}

.stock-kpi-info {
  display: flex;
  flex-direction: column;
}

.stock-kpi-title {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  font-weight: 700;
}

.stock-kpi-val {
  font-size: 1.45rem;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.stock-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.stock-categories-pills {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.stock-pill-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-dim);
  padding: 0.4rem 0.85rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stock-pill-btn:hover {
  color: var(--text-main);
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.08);
}

.stock-pill-btn.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.25), rgba(79, 172, 254, 0.25));
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.stock-search-box {
  min-width: 280px;
  flex: 1;
  max-width: 420px;
}

.stock-search-input {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
}

.stock-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.1rem;
}

.stock-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.stock-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.stock-card.is-low-stock {
  border-color: rgba(239, 68, 68, 0.5);
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.06), var(--bg-card));
}

.stock-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.stock-cat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--accent-cyan);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stock-cat-badge.cat-adhesives { color: #facc15; background: rgba(250, 204, 21, 0.12); border-color: rgba(250, 204, 21, 0.3); }
.stock-cat-badge.cat-screws { color: #38bdf8; background: rgba(56, 189, 248, 0.12); border-color: rgba(56, 189, 248, 0.3); }
.stock-cat-badge.cat-magnets { color: #c084fc; background: rgba(192, 132, 252, 0.12); border-color: rgba(192, 132, 252, 0.3); }
.stock-cat-badge.cat-spares { color: #f87171; background: rgba(248, 113, 113, 0.12); border-color: rgba(248, 113, 113, 0.3); }
.stock-cat-badge.cat-packing { color: #4ade80; background: rgba(74, 222, 128, 0.12); border-color: rgba(74, 222, 128, 0.3); }

.stock-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin: 0.2rem 0 0.15rem 0;
  line-height: 1.35;
}

.stock-card-location {
  font-size: 0.75rem;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.stock-qty-control-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stock-qty-display {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.stock-qty-num {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
}

.stock-qty-unit {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
}

.stock-stepper-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.stock-stepper-btn:hover {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

.stock-low-alert-pill {
  font-size: 0.74rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  animation: pulse 2s infinite;
}

.stock-financial-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.5rem;
}

.stock-buy-link-btn {
  padding: 0.4rem 0.8rem;
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  color: #fde047;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  width: 100%;
}

.stock-buy-link-btn:hover {
  background: rgba(234, 179, 8, 0.28);
  border-color: #fde047;
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.25);
}


/* ==================== MANTENIMIENTO PREVENTIVO ==================== */
.maint-service-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.65rem;
  transition: all 0.15s ease;
}

.maint-service-card:hover {
  border-color: rgba(0, 242, 254, 0.3);
}

.maint-service-card.status-critical {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.08);
}

.maint-service-card.status-warning {
  border-color: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.06);
}

.maint-bar-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin: 0.3rem 0;
}

.maint-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.maint-bar-fill.bar-ok { background: linear-gradient(90deg, #10b981, #34d399); }
.maint-bar-fill.bar-warning { background: linear-gradient(90deg, #eab308, #facc15); }
.maint-bar-fill.bar-critical { background: linear-gradient(90deg, #ef4444, #f87171); }


/* ==================== PEDIDOS & CLIENTES EN CALCULADORA ==================== */
.order-item-card {
  background: rgba(11, 19, 38, 0.8);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.15s ease;
}

.order-item-card:hover {
  border-color: rgba(0, 242, 254, 0.3);
  background: rgba(11, 19, 38, 0.95);
}

.order-status-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.order-status-cotizado { background: rgba(250, 204, 21, 0.15); color: #facc15; border: 1px solid rgba(250, 204, 21, 0.35); }
.order-status-anticipo { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.order-status-produccion { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.35); }
.order-status-listo { background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.35); }
.order-status-entregado { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; border: 1px solid rgba(148, 163, 184, 0.35); }

/* Input de nombre de pieza en calculadora - Dark mode nativo */
.calc-jobname-input {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: var(--radius-sm, 6px);
  color: #fff !important;
  font-family: inherit;
  font-size: 0.84rem;
  padding: 0.45rem 0.75rem;
  outline: none;
  transition: all 0.2s ease;
  width: 100%;
}
.calc-jobname-input:focus {
  border-color: #00f2fe !important;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 0 0 2px rgba(0, 242, 254, 0.25);
}
.calc-jobname-input::placeholder {
  color: rgba(255, 255, 255, 0.35) !important;
}

/* ==================== MODAL DE ADMINISTRACIÓN DE CLIENTES ==================== */
.clients-admin-modal-card {
  width: 900px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.clients-table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 55vh;
  margin: 1rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 740px;
}

.clients-table th {
  background: rgba(11, 19, 38, 0.95);
  padding: 0.65rem 0.85rem;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 2;
}

.clients-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-color);
  vertical-align: middle;
}

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

.client-wa-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #4ade80;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.15s ease;
}
.client-wa-link:hover {
  text-decoration: underline;
  color: #86efac;
}

/* ==================== VISTA COMPLETA: MANTENIMIENTO ==================== */
.maintenance-full-view {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ==================== LOGIN ANIMATED BACKGROUND & STYLING ==================== */
.auth-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  background: radial-gradient(circle at 50% 35%, #0b1730 0%, #050b18 65%, #02050d 100%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 9999999 !important;
  overflow: hidden !important;
}

.login-particles-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.login-card-advanced {
  position: relative !important;
  z-index: 10 !important;
  background: rgba(11, 20, 40, 0.82) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(0, 242, 254, 0.28) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(0, 242, 254, 0.15) !important;
  border-radius: 18px !important;
  animation: authCardFloatIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

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

/* ==================== HAMBURGER BUTTON & MOBILE DRAWER ==================== */
.btn-hamburger {
  display: none;
  font-size: 1.15rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-hamburger:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: #00f2fe;
  color: #fff;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000080;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 0.2s ease;
}

.mobile-nav-drawer {
  width: 320px;
  max-width: 85vw;
  height: 100%;
  background: rgba(10, 17, 34, 0.98);
  border-left: 1px solid var(--border-color);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  overflow-y: auto;
  animation: slideDrawerIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDrawerIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.mobile-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 0.85rem;
}

.mobile-drawer-user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 1rem;
}

.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mobile-drawer-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin: 0.6rem 0 0.3rem 0.35rem;
  text-transform: uppercase;
}

.mobile-drawer-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-color);
  font-size: 0.86rem;
  font-weight: 500;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  width: 100%;
}

.mobile-drawer-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.mobile-drawer-btn.active {
  background: rgba(0, 242, 254, 0.12);
  border-color: rgba(0, 242, 254, 0.35);
  color: #00f2fe;
  font-weight: 700;
}

.drawer-btn-logout:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: #f87171 !important;
}

/* ==================== HEADER RESPONSIVENESS & EMERGENCY BUTTON PROTECTION ==================== */
.header {
  flex-wrap: nowrap !important;
  overflow: visible !important;
}

.header-center {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
  overflow: visible !important;
}

.nav-switch-pills {
  overflow: visible !important;
  scrollbar-width: none !important;
  white-space: nowrap !important;
  flex-wrap: nowrap !important;
  max-width: 100% !important;
}
.nav-switch-pills::-webkit-scrollbar {
  display: none !important;
}

.header-right {
  flex-shrink: 0 !important;
}

.btn-emergency {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

@media (max-width: 1024px) {
  .btn-hamburger {
    display: inline-flex !important;
  }
  .nav-switch-pills {
    display: none !important;
  }
  .user-email-text {
    display: none !important;
  }
  .user-role-badge {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .header-left .brand-name {
    display: none !important;
  }
  .btn-discover-printers span:last-child {
    display: none !important;
  }
  .btn-emergency span, .btn-emergency svg {
    margin: 0 !important;
  }
  .btn-emergency {
    padding: 0.45rem 0.75rem !important;
    font-size: 0.78rem !important;
  }
}

/* ==================== USER PROFILE IN HEADER & DROPDOWN ==================== */
.btn-user-pill-profile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  border-radius: 30px;
  cursor: pointer;
  color: var(--text-color);
  transition: all 0.2s ease;
}

.btn-user-pill-profile:hover {
  border-color: var(--accent-cyan);
  background: rgba(0, 242, 254, 0.1);
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00f2fe, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1.5px solid rgba(0, 242, 254, 0.5);
  flex-shrink: 0;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.user-avatar-fallback {
  font-size: 0.95rem;
  line-height: 1;
}

.user-name-role-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.user-alias-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-dropdown-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 0.6rem 0.75rem 0.25rem;
  text-transform: uppercase;
}

.user-dropdown-avatar-large {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00f2fe, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px solid rgba(0, 242, 254, 0.6);
  flex-shrink: 0;
}

.user-avatar-img-lg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-fallback-lg {
  font-size: 1.3rem;
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.user-dropdown-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-dropdown-info strong {
  color: #fff;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.user-dropdown-info small {
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Modal User Profile Avatar Upload */
.profile-avatar-upload-wrap {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  border: 2.5px solid var(--accent-cyan);
  background: linear-gradient(135deg, #00f2fe, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.35);
}

.profile-avatar-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-preview-placeholder {
  font-size: 2.4rem;
}

.profile-avatar-upload-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.profile-avatar-upload-wrap:hover .profile-avatar-upload-overlay {
  opacity: 1;
}

/* Apps 3D Dropdown */
.apps-dropdown-wrapper {
  position: relative;
}

.btn-apps-trigger {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: rgba(139, 92, 246, 0.15) !important;
  border: 1px solid rgba(139, 92, 246, 0.35) !important;
  color: #c4b5fd !important;
}

.btn-apps-trigger:hover {
  background: rgba(139, 92, 246, 0.25) !important;
  border-color: #8b5cf6 !important;
  color: #fff !important;
}

.apps-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  background: rgba(12, 19, 36, 0.98);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  z-index: 10000;
  animation: fadeIn 0.15s ease-out;
}

.apps-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  color: var(--text-color);
  text-decoration: none;
  transition: all 0.15s ease;
}

.apps-dropdown-item:hover {
  background: rgba(139, 92, 246, 0.2);
  color: #fff;
}

.apps-item-icon {
  font-size: 1.25rem;
}

.apps-item-content {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.apps-item-content strong {
  font-size: 0.82rem;
  color: #fff;
}

.apps-item-content small {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* Relocated STOP Emergency Button inside Card */
.btn-emergency-card {
  width: 100% !important;
  margin-top: 0.65rem !important;
  padding: 0.75rem 1rem !important;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(239, 68, 68, 0.6) !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  font-size: 0.85rem !important;
  letter-spacing: 0.5px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.55rem !important;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.35) !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.btn-emergency-card:hover {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%) !important;
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.55) !important;
  transform: translateY(-1px) !important;
}

.btn-emergency-card svg {
  width: 18px;
  height: 18px;
}

/* ========================================================
   CORRECCIONES MODO CLARO / LIGHT THEME
   ======================================================== */
.nav-switch-pills {
  overflow: visible !important;
}

.apps-dropdown-wrapper {
  position: relative !important;
  display: inline-block !important;
}

.apps-dropdown-menu {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  width: 270px !important;
  background: rgba(12, 19, 36, 0.98) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(139, 92, 246, 0.4) !important;
  border-radius: 12px !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(139, 92, 246, 0.2) !important;
  padding: 0.5rem !important;
  z-index: 99999 !important;
}

body.light-theme .apps-dropdown-menu {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15) !important;
}

body.light-theme .apps-dropdown-item {
  color: #1e293b !important;
}

body.light-theme .apps-dropdown-item:hover {
  background: #f1f5f9 !important;
  color: #0284c7 !important;
}

body.light-theme .apps-dropdown-item small {
  color: #64748b !important;
}

/* Tabs Archivos G-Code en modo claro */
body.light-theme .tab-pill-group {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

/* Buscador de Gestor de Archivos 3D y Filamentos en modo claro */
body.light-theme .models-search-input,
body.light-theme .filateca-search-input,
body.light-theme .stock-search-input,
body.light-theme #macroSearchInput,
body.light-theme #spoolSearchInput {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .models-search-input::placeholder,
body.light-theme .filateca-search-input::placeholder,
body.light-theme .stock-search-input::placeholder {
  color: #94a3b8 !important;
}

/* Botones con enlace sin subrayado */
a.btn,
.models-top-actions a,
.btn-ghost,
.btn-secondary,
.apps-dropdown-item,
.mobile-drawer-btn {
  text-decoration: none !important;
}

/* Insumos & Repuestos - Control de cantidad en modo claro */
body.light-theme .stock-qty-control-box {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .stock-qty-num {
  color: #0f172a !important;
}

body.light-theme .stock-qty-unit {
  color: #64748b !important;
}

body.light-theme .stock-stepper-btn {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .stock-stepper-btn:hover {
  background: #e2e8f0 !important;
  border-color: #94a3b8 !important;
  color: #0284c7 !important;
}

/* Menú de Usuario / Perfil en modo claro */
body.light-theme .btn-user-pill-profile {
  background: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .btn-user-pill-profile:hover {
  background: #e2e8f0 !important;
  border-color: #0284c7 !important;
}

body.light-theme .user-alias-text {
  color: #0f172a !important;
}

body.light-theme .dropdown-chevron {
  color: #64748b !important;
}

/* ========================================================
   VISTA DEDICADA DE PEDIDOS (ORDERS VIEW)
   ======================================================== */
.orders-full-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 0 3rem;
  max-width: 1440px;
  margin: 0 auto;
}

.orders-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.orders-title-box h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.25rem;
}

.orders-title-box p {
  font-size: 0.85rem;
  color: var(--text-dim);
}

body.light-theme .orders-title-box h2 {
  color: #0f172a;
}

.orders-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem;
}

.orders-kpi-card {
  background: rgba(13, 22, 38, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

body.light-theme .orders-kpi-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.orders-kpi-icon {
  font-size: 1.8rem;
}

.orders-kpi-val {
  font-size: 1.35rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  color: #fff;
}

body.light-theme .orders-kpi-val {
  color: #0f172a;
}

.orders-kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.orders-toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

body.light-theme .orders-toolbar {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.orders-search-input {
  flex: 1;
  min-width: 250px;
  padding: 0.55rem 0.9rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.85rem;
  outline: none;
}

body.light-theme .orders-search-input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}

.orders-filter-pills {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
}

.orders-filter-btn {
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.orders-filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.orders-filter-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #050d1a;
  font-weight: 700;
}

body.light-theme .orders-filter-btn.active {
  background: #0284c7;
  color: #ffffff;
}

.orders-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.1rem;
}

.order-card-item {
  background: rgba(13, 22, 38, 0.85);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.order-card-item:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 242, 254, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

body.light-theme .order-card-item {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.order-card-id {
  font-size: 0.78rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-cyan);
  font-weight: 700;
}

body.light-theme .order-card-id {
  color: #0284c7;
}

.order-card-piece {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

body.light-theme .order-card-piece {
  color: #0f172a;
}

.order-client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

body.light-theme .order-client-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.order-client-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}

.order-whatsapp-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.25rem 0.55rem;
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.4);
  border-radius: 6px;
  color: #25d366;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}

.order-whatsapp-btn:hover {
  background: #25d366;
  color: #fff;
}

.order-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.order-finance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-color);
  font-family: 'JetBrains Mono', monospace;
}

.order-price-total {
  font-size: 1.15rem;
  font-weight: 800;
  color: #00ff88;
}

body.light-theme .order-price-total {
  color: #16a34a;
}

.order-card-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.4rem;
}

/* ========================================================
   TELEGRAM BOT MANAGER STYLES
   ======================================================== */
.telegram-manager-box {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.telegram-status-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(0, 136, 204, 0.12);
  border: 1px solid rgba(0, 136, 204, 0.35);
}

.telegram-status-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.telegram-status-icon {
  font-size: 1.6rem;
}

.telegram-status-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #38bdf8;
}

.telegram-status-subtitle {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.telegram-rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.telegram-rules-table th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-color);
}

body.light-theme .telegram-rules-table th {
  background: #f1f5f9;
  color: #64748b;
  border-bottom-color: #cbd5e1;
}

.telegram-rules-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

body.light-theme .telegram-rules-table td {
  border-bottom-color: #f1f5f9;
  color: #0f172a;
}

/* ========================================================
   ESTILOS GENERALES PARA FORM-INPUT & CORRECCIONES MODO DÍA
   ======================================================== */
.form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-family: var(--font-family);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

body.light-theme .form-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .form-input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}

body.light-theme .form-input::placeholder {
  color: #94a3b8 !important;
}

/* 1. Insumos & Stock en Modo Claro */
body.light-theme .stock-card-location {
  background: #e2e8f0 !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 500 !important;
}

body.light-theme .stock-qty-control-box {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .stock-search-input {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  border-radius: var(--radius-md) !important;
}

/* 2. Directorio de Clientes en Modo Claro */
body.light-theme .clients-table th {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom: 2px solid #cbd5e1 !important;
  font-weight: 700 !important;
}

body.light-theme .clients-table td {
  border-bottom: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  background: transparent !important;
}

body.light-theme .clients-table tr:hover td {
  background: #f8fafc !important;
}

body.light-theme .clients-table-container {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

/* 3. Administración de Usuarios en Modo Claro */
body.light-theme .users-table th {
  background: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom: 2px solid #cbd5e1 !important;
  font-weight: 700 !important;
}

body.light-theme .users-table td {
  border-bottom: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
  background: transparent !important;
}

body.light-theme .users-table tr:hover td {
  background: #f8fafc !important;
}

body.light-theme .users-table-container {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
}

/* 4. Permisos & Control de Acceso en Modo Claro */
body.light-theme .assign-printer-checkbox-item {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .assign-printer-checkbox-item:hover {
  background: #f1f5f9 !important;
  border-color: #0284c7 !important;
}

body.light-theme .assign-printer-checkbox-item strong {
  color: #0f172a !important;
}

body.light-theme .assign-printer-checkbox-item small {
  color: #64748b !important;
}

body.light-theme #userPermissionsModal .form-group {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

body.light-theme #userPermissionsModal .form-group label {
  color: #0f172a !important;
}

body.light-theme #userPermissionsModal .form-group span,
body.light-theme #userPermissionsModal .form-group small {
  color: #64748b !important;
}

/* 5. Asegurar visibilidad de Apps 3D Dropdown */
.apps-dropdown-wrapper {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
}

.apps-dropdown-menu {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  z-index: 10000050 !important;
}
